Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r1582 - genpatches-2.6/trunk/2.6.30
Date: Fri, 03 Jul 2009 18:00:18
Message-Id: E1MMn3O-0004qj-40@stork.gentoo.org
1 Author: mpagano
2 Date: 2009-07-03 18:00:05 +0000 (Fri, 03 Jul 2009)
3 New Revision: 1582
4
5 Added:
6 genpatches-2.6/trunk/2.6.30/1000_linux-2.6.30.1.patch
7 Modified:
8 genpatches-2.6/trunk/2.6.30/0000_README
9 Log:
10 Linux patch 2.6.30.1
11
12 Modified: genpatches-2.6/trunk/2.6.30/0000_README
13 ===================================================================
14 --- genpatches-2.6/trunk/2.6.30/0000_README 2009-07-03 00:47:12 UTC (rev 1581)
15 +++ genpatches-2.6/trunk/2.6.30/0000_README 2009-07-03 18:00:05 UTC (rev 1582)
16 @@ -39,6 +39,10 @@
17 Individual Patch Descriptions:
18 --------------------------------------------------------------------------
19
20 +Patch: 1000_linux-2.6.30.1.patch
21 +From: http://www.kernel.org
22 +Desc: Linux 2.6.30.1
23 +
24 Patch: 2500_ide-cd-handle-fragmented-patckets.patch
25 From: http://bugs.gentoo.org/show_bug.cgi?id=274182
26 Desc: ide-cd: handle fragmented packet commands gracefully
27
28 Added: genpatches-2.6/trunk/2.6.30/1000_linux-2.6.30.1.patch
29 ===================================================================
30 --- genpatches-2.6/trunk/2.6.30/1000_linux-2.6.30.1.patch (rev 0)
31 +++ genpatches-2.6/trunk/2.6.30/1000_linux-2.6.30.1.patch 2009-07-03 18:00:05 UTC (rev 1582)
32 @@ -0,0 +1,5245 @@
33 +diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
34 +index c302ddf..5236573 100644
35 +--- a/Documentation/sysctl/vm.txt
36 ++++ b/Documentation/sysctl/vm.txt
37 +@@ -314,10 +314,14 @@ min_unmapped_ratio:
38 +
39 + This is available only on NUMA kernels.
40 +
41 +-A percentage of the total pages in each zone. Zone reclaim will only
42 +-occur if more than this percentage of pages are file backed and unmapped.
43 +-This is to insure that a minimal amount of local pages is still available for
44 +-file I/O even if the node is overallocated.
45 ++This is a percentage of the total pages in each zone. Zone reclaim will
46 ++only occur if more than this percentage of pages are in a state that
47 ++zone_reclaim_mode allows to be reclaimed.
48 ++
49 ++If zone_reclaim_mode has the value 4 OR'd, then the percentage is compared
50 ++against all file-backed unmapped pages including swapcache pages and tmpfs
51 ++files. Otherwise, only unmapped pages backed by normal files but not tmpfs
52 ++files and similar are considered.
53 +
54 + The default is 1 percent.
55 +
56 +diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
57 +index bb7d695..1a711ea 100644
58 +--- a/arch/arm/include/asm/cacheflush.h
59 ++++ b/arch/arm/include/asm/cacheflush.h
60 +@@ -429,6 +429,14 @@ static inline void flush_anon_page(struct vm_area_struct *vma,
61 + __flush_anon_page(vma, page, vmaddr);
62 + }
63 +
64 ++#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
65 ++static inline void flush_kernel_dcache_page(struct page *page)
66 ++{
67 ++ /* highmem pages are always flushed upon kunmap already */
68 ++ if ((cache_is_vivt() || cache_is_vipt_aliasing()) && !PageHighMem(page))
69 ++ __cpuc_flush_dcache_page(page_address(page));
70 ++}
71 ++
72 + #define flush_dcache_mmap_lock(mapping) \
73 + spin_lock_irq(&(mapping)->tree_lock)
74 + #define flush_dcache_mmap_unlock(mapping) \
75 +diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S
76 +index caba996..eb0566e 100644
77 +--- a/arch/x86/crypto/aesni-intel_asm.S
78 ++++ b/arch/x86/crypto/aesni-intel_asm.S
79 +@@ -845,7 +845,7 @@ ENTRY(aesni_cbc_enc)
80 + */
81 + ENTRY(aesni_cbc_dec)
82 + cmp $16, LEN
83 +- jb .Lcbc_dec_ret
84 ++ jb .Lcbc_dec_just_ret
85 + mov 480(KEYP), KLEN
86 + add $240, KEYP
87 + movups (IVP), IV
88 +@@ -891,6 +891,7 @@ ENTRY(aesni_cbc_dec)
89 + add $16, OUTP
90 + cmp $16, LEN
91 + jge .Lcbc_dec_loop1
92 +- movups IV, (IVP)
93 + .Lcbc_dec_ret:
94 ++ movups IV, (IVP)
95 ++.Lcbc_dec_just_ret:
96 + ret
97 +diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
98 +index 42f2f83..9b2c049 100644
99 +--- a/arch/x86/include/asm/apic.h
100 ++++ b/arch/x86/include/asm/apic.h
101 +@@ -410,7 +410,7 @@ static inline unsigned default_get_apic_id(unsigned long x)
102 + {
103 + unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR));
104 +
105 +- if (APIC_XAPIC(ver))
106 ++ if (APIC_XAPIC(ver) || boot_cpu_has(X86_FEATURE_EXTD_APICID))
107 + return (x >> 24) & 0xFF;
108 + else
109 + return (x >> 24) & 0x0F;
110 +diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
111 +index bb83b1c..78dee4f 100644
112 +--- a/arch/x86/include/asm/cpufeature.h
113 ++++ b/arch/x86/include/asm/cpufeature.h
114 +@@ -94,6 +94,7 @@
115 + #define X86_FEATURE_TSC_RELIABLE (3*32+23) /* TSC is known to be reliable */
116 + #define X86_FEATURE_NONSTOP_TSC (3*32+24) /* TSC does not stop in C states */
117 + #define X86_FEATURE_CLFLUSH_MONITOR (3*32+25) /* "" clflush reqd with monitor */
118 ++#define X86_FEATURE_EXTD_APICID (3*32+26) /* has extended APICID (8 bits) */
119 +
120 + /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
121 + #define X86_FEATURE_XMM3 (4*32+ 0) /* "pni" SSE-3 */
122 +diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
123 +index f0faf58..a93d1cc 100644
124 +--- a/arch/x86/include/asm/kvm_host.h
125 ++++ b/arch/x86/include/asm/kvm_host.h
126 +@@ -371,6 +371,8 @@ struct kvm_vcpu_arch {
127 + unsigned long dr6;
128 + unsigned long dr7;
129 + unsigned long eff_db[KVM_NR_DB_REGS];
130 ++
131 ++ u32 exit_reason;
132 + };
133 +
134 + struct kvm_mem_alias {
135 +diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
136 +index 4f8c199..5c70378 100644
137 +--- a/arch/x86/include/asm/mce.h
138 ++++ b/arch/x86/include/asm/mce.h
139 +@@ -153,5 +153,7 @@ extern void mcheck_init(struct cpuinfo_x86 *c);
140 +
141 + extern void (*mce_threshold_vector)(void);
142 +
143 ++extern void (*machine_check_vector)(struct pt_regs *, long error_code);
144 ++
145 + #endif /* __KERNEL__ */
146 + #endif /* _ASM_X86_MCE_H */
147 +diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h
148 +index 9b0e61b..bddd44f 100644
149 +--- a/arch/x86/include/asm/uv/uv_bau.h
150 ++++ b/arch/x86/include/asm/uv/uv_bau.h
151 +@@ -37,7 +37,7 @@
152 + #define UV_CPUS_PER_ACT_STATUS 32
153 + #define UV_ACT_STATUS_MASK 0x3
154 + #define UV_ACT_STATUS_SIZE 2
155 +-#define UV_ACTIVATION_DESCRIPTOR_SIZE 32
156 ++#define UV_ADP_SIZE 32
157 + #define UV_DISTRIBUTION_SIZE 256
158 + #define UV_SW_ACK_NPENDING 8
159 + #define UV_NET_ENDPOINT_INTD 0x38
160 +diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h
161 +index d3a98ea..341070f 100644
162 +--- a/arch/x86/include/asm/uv/uv_hub.h
163 ++++ b/arch/x86/include/asm/uv/uv_hub.h
164 +@@ -133,6 +133,7 @@ struct uv_scir_s {
165 + struct uv_hub_info_s {
166 + unsigned long global_mmr_base;
167 + unsigned long gpa_mask;
168 ++ unsigned int gnode_extra;
169 + unsigned long gnode_upper;
170 + unsigned long lowmem_remap_top;
171 + unsigned long lowmem_remap_base;
172 +@@ -159,7 +160,8 @@ DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
173 + * p - PNODE (local part of nsids, right shifted 1)
174 + */
175 + #define UV_NASID_TO_PNODE(n) (((n) >> 1) & uv_hub_info->pnode_mask)
176 +-#define UV_PNODE_TO_NASID(p) (((p) << 1) | uv_hub_info->gnode_upper)
177 ++#define UV_PNODE_TO_GNODE(p) ((p) |uv_hub_info->gnode_extra)
178 ++#define UV_PNODE_TO_NASID(p) (UV_PNODE_TO_GNODE(p) << 1)
179 +
180 + #define UV_LOCAL_MMR_BASE 0xf4000000UL
181 + #define UV_GLOBAL_MMR32_BASE 0xf8000000UL
182 +@@ -173,7 +175,7 @@ DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
183 + #define UV_GLOBAL_MMR32_PNODE_BITS(p) ((p) << (UV_GLOBAL_MMR32_PNODE_SHIFT))
184 +
185 + #define UV_GLOBAL_MMR64_PNODE_BITS(p) \
186 +- ((unsigned long)(p) << UV_GLOBAL_MMR64_PNODE_SHIFT)
187 ++ ((unsigned long)(UV_PNODE_TO_GNODE(p)) << UV_GLOBAL_MMR64_PNODE_SHIFT)
188 +
189 + #define UV_APIC_PNODE_SHIFT 6
190 +
191 +diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
192 +index 498f944..11be5ad 100644
193 +--- a/arch/x86/include/asm/vmx.h
194 ++++ b/arch/x86/include/asm/vmx.h
195 +@@ -247,6 +247,7 @@ enum vmcs_field {
196 + #define EXIT_REASON_MSR_READ 31
197 + #define EXIT_REASON_MSR_WRITE 32
198 + #define EXIT_REASON_MWAIT_INSTRUCTION 36
199 ++#define EXIT_REASON_MCE_DURING_VMENTRY 41
200 + #define EXIT_REASON_TPR_BELOW_THRESHOLD 43
201 + #define EXIT_REASON_APIC_ACCESS 44
202 + #define EXIT_REASON_EPT_VIOLATION 48
203 +diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
204 +index 2bda693..39f2af4 100644
205 +--- a/arch/x86/kernel/apic/x2apic_uv_x.c
206 ++++ b/arch/x86/kernel/apic/x2apic_uv_x.c
207 +@@ -562,7 +562,7 @@ void __init uv_system_init(void)
208 + union uvh_node_id_u node_id;
209 + unsigned long gnode_upper, lowmem_redir_base, lowmem_redir_size;
210 + int bytes, nid, cpu, lcpu, pnode, blade, i, j, m_val, n_val;
211 +- int max_pnode = 0;
212 ++ int gnode_extra, max_pnode = 0;
213 + unsigned long mmr_base, present, paddr;
214 + unsigned short pnode_mask;
215 +
216 +@@ -574,6 +574,13 @@ void __init uv_system_init(void)
217 + mmr_base =
218 + uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR) &
219 + ~UV_MMR_ENABLE;
220 ++ pnode_mask = (1 << n_val) - 1;
221 ++ node_id.v = uv_read_local_mmr(UVH_NODE_ID);
222 ++ gnode_extra = (node_id.s.node_id & ~((1 << n_val) - 1)) >> 1;
223 ++ gnode_upper = ((unsigned long)gnode_extra << m_val);
224 ++ printk(KERN_DEBUG "UV: N %d, M %d, gnode_upper 0x%lx, gnode_extra 0x%x\n",
225 ++ n_val, m_val, gnode_upper, gnode_extra);
226 ++
227 + printk(KERN_DEBUG "UV: global MMR base 0x%lx\n", mmr_base);
228 +
229 + for(i = 0; i < UVH_NODE_PRESENT_TABLE_DEPTH; i++)
230 +@@ -607,11 +614,6 @@ void __init uv_system_init(void)
231 + }
232 + }
233 +
234 +- pnode_mask = (1 << n_val) - 1;
235 +- node_id.v = uv_read_local_mmr(UVH_NODE_ID);
236 +- gnode_upper = (((unsigned long)node_id.s.node_id) &
237 +- ~((1 << n_val) - 1)) << m_val;
238 +-
239 + uv_bios_init();
240 + uv_bios_get_sn_info(0, &uv_type, &sn_partition_id,
241 + &sn_coherency_id, &sn_region_size);
242 +@@ -634,6 +636,7 @@ void __init uv_system_init(void)
243 + uv_cpu_hub_info(cpu)->pnode_mask = pnode_mask;
244 + uv_cpu_hub_info(cpu)->gpa_mask = (1 << (m_val + n_val)) - 1;
245 + uv_cpu_hub_info(cpu)->gnode_upper = gnode_upper;
246 ++ uv_cpu_hub_info(cpu)->gnode_extra = gnode_extra;
247 + uv_cpu_hub_info(cpu)->global_mmr_base = mmr_base;
248 + uv_cpu_hub_info(cpu)->coherency_domain_number = sn_coherency_id;
249 + uv_cpu_hub_info(cpu)->scir.offset = SCIR_LOCAL_MMR_BASE + lcpu;
250 +diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
251 +index 7e4a459..d869b3b 100644
252 +--- a/arch/x86/kernel/cpu/amd.c
253 ++++ b/arch/x86/kernel/cpu/amd.c
254 +@@ -6,6 +6,7 @@
255 + #include <asm/processor.h>
256 + #include <asm/apic.h>
257 + #include <asm/cpu.h>
258 ++#include <asm/pci-direct.h>
259 +
260 + #ifdef CONFIG_X86_64
261 + # include <asm/numa_64.h>
262 +@@ -257,13 +258,15 @@ static void __cpuinit amd_detect_cmp(struct cpuinfo_x86 *c)
263 + {
264 + #ifdef CONFIG_X86_HT
265 + unsigned bits;
266 ++ int cpu = smp_processor_id();
267 +
268 + bits = c->x86_coreid_bits;
269 +-
270 + /* Low order bits define the core id (index of core in socket) */
271 + c->cpu_core_id = c->initial_apicid & ((1 << bits)-1);
272 + /* Convert the initial APIC ID into the socket ID */
273 + c->phys_proc_id = c->initial_apicid >> bits;
274 ++ /* use socket ID also for last level cache */
275 ++ per_cpu(cpu_llc_id, cpu) = c->phys_proc_id;
276 + #endif
277 + }
278 +
279 +@@ -351,6 +354,15 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
280 + (c->x86_model == 8 && c->x86_mask >= 8))
281 + set_cpu_cap(c, X86_FEATURE_K6_MTRR);
282 + #endif
283 ++#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_PCI)
284 ++ /* check CPU config space for extended APIC ID */
285 ++ if (c->x86 >= 0xf) {
286 ++ unsigned int val;
287 ++ val = read_pci_config(0, 24, 0, 0x68);
288 ++ if ((val & ((1 << 17) | (1 << 18))) == ((1 << 17) | (1 << 18)))
289 ++ set_cpu_cap(c, X86_FEATURE_EXTD_APICID);
290 ++ }
291 ++#endif
292 + }
293 +
294 + static void __cpuinit init_amd(struct cpuinfo_x86 *c)
295 +diff --git a/arch/x86/kernel/cpu/mcheck/mce_32.c b/arch/x86/kernel/cpu/mcheck/mce_32.c
296 +index 3552119..07b523c 100644
297 +--- a/arch/x86/kernel/cpu/mcheck/mce_32.c
298 ++++ b/arch/x86/kernel/cpu/mcheck/mce_32.c
299 +@@ -29,6 +29,7 @@ static void unexpected_machine_check(struct pt_regs *regs, long error_code)
300 +
301 + /* Call the installed machine check handler for this CPU setup. */
302 + void (*machine_check_vector)(struct pt_regs *, long error_code) = unexpected_machine_check;
303 ++EXPORT_SYMBOL_GPL(machine_check_vector);
304 +
305 + /* This has to be run for each processor */
306 + void mcheck_init(struct cpuinfo_x86 *c)
307 +diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c
308 +index 09dd1d4..289cc48 100644
309 +--- a/arch/x86/kernel/cpu/mcheck/mce_64.c
310 ++++ b/arch/x86/kernel/cpu/mcheck/mce_64.c
311 +@@ -420,6 +420,7 @@ void do_machine_check(struct pt_regs * regs, long error_code)
312 + out2:
313 + atomic_dec(&mce_entry);
314 + }
315 ++EXPORT_SYMBOL_GPL(do_machine_check);
316 +
317 + #ifdef CONFIG_X86_MCE_INTEL
318 + /***
319 +diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
320 +index 81408b9..dedc2bd 100644
321 +--- a/arch/x86/kernel/hpet.c
322 ++++ b/arch/x86/kernel/hpet.c
323 +@@ -510,7 +510,8 @@ static int hpet_setup_irq(struct hpet_dev *dev)
324 + {
325 +
326 + if (request_irq(dev->irq, hpet_interrupt_handler,
327 +- IRQF_DISABLED|IRQF_NOBALANCING, dev->name, dev))
328 ++ IRQF_TIMER | IRQF_DISABLED | IRQF_NOBALANCING,
329 ++ dev->name, dev))
330 + return -1;
331 +
332 + disable_irq(dev->irq);
333 +diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
334 +index b284b58..3065b40 100644
335 +--- a/arch/x86/kernel/pci-gart_64.c
336 ++++ b/arch/x86/kernel/pci-gart_64.c
337 +@@ -688,8 +688,6 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
338 +
339 + agp_gatt_table = gatt;
340 +
341 +- enable_gart_translations();
342 +-
343 + error = sysdev_class_register(&gart_sysdev_class);
344 + if (!error)
345 + error = sysdev_register(&device_gart);
346 +@@ -847,6 +845,14 @@ void __init gart_iommu_init(void)
347 + wbinvd();
348 +
349 + /*
350 ++ * Now all caches are flushed and we can safely enable
351 ++ * GART hardware. Doing it early leaves the possibility
352 ++ * of stale cache entries that can lead to GART PTE
353 ++ * errors.
354 ++ */
355 ++ enable_gart_translations();
356 ++
357 ++ /*
358 + * Try to workaround a bug (thanks to BenH):
359 + * Set unmapped entries to a scratch page instead of 0.
360 + * Any prefetches that hit unmapped entries won't get an bus abort
361 +diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
362 +index 667188e..d2d1ce8 100644
363 +--- a/arch/x86/kernel/reboot.c
364 ++++ b/arch/x86/kernel/reboot.c
365 +@@ -192,6 +192,15 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
366 + DMI_MATCH(DMI_BOARD_NAME, "0KP561"),
367 + },
368 + },
369 ++ { /* Handle problems with rebooting on Dell Optiplex 360 with 0T656F */
370 ++ .callback = set_bios_reboot,
371 ++ .ident = "Dell OptiPlex 360",
372 ++ .matches = {
373 ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
374 ++ DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 360"),
375 ++ DMI_MATCH(DMI_BOARD_NAME, "0T656F"),
376 ++ },
377 ++ },
378 + { /* Handle problems with rebooting on Dell 2400's */
379 + .callback = set_bios_reboot,
380 + .ident = "Dell PowerEdge 2400",
381 +diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
382 +index b415843..0acc6a7 100644
383 +--- a/arch/x86/kernel/setup.c
384 ++++ b/arch/x86/kernel/setup.c
385 +@@ -293,15 +293,13 @@ static void __init reserve_brk(void)
386 +
387 + #ifdef CONFIG_BLK_DEV_INITRD
388 +
389 +-#ifdef CONFIG_X86_32
390 +-
391 + #define MAX_MAP_CHUNK (NR_FIX_BTMAPS << PAGE_SHIFT)
392 + static void __init relocate_initrd(void)
393 + {
394 +
395 + u64 ramdisk_image = boot_params.hdr.ramdisk_image;
396 + u64 ramdisk_size = boot_params.hdr.ramdisk_size;
397 +- u64 end_of_lowmem = max_low_pfn << PAGE_SHIFT;
398 ++ u64 end_of_lowmem = max_low_pfn_mapped << PAGE_SHIFT;
399 + u64 ramdisk_here;
400 + unsigned long slop, clen, mapaddr;
401 + char *p, *q;
402 +@@ -357,14 +355,13 @@ static void __init relocate_initrd(void)
403 + ramdisk_image, ramdisk_image + ramdisk_size - 1,
404 + ramdisk_here, ramdisk_here + ramdisk_size - 1);
405 + }
406 +-#endif
407 +
408 + static void __init reserve_initrd(void)
409 + {
410 + u64 ramdisk_image = boot_params.hdr.ramdisk_image;
411 + u64 ramdisk_size = boot_params.hdr.ramdisk_size;
412 + u64 ramdisk_end = ramdisk_image + ramdisk_size;
413 +- u64 end_of_lowmem = max_low_pfn << PAGE_SHIFT;
414 ++ u64 end_of_lowmem = max_low_pfn_mapped << PAGE_SHIFT;
415 +
416 + if (!boot_params.hdr.type_of_loader ||
417 + !ramdisk_image || !ramdisk_size)
418 +@@ -394,14 +391,8 @@ static void __init reserve_initrd(void)
419 + return;
420 + }
421 +
422 +-#ifdef CONFIG_X86_32
423 + relocate_initrd();
424 +-#else
425 +- printk(KERN_ERR "initrd extends beyond end of memory "
426 +- "(0x%08llx > 0x%08llx)\ndisabling initrd\n",
427 +- ramdisk_end, end_of_lowmem);
428 +- initrd_start = 0;
429 +-#endif
430 ++
431 + free_early(ramdisk_image, ramdisk_end);
432 + }
433 + #else
434 +diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
435 +index 8c7b03b..8ccabb8 100644
436 +--- a/arch/x86/kernel/tlb_uv.c
437 ++++ b/arch/x86/kernel/tlb_uv.c
438 +@@ -711,25 +711,31 @@ uv_activation_descriptor_init(int node, int pnode)
439 + unsigned long pa;
440 + unsigned long m;
441 + unsigned long n;
442 +- unsigned long mmr_image;
443 + struct bau_desc *adp;
444 + struct bau_desc *ad2;
445 +
446 +- adp = (struct bau_desc *)kmalloc_node(16384, GFP_KERNEL, node);
447 ++ /*
448 ++ * each bau_desc is 64 bytes; there are 8 (UV_ITEMS_PER_DESCRIPTOR)
449 ++ * per cpu; and up to 32 (UV_ADP_SIZE) cpu's per blade
450 ++ */
451 ++ adp = (struct bau_desc *)kmalloc_node(sizeof(struct bau_desc)*
452 ++ UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node);
453 + BUG_ON(!adp);
454 +
455 + pa = uv_gpa(adp); /* need the real nasid*/
456 + n = pa >> uv_nshift;
457 + m = pa & uv_mmask;
458 +
459 +- mmr_image = uv_read_global_mmr64(pnode, UVH_LB_BAU_SB_DESCRIPTOR_BASE);
460 +- if (mmr_image) {
461 +- uv_write_global_mmr64(pnode, (unsigned long)
462 +- UVH_LB_BAU_SB_DESCRIPTOR_BASE,
463 +- (n << UV_DESC_BASE_PNODE_SHIFT | m));
464 +- }
465 ++ uv_write_global_mmr64(pnode, UVH_LB_BAU_SB_DESCRIPTOR_BASE,
466 ++ (n << UV_DESC_BASE_PNODE_SHIFT | m));
467 +
468 +- for (i = 0, ad2 = adp; i < UV_ACTIVATION_DESCRIPTOR_SIZE; i++, ad2++) {
469 ++ /*
470 ++ * initializing all 8 (UV_ITEMS_PER_DESCRIPTOR) descriptors for each
471 ++ * cpu even though we only use the first one; one descriptor can
472 ++ * describe a broadcast to 256 nodes.
473 ++ */
474 ++ for (i = 0, ad2 = adp; i < (UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR);
475 ++ i++, ad2++) {
476 + memset(ad2, 0, sizeof(struct bau_desc));
477 + ad2->header.sw_ack_flag = 1;
478 + /*
479 +diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
480 +index d57de05..cf8611d 100644
481 +--- a/arch/x86/kernel/tsc.c
482 ++++ b/arch/x86/kernel/tsc.c
483 +@@ -710,7 +710,16 @@ static cycle_t read_tsc(struct clocksource *cs)
484 + #ifdef CONFIG_X86_64
485 + static cycle_t __vsyscall_fn vread_tsc(void)
486 + {
487 +- cycle_t ret = (cycle_t)vget_cycles();
488 ++ cycle_t ret;
489 ++
490 ++ /*
491 ++ * Surround the RDTSC by barriers, to make sure it's not
492 ++ * speculated to outside the seqlock critical section and
493 ++ * does not cause time warps:
494 ++ */
495 ++ rdtsc_barrier();
496 ++ ret = (cycle_t)vget_cycles();
497 ++ rdtsc_barrier();
498 +
499 + return ret >= __vsyscall_gtod_data.clock.cycle_last ?
500 + ret : __vsyscall_gtod_data.clock.cycle_last;
501 +diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
502 +index d7ac84e..6a17769 100644
503 +--- a/arch/x86/kernel/vm86_32.c
504 ++++ b/arch/x86/kernel/vm86_32.c
505 +@@ -287,10 +287,9 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk
506 + info->regs.pt.ds = 0;
507 + info->regs.pt.es = 0;
508 + info->regs.pt.fs = 0;
509 +-
510 +-/* we are clearing gs later just before "jmp resume_userspace",
511 +- * because it is not saved/restored.
512 +- */
513 ++#ifndef CONFIG_X86_32_LAZY_GS
514 ++ info->regs.pt.gs = 0;
515 ++#endif
516 +
517 + /*
518 + * The flags register is also special: we cannot trust that the user
519 +@@ -343,7 +342,9 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk
520 + __asm__ __volatile__(
521 + "movl %0,%%esp\n\t"
522 + "movl %1,%%ebp\n\t"
523 ++#ifdef CONFIG_X86_32_LAZY_GS
524 + "mov %2, %%gs\n\t"
525 ++#endif
526 + "jmp resume_userspace"
527 + : /* no outputs */
528 + :"r" (&info->regs), "r" (task_thread_info(tsk)), "r" (0));
529 +diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
530 +index 44153af..25ee06a 100644
531 +--- a/arch/x86/kernel/vsyscall_64.c
532 ++++ b/arch/x86/kernel/vsyscall_64.c
533 +@@ -132,15 +132,7 @@ static __always_inline void do_vgettimeofday(struct timeval * tv)
534 + return;
535 + }
536 +
537 +- /*
538 +- * Surround the RDTSC by barriers, to make sure it's not
539 +- * speculated to outside the seqlock critical section and
540 +- * does not cause time warps:
541 +- */
542 +- rdtsc_barrier();
543 + now = vread();
544 +- rdtsc_barrier();
545 +-
546 + base = __vsyscall_gtod_data.clock.cycle_last;
547 + mask = __vsyscall_gtod_data.clock.mask;
548 + mult = __vsyscall_gtod_data.clock.mult;
549 +diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
550 +index bb48133..fa0adcd 100644
551 +--- a/arch/x86/kvm/vmx.c
552 ++++ b/arch/x86/kvm/vmx.c
553 +@@ -32,6 +32,7 @@
554 + #include <asm/desc.h>
555 + #include <asm/vmx.h>
556 + #include <asm/virtext.h>
557 ++#include <asm/mce.h>
558 +
559 + #define __ex(x) __kvm_handle_fault_on_reboot(x)
560 +
561 +@@ -97,6 +98,8 @@ struct vcpu_vmx {
562 + int soft_vnmi_blocked;
563 + ktime_t entry_time;
564 + s64 vnmi_blocked_time;
565 ++
566 ++ u32 exit_reason;
567 + };
568 +
569 + static inline struct vcpu_vmx *to_vmx(struct kvm_vcpu *vcpu)
570 +@@ -478,7 +481,7 @@ static void update_exception_bitmap(struct kvm_vcpu *vcpu)
571 + {
572 + u32 eb;
573 +
574 +- eb = (1u << PF_VECTOR) | (1u << UD_VECTOR);
575 ++ eb = (1u << PF_VECTOR) | (1u << UD_VECTOR) | (1u << MC_VECTOR);
576 + if (!vcpu->fpu_active)
577 + eb |= 1u << NM_VECTOR;
578 + if (vcpu->guest_debug & KVM_GUESTDBG_ENABLE) {
579 +@@ -2585,6 +2588,35 @@ static int handle_rmode_exception(struct kvm_vcpu *vcpu,
580 + return 0;
581 + }
582 +
583 ++/*
584 ++ * Trigger machine check on the host. We assume all the MSRs are already set up
585 ++ * by the CPU and that we still run on the same CPU as the MCE occurred on.
586 ++ * We pass a fake environment to the machine check handler because we want
587 ++ * the guest to be always treated like user space, no matter what context
588 ++ * it used internally.
589 ++ */
590 ++static void kvm_machine_check(void)
591 ++{
592 ++#ifdef CONFIG_X86_MCE
593 ++ struct pt_regs regs = {
594 ++ .cs = 3, /* Fake ring 3 no matter what the guest ran on */
595 ++ .flags = X86_EFLAGS_IF,
596 ++ };
597 ++
598 ++#ifdef CONFIG_X86_64
599 ++ do_machine_check(&regs, 0);
600 ++#else
601 ++ machine_check_vector(&regs, 0);
602 ++#endif
603 ++#endif
604 ++}
605 ++
606 ++static int handle_machine_check(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
607 ++{
608 ++ /* already handled by vcpu_run */
609 ++ return 1;
610 ++}
611 ++
612 + static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
613 + {
614 + struct vcpu_vmx *vmx = to_vmx(vcpu);
615 +@@ -2596,6 +2628,10 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
616 + vect_info = vmx->idt_vectoring_info;
617 + intr_info = vmcs_read32(VM_EXIT_INTR_INFO);
618 +
619 ++ ex_no = intr_info & INTR_INFO_VECTOR_MASK;
620 ++ if (ex_no == MC_VECTOR)
621 ++ return handle_machine_check(vcpu, kvm_run);
622 ++
623 + if ((vect_info & VECTORING_INFO_VALID_MASK) &&
624 + !is_page_fault(intr_info))
625 + printk(KERN_ERR "%s: unexpected, vectoring info 0x%x "
626 +@@ -2648,7 +2684,6 @@ static int handle_exception(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
627 + return 1;
628 + }
629 +
630 +- ex_no = intr_info & INTR_INFO_VECTOR_MASK;
631 + switch (ex_no) {
632 + case DB_VECTOR:
633 + dr6 = vmcs_readl(EXIT_QUALIFICATION);
634 +@@ -2978,6 +3013,12 @@ static int handle_vmcall(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
635 + return 1;
636 + }
637 +
638 ++static int handle_vmx_insn(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
639 ++{
640 ++ kvm_queue_exception(vcpu, UD_VECTOR);
641 ++ return 1;
642 ++}
643 ++
644 + static int handle_invlpg(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
645 + {
646 + u64 exit_qualification = vmcs_read64(EXIT_QUALIFICATION);
647 +@@ -3145,11 +3186,21 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu,
648 + [EXIT_REASON_HLT] = handle_halt,
649 + [EXIT_REASON_INVLPG] = handle_invlpg,
650 + [EXIT_REASON_VMCALL] = handle_vmcall,
651 ++ [EXIT_REASON_VMCLEAR] = handle_vmx_insn,
652 ++ [EXIT_REASON_VMLAUNCH] = handle_vmx_insn,
653 ++ [EXIT_REASON_VMPTRLD] = handle_vmx_insn,
654 ++ [EXIT_REASON_VMPTRST] = handle_vmx_insn,
655 ++ [EXIT_REASON_VMREAD] = handle_vmx_insn,
656 ++ [EXIT_REASON_VMRESUME] = handle_vmx_insn,
657 ++ [EXIT_REASON_VMWRITE] = handle_vmx_insn,
658 ++ [EXIT_REASON_VMOFF] = handle_vmx_insn,
659 ++ [EXIT_REASON_VMON] = handle_vmx_insn,
660 + [EXIT_REASON_TPR_BELOW_THRESHOLD] = handle_tpr_below_threshold,
661 + [EXIT_REASON_APIC_ACCESS] = handle_apic_access,
662 + [EXIT_REASON_WBINVD] = handle_wbinvd,
663 + [EXIT_REASON_TASK_SWITCH] = handle_task_switch,
664 + [EXIT_REASON_EPT_VIOLATION] = handle_ept_violation,
665 ++ [EXIT_REASON_MCE_DURING_VMENTRY] = handle_machine_check,
666 + };
667 +
668 + static const int kvm_vmx_max_exit_handlers =
669 +@@ -3161,8 +3212,8 @@ static const int kvm_vmx_max_exit_handlers =
670 + */
671 + static int kvm_handle_exit(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
672 + {
673 +- u32 exit_reason = vmcs_read32(VM_EXIT_REASON);
674 + struct vcpu_vmx *vmx = to_vmx(vcpu);
675 ++ u32 exit_reason = vmx->exit_reason;
676 + u32 vectoring_info = vmx->idt_vectoring_info;
677 +
678 + KVMTRACE_3D(VMEXIT, vcpu, exit_reason, (u32)kvm_rip_read(vcpu),
679 +@@ -3512,6 +3563,13 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
680 +
681 + intr_info = vmcs_read32(VM_EXIT_INTR_INFO);
682 +
683 ++ vmx->exit_reason = vmcs_read32(VM_EXIT_REASON);
684 ++
685 ++ /* Handle machine checks before interrupts are enabled */
686 ++ if ((vmx->exit_reason == EXIT_REASON_MCE_DURING_VMENTRY) ||
687 ++ (intr_info & INTR_INFO_VECTOR_MASK) == MC_VECTOR)
688 ++ kvm_machine_check();
689 ++
690 + /* We need to handle NMIs before interrupts are enabled */
691 + if ((intr_info & INTR_INFO_INTR_TYPE_MASK) == INTR_TYPE_NMI_INTR &&
692 + (intr_info & INTR_INFO_VALID_MASK)) {
693 +diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
694 +index 3944e91..ee4714b 100644
695 +--- a/arch/x86/kvm/x86.c
696 ++++ b/arch/x86/kvm/x86.c
697 +@@ -634,10 +634,12 @@ static void kvm_write_guest_time(struct kvm_vcpu *v)
698 + if ((!vcpu->time_page))
699 + return;
700 +
701 ++ preempt_disable();
702 + if (unlikely(vcpu->hv_clock_tsc_khz != __get_cpu_var(cpu_tsc_khz))) {
703 + kvm_set_time_scale(__get_cpu_var(cpu_tsc_khz), &vcpu->hv_clock);
704 + vcpu->hv_clock_tsc_khz = __get_cpu_var(cpu_tsc_khz);
705 + }
706 ++ preempt_enable();
707 +
708 + /* Keep irq disabled to prevent changes to the clock */
709 + local_irq_save(flags);
710 +@@ -3934,7 +3936,13 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
711 +
712 + vcpu->arch.cr2 = sregs->cr2;
713 + mmu_reset_needed |= vcpu->arch.cr3 != sregs->cr3;
714 +- vcpu->arch.cr3 = sregs->cr3;
715 ++
716 ++ down_read(&vcpu->kvm->slots_lock);
717 ++ if (gfn_to_memslot(vcpu->kvm, sregs->cr3 >> PAGE_SHIFT))
718 ++ vcpu->arch.cr3 = sregs->cr3;
719 ++ else
720 ++ set_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests);
721 ++ up_read(&vcpu->kvm->slots_lock);
722 +
723 + kvm_set_cr8(vcpu, sregs->cr8);
724 +
725 +diff --git a/arch/x86/mm/memtest.c b/arch/x86/mm/memtest.c
726 +index 605c8be..c0bedcd 100644
727 +--- a/arch/x86/mm/memtest.c
728 ++++ b/arch/x86/mm/memtest.c
729 +@@ -40,23 +40,23 @@ static void __init reserve_bad_mem(u64 pattern, u64 start_bad, u64 end_bad)
730 +
731 + static void __init memtest(u64 pattern, u64 start_phys, u64 size)
732 + {
733 +- u64 i, count;
734 +- u64 *start;
735 ++ u64 *p;
736 ++ void *start, *end;
737 + u64 start_bad, last_bad;
738 + u64 start_phys_aligned;
739 + size_t incr;
740 +
741 + incr = sizeof(pattern);
742 + start_phys_aligned = ALIGN(start_phys, incr);
743 +- count = (size - (start_phys_aligned - start_phys))/incr;
744 + start = __va(start_phys_aligned);
745 ++ end = start + size - (start_phys_aligned - start_phys);
746 + start_bad = 0;
747 + last_bad = 0;
748 +
749 +- for (i = 0; i < count; i++)
750 +- start[i] = pattern;
751 +- for (i = 0; i < count; i++, start++, start_phys_aligned += incr) {
752 +- if (*start == pattern)
753 ++ for (p = start; p < end; p++)
754 ++ *p = pattern;
755 ++ for (p = start; p < end; p++, start_phys_aligned += incr) {
756 ++ if (*p == pattern)
757 + continue;
758 + if (start_phys_aligned == last_bad + incr) {
759 + last_bad += incr;
760 +diff --git a/drivers/char/epca.c b/drivers/char/epca.c
761 +index af7c13c..bcd07cb 100644
762 +--- a/drivers/char/epca.c
763 ++++ b/drivers/char/epca.c
764 +@@ -1518,7 +1518,7 @@ static void doevent(int crd)
765 + if (event & MODEMCHG_IND) {
766 + /* A modem signal change has been indicated */
767 + ch->imodem = mstat;
768 +- if (test_bit(ASYNC_CHECK_CD, &ch->port.flags)) {
769 ++ if (test_bit(ASYNCB_CHECK_CD, &ch->port.flags)) {
770 + /* We are now receiving dcd */
771 + if (mstat & ch->dcd)
772 + wake_up_interruptible(&ch->port.open_wait);
773 +@@ -1765,9 +1765,9 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch)
774 + * that the driver will wait on carrier detect.
775 + */
776 + if (ts->c_cflag & CLOCAL)
777 +- clear_bit(ASYNC_CHECK_CD, &ch->port.flags);
778 ++ clear_bit(ASYNCB_CHECK_CD, &ch->port.flags);
779 + else
780 +- set_bit(ASYNC_CHECK_CD, &ch->port.flags);
781 ++ set_bit(ASYNCB_CHECK_CD, &ch->port.flags);
782 + mval = ch->m_dtr | ch->m_rts;
783 + } /* End CBAUD not detected */
784 + iflag = termios2digi_i(ch, ts->c_iflag);
785 +@@ -2244,7 +2244,8 @@ static void do_softint(struct work_struct *work)
786 + if (test_and_clear_bit(EPCA_EVENT_HANGUP, &ch->event)) {
787 + tty_hangup(tty);
788 + wake_up_interruptible(&ch->port.open_wait);
789 +- clear_bit(ASYNC_NORMAL_ACTIVE, &ch->port.flags);
790 ++ clear_bit(ASYNCB_NORMAL_ACTIVE,
791 ++ &ch->port.flags);
792 + }
793 + }
794 + tty_kref_put(tty);
795 +diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c
796 +index 4a4cab7..a57ab11 100644
797 +--- a/drivers/char/moxa.c
798 ++++ b/drivers/char/moxa.c
799 +@@ -1184,6 +1184,11 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
800 + return -ENODEV;
801 + }
802 +
803 ++ if (port % MAX_PORTS_PER_BOARD >= brd->numPorts) {
804 ++ retval = -ENODEV;
805 ++ goto out_unlock;
806 ++ }
807 ++
808 + ch = &brd->ports[port % MAX_PORTS_PER_BOARD];
809 + ch->port.count++;
810 + tty->driver_data = ch;
811 +@@ -1208,8 +1213,8 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
812 + moxa_close_port(tty);
813 + } else
814 + ch->port.flags |= ASYNC_NORMAL_ACTIVE;
815 ++out_unlock:
816 + mutex_unlock(&moxa_openlock);
817 +-
818 + return retval;
819 + }
820 +
821 +diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c
822 +index d2e93e3..2e99158 100644
823 +--- a/drivers/char/n_r3964.c
824 ++++ b/drivers/char/n_r3964.c
825 +@@ -1062,7 +1062,7 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
826 + struct r3964_client_info *pClient;
827 + struct r3964_message *pMsg;
828 + struct r3964_client_message theMsg;
829 +- int count;
830 ++ int ret;
831 +
832 + TRACE_L("read()");
833 +
834 +@@ -1074,8 +1074,8 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
835 + if (pMsg == NULL) {
836 + /* no messages available. */
837 + if (file->f_flags & O_NONBLOCK) {
838 +- unlock_kernel();
839 +- return -EAGAIN;
840 ++ ret = -EAGAIN;
841 ++ goto unlock;
842 + }
843 + /* block until there is a message: */
844 + wait_event_interruptible(pInfo->read_wait,
845 +@@ -1085,29 +1085,31 @@ static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
846 + /* If we still haven't got a message, we must have been signalled */
847 +
848 + if (!pMsg) {
849 +- unlock_kernel();
850 +- return -EINTR;
851 ++ ret = -EINTR;
852 ++ goto unlock;
853 + }
854 +
855 + /* deliver msg to client process: */
856 + theMsg.msg_id = pMsg->msg_id;
857 + theMsg.arg = pMsg->arg;
858 + theMsg.error_code = pMsg->error_code;
859 +- count = sizeof(struct r3964_client_message);
860 ++ ret = sizeof(struct r3964_client_message);
861 +
862 + kfree(pMsg);
863 + TRACE_M("r3964_read - msg kfree %p", pMsg);
864 +
865 +- if (copy_to_user(buf, &theMsg, count)) {
866 +- unlock_kernel();
867 +- return -EFAULT;
868 ++ if (copy_to_user(buf, &theMsg, ret)) {
869 ++ ret = -EFAULT;
870 ++ goto unlock;
871 + }
872 +
873 +- TRACE_PS("read - return %d", count);
874 +- return count;
875 ++ TRACE_PS("read - return %d", ret);
876 ++ goto unlock;
877 + }
878 ++ ret = -EPERM;
879 ++unlock:
880 + unlock_kernel();
881 +- return -EPERM;
882 ++ return ret;
883 + }
884 +
885 + static ssize_t r3964_write(struct tty_struct *tty, struct file *file,
886 +diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
887 +index dbb9125..881934c 100644
888 +--- a/drivers/char/pcmcia/cm4000_cs.c
889 ++++ b/drivers/char/pcmcia/cm4000_cs.c
890 +@@ -1575,7 +1575,8 @@ static long cmm_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
891 + clear_bit(LOCK_IO, &dev->flags);
892 + wake_up_interruptible(&dev->ioq);
893 +
894 +- return 0;
895 ++ rc = 0;
896 ++ break;
897 + case CM_IOCSPTS:
898 + {
899 + struct ptsreq krnptsreq;
900 +diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
901 +index f59fc5c..3fa7234 100644
902 +--- a/drivers/char/rocket.c
903 ++++ b/drivers/char/rocket.c
904 +@@ -934,7 +934,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
905 + /*
906 + * Info->count is now 1; so it's safe to sleep now.
907 + */
908 +- if (!test_bit(ASYNC_INITIALIZED, &port->flags)) {
909 ++ if (!test_bit(ASYNCB_INITIALIZED, &port->flags)) {
910 + cp = &info->channel;
911 + sSetRxTrigger(cp, TRIG_1);
912 + if (sGetChanStatus(cp) & CD_ACT)
913 +@@ -958,7 +958,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
914 + sEnRxFIFO(cp);
915 + sEnTransmit(cp);
916 +
917 +- set_bit(ASYNC_INITIALIZED, &info->port.flags);
918 ++ set_bit(ASYNCB_INITIALIZED, &info->port.flags);
919 +
920 + /*
921 + * Set up the tty->alt_speed kludge
922 +@@ -1641,7 +1641,7 @@ static int rp_write(struct tty_struct *tty,
923 + /* Write remaining data into the port's xmit_buf */
924 + while (1) {
925 + /* Hung up ? */
926 +- if (!test_bit(ASYNC_NORMAL_ACTIVE, &info->port.flags))
927 ++ if (!test_bit(ASYNCB_NORMAL_ACTIVE, &info->port.flags))
928 + goto end;
929 + c = min(count, XMIT_BUF_SIZE - info->xmit_cnt - 1);
930 + c = min(c, XMIT_BUF_SIZE - info->xmit_head);
931 +diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
932 +index e6ce632..7539bed 100644
933 +--- a/drivers/char/vt_ioctl.c
934 ++++ b/drivers/char/vt_ioctl.c
935 +@@ -396,7 +396,8 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
936 + kbd = kbd_table + console;
937 + switch (cmd) {
938 + case TIOCLINUX:
939 +- return tioclinux(tty, arg);
940 ++ ret = tioclinux(tty, arg);
941 ++ break;
942 + case KIOCSOUND:
943 + if (!perm)
944 + goto eperm;
945 +diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c
946 +index 05aa2d4..d5ea8a6 100644
947 +--- a/drivers/firmware/memmap.c
948 ++++ b/drivers/firmware/memmap.c
949 +@@ -31,8 +31,12 @@
950 + * information is necessary as for the resource tree.
951 + */
952 + struct firmware_map_entry {
953 +- resource_size_t start; /* start of the memory range */
954 +- resource_size_t end; /* end of the memory range (incl.) */
955 ++ /*
956 ++ * start and end must be u64 rather than resource_size_t, because e820
957 ++ * resources can lie at addresses above 4G.
958 ++ */
959 ++ u64 start; /* start of the memory range */
960 ++ u64 end; /* end of the memory range (incl.) */
961 + const char *type; /* type of the memory range */
962 + struct list_head list; /* entry for the linked list */
963 + struct kobject kobj; /* kobject for each entry */
964 +@@ -101,7 +105,7 @@ static LIST_HEAD(map_entries);
965 + * Common implementation of firmware_map_add() and firmware_map_add_early()
966 + * which expects a pre-allocated struct firmware_map_entry.
967 + **/
968 +-static int firmware_map_add_entry(resource_size_t start, resource_size_t end,
969 ++static int firmware_map_add_entry(u64 start, u64 end,
970 + const char *type,
971 + struct firmware_map_entry *entry)
972 + {
973 +@@ -132,8 +136,7 @@ static int firmware_map_add_entry(resource_size_t start, resource_size_t end,
974 + *
975 + * Returns 0 on success, or -ENOMEM if no memory could be allocated.
976 + **/
977 +-int firmware_map_add(resource_size_t start, resource_size_t end,
978 +- const char *type)
979 ++int firmware_map_add(u64 start, u64 end, const char *type)
980 + {
981 + struct firmware_map_entry *entry;
982 +
983 +@@ -157,8 +160,7 @@ int firmware_map_add(resource_size_t start, resource_size_t end,
984 + *
985 + * Returns 0 on success, or -ENOMEM if no memory could be allocated.
986 + **/
987 +-int __init firmware_map_add_early(resource_size_t start, resource_size_t end,
988 +- const char *type)
989 ++int __init firmware_map_add_early(u64 start, u64 end, const char *type)
990 + {
991 + struct firmware_map_entry *entry;
992 +
993 +diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
994 +index 98560e1..e3cb402 100644
995 +--- a/drivers/gpu/drm/i915/i915_drv.c
996 ++++ b/drivers/gpu/drm/i915/i915_drv.c
997 +@@ -67,8 +67,6 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state)
998 +
999 + pci_save_state(dev->pdev);
1000 +
1001 +- i915_save_state(dev);
1002 +-
1003 + /* If KMS is active, we do the leavevt stuff here */
1004 + if (drm_core_check_feature(dev, DRIVER_MODESET)) {
1005 + if (i915_gem_idle(dev))
1006 +@@ -77,6 +75,8 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state)
1007 + drm_irq_uninstall(dev);
1008 + }
1009 +
1010 ++ i915_save_state(dev);
1011 ++
1012 + intel_opregion_free(dev, 1);
1013 +
1014 + if (state.event == PM_EVENT_SUSPEND) {
1015 +diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
1016 +index 925eb9e..6368f57 100644
1017 +--- a/drivers/ide/ide-cd.c
1018 ++++ b/drivers/ide/ide-cd.c
1019 +@@ -758,7 +758,7 @@ out_end:
1020 + rq->errors = -EIO;
1021 + }
1022 +
1023 +- if (uptodate == 0)
1024 ++ if (uptodate == 0 && rq->bio)
1025 + ide_cd_error_cmd(drive, cmd);
1026 +
1027 + /* make sure it's fully ended */
1028 +diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
1029 +index 20724ae..c4a0264 100644
1030 +--- a/drivers/infiniband/hw/mlx4/qp.c
1031 ++++ b/drivers/infiniband/hw/mlx4/qp.c
1032 +@@ -1585,12 +1585,16 @@ int mlx4_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
1033 + break;
1034 +
1035 + case IB_WR_LOCAL_INV:
1036 ++ ctrl->srcrb_flags |=
1037 ++ cpu_to_be32(MLX4_WQE_CTRL_STRONG_ORDER);
1038 + set_local_inv_seg(wqe, wr->ex.invalidate_rkey);
1039 + wqe += sizeof (struct mlx4_wqe_local_inval_seg);
1040 + size += sizeof (struct mlx4_wqe_local_inval_seg) / 16;
1041 + break;
1042 +
1043 + case IB_WR_FAST_REG_MR:
1044 ++ ctrl->srcrb_flags |=
1045 ++ cpu_to_be32(MLX4_WQE_CTRL_STRONG_ORDER);
1046 + set_fmr_seg(wqe, wr);
1047 + wqe += sizeof (struct mlx4_wqe_fmr_seg);
1048 + size += sizeof (struct mlx4_wqe_fmr_seg) / 16;
1049 +diff --git a/drivers/isdn/hisax/hfc_pci.c b/drivers/isdn/hisax/hfc_pci.c
1050 +index f126566..3d337d9 100644
1051 +--- a/drivers/isdn/hisax/hfc_pci.c
1052 ++++ b/drivers/isdn/hisax/hfc_pci.c
1053 +@@ -82,8 +82,9 @@ release_io_hfcpci(struct IsdnCardState *cs)
1054 + Write_hfc(cs, HFCPCI_INT_M2, cs->hw.hfcpci.int_m2);
1055 + pci_write_config_word(cs->hw.hfcpci.dev, PCI_COMMAND, 0); /* disable memory mapped ports + busmaster */
1056 + del_timer(&cs->hw.hfcpci.timer);
1057 +- kfree(cs->hw.hfcpci.share_start);
1058 +- cs->hw.hfcpci.share_start = NULL;
1059 ++ pci_free_consistent(cs->hw.hfcpci.dev, 0x8000,
1060 ++ cs->hw.hfcpci.fifos, cs->hw.hfcpci.dma);
1061 ++ cs->hw.hfcpci.fifos = NULL;
1062 + iounmap((void *)cs->hw.hfcpci.pci_io);
1063 + }
1064 +
1065 +@@ -1663,8 +1664,19 @@ setup_hfcpci(struct IsdnCard *card)
1066 + dev_hfcpci);
1067 + i++;
1068 + if (tmp_hfcpci) {
1069 ++ dma_addr_t dma_mask = DMA_BIT_MASK(32) & ~0x7fffUL;
1070 + if (pci_enable_device(tmp_hfcpci))
1071 + continue;
1072 ++ if (pci_set_dma_mask(tmp_hfcpci, dma_mask)) {
1073 ++ printk(KERN_WARNING
1074 ++ "HiSax hfc_pci: No suitable DMA available.\n");
1075 ++ continue;
1076 ++ }
1077 ++ if (pci_set_consistent_dma_mask(tmp_hfcpci, dma_mask)) {
1078 ++ printk(KERN_WARNING
1079 ++ "HiSax hfc_pci: No suitable consistent DMA available.\n");
1080 ++ continue;
1081 ++ }
1082 + pci_set_master(tmp_hfcpci);
1083 + if ((card->para[0]) && (card->para[0] != (tmp_hfcpci->resource[ 0].start & PCI_BASE_ADDRESS_IO_MASK)))
1084 + continue;
1085 +@@ -1693,22 +1705,29 @@ setup_hfcpci(struct IsdnCard *card)
1086 + printk(KERN_WARNING "HFC-PCI: No IO-Mem for PCI card found\n");
1087 + return (0);
1088 + }
1089 ++
1090 + /* Allocate memory for FIFOS */
1091 +- /* Because the HFC-PCI needs a 32K physical alignment, we */
1092 +- /* need to allocate the double mem and align the address */
1093 +- if (!(cs->hw.hfcpci.share_start = kmalloc(65536, GFP_KERNEL))) {
1094 +- printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n");
1095 ++ cs->hw.hfcpci.fifos = pci_alloc_consistent(cs->hw.hfcpci.dev,
1096 ++ 0x8000, &cs->hw.hfcpci.dma);
1097 ++ if (!cs->hw.hfcpci.fifos) {
1098 ++ printk(KERN_WARNING "HFC-PCI: Error allocating FIFO memory!\n");
1099 ++ return 0;
1100 ++ }
1101 ++ if (cs->hw.hfcpci.dma & 0x7fff) {
1102 ++ printk(KERN_WARNING
1103 ++ "HFC-PCI: Error DMA memory not on 32K boundary (%lx)\n",
1104 ++ (u_long)cs->hw.hfcpci.dma);
1105 ++ pci_free_consistent(cs->hw.hfcpci.dev, 0x8000,
1106 ++ cs->hw.hfcpci.fifos, cs->hw.hfcpci.dma);
1107 + return 0;
1108 + }
1109 +- cs->hw.hfcpci.fifos = (void *)
1110 +- (((ulong) cs->hw.hfcpci.share_start) & ~0x7FFF) + 0x8000;
1111 +- pci_write_config_dword(cs->hw.hfcpci.dev, 0x80, (u_int) virt_to_bus(cs->hw.hfcpci.fifos));
1112 ++ pci_write_config_dword(cs->hw.hfcpci.dev, 0x80, (u32)cs->hw.hfcpci.dma);
1113 + cs->hw.hfcpci.pci_io = ioremap((ulong) cs->hw.hfcpci.pci_io, 256);
1114 + printk(KERN_INFO
1115 +- "HFC-PCI: defined at mem %p fifo %p(%#x) IRQ %d HZ %d\n",
1116 ++ "HFC-PCI: defined at mem %p fifo %p(%lx) IRQ %d HZ %d\n",
1117 + cs->hw.hfcpci.pci_io,
1118 + cs->hw.hfcpci.fifos,
1119 +- (u_int) virt_to_bus(cs->hw.hfcpci.fifos),
1120 ++ (u_long)cs->hw.hfcpci.dma,
1121 + cs->irq, HZ);
1122 +
1123 + spin_lock_irqsave(&cs->lock, flags);
1124 +diff --git a/drivers/isdn/hisax/hisax.h b/drivers/isdn/hisax/hisax.h
1125 +index f852704..0685c19 100644
1126 +--- a/drivers/isdn/hisax/hisax.h
1127 ++++ b/drivers/isdn/hisax/hisax.h
1128 +@@ -703,7 +703,7 @@ struct hfcPCI_hw {
1129 + int nt_timer;
1130 + struct pci_dev *dev;
1131 + unsigned char *pci_io; /* start of PCI IO memory */
1132 +- void *share_start; /* shared memory for Fifos start */
1133 ++ dma_addr_t dma; /* dma handle for Fifos */
1134 + void *fifos; /* FIFO memory */
1135 + int last_bfifo_cnt[2]; /* marker saving last b-fifo frame count */
1136 + struct timer_list timer;
1137 +diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c
1138 +index a2e26c2..14ce11e 100644
1139 +--- a/drivers/md/dm-exception-store.c
1140 ++++ b/drivers/md/dm-exception-store.c
1141 +@@ -195,7 +195,7 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
1142 + struct dm_exception_store **store)
1143 + {
1144 + int r = 0;
1145 +- struct dm_exception_store_type *type;
1146 ++ struct dm_exception_store_type *type = NULL;
1147 + struct dm_exception_store *tmp_store;
1148 + char persistent;
1149 +
1150 +@@ -211,12 +211,15 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
1151 + }
1152 +
1153 + persistent = toupper(*argv[1]);
1154 +- if (persistent != 'P' && persistent != 'N') {
1155 ++ if (persistent == 'P')
1156 ++ type = get_type("P");
1157 ++ else if (persistent == 'N')
1158 ++ type = get_type("N");
1159 ++ else {
1160 + ti->error = "Persistent flag is not P or N";
1161 + return -EINVAL;
1162 + }
1163 +
1164 +- type = get_type(argv[1]);
1165 + if (!type) {
1166 + ti->error = "Exception store type not recognised";
1167 + r = -EINVAL;
1168 +diff --git a/drivers/md/dm-exception-store.h b/drivers/md/dm-exception-store.h
1169 +index 0a2e6e7..96a796b 100644
1170 +--- a/drivers/md/dm-exception-store.h
1171 ++++ b/drivers/md/dm-exception-store.h
1172 +@@ -156,7 +156,7 @@ static inline void dm_consecutive_chunk_count_inc(struct dm_snap_exception *e)
1173 + */
1174 + static inline sector_t get_dev_size(struct block_device *bdev)
1175 + {
1176 +- return bdev->bd_inode->i_size >> SECTOR_SHIFT;
1177 ++ return i_size_read(bdev->bd_inode) >> SECTOR_SHIFT;
1178 + }
1179 +
1180 + static inline chunk_t sector_to_chunk(struct dm_exception_store *store,
1181 +diff --git a/drivers/md/dm-log.c b/drivers/md/dm-log.c
1182 +index be233bc..5eaa954 100644
1183 +--- a/drivers/md/dm-log.c
1184 ++++ b/drivers/md/dm-log.c
1185 +@@ -415,7 +415,7 @@ static int create_log_context(struct dm_dirty_log *log, struct dm_target *ti,
1186 + buf_size = dm_round_up((LOG_OFFSET << SECTOR_SHIFT) +
1187 + bitset_size, ti->limits.hardsect_size);
1188 +
1189 +- if (buf_size > dev->bdev->bd_inode->i_size) {
1190 ++ if (buf_size > i_size_read(dev->bdev->bd_inode)) {
1191 + DMWARN("log device %s too small: need %llu bytes",
1192 + dev->name, (unsigned long long)buf_size);
1193 + kfree(lc);
1194 +diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
1195 +index 6a386ab..3a8f827 100644
1196 +--- a/drivers/md/dm-mpath.c
1197 ++++ b/drivers/md/dm-mpath.c
1198 +@@ -553,6 +553,12 @@ static int parse_path_selector(struct arg_set *as, struct priority_group *pg,
1199 + return -EINVAL;
1200 + }
1201 +
1202 ++ if (ps_argc > as->argc) {
1203 ++ dm_put_path_selector(pst);
1204 ++ ti->error = "not enough arguments for path selector";
1205 ++ return -EINVAL;
1206 ++ }
1207 ++
1208 + r = pst->create(&pg->ps, ps_argc, as->argv);
1209 + if (r) {
1210 + dm_put_path_selector(pst);
1211 +@@ -699,6 +705,11 @@ static int parse_hw_handler(struct arg_set *as, struct multipath *m)
1212 + if (!hw_argc)
1213 + return 0;
1214 +
1215 ++ if (hw_argc > as->argc) {
1216 ++ ti->error = "not enough arguments for hardware handler";
1217 ++ return -EINVAL;
1218 ++ }
1219 ++
1220 + m->hw_handler_name = kstrdup(shift(as), GFP_KERNEL);
1221 + request_module("scsi_dh_%s", m->hw_handler_name);
1222 + if (scsi_dh_handler_exist(m->hw_handler_name) == 0) {
1223 +@@ -836,6 +847,7 @@ static void multipath_dtr(struct dm_target *ti)
1224 +
1225 + flush_workqueue(kmpath_handlerd);
1226 + flush_workqueue(kmultipathd);
1227 ++ flush_scheduled_work();
1228 + free_multipath(m);
1229 + }
1230 +
1231 +diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
1232 +index 429b50b..c5c4a0d 100644
1233 +--- a/drivers/md/dm-table.c
1234 ++++ b/drivers/md/dm-table.c
1235 +@@ -387,7 +387,8 @@ static void close_dev(struct dm_dev_internal *d, struct mapped_device *md)
1236 + static int check_device_area(struct dm_dev_internal *dd, sector_t start,
1237 + sector_t len)
1238 + {
1239 +- sector_t dev_size = dd->dm_dev.bdev->bd_inode->i_size >> SECTOR_SHIFT;
1240 ++ sector_t dev_size = i_size_read(dd->dm_dev.bdev->bd_inode) >>
1241 ++ SECTOR_SHIFT;
1242 +
1243 + if (!dev_size)
1244 + return 1;
1245 +diff --git a/drivers/md/dm.c b/drivers/md/dm.c
1246 +index 424f7b0..add49c1 100644
1247 +--- a/drivers/md/dm.c
1248 ++++ b/drivers/md/dm.c
1249 +@@ -1780,6 +1780,10 @@ struct mapped_device *dm_get_from_kobject(struct kobject *kobj)
1250 + if (&md->kobj != kobj)
1251 + return NULL;
1252 +
1253 ++ if (test_bit(DMF_FREEING, &md->flags) ||
1254 ++ test_bit(DMF_DELETING, &md->flags))
1255 ++ return NULL;
1256 ++
1257 + dm_get(md);
1258 + return md;
1259 + }
1260 +diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
1261 +index bb37fb1..c0434e0 100644
1262 +--- a/drivers/md/raid5.c
1263 ++++ b/drivers/md/raid5.c
1264 +@@ -3696,6 +3696,7 @@ static int make_request(struct request_queue *q, struct bio * bi)
1265 + spin_unlock_irq(&conf->device_lock);
1266 + if (must_retry) {
1267 + release_stripe(sh);
1268 ++ schedule();
1269 + goto retry;
1270 + }
1271 + }
1272 +diff --git a/drivers/media/dvb/frontends/lgdt3305.c b/drivers/media/dvb/frontends/lgdt3305.c
1273 +index d92d055..fde8c59 100644
1274 +--- a/drivers/media/dvb/frontends/lgdt3305.c
1275 ++++ b/drivers/media/dvb/frontends/lgdt3305.c
1276 +@@ -19,6 +19,7 @@
1277 + *
1278 + */
1279 +
1280 ++#include <asm/div64.h>
1281 + #include <linux/dvb/frontend.h>
1282 + #include "dvb_math.h"
1283 + #include "lgdt3305.h"
1284 +@@ -496,27 +497,15 @@ static int lgdt3305_set_if(struct lgdt3305_state *state,
1285 +
1286 + nco = if_freq_khz / 10;
1287 +
1288 +-#define LGDT3305_64BIT_DIVISION_ENABLED 0
1289 +- /* FIXME: 64bit division disabled to avoid linking error:
1290 +- * WARNING: "__udivdi3" [lgdt3305.ko] undefined!
1291 +- */
1292 + switch (param->u.vsb.modulation) {
1293 + case VSB_8:
1294 +-#if LGDT3305_64BIT_DIVISION_ENABLED
1295 + nco <<= 24;
1296 +- nco /= 625;
1297 +-#else
1298 +- nco *= ((1 << 24) / 625);
1299 +-#endif
1300 ++ do_div(nco, 625);
1301 + break;
1302 + case QAM_64:
1303 + case QAM_256:
1304 +-#if LGDT3305_64BIT_DIVISION_ENABLED
1305 + nco <<= 28;
1306 +- nco /= 625;
1307 +-#else
1308 +- nco *= ((1 << 28) / 625);
1309 +-#endif
1310 ++ do_div(nco, 625);
1311 + break;
1312 + default:
1313 + return -EINVAL;
1314 +diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
1315 +index 3f1a035..448c306 100644
1316 +--- a/drivers/media/video/Makefile
1317 ++++ b/drivers/media/video/Makefile
1318 +@@ -12,6 +12,8 @@ omap2cam-objs := omap24xxcam.o omap24xxcam-dma.o
1319 +
1320 + videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o
1321 +
1322 ++# V4L2 core modules
1323 ++
1324 + obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-int-device.o
1325 + ifeq ($(CONFIG_COMPAT),y)
1326 + obj-$(CONFIG_VIDEO_DEV) += v4l2-compat-ioctl32.o
1327 +@@ -23,21 +25,15 @@ ifeq ($(CONFIG_VIDEO_V4L1_COMPAT),y)
1328 + obj-$(CONFIG_VIDEO_DEV) += v4l1-compat.o
1329 + endif
1330 +
1331 +-obj-$(CONFIG_VIDEO_TUNER) += tuner.o
1332 ++# All i2c modules must come first:
1333 +
1334 +-obj-$(CONFIG_VIDEO_BT848) += bt8xx/
1335 +-obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o
1336 ++obj-$(CONFIG_VIDEO_TUNER) += tuner.o
1337 + obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o
1338 + obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o
1339 + obj-$(CONFIG_VIDEO_TDA9875) += tda9875.o
1340 +-
1341 + obj-$(CONFIG_VIDEO_SAA6588) += saa6588.o
1342 + obj-$(CONFIG_VIDEO_SAA5246A) += saa5246a.o
1343 + obj-$(CONFIG_VIDEO_SAA5249) += saa5249.o
1344 +-obj-$(CONFIG_VIDEO_CQCAM) += c-qcam.o
1345 +-obj-$(CONFIG_VIDEO_BWQCAM) += bw-qcam.o
1346 +-obj-$(CONFIG_VIDEO_W9966) += w9966.o
1347 +-
1348 + obj-$(CONFIG_VIDEO_TDA9840) += tda9840.o
1349 + obj-$(CONFIG_VIDEO_TEA6415C) += tea6415c.o
1350 + obj-$(CONFIG_VIDEO_TEA6420) += tea6420.o
1351 +@@ -54,11 +50,40 @@ obj-$(CONFIG_VIDEO_BT819) += bt819.o
1352 + obj-$(CONFIG_VIDEO_BT856) += bt856.o
1353 + obj-$(CONFIG_VIDEO_BT866) += bt866.o
1354 + obj-$(CONFIG_VIDEO_KS0127) += ks0127.o
1355 ++obj-$(CONFIG_VIDEO_VINO) += indycam.o
1356 ++obj-$(CONFIG_VIDEO_TVP5150) += tvp5150.o
1357 ++obj-$(CONFIG_VIDEO_TVP514X) += tvp514x.o
1358 ++obj-$(CONFIG_VIDEO_MSP3400) += msp3400.o
1359 ++obj-$(CONFIG_VIDEO_CS5345) += cs5345.o
1360 ++obj-$(CONFIG_VIDEO_CS53L32A) += cs53l32a.o
1361 ++obj-$(CONFIG_VIDEO_M52790) += m52790.o
1362 ++obj-$(CONFIG_VIDEO_TLV320AIC23B) += tlv320aic23b.o
1363 ++obj-$(CONFIG_VIDEO_WM8775) += wm8775.o
1364 ++obj-$(CONFIG_VIDEO_WM8739) += wm8739.o
1365 ++obj-$(CONFIG_VIDEO_VP27SMPX) += vp27smpx.o
1366 ++obj-$(CONFIG_VIDEO_CX25840) += cx25840/
1367 ++obj-$(CONFIG_VIDEO_UPD64031A) += upd64031a.o
1368 ++obj-$(CONFIG_VIDEO_UPD64083) += upd64083.o
1369 ++obj-$(CONFIG_VIDEO_OV7670) += ov7670.o
1370 ++obj-$(CONFIG_VIDEO_TCM825X) += tcm825x.o
1371 ++obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o
1372 +
1373 +-obj-$(CONFIG_VIDEO_ZORAN) += zoran/
1374 ++obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o
1375 ++obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o
1376 ++obj-$(CONFIG_SOC_CAMERA_MT9T031) += mt9t031.o
1377 ++obj-$(CONFIG_SOC_CAMERA_MT9V022) += mt9v022.o
1378 ++obj-$(CONFIG_SOC_CAMERA_OV772X) += ov772x.o
1379 ++obj-$(CONFIG_SOC_CAMERA_TW9910) += tw9910.o
1380 +
1381 ++# And now the v4l2 drivers:
1382 ++
1383 ++obj-$(CONFIG_VIDEO_BT848) += bt8xx/
1384 ++obj-$(CONFIG_VIDEO_ZORAN) += zoran/
1385 ++obj-$(CONFIG_VIDEO_CQCAM) += c-qcam.o
1386 ++obj-$(CONFIG_VIDEO_BWQCAM) += bw-qcam.o
1387 ++obj-$(CONFIG_VIDEO_W9966) += w9966.o
1388 + obj-$(CONFIG_VIDEO_PMS) += pms.o
1389 +-obj-$(CONFIG_VIDEO_VINO) += vino.o indycam.o
1390 ++obj-$(CONFIG_VIDEO_VINO) += vino.o
1391 + obj-$(CONFIG_VIDEO_STRADIS) += stradis.o
1392 + obj-$(CONFIG_VIDEO_CPIA) += cpia.o
1393 + obj-$(CONFIG_VIDEO_CPIA_PP) += cpia_pp.o
1394 +@@ -69,17 +94,7 @@ obj-$(CONFIG_VIDEO_CX88) += cx88/
1395 + obj-$(CONFIG_VIDEO_EM28XX) += em28xx/
1396 + obj-$(CONFIG_VIDEO_CX231XX) += cx231xx/
1397 + obj-$(CONFIG_VIDEO_USBVISION) += usbvision/
1398 +-obj-$(CONFIG_VIDEO_TVP5150) += tvp5150.o
1399 +-obj-$(CONFIG_VIDEO_TVP514X) += tvp514x.o
1400 + obj-$(CONFIG_VIDEO_PVRUSB2) += pvrusb2/
1401 +-obj-$(CONFIG_VIDEO_MSP3400) += msp3400.o
1402 +-obj-$(CONFIG_VIDEO_CS5345) += cs5345.o
1403 +-obj-$(CONFIG_VIDEO_CS53L32A) += cs53l32a.o
1404 +-obj-$(CONFIG_VIDEO_M52790) += m52790.o
1405 +-obj-$(CONFIG_VIDEO_TLV320AIC23B) += tlv320aic23b.o
1406 +-obj-$(CONFIG_VIDEO_WM8775) += wm8775.o
1407 +-obj-$(CONFIG_VIDEO_WM8739) += wm8739.o
1408 +-obj-$(CONFIG_VIDEO_VP27SMPX) += vp27smpx.o
1409 + obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip/
1410 + obj-$(CONFIG_VIDEO_CPIA2) += cpia2/
1411 + obj-$(CONFIG_VIDEO_MXB) += mxb.o
1412 +@@ -92,19 +107,12 @@ obj-$(CONFIG_VIDEOBUF_DMA_CONTIG) += videobuf-dma-contig.o
1413 + obj-$(CONFIG_VIDEOBUF_VMALLOC) += videobuf-vmalloc.o
1414 + obj-$(CONFIG_VIDEOBUF_DVB) += videobuf-dvb.o
1415 + obj-$(CONFIG_VIDEO_BTCX) += btcx-risc.o
1416 +-obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o
1417 +
1418 + obj-$(CONFIG_VIDEO_M32R_AR_M64278) += arv.o
1419 +
1420 +-obj-$(CONFIG_VIDEO_CX25840) += cx25840/
1421 +-obj-$(CONFIG_VIDEO_UPD64031A) += upd64031a.o
1422 +-obj-$(CONFIG_VIDEO_UPD64083) += upd64083.o
1423 + obj-$(CONFIG_VIDEO_CX2341X) += cx2341x.o
1424 +
1425 + obj-$(CONFIG_VIDEO_CAFE_CCIC) += cafe_ccic.o
1426 +-obj-$(CONFIG_VIDEO_OV7670) += ov7670.o
1427 +-
1428 +-obj-$(CONFIG_VIDEO_TCM825X) += tcm825x.o
1429 +
1430 + obj-$(CONFIG_USB_DABUSB) += dabusb.o
1431 + obj-$(CONFIG_USB_OV511) += ov511.o
1432 +@@ -134,24 +142,21 @@ obj-$(CONFIG_VIDEO_CX18) += cx18/
1433 + obj-$(CONFIG_VIDEO_VIVI) += vivi.o
1434 + obj-$(CONFIG_VIDEO_CX23885) += cx23885/
1435 +
1436 ++obj-$(CONFIG_VIDEO_OMAP2) += omap2cam.o
1437 ++obj-$(CONFIG_SOC_CAMERA) += soc_camera.o
1438 ++obj-$(CONFIG_SOC_CAMERA_PLATFORM) += soc_camera_platform.o
1439 ++# soc-camera host drivers have to be linked after camera drivers
1440 + obj-$(CONFIG_VIDEO_MX1) += mx1_camera.o
1441 + obj-$(CONFIG_VIDEO_MX3) += mx3_camera.o
1442 + obj-$(CONFIG_VIDEO_PXA27x) += pxa_camera.o
1443 + obj-$(CONFIG_VIDEO_SH_MOBILE_CEU) += sh_mobile_ceu_camera.o
1444 +-obj-$(CONFIG_VIDEO_OMAP2) += omap2cam.o
1445 +-obj-$(CONFIG_SOC_CAMERA) += soc_camera.o
1446 +-obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o
1447 +-obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o
1448 +-obj-$(CONFIG_SOC_CAMERA_MT9T031) += mt9t031.o
1449 +-obj-$(CONFIG_SOC_CAMERA_MT9V022) += mt9v022.o
1450 +-obj-$(CONFIG_SOC_CAMERA_OV772X) += ov772x.o
1451 +-obj-$(CONFIG_SOC_CAMERA_PLATFORM) += soc_camera_platform.o
1452 +-obj-$(CONFIG_SOC_CAMERA_TW9910) += tw9910.o
1453 +
1454 + obj-$(CONFIG_VIDEO_AU0828) += au0828/
1455 +
1456 + obj-$(CONFIG_USB_VIDEO_CLASS) += uvc/
1457 +
1458 ++obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o
1459 ++
1460 + EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
1461 + EXTRA_CFLAGS += -Idrivers/media/dvb/frontends
1462 + EXTRA_CFLAGS += -Idrivers/media/common/tuners
1463 +diff --git a/drivers/media/video/cx18/cx18-controls.c b/drivers/media/video/cx18/cx18-controls.c
1464 +index 82fc2f9..3783b49 100644
1465 +--- a/drivers/media/video/cx18/cx18-controls.c
1466 ++++ b/drivers/media/video/cx18/cx18-controls.c
1467 +@@ -61,6 +61,8 @@ int cx18_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl)
1468 +
1469 + switch (qctrl->id) {
1470 + /* Standard V4L2 controls */
1471 ++ case V4L2_CID_USER_CLASS:
1472 ++ return v4l2_ctrl_query_fill(qctrl, 0, 0, 0, 0);
1473 + case V4L2_CID_BRIGHTNESS:
1474 + case V4L2_CID_HUE:
1475 + case V4L2_CID_SATURATION:
1476 +diff --git a/drivers/media/video/cx2341x.c b/drivers/media/video/cx2341x.c
1477 +index 8ded529..4c8e958 100644
1478 +--- a/drivers/media/video/cx2341x.c
1479 ++++ b/drivers/media/video/cx2341x.c
1480 +@@ -500,6 +500,8 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
1481 + int err;
1482 +
1483 + switch (qctrl->id) {
1484 ++ case V4L2_CID_MPEG_CLASS:
1485 ++ return v4l2_ctrl_query_fill(qctrl, 0, 0, 0, 0);
1486 + case V4L2_CID_MPEG_STREAM_TYPE:
1487 + return v4l2_ctrl_query_fill(qctrl,
1488 + V4L2_MPEG_STREAM_TYPE_MPEG2_PS,
1489 +diff --git a/drivers/media/video/ivtv/ivtv-controls.c b/drivers/media/video/ivtv/ivtv-controls.c
1490 +index 84995bc..a3b77ed 100644
1491 +--- a/drivers/media/video/ivtv/ivtv-controls.c
1492 ++++ b/drivers/media/video/ivtv/ivtv-controls.c
1493 +@@ -60,6 +60,8 @@ int ivtv_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl)
1494 +
1495 + switch (qctrl->id) {
1496 + /* Standard V4L2 controls */
1497 ++ case V4L2_CID_USER_CLASS:
1498 ++ return v4l2_ctrl_query_fill(qctrl, 0, 0, 0, 0);
1499 + case V4L2_CID_BRIGHTNESS:
1500 + case V4L2_CID_HUE:
1501 + case V4L2_CID_SATURATION:
1502 +diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
1503 +index add3395..c5563cf 100644
1504 +--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
1505 ++++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
1506 +@@ -1978,6 +1978,34 @@ static unsigned int pvr2_copy_i2c_addr_list(
1507 + }
1508 +
1509 +
1510 ++static void pvr2_hdw_cx25840_vbi_hack(struct pvr2_hdw *hdw)
1511 ++{
1512 ++ /*
1513 ++ Mike Isely <isely@×××××.com> 19-Nov-2006 - This bit of nuttiness
1514 ++ for cx25840 causes that module to correctly set up its video
1515 ++ scaling. This is really a problem in the cx25840 module itself,
1516 ++ but we work around it here. The problem has not been seen in
1517 ++ ivtv because there VBI is supported and set up. We don't do VBI
1518 ++ here (at least not yet) and thus we never attempted to even set
1519 ++ it up.
1520 ++ */
1521 ++ struct v4l2_format fmt;
1522 ++ if (hdw->decoder_client_id != PVR2_CLIENT_ID_CX25840) {
1523 ++ /* We're not using a cx25840 so don't enable the hack */
1524 ++ return;
1525 ++ }
1526 ++
1527 ++ pvr2_trace(PVR2_TRACE_INIT,
1528 ++ "Module ID %u:"
1529 ++ " Executing cx25840 VBI hack",
1530 ++ hdw->decoder_client_id);
1531 ++ memset(&fmt, 0, sizeof(fmt));
1532 ++ fmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE;
1533 ++ v4l2_device_call_all(&hdw->v4l2_dev, hdw->decoder_client_id,
1534 ++ video, s_fmt, &fmt);
1535 ++}
1536 ++
1537 ++
1538 + static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
1539 + const struct pvr2_device_client_desc *cd)
1540 + {
1541 +@@ -2069,30 +2097,6 @@ static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw,
1542 + /* client-specific setup... */
1543 + switch (mid) {
1544 + case PVR2_CLIENT_ID_CX25840:
1545 +- hdw->decoder_client_id = mid;
1546 +- {
1547 +- /*
1548 +- Mike Isely <isely@×××××.com> 19-Nov-2006 - This
1549 +- bit of nuttiness for cx25840 causes that module
1550 +- to correctly set up its video scaling. This is
1551 +- really a problem in the cx25840 module itself,
1552 +- but we work around it here. The problem has not
1553 +- been seen in ivtv because there VBI is supported
1554 +- and set up. We don't do VBI here (at least not
1555 +- yet) and thus we never attempted to even set it
1556 +- up.
1557 +- */
1558 +- struct v4l2_format fmt;
1559 +- pvr2_trace(PVR2_TRACE_INIT,
1560 +- "Module ID %u:"
1561 +- " Executing cx25840 VBI hack",
1562 +- mid);
1563 +- memset(&fmt, 0, sizeof(fmt));
1564 +- fmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE;
1565 +- v4l2_device_call_all(&hdw->v4l2_dev, mid,
1566 +- video, s_fmt, &fmt);
1567 +- }
1568 +- break;
1569 + case PVR2_CLIENT_ID_SAA7115:
1570 + hdw->decoder_client_id = mid;
1571 + break;
1572 +@@ -2193,6 +2197,8 @@ static void pvr2_hdw_setup_low(struct pvr2_hdw *hdw)
1573 + cptr->info->set_value(cptr,~0,cptr->info->default_value);
1574 + }
1575 +
1576 ++ pvr2_hdw_cx25840_vbi_hack(hdw);
1577 ++
1578 + /* Set up special default values for the television and radio
1579 + frequencies here. It's not really important what these defaults
1580 + are, but I set them to something usable in the Chicago area just
1581 +@@ -2944,6 +2950,7 @@ static void pvr2_subdev_update(struct pvr2_hdw *hdw)
1582 + vs = hdw->std_mask_cur;
1583 + v4l2_device_call_all(&hdw->v4l2_dev, 0,
1584 + core, s_std, vs);
1585 ++ pvr2_hdw_cx25840_vbi_hack(hdw);
1586 + }
1587 + hdw->tuner_signal_stale = !0;
1588 + hdw->cropcap_stale = !0;
1589 +@@ -4066,6 +4073,7 @@ int pvr2_hdw_cmd_decoder_reset(struct pvr2_hdw *hdw)
1590 + if (hdw->decoder_client_id) {
1591 + v4l2_device_call_all(&hdw->v4l2_dev, hdw->decoder_client_id,
1592 + core, reset, 0);
1593 ++ pvr2_hdw_cx25840_vbi_hack(hdw);
1594 + return 0;
1595 + }
1596 + pvr2_trace(PVR2_TRACE_INIT,
1597 +diff --git a/drivers/media/video/saa7134/Makefile b/drivers/media/video/saa7134/Makefile
1598 +index 3dbaa19..604158a 100644
1599 +--- a/drivers/media/video/saa7134/Makefile
1600 ++++ b/drivers/media/video/saa7134/Makefile
1601 +@@ -3,8 +3,7 @@ saa7134-objs := saa7134-cards.o saa7134-core.o saa7134-i2c.o \
1602 + saa7134-ts.o saa7134-tvaudio.o saa7134-vbi.o \
1603 + saa7134-video.o saa7134-input.o
1604 +
1605 +-obj-$(CONFIG_VIDEO_SAA7134) += saa7134.o saa7134-empress.o \
1606 +- saa6752hs.o
1607 ++obj-$(CONFIG_VIDEO_SAA7134) += saa6752hs.o saa7134.o saa7134-empress.o
1608 +
1609 + obj-$(CONFIG_VIDEO_SAA7134_ALSA) += saa7134-alsa.o
1610 +
1611 +diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
1612 +index d287315..cd95093 100644
1613 +--- a/drivers/net/bonding/bond_sysfs.c
1614 ++++ b/drivers/net/bonding/bond_sysfs.c
1615 +@@ -1538,6 +1538,7 @@ int bond_create_sysfs(void)
1616 + printk(KERN_ERR
1617 + "network device named %s already exists in sysfs",
1618 + class_attr_bonding_masters.attr.name);
1619 ++ ret = 0;
1620 + }
1621 +
1622 + return ret;
1623 +diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
1624 +index ca82f19..42055a5 100644
1625 +--- a/drivers/net/e1000e/netdev.c
1626 ++++ b/drivers/net/e1000e/netdev.c
1627 +@@ -1996,7 +1996,7 @@ static int e1000_clean(struct napi_struct *napi, int budget)
1628 + struct e1000_adapter *adapter = container_of(napi, struct e1000_adapter, napi);
1629 + struct e1000_hw *hw = &adapter->hw;
1630 + struct net_device *poll_dev = adapter->netdev;
1631 +- int tx_cleaned = 0, work_done = 0;
1632 ++ int tx_cleaned = 1, work_done = 0;
1633 +
1634 + adapter = netdev_priv(poll_dev);
1635 +
1636 +diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
1637 +index 6bb5af3..305e0d1 100644
1638 +--- a/drivers/net/mv643xx_eth.c
1639 ++++ b/drivers/net/mv643xx_eth.c
1640 +@@ -1751,12 +1751,12 @@ static void mv643xx_eth_program_unicast_filter(struct net_device *dev)
1641 +
1642 + uc_addr_set(mp, dev->dev_addr);
1643 +
1644 +- port_config = rdlp(mp, PORT_CONFIG);
1645 ++ port_config = rdlp(mp, PORT_CONFIG) & ~UNICAST_PROMISCUOUS_MODE;
1646 ++
1647 + nibbles = uc_addr_filter_mask(dev);
1648 + if (!nibbles) {
1649 + port_config |= UNICAST_PROMISCUOUS_MODE;
1650 +- wrlp(mp, PORT_CONFIG, port_config);
1651 +- return;
1652 ++ nibbles = 0xffff;
1653 + }
1654 +
1655 + for (i = 0; i < 16; i += 4) {
1656 +@@ -1777,7 +1777,6 @@ static void mv643xx_eth_program_unicast_filter(struct net_device *dev)
1657 + wrl(mp, off, v);
1658 + }
1659 +
1660 +- port_config &= ~UNICAST_PROMISCUOUS_MODE;
1661 + wrlp(mp, PORT_CONFIG, port_config);
1662 + }
1663 +
1664 +diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
1665 +index a2ff9cb..6714a9d 100644
1666 +--- a/drivers/net/sky2.c
1667 ++++ b/drivers/net/sky2.c
1668 +@@ -4365,6 +4365,22 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
1669 + goto err_out;
1670 + }
1671 +
1672 ++ /* Get configuration information
1673 ++ * Note: only regular PCI config access once to test for HW issues
1674 ++ * other PCI access through shared memory for speed and to
1675 ++ * avoid MMCONFIG problems.
1676 ++ */
1677 ++ err = pci_read_config_dword(pdev, PCI_DEV_REG2, &reg);
1678 ++ if (err) {
1679 ++ dev_err(&pdev->dev, "PCI read config failed\n");
1680 ++ goto err_out;
1681 ++ }
1682 ++
1683 ++ if (~reg == 0) {
1684 ++ dev_err(&pdev->dev, "PCI configuration read error\n");
1685 ++ goto err_out;
1686 ++ }
1687 ++
1688 + err = pci_request_regions(pdev, DRV_NAME);
1689 + if (err) {
1690 + dev_err(&pdev->dev, "cannot obtain PCI resources\n");
1691 +@@ -4390,21 +4406,6 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
1692 + }
1693 + }
1694 +
1695 +- /* Get configuration information
1696 +- * Note: only regular PCI config access once to test for HW issues
1697 +- * other PCI access through shared memory for speed and to
1698 +- * avoid MMCONFIG problems.
1699 +- */
1700 +- err = pci_read_config_dword(pdev, PCI_DEV_REG2, &reg);
1701 +- if (err) {
1702 +- dev_err(&pdev->dev, "PCI read config failed\n");
1703 +- goto err_out_free_regions;
1704 +- }
1705 +-
1706 +- /* size of available VPD, only impact sysfs */
1707 +- err = pci_vpd_truncate(pdev, 1ul << (((reg & PCI_VPD_ROM_SZ) >> 14) + 8));
1708 +- if (err)
1709 +- dev_warn(&pdev->dev, "Can't set VPD size\n");
1710 +
1711 + #ifdef __BIG_ENDIAN
1712 + /* The sk98lin vendor driver uses hardware byte swapping but
1713 +diff --git a/drivers/net/tun.c b/drivers/net/tun.c
1714 +index 735bf41..1be6a6b 100644
1715 +--- a/drivers/net/tun.c
1716 ++++ b/drivers/net/tun.c
1717 +@@ -1275,21 +1275,22 @@ static int tun_chr_open(struct inode *inode, struct file * file)
1718 + static int tun_chr_close(struct inode *inode, struct file *file)
1719 + {
1720 + struct tun_file *tfile = file->private_data;
1721 +- struct tun_struct *tun = __tun_get(tfile);
1722 ++ struct tun_struct *tun;
1723 +
1724 +
1725 ++ rtnl_lock();
1726 ++ tun = __tun_get(tfile);
1727 + if (tun) {
1728 + DBG(KERN_INFO "%s: tun_chr_close\n", tun->dev->name);
1729 +
1730 +- rtnl_lock();
1731 + __tun_detach(tun);
1732 +
1733 + /* If desireable, unregister the netdevice. */
1734 + if (!(tun->flags & TUN_PERSIST))
1735 + unregister_netdevice(tun->dev);
1736 +
1737 +- rtnl_unlock();
1738 + }
1739 ++ rtnl_unlock();
1740 +
1741 + tun = tfile->tun;
1742 + if (tun)
1743 +diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
1744 +index 2138535..73acbd2 100644
1745 +--- a/drivers/net/usb/pegasus.c
1746 ++++ b/drivers/net/usb/pegasus.c
1747 +@@ -297,7 +297,7 @@ static int update_eth_regs_async(pegasus_t * pegasus)
1748 +
1749 + pegasus->dr.bRequestType = PEGASUS_REQT_WRITE;
1750 + pegasus->dr.bRequest = PEGASUS_REQ_SET_REGS;
1751 +- pegasus->dr.wValue = 0;
1752 ++ pegasus->dr.wValue = cpu_to_le16(0);
1753 + pegasus->dr.wIndex = cpu_to_le16(EthCtrl0);
1754 + pegasus->dr.wLength = cpu_to_le16(3);
1755 + pegasus->ctrl_urb->transfer_buffer_length = 3;
1756 +@@ -446,11 +446,12 @@ static int write_eprom_word(pegasus_t * pegasus, __u8 index, __u16 data)
1757 + int i;
1758 + __u8 tmp, d[4] = { 0x3f, 0, 0, EPROM_WRITE };
1759 + int ret;
1760 ++ __le16 le_data = cpu_to_le16(data);
1761 +
1762 + set_registers(pegasus, EpromOffset, 4, d);
1763 + enable_eprom_write(pegasus);
1764 + set_register(pegasus, EpromOffset, index);
1765 +- set_registers(pegasus, EpromData, 2, &data);
1766 ++ set_registers(pegasus, EpromData, 2, &le_data);
1767 + set_register(pegasus, EpromCtrl, EPROM_WRITE);
1768 +
1769 + for (i = 0; i < REG_TIMEOUT; i++) {
1770 +@@ -923,29 +924,32 @@ static struct net_device_stats *pegasus_netdev_stats(struct net_device *dev)
1771 +
1772 + static inline void disable_net_traffic(pegasus_t * pegasus)
1773 + {
1774 +- int tmp = 0;
1775 ++ __le16 tmp = cpu_to_le16(0);
1776 +
1777 +- set_registers(pegasus, EthCtrl0, 2, &tmp);
1778 ++ set_registers(pegasus, EthCtrl0, sizeof(tmp), &tmp);
1779 + }
1780 +
1781 + static inline void get_interrupt_interval(pegasus_t * pegasus)
1782 + {
1783 +- __u8 data[2];
1784 ++ u16 data;
1785 ++ u8 interval;
1786 +
1787 +- read_eprom_word(pegasus, 4, (__u16 *) data);
1788 ++ read_eprom_word(pegasus, 4, &data);
1789 ++ interval = data >> 8;
1790 + if (pegasus->usb->speed != USB_SPEED_HIGH) {
1791 +- if (data[1] < 0x80) {
1792 ++ if (interval < 0x80) {
1793 + if (netif_msg_timer(pegasus))
1794 + dev_info(&pegasus->intf->dev, "intr interval "
1795 + "changed from %ums to %ums\n",
1796 +- data[1], 0x80);
1797 +- data[1] = 0x80;
1798 ++ interval, 0x80);
1799 ++ interval = 0x80;
1800 ++ data = (data & 0x00FF) | ((u16)interval << 8);
1801 + #ifdef PEGASUS_WRITE_EEPROM
1802 +- write_eprom_word(pegasus, 4, *(__u16 *) data);
1803 ++ write_eprom_word(pegasus, 4, data);
1804 + #endif
1805 + }
1806 + }
1807 +- pegasus->intr_interval = data[1];
1808 ++ pegasus->intr_interval = interval;
1809 + }
1810 +
1811 + static void set_carrier(struct net_device *net)
1812 +@@ -1299,7 +1303,8 @@ static int pegasus_blacklisted(struct usb_device *udev)
1813 + /* Special quirk to keep the driver from handling the Belkin Bluetooth
1814 + * dongle which happens to have the same ID.
1815 + */
1816 +- if ((udd->idVendor == VENDOR_BELKIN && udd->idProduct == 0x0121) &&
1817 ++ if ((udd->idVendor == cpu_to_le16(VENDOR_BELKIN)) &&
1818 ++ (udd->idProduct == cpu_to_le16(0x0121)) &&
1819 + (udd->bDeviceClass == USB_CLASS_WIRELESS_CONTROLLER) &&
1820 + (udd->bDeviceProtocol == 1))
1821 + return 1;
1822 +diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
1823 +index 754a4b1..b2816ad 100644
1824 +--- a/drivers/net/via-velocity.c
1825 ++++ b/drivers/net/via-velocity.c
1826 +@@ -1845,7 +1845,7 @@ static void velocity_free_tx_buf(struct velocity_info *vptr, struct velocity_td_
1827 + */
1828 + if (tdinfo->skb_dma) {
1829 +
1830 +- pktlen = (skb->len > ETH_ZLEN ? : ETH_ZLEN);
1831 ++ pktlen = max_t(unsigned int, skb->len, ETH_ZLEN);
1832 + for (i = 0; i < tdinfo->nskb_dma; i++) {
1833 + #ifdef VELOCITY_ZERO_COPY_SUPPORT
1834 + pci_unmap_single(vptr->pdev, tdinfo->skb_dma[i], le16_to_cpu(td->tdesc1.len), PCI_DMA_TODEVICE);
1835 +diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
1836 +index 32df27a..409f022 100644
1837 +--- a/drivers/net/wireless/ath5k/base.c
1838 ++++ b/drivers/net/wireless/ath5k/base.c
1839 +@@ -685,6 +685,13 @@ ath5k_pci_resume(struct pci_dev *pdev)
1840 + if (err)
1841 + return err;
1842 +
1843 ++ /*
1844 ++ * Suspend/Resume resets the PCI configuration space, so we have to
1845 ++ * re-disable the RETRY_TIMEOUT register (0x41) to keep
1846 ++ * PCI Tx retries from interfering with C3 CPU state
1847 ++ */
1848 ++ pci_write_config_byte(pdev, 0x41, 0);
1849 ++
1850 + err = request_irq(pdev->irq, ath5k_intr, IRQF_SHARED, "ath", sc);
1851 + if (err) {
1852 + ATH5K_ERR(sc, "request_irq failed\n");
1853 +diff --git a/drivers/net/wireless/ath9k/calib.c b/drivers/net/wireless/ath9k/calib.c
1854 +index e2d62e9..2117074 100644
1855 +--- a/drivers/net/wireless/ath9k/calib.c
1856 ++++ b/drivers/net/wireless/ath9k/calib.c
1857 +@@ -284,8 +284,8 @@ static bool ath9k_hw_iscal_supported(struct ath_hw *ah,
1858 + return true;
1859 + case ADC_GAIN_CAL:
1860 + case ADC_DC_CAL:
1861 +- if (conf->channel->band == IEEE80211_BAND_5GHZ &&
1862 +- conf_is_ht20(conf))
1863 ++ if (!(conf->channel->band == IEEE80211_BAND_2GHZ &&
1864 ++ conf_is_ht20(conf)))
1865 + return true;
1866 + break;
1867 + }
1868 +@@ -883,7 +883,7 @@ bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
1869 + static bool ar9285_clc(struct ath_hw *ah, struct ath9k_channel *chan)
1870 + {
1871 + REG_SET_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE);
1872 +- if (chan->channelFlags & CHANNEL_HT20) {
1873 ++ if (IS_CHAN_HT20(chan)) {
1874 + REG_SET_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_PARALLEL_CAL_ENABLE);
1875 + REG_SET_BIT(ah, AR_PHY_TURBO, AR_PHY_FC_DYN2040_EN);
1876 + REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL,
1877 +@@ -919,83 +919,66 @@ static bool ar9285_clc(struct ath_hw *ah, struct ath9k_channel *chan)
1878 + return true;
1879 + }
1880 +
1881 +-bool ath9k_hw_init_cal(struct ath_hw *ah,
1882 +- struct ath9k_channel *chan)
1883 ++bool ath9k_hw_init_cal(struct ath_hw *ah, struct ath9k_channel *chan)
1884 + {
1885 + if (AR_SREV_9285(ah) && AR_SREV_9285_12_OR_LATER(ah)) {
1886 + if (!ar9285_clc(ah, chan))
1887 + return false;
1888 +- } else if (AR_SREV_9280_10_OR_LATER(ah)) {
1889 +- REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC);
1890 +- REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL);
1891 +- REG_CLR_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE);
1892 ++ } else {
1893 ++ if (AR_SREV_9280_10_OR_LATER(ah)) {
1894 ++ REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC);
1895 ++ REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL);
1896 ++ }
1897 +
1898 +- /* Kick off the cal */
1899 ++ /* Calibrate the AGC */
1900 + REG_WRITE(ah, AR_PHY_AGC_CONTROL,
1901 +- REG_READ(ah, AR_PHY_AGC_CONTROL) |
1902 +- AR_PHY_AGC_CONTROL_CAL);
1903 ++ REG_READ(ah, AR_PHY_AGC_CONTROL) |
1904 ++ AR_PHY_AGC_CONTROL_CAL);
1905 +
1906 +- if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL,
1907 +- AR_PHY_AGC_CONTROL_CAL, 0,
1908 +- AH_WAIT_TIMEOUT)) {
1909 ++ /* Poll for offset calibration complete */
1910 ++ if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL,
1911 ++ 0, AH_WAIT_TIMEOUT)) {
1912 + DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
1913 + "offset calibration failed to complete in 1ms; "
1914 + "noisy environment?\n");
1915 + return false;
1916 + }
1917 +
1918 +- REG_CLR_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC);
1919 +- REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL);
1920 +- REG_SET_BIT(ah, AR_PHY_CL_CAL_CTL, AR_PHY_CL_CAL_ENABLE);
1921 +- }
1922 +-
1923 +- /* Calibrate the AGC */
1924 +- REG_WRITE(ah, AR_PHY_AGC_CONTROL,
1925 +- REG_READ(ah, AR_PHY_AGC_CONTROL) |
1926 +- AR_PHY_AGC_CONTROL_CAL);
1927 +-
1928 +- if (!ath9k_hw_wait(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_CAL,
1929 +- 0, AH_WAIT_TIMEOUT)) {
1930 +- DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
1931 +- "offset calibration failed to complete in 1ms; "
1932 +- "noisy environment?\n");
1933 +- return false;
1934 +- }
1935 +-
1936 +- if (AR_SREV_9280_10_OR_LATER(ah)) {
1937 +- REG_SET_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC);
1938 +- REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL);
1939 ++ if (AR_SREV_9280_10_OR_LATER(ah)) {
1940 ++ REG_SET_BIT(ah, AR_PHY_ADC_CTL, AR_PHY_ADC_CTL_OFF_PWDADC);
1941 ++ REG_CLR_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_FLTR_CAL);
1942 ++ }
1943 + }
1944 +
1945 + /* Do PA Calibration */
1946 + if (AR_SREV_9285(ah) && AR_SREV_9285_11_OR_LATER(ah))
1947 + ath9k_hw_9285_pa_cal(ah);
1948 +
1949 +- /* Do NF Calibration */
1950 ++ /* Do NF Calibration after DC offset and other calibrations */
1951 + REG_WRITE(ah, AR_PHY_AGC_CONTROL,
1952 +- REG_READ(ah, AR_PHY_AGC_CONTROL) |
1953 +- AR_PHY_AGC_CONTROL_NF);
1954 ++ REG_READ(ah, AR_PHY_AGC_CONTROL) | AR_PHY_AGC_CONTROL_NF);
1955 +
1956 + ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
1957 +
1958 ++ /* Enable IQ, ADC Gain and ADC DC offset CALs */
1959 + if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah)) {
1960 + if (ath9k_hw_iscal_supported(ah, ADC_GAIN_CAL)) {
1961 + INIT_CAL(&ah->adcgain_caldata);
1962 + INSERT_CAL(ah, &ah->adcgain_caldata);
1963 + DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
1964 +- "enabling ADC Gain Calibration.\n");
1965 ++ "enabling ADC Gain Calibration.\n");
1966 + }
1967 + if (ath9k_hw_iscal_supported(ah, ADC_DC_CAL)) {
1968 + INIT_CAL(&ah->adcdc_caldata);
1969 + INSERT_CAL(ah, &ah->adcdc_caldata);
1970 + DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
1971 +- "enabling ADC DC Calibration.\n");
1972 ++ "enabling ADC DC Calibration.\n");
1973 + }
1974 + if (ath9k_hw_iscal_supported(ah, IQ_MISMATCH_CAL)) {
1975 + INIT_CAL(&ah->iq_caldata);
1976 + INSERT_CAL(ah, &ah->iq_caldata);
1977 + DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
1978 +- "enabling IQ Calibration.\n");
1979 ++ "enabling IQ Calibration.\n");
1980 + }
1981 +
1982 + ah->cal_list_curr = ah->cal_list;
1983 +diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
1984 +index 13d4e67..bb5312f 100644
1985 +--- a/drivers/net/wireless/ath9k/main.c
1986 ++++ b/drivers/net/wireless/ath9k/main.c
1987 +@@ -408,6 +408,18 @@ set_timer:
1988 + mod_timer(&sc->ani.timer, jiffies + msecs_to_jiffies(cal_interval));
1989 + }
1990 +
1991 ++static void ath_start_ani(struct ath_softc *sc)
1992 ++{
1993 ++ unsigned long timestamp = jiffies_to_msecs(jiffies);
1994 ++
1995 ++ sc->ani.longcal_timer = timestamp;
1996 ++ sc->ani.shortcal_timer = timestamp;
1997 ++ sc->ani.checkani_timer = timestamp;
1998 ++
1999 ++ mod_timer(&sc->ani.timer,
2000 ++ jiffies + msecs_to_jiffies(ATH_ANI_POLLINTERVAL));
2001 ++}
2002 ++
2003 + /*
2004 + * Update tx/rx chainmask. For legacy association,
2005 + * hard code chainmask to 1x1, for 11n association, use
2006 +@@ -920,9 +932,7 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
2007 + sc->nodestats.ns_avgtxrssi = ATH_RSSI_DUMMY_MARKER;
2008 + sc->nodestats.ns_avgtxrate = ATH_RATE_DUMMY_MARKER;
2009 +
2010 +- /* Start ANI */
2011 +- mod_timer(&sc->ani.timer,
2012 +- jiffies + msecs_to_jiffies(ATH_ANI_POLLINTERVAL));
2013 ++ ath_start_ani(sc);
2014 + } else {
2015 + DPRINTF(sc, ATH_DBG_CONFIG, "Bss Info DISSOC\n");
2016 + sc->curaid = 0;
2017 +@@ -1416,7 +1426,8 @@ static int ath_init(u16 devid, struct ath_softc *sc)
2018 + for (i = 0; i < sc->keymax; i++)
2019 + ath9k_hw_keyreset(ah, (u16) i);
2020 +
2021 +- if (ath9k_regd_init(sc->sc_ah))
2022 ++ error = ath9k_regd_init(sc->sc_ah);
2023 ++ if (error)
2024 + goto bad;
2025 +
2026 + /* default to MONITOR mode */
2027 +@@ -2270,12 +2281,8 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
2028 +
2029 + ath9k_hw_set_interrupts(sc->sc_ah, sc->imask);
2030 +
2031 +- if (conf->type == NL80211_IFTYPE_AP) {
2032 +- /* TODO: is this a suitable place to start ANI for AP mode? */
2033 +- /* Start ANI */
2034 +- mod_timer(&sc->ani.timer,
2035 +- jiffies + msecs_to_jiffies(ATH_ANI_POLLINTERVAL));
2036 +- }
2037 ++ if (conf->type == NL80211_IFTYPE_AP)
2038 ++ ath_start_ani(sc);
2039 +
2040 + out:
2041 + mutex_unlock(&sc->mutex);
2042 +@@ -2771,6 +2778,7 @@ static void ath9k_sw_scan_complete(struct ieee80211_hw *hw)
2043 + mutex_lock(&sc->mutex);
2044 + aphy->state = ATH_WIPHY_ACTIVE;
2045 + sc->sc_flags &= ~SC_OP_SCANNING;
2046 ++ sc->sc_flags |= SC_OP_FULL_RESET;
2047 + mutex_unlock(&sc->mutex);
2048 + }
2049 +
2050 +diff --git a/drivers/net/wireless/ath9k/pci.c b/drivers/net/wireless/ath9k/pci.c
2051 +index 168411d..4affb49 100644
2052 +--- a/drivers/net/wireless/ath9k/pci.c
2053 ++++ b/drivers/net/wireless/ath9k/pci.c
2054 +@@ -87,6 +87,7 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2055 + struct ath_softc *sc;
2056 + struct ieee80211_hw *hw;
2057 + u8 csz;
2058 ++ u32 val;
2059 + int ret = 0;
2060 + struct ath_hw *ah;
2061 +
2062 +@@ -133,6 +134,14 @@ static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2063 +
2064 + pci_set_master(pdev);
2065 +
2066 ++ /*
2067 ++ * Disable the RETRY_TIMEOUT register (0x41) to keep
2068 ++ * PCI Tx retries from interfering with C3 CPU state.
2069 ++ */
2070 ++ pci_read_config_dword(pdev, 0x40, &val);
2071 ++ if ((val & 0x0000ff00) != 0)
2072 ++ pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
2073 ++
2074 + ret = pci_request_region(pdev, 0, "ath9k");
2075 + if (ret) {
2076 + dev_err(&pdev->dev, "PCI memory region reserve error\n");
2077 +@@ -244,12 +253,21 @@ static int ath_pci_resume(struct pci_dev *pdev)
2078 + struct ieee80211_hw *hw = pci_get_drvdata(pdev);
2079 + struct ath_wiphy *aphy = hw->priv;
2080 + struct ath_softc *sc = aphy->sc;
2081 ++ u32 val;
2082 + int err;
2083 +
2084 + err = pci_enable_device(pdev);
2085 + if (err)
2086 + return err;
2087 + pci_restore_state(pdev);
2088 ++ /*
2089 ++ * Suspend/Resume resets the PCI configuration space, so we have to
2090 ++ * re-disable the RETRY_TIMEOUT register (0x41) to keep
2091 ++ * PCI Tx retries from interfering with C3 CPU state
2092 ++ */
2093 ++ pci_read_config_dword(pdev, 0x40, &val);
2094 ++ if ((val & 0x0000ff00) != 0)
2095 ++ pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
2096 +
2097 + /* Enable LED */
2098 + ath9k_hw_cfg_output(sc->sc_ah, ATH_LED_PIN,
2099 +diff --git a/drivers/net/wireless/ath9k/regd.c b/drivers/net/wireless/ath9k/regd.c
2100 +index 4ca6251..5256d24 100644
2101 +--- a/drivers/net/wireless/ath9k/regd.c
2102 ++++ b/drivers/net/wireless/ath9k/regd.c
2103 +@@ -439,7 +439,7 @@ int ath9k_regd_init(struct ath_hw *ah)
2104 + u16 regdmn;
2105 +
2106 + if (!ath9k_regd_is_eeprom_valid(ah)) {
2107 +- DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
2108 ++ DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
2109 + "Invalid EEPROM contents\n");
2110 + return -EINVAL;
2111 + }
2112 +diff --git a/drivers/net/wireless/ath9k/xmit.c b/drivers/net/wireless/ath9k/xmit.c
2113 +index 689bdbf..c92f442 100644
2114 +--- a/drivers/net/wireless/ath9k/xmit.c
2115 ++++ b/drivers/net/wireless/ath9k/xmit.c
2116 +@@ -1573,8 +1573,9 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf,
2117 + skb->len, DMA_TO_DEVICE);
2118 + if (unlikely(dma_mapping_error(sc->dev, bf->bf_dmacontext))) {
2119 + bf->bf_mpdu = NULL;
2120 +- DPRINTF(sc, ATH_DBG_CONFIG,
2121 +- "dma_mapping_error() on TX\n");
2122 ++ kfree(tx_info_priv);
2123 ++ tx_info->rate_driver_data[0] = NULL;
2124 ++ DPRINTF(sc, ATH_DBG_FATAL, "dma_mapping_error() on TX\n");
2125 + return -ENOMEM;
2126 + }
2127 +
2128 +diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
2129 +index 4e63cc9..3d3c9c0 100644
2130 +--- a/drivers/parport/parport_pc.c
2131 ++++ b/drivers/parport/parport_pc.c
2132 +@@ -1413,11 +1413,13 @@ static void __devinit decode_smsc(int efer, int key, int devid, int devrev)
2133 +
2134 + static void __devinit winbond_check(int io, int key)
2135 + {
2136 +- int devid,devrev,oldid,x_devid,x_devrev,x_oldid;
2137 ++ int origval, devid, devrev, oldid, x_devid, x_devrev, x_oldid;
2138 +
2139 + if (!request_region(io, 3, __func__))
2140 + return;
2141 +
2142 ++ origval = inb(io); /* Save original value */
2143 ++
2144 + /* First probe without key */
2145 + outb(0x20,io);
2146 + x_devid=inb(io+1);
2147 +@@ -1437,6 +1439,8 @@ static void __devinit winbond_check(int io, int key)
2148 + oldid=inb(io+1);
2149 + outb(0xaa,io); /* Magic Seal */
2150 +
2151 ++ outb(origval, io); /* in case we poked some entirely different hardware */
2152 ++
2153 + if ((x_devid == devid) && (x_devrev == devrev) && (x_oldid == oldid))
2154 + goto out; /* protection against false positives */
2155 +
2156 +@@ -1447,11 +1451,15 @@ out:
2157 +
2158 + static void __devinit winbond_check2(int io,int key)
2159 + {
2160 +- int devid,devrev,oldid,x_devid,x_devrev,x_oldid;
2161 ++ int origval[3], devid, devrev, oldid, x_devid, x_devrev, x_oldid;
2162 +
2163 + if (!request_region(io, 3, __func__))
2164 + return;
2165 +
2166 ++ origval[0] = inb(io); /* Save original values */
2167 ++ origval[1] = inb(io + 1);
2168 ++ origval[2] = inb(io + 2);
2169 ++
2170 + /* First probe without the key */
2171 + outb(0x20,io+2);
2172 + x_devid=inb(io+2);
2173 +@@ -1470,6 +1478,10 @@ static void __devinit winbond_check2(int io,int key)
2174 + oldid=inb(io+2);
2175 + outb(0xaa,io); /* Magic Seal */
2176 +
2177 ++ outb(origval[0], io); /* in case we poked some entirely different hardware */
2178 ++ outb(origval[1], io + 1);
2179 ++ outb(origval[2], io + 2);
2180 ++
2181 + if ((x_devid == devid) && (x_devrev == devrev) && (x_oldid == oldid))
2182 + goto out; /* protection against false positives */
2183 +
2184 +@@ -1480,11 +1492,13 @@ out:
2185 +
2186 + static void __devinit smsc_check(int io, int key)
2187 + {
2188 +- int id,rev,oldid,oldrev,x_id,x_rev,x_oldid,x_oldrev;
2189 ++ int origval, id, rev, oldid, oldrev, x_id, x_rev, x_oldid, x_oldrev;
2190 +
2191 + if (!request_region(io, 3, __func__))
2192 + return;
2193 +
2194 ++ origval = inb(io); /* Save original value */
2195 ++
2196 + /* First probe without the key */
2197 + outb(0x0d,io);
2198 + x_oldid=inb(io+1);
2199 +@@ -1508,6 +1522,8 @@ static void __devinit smsc_check(int io, int key)
2200 + rev=inb(io+1);
2201 + outb(0xaa,io); /* Magic Seal */
2202 +
2203 ++ outb(origval, io); /* in case we poked some entirely different hardware */
2204 ++
2205 + if ((x_id == id) && (x_oldrev == oldrev) &&
2206 + (x_oldid == oldid) && (x_rev == rev))
2207 + goto out; /* protection against false positives */
2208 +@@ -1544,11 +1560,12 @@ static void __devinit detect_and_report_smsc (void)
2209 + static void __devinit detect_and_report_it87(void)
2210 + {
2211 + u16 dev;
2212 +- u8 r;
2213 ++ u8 origval, r;
2214 + if (verbose_probing)
2215 + printk(KERN_DEBUG "IT8705 Super-IO detection, now testing port 2E ...\n");
2216 +- if (!request_region(0x2e, 1, __func__))
2217 ++ if (!request_region(0x2e, 2, __func__))
2218 + return;
2219 ++ origval = inb(0x2e); /* Save original value */
2220 + outb(0x87, 0x2e);
2221 + outb(0x01, 0x2e);
2222 + outb(0x55, 0x2e);
2223 +@@ -1568,8 +1585,10 @@ static void __devinit detect_and_report_it87(void)
2224 + outb(r | 8, 0x2F);
2225 + outb(0x02, 0x2E); /* Lock */
2226 + outb(0x02, 0x2F);
2227 ++ } else {
2228 ++ outb(origval, 0x2e); /* Oops, sorry to disturb */
2229 + }
2230 +- release_region(0x2e, 1);
2231 ++ release_region(0x2e, 2);
2232 + }
2233 + #endif /* CONFIG_PARPORT_PC_SUPERIO */
2234 +
2235 +@@ -2193,6 +2212,9 @@ struct parport *parport_pc_probe_port(unsigned long int base,
2236 + if (IS_ERR(pdev))
2237 + return NULL;
2238 + dev = &pdev->dev;
2239 ++
2240 ++ dev->coherent_dma_mask = DMA_BIT_MASK(24);
2241 ++ dev->dma_mask = &dev->coherent_dma_mask;
2242 + }
2243 +
2244 + ops = kmalloc(sizeof(struct parport_operations), GFP_KERNEL);
2245 +diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
2246 +index 1a91bf9..440f4fb 100644
2247 +--- a/drivers/pci/pci.c
2248 ++++ b/drivers/pci/pci.c
2249 +@@ -480,6 +480,8 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
2250 + pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
2251 + pmcsr |= state;
2252 + break;
2253 ++ case PCI_D3hot:
2254 ++ case PCI_D3cold:
2255 + case PCI_UNKNOWN: /* Boot-up */
2256 + if ((pmcsr & PCI_PM_CTRL_STATE_MASK) == PCI_D3hot
2257 + && !(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET))
2258 +@@ -1282,15 +1284,14 @@ pci_power_t pci_target_state(struct pci_dev *dev)
2259 + default:
2260 + target_state = state;
2261 + }
2262 ++ } else if (!dev->pm_cap) {
2263 ++ target_state = PCI_D0;
2264 + } else if (device_may_wakeup(&dev->dev)) {
2265 + /*
2266 + * Find the deepest state from which the device can generate
2267 + * wake-up events, make it the target state and enable device
2268 + * to generate PME#.
2269 + */
2270 +- if (!dev->pm_cap)
2271 +- return PCI_POWER_ERROR;
2272 +-
2273 + if (dev->pme_support) {
2274 + while (target_state
2275 + && !(dev->pme_support & (1 << target_state)))
2276 +diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
2277 +index b0367f1..777b2c7 100644
2278 +--- a/drivers/pci/pcie/aspm.c
2279 ++++ b/drivers/pci/pcie/aspm.c
2280 +@@ -638,6 +638,10 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev)
2281 + if (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT &&
2282 + pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM)
2283 + return;
2284 ++ /* VIA has a strange chipset, root port is under a bridge */
2285 ++ if (pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT &&
2286 ++ pdev->bus->self)
2287 ++ return;
2288 + down_read(&pci_bus_sem);
2289 + if (list_empty(&pdev->subordinate->devices))
2290 + goto out;
2291 +diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
2292 +index 34760f8..00856ba 100644
2293 +--- a/drivers/scsi/qla2xxx/qla_dbg.c
2294 ++++ b/drivers/scsi/qla2xxx/qla_dbg.c
2295 +@@ -218,7 +218,7 @@ qla24xx_soft_reset(struct qla_hw_data *ha)
2296 +
2297 + static int
2298 + qla2xxx_dump_ram(struct qla_hw_data *ha, uint32_t addr, uint16_t *ram,
2299 +- uint16_t ram_words, void **nxt)
2300 ++ uint32_t ram_words, void **nxt)
2301 + {
2302 + int rval;
2303 + uint32_t cnt, stat, timer, words, idx;
2304 +diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
2305 +index ffa70d1..e9e1865 100644
2306 +--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
2307 ++++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
2308 +@@ -2312,8 +2312,9 @@ static void sym_int_par (struct sym_hcb *np, u_short sist)
2309 + int phase = cmd & 7;
2310 + struct sym_ccb *cp = sym_ccb_from_dsa(np, dsa);
2311 +
2312 +- printf("%s: SCSI parity error detected: SCR1=%d DBC=%x SBCL=%x\n",
2313 +- sym_name(np), hsts, dbc, sbcl);
2314 ++ if (printk_ratelimit())
2315 ++ printf("%s: SCSI parity error detected: SCR1=%d DBC=%x SBCL=%x\n",
2316 ++ sym_name(np), hsts, dbc, sbcl);
2317 +
2318 + /*
2319 + * Check that the chip is connected to the SCSI BUS.
2320 +diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
2321 +index d86123e..a543acf 100644
2322 +--- a/drivers/serial/bfin_5xx.c
2323 ++++ b/drivers/serial/bfin_5xx.c
2324 +@@ -38,6 +38,10 @@
2325 + #include <asm/cacheflush.h>
2326 + #endif
2327 +
2328 ++#ifdef CONFIG_SERIAL_BFIN_MODULE
2329 ++# undef CONFIG_EARLY_PRINTK
2330 ++#endif
2331 ++
2332 + /* UART name and device definitions */
2333 + #define BFIN_SERIAL_NAME "ttyBF"
2334 + #define BFIN_SERIAL_MAJOR 204
2335 +@@ -1058,6 +1062,7 @@ static void __init bfin_serial_init_ports(void)
2336 + bfin_serial_hw_init();
2337 +
2338 + for (i = 0; i < nr_active_ports; i++) {
2339 ++ spin_lock_init(&bfin_serial_ports[i].port.lock);
2340 + bfin_serial_ports[i].port.uartclk = get_sclk();
2341 + bfin_serial_ports[i].port.fifosize = BFIN_UART_TX_FIFO_SIZE;
2342 + bfin_serial_ports[i].port.ops = &bfin_serial_pops;
2343 +diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
2344 +index f4573a9..a32ccb4 100644
2345 +--- a/drivers/spi/spi_mpc83xx.c
2346 ++++ b/drivers/spi/spi_mpc83xx.c
2347 +@@ -711,12 +711,12 @@ static int of_mpc83xx_spi_get_chipselects(struct device *dev)
2348 + return 0;
2349 + }
2350 +
2351 +- pinfo->gpios = kmalloc(ngpios * sizeof(pinfo->gpios), GFP_KERNEL);
2352 ++ pinfo->gpios = kmalloc(ngpios * sizeof(*pinfo->gpios), GFP_KERNEL);
2353 + if (!pinfo->gpios)
2354 + return -ENOMEM;
2355 +- memset(pinfo->gpios, -1, ngpios * sizeof(pinfo->gpios));
2356 ++ memset(pinfo->gpios, -1, ngpios * sizeof(*pinfo->gpios));
2357 +
2358 +- pinfo->alow_flags = kzalloc(ngpios * sizeof(pinfo->alow_flags),
2359 ++ pinfo->alow_flags = kzalloc(ngpios * sizeof(*pinfo->alow_flags),
2360 + GFP_KERNEL);
2361 + if (!pinfo->alow_flags) {
2362 + ret = -ENOMEM;
2363 +diff --git a/drivers/staging/uc2322/aten2011.c b/drivers/staging/uc2322/aten2011.c
2364 +index 9c62f78..39d0926 100644
2365 +--- a/drivers/staging/uc2322/aten2011.c
2366 ++++ b/drivers/staging/uc2322/aten2011.c
2367 +@@ -2336,7 +2336,7 @@ static int ATEN2011_startup(struct usb_serial *serial)
2368 + return 0;
2369 + }
2370 +
2371 +-static void ATEN2011_shutdown(struct usb_serial *serial)
2372 ++static void ATEN2011_release(struct usb_serial *serial)
2373 + {
2374 + int i;
2375 + struct ATENINTL_port *ATEN2011_port;
2376 +@@ -2382,7 +2382,7 @@ static struct usb_serial_driver aten_serial_driver = {
2377 + .tiocmget = ATEN2011_tiocmget,
2378 + .tiocmset = ATEN2011_tiocmset,
2379 + .attach = ATEN2011_startup,
2380 +- .shutdown = ATEN2011_shutdown,
2381 ++ .release = ATEN2011_release,
2382 + .read_bulk_callback = ATEN2011_bulk_in_callback,
2383 + .read_int_callback = ATEN2011_interrupt_callback,
2384 + };
2385 +diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
2386 +index c40a9b2..3703789 100644
2387 +--- a/drivers/usb/class/usbtmc.c
2388 ++++ b/drivers/usb/class/usbtmc.c
2389 +@@ -927,21 +927,27 @@ static long usbtmc_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2390 + switch (cmd) {
2391 + case USBTMC_IOCTL_CLEAR_OUT_HALT:
2392 + retval = usbtmc_ioctl_clear_out_halt(data);
2393 ++ break;
2394 +
2395 + case USBTMC_IOCTL_CLEAR_IN_HALT:
2396 + retval = usbtmc_ioctl_clear_in_halt(data);
2397 ++ break;
2398 +
2399 + case USBTMC_IOCTL_INDICATOR_PULSE:
2400 + retval = usbtmc_ioctl_indicator_pulse(data);
2401 ++ break;
2402 +
2403 + case USBTMC_IOCTL_CLEAR:
2404 + retval = usbtmc_ioctl_clear(data);
2405 ++ break;
2406 +
2407 + case USBTMC_IOCTL_ABORT_BULK_OUT:
2408 + retval = usbtmc_ioctl_abort_bulk_out(data);
2409 ++ break;
2410 +
2411 + case USBTMC_IOCTL_ABORT_BULK_IN:
2412 + retval = usbtmc_ioctl_abort_bulk_in(data);
2413 ++ break;
2414 + }
2415 +
2416 + mutex_unlock(&data->io_mutex);
2417 +diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c
2418 +index 6d106e7..2cbfab3 100644
2419 +--- a/drivers/usb/serial/aircable.c
2420 ++++ b/drivers/usb/serial/aircable.c
2421 +@@ -364,7 +364,7 @@ static int aircable_attach(struct usb_serial *serial)
2422 + return 0;
2423 + }
2424 +
2425 +-static void aircable_shutdown(struct usb_serial *serial)
2426 ++static void aircable_release(struct usb_serial *serial)
2427 + {
2428 +
2429 + struct usb_serial_port *port = serial->port[0];
2430 +@@ -375,7 +375,6 @@ static void aircable_shutdown(struct usb_serial *serial)
2431 + if (priv) {
2432 + serial_buf_free(priv->tx_buf);
2433 + serial_buf_free(priv->rx_buf);
2434 +- usb_set_serial_port_data(port, NULL);
2435 + kfree(priv);
2436 + }
2437 + }
2438 +@@ -601,7 +600,7 @@ static struct usb_serial_driver aircable_device = {
2439 + .num_ports = 1,
2440 + .attach = aircable_attach,
2441 + .probe = aircable_probe,
2442 +- .shutdown = aircable_shutdown,
2443 ++ .release = aircable_release,
2444 + .write = aircable_write,
2445 + .write_room = aircable_write_room,
2446 + .write_bulk_callback = aircable_write_bulk_callback,
2447 +diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
2448 +index b7eacad..9637228 100644
2449 +--- a/drivers/usb/serial/belkin_sa.c
2450 ++++ b/drivers/usb/serial/belkin_sa.c
2451 +@@ -90,7 +90,7 @@ static int debug;
2452 +
2453 + /* function prototypes for a Belkin USB Serial Adapter F5U103 */
2454 + static int belkin_sa_startup(struct usb_serial *serial);
2455 +-static void belkin_sa_shutdown(struct usb_serial *serial);
2456 ++static void belkin_sa_release(struct usb_serial *serial);
2457 + static int belkin_sa_open(struct tty_struct *tty,
2458 + struct usb_serial_port *port, struct file *filp);
2459 + static void belkin_sa_close(struct tty_struct *tty,
2460 +@@ -143,7 +143,7 @@ static struct usb_serial_driver belkin_device = {
2461 + .tiocmget = belkin_sa_tiocmget,
2462 + .tiocmset = belkin_sa_tiocmset,
2463 + .attach = belkin_sa_startup,
2464 +- .shutdown = belkin_sa_shutdown,
2465 ++ .release = belkin_sa_release,
2466 + };
2467 +
2468 +
2469 +@@ -198,14 +198,13 @@ static int belkin_sa_startup(struct usb_serial *serial)
2470 + }
2471 +
2472 +
2473 +-static void belkin_sa_shutdown(struct usb_serial *serial)
2474 ++static void belkin_sa_release(struct usb_serial *serial)
2475 + {
2476 + struct belkin_sa_private *priv;
2477 + int i;
2478 +
2479 + dbg("%s", __func__);
2480 +
2481 +- /* stop reads and writes on all ports */
2482 + for (i = 0; i < serial->num_ports; ++i) {
2483 + /* My special items, the standard routines free my urbs */
2484 + priv = usb_get_serial_port_data(serial->port[i]);
2485 +diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
2486 +index e8d5133..cf5093f 100644
2487 +--- a/drivers/usb/serial/cp210x.c
2488 ++++ b/drivers/usb/serial/cp210x.c
2489 +@@ -51,7 +51,7 @@ static int cp2101_tiocmset_port(struct usb_serial_port *port, struct file *,
2490 + unsigned int, unsigned int);
2491 + static void cp2101_break_ctl(struct tty_struct *, int);
2492 + static int cp2101_startup(struct usb_serial *);
2493 +-static void cp2101_shutdown(struct usb_serial *);
2494 ++static void cp2101_disconnect(struct usb_serial *);
2495 +
2496 + static int debug;
2497 +
2498 +@@ -131,7 +131,7 @@ static struct usb_serial_driver cp2101_device = {
2499 + .tiocmget = cp2101_tiocmget,
2500 + .tiocmset = cp2101_tiocmset,
2501 + .attach = cp2101_startup,
2502 +- .shutdown = cp2101_shutdown,
2503 ++ .disconnect = cp2101_disconnect,
2504 + };
2505 +
2506 + /* Config request types */
2507 +@@ -773,7 +773,7 @@ static int cp2101_startup(struct usb_serial *serial)
2508 + return 0;
2509 + }
2510 +
2511 +-static void cp2101_shutdown(struct usb_serial *serial)
2512 ++static void cp2101_disconnect(struct usb_serial *serial)
2513 + {
2514 + int i;
2515 +
2516 +diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
2517 +index dd501bb..49cf9ee 100644
2518 +--- a/drivers/usb/serial/cyberjack.c
2519 ++++ b/drivers/usb/serial/cyberjack.c
2520 +@@ -58,7 +58,8 @@ static int debug;
2521 +
2522 + /* Function prototypes */
2523 + static int cyberjack_startup(struct usb_serial *serial);
2524 +-static void cyberjack_shutdown(struct usb_serial *serial);
2525 ++static void cyberjack_disconnect(struct usb_serial *serial);
2526 ++static void cyberjack_release(struct usb_serial *serial);
2527 + static int cyberjack_open(struct tty_struct *tty,
2528 + struct usb_serial_port *port, struct file *filp);
2529 + static void cyberjack_close(struct tty_struct *tty,
2530 +@@ -95,7 +96,8 @@ static struct usb_serial_driver cyberjack_device = {
2531 + .id_table = id_table,
2532 + .num_ports = 1,
2533 + .attach = cyberjack_startup,
2534 +- .shutdown = cyberjack_shutdown,
2535 ++ .disconnect = cyberjack_disconnect,
2536 ++ .release = cyberjack_release,
2537 + .open = cyberjack_open,
2538 + .close = cyberjack_close,
2539 + .write = cyberjack_write,
2540 +@@ -149,17 +151,25 @@ static int cyberjack_startup(struct usb_serial *serial)
2541 + return 0;
2542 + }
2543 +
2544 +-static void cyberjack_shutdown(struct usb_serial *serial)
2545 ++static void cyberjack_disconnect(struct usb_serial *serial)
2546 + {
2547 + int i;
2548 +
2549 + dbg("%s", __func__);
2550 +
2551 +- for (i = 0; i < serial->num_ports; ++i) {
2552 ++ for (i = 0; i < serial->num_ports; ++i)
2553 + usb_kill_urb(serial->port[i]->interrupt_in_urb);
2554 ++}
2555 ++
2556 ++static void cyberjack_release(struct usb_serial *serial)
2557 ++{
2558 ++ int i;
2559 ++
2560 ++ dbg("%s", __func__);
2561 ++
2562 ++ for (i = 0; i < serial->num_ports; ++i) {
2563 + /* My special items, the standard routines free my urbs */
2564 + kfree(usb_get_serial_port_data(serial->port[i]));
2565 +- usb_set_serial_port_data(serial->port[i], NULL);
2566 + }
2567 + }
2568 +
2569 +diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
2570 +index e568710..b8e6e4d 100644
2571 +--- a/drivers/usb/serial/cypress_m8.c
2572 ++++ b/drivers/usb/serial/cypress_m8.c
2573 +@@ -171,7 +171,7 @@ struct cypress_buf {
2574 + static int cypress_earthmate_startup(struct usb_serial *serial);
2575 + static int cypress_hidcom_startup(struct usb_serial *serial);
2576 + static int cypress_ca42v2_startup(struct usb_serial *serial);
2577 +-static void cypress_shutdown(struct usb_serial *serial);
2578 ++static void cypress_release(struct usb_serial *serial);
2579 + static int cypress_open(struct tty_struct *tty,
2580 + struct usb_serial_port *port, struct file *filp);
2581 + static void cypress_close(struct tty_struct *tty,
2582 +@@ -215,7 +215,7 @@ static struct usb_serial_driver cypress_earthmate_device = {
2583 + .id_table = id_table_earthmate,
2584 + .num_ports = 1,
2585 + .attach = cypress_earthmate_startup,
2586 +- .shutdown = cypress_shutdown,
2587 ++ .release = cypress_release,
2588 + .open = cypress_open,
2589 + .close = cypress_close,
2590 + .write = cypress_write,
2591 +@@ -241,7 +241,7 @@ static struct usb_serial_driver cypress_hidcom_device = {
2592 + .id_table = id_table_cyphidcomrs232,
2593 + .num_ports = 1,
2594 + .attach = cypress_hidcom_startup,
2595 +- .shutdown = cypress_shutdown,
2596 ++ .release = cypress_release,
2597 + .open = cypress_open,
2598 + .close = cypress_close,
2599 + .write = cypress_write,
2600 +@@ -267,7 +267,7 @@ static struct usb_serial_driver cypress_ca42v2_device = {
2601 + .id_table = id_table_nokiaca42v2,
2602 + .num_ports = 1,
2603 + .attach = cypress_ca42v2_startup,
2604 +- .shutdown = cypress_shutdown,
2605 ++ .release = cypress_release,
2606 + .open = cypress_open,
2607 + .close = cypress_close,
2608 + .write = cypress_write,
2609 +@@ -613,7 +613,7 @@ static int cypress_ca42v2_startup(struct usb_serial *serial)
2610 + } /* cypress_ca42v2_startup */
2611 +
2612 +
2613 +-static void cypress_shutdown(struct usb_serial *serial)
2614 ++static void cypress_release(struct usb_serial *serial)
2615 + {
2616 + struct cypress_private *priv;
2617 +
2618 +@@ -626,7 +626,6 @@ static void cypress_shutdown(struct usb_serial *serial)
2619 + if (priv) {
2620 + cypress_buf_free(priv->buf);
2621 + kfree(priv);
2622 +- usb_set_serial_port_data(serial->port[0], NULL);
2623 + }
2624 + }
2625 +
2626 +diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
2627 +index 38ba4ea..e9373db 100644
2628 +--- a/drivers/usb/serial/digi_acceleport.c
2629 ++++ b/drivers/usb/serial/digi_acceleport.c
2630 +@@ -460,7 +460,8 @@ static void digi_close(struct tty_struct *tty, struct usb_serial_port *port,
2631 + struct file *filp);
2632 + static int digi_startup_device(struct usb_serial *serial);
2633 + static int digi_startup(struct usb_serial *serial);
2634 +-static void digi_shutdown(struct usb_serial *serial);
2635 ++static void digi_disconnect(struct usb_serial *serial);
2636 ++static void digi_release(struct usb_serial *serial);
2637 + static void digi_read_bulk_callback(struct urb *urb);
2638 + static int digi_read_inb_callback(struct urb *urb);
2639 + static int digi_read_oob_callback(struct urb *urb);
2640 +@@ -522,7 +523,8 @@ static struct usb_serial_driver digi_acceleport_2_device = {
2641 + .tiocmget = digi_tiocmget,
2642 + .tiocmset = digi_tiocmset,
2643 + .attach = digi_startup,
2644 +- .shutdown = digi_shutdown,
2645 ++ .disconnect = digi_disconnect,
2646 ++ .release = digi_release,
2647 + };
2648 +
2649 + static struct usb_serial_driver digi_acceleport_4_device = {
2650 +@@ -548,7 +550,8 @@ static struct usb_serial_driver digi_acceleport_4_device = {
2651 + .tiocmget = digi_tiocmget,
2652 + .tiocmset = digi_tiocmset,
2653 + .attach = digi_startup,
2654 +- .shutdown = digi_shutdown,
2655 ++ .disconnect = digi_disconnect,
2656 ++ .release = digi_release,
2657 + };
2658 +
2659 +
2660 +@@ -1589,16 +1592,23 @@ static int digi_startup(struct usb_serial *serial)
2661 + }
2662 +
2663 +
2664 +-static void digi_shutdown(struct usb_serial *serial)
2665 ++static void digi_disconnect(struct usb_serial *serial)
2666 + {
2667 + int i;
2668 +- dbg("digi_shutdown: TOP, in_interrupt()=%ld", in_interrupt());
2669 ++ dbg("digi_disconnect: TOP, in_interrupt()=%ld", in_interrupt());
2670 +
2671 + /* stop reads and writes on all ports */
2672 + for (i = 0; i < serial->type->num_ports + 1; i++) {
2673 + usb_kill_urb(serial->port[i]->read_urb);
2674 + usb_kill_urb(serial->port[i]->write_urb);
2675 + }
2676 ++}
2677 ++
2678 ++
2679 ++static void digi_release(struct usb_serial *serial)
2680 ++{
2681 ++ int i;
2682 ++ dbg("digi_release: TOP, in_interrupt()=%ld", in_interrupt());
2683 +
2684 + /* free the private data structures for all ports */
2685 + /* number of regular ports + 1 for the out-of-band port */
2686 +diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c
2687 +index c709ec4..b0d678c 100644
2688 +--- a/drivers/usb/serial/empeg.c
2689 ++++ b/drivers/usb/serial/empeg.c
2690 +@@ -91,7 +91,6 @@ static int empeg_chars_in_buffer(struct tty_struct *tty);
2691 + static void empeg_throttle(struct tty_struct *tty);
2692 + static void empeg_unthrottle(struct tty_struct *tty);
2693 + static int empeg_startup(struct usb_serial *serial);
2694 +-static void empeg_shutdown(struct usb_serial *serial);
2695 + static void empeg_set_termios(struct tty_struct *tty,
2696 + struct usb_serial_port *port, struct ktermios *old_termios);
2697 + static void empeg_write_bulk_callback(struct urb *urb);
2698 +@@ -125,7 +124,6 @@ static struct usb_serial_driver empeg_device = {
2699 + .throttle = empeg_throttle,
2700 + .unthrottle = empeg_unthrottle,
2701 + .attach = empeg_startup,
2702 +- .shutdown = empeg_shutdown,
2703 + .set_termios = empeg_set_termios,
2704 + .write = empeg_write,
2705 + .write_room = empeg_write_room,
2706 +@@ -429,12 +427,6 @@ static int empeg_startup(struct usb_serial *serial)
2707 + }
2708 +
2709 +
2710 +-static void empeg_shutdown(struct usb_serial *serial)
2711 +-{
2712 +- dbg("%s", __func__);
2713 +-}
2714 +-
2715 +-
2716 + static void empeg_set_termios(struct tty_struct *tty,
2717 + struct usb_serial_port *port, struct ktermios *old_termios)
2718 + {
2719 +diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
2720 +index d9fcdae..9722512 100644
2721 +--- a/drivers/usb/serial/ftdi_sio.c
2722 ++++ b/drivers/usb/serial/ftdi_sio.c
2723 +@@ -714,7 +714,6 @@ static const char *ftdi_chip_name[] = {
2724 + /* function prototypes for a FTDI serial converter */
2725 + static int ftdi_sio_probe(struct usb_serial *serial,
2726 + const struct usb_device_id *id);
2727 +-static void ftdi_shutdown(struct usb_serial *serial);
2728 + static int ftdi_sio_port_probe(struct usb_serial_port *port);
2729 + static int ftdi_sio_port_remove(struct usb_serial_port *port);
2730 + static int ftdi_open(struct tty_struct *tty,
2731 +@@ -770,7 +769,6 @@ static struct usb_serial_driver ftdi_sio_device = {
2732 + .ioctl = ftdi_ioctl,
2733 + .set_termios = ftdi_set_termios,
2734 + .break_ctl = ftdi_break_ctl,
2735 +- .shutdown = ftdi_shutdown,
2736 + };
2737 +
2738 +
2739 +@@ -1460,18 +1458,6 @@ static int ftdi_mtxorb_hack_setup(struct usb_serial *serial)
2740 + return 0;
2741 + }
2742 +
2743 +-/* ftdi_shutdown is called from usbserial:usb_serial_disconnect
2744 +- * it is called when the usb device is disconnected
2745 +- *
2746 +- * usbserial:usb_serial_disconnect
2747 +- * calls __serial_close for each open of the port
2748 +- * shutdown is called then (ie ftdi_shutdown)
2749 +- */
2750 +-static void ftdi_shutdown(struct usb_serial *serial)
2751 +-{
2752 +- dbg("%s", __func__);
2753 +-}
2754 +-
2755 + static void ftdi_sio_priv_release(struct kref *k)
2756 + {
2757 + struct ftdi_private *priv = container_of(k, struct ftdi_private, kref);
2758 +diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
2759 +index 586d30f..ed8bd90 100644
2760 +--- a/drivers/usb/serial/garmin_gps.c
2761 ++++ b/drivers/usb/serial/garmin_gps.c
2762 +@@ -1528,7 +1528,7 @@ static int garmin_attach(struct usb_serial *serial)
2763 + }
2764 +
2765 +
2766 +-static void garmin_shutdown(struct usb_serial *serial)
2767 ++static void garmin_disconnect(struct usb_serial *serial)
2768 + {
2769 + struct usb_serial_port *port = serial->port[0];
2770 + struct garmin_data *garmin_data_p = usb_get_serial_port_data(port);
2771 +@@ -1537,8 +1537,17 @@ static void garmin_shutdown(struct usb_serial *serial)
2772 +
2773 + usb_kill_urb(port->interrupt_in_urb);
2774 + del_timer_sync(&garmin_data_p->timer);
2775 ++}
2776 ++
2777 ++
2778 ++static void garmin_release(struct usb_serial *serial)
2779 ++{
2780 ++ struct usb_serial_port *port = serial->port[0];
2781 ++ struct garmin_data *garmin_data_p = usb_get_serial_port_data(port);
2782 ++
2783 ++ dbg("%s", __func__);
2784 ++
2785 + kfree(garmin_data_p);
2786 +- usb_set_serial_port_data(port, NULL);
2787 + }
2788 +
2789 +
2790 +@@ -1557,7 +1566,8 @@ static struct usb_serial_driver garmin_device = {
2791 + .throttle = garmin_throttle,
2792 + .unthrottle = garmin_unthrottle,
2793 + .attach = garmin_attach,
2794 +- .shutdown = garmin_shutdown,
2795 ++ .disconnect = garmin_disconnect,
2796 ++ .release = garmin_release,
2797 + .write = garmin_write,
2798 + .write_room = garmin_write_room,
2799 + .write_bulk_callback = garmin_write_bulk_callback,
2800 +diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
2801 +index 4cec990..ef29788 100644
2802 +--- a/drivers/usb/serial/generic.c
2803 ++++ b/drivers/usb/serial/generic.c
2804 +@@ -63,7 +63,8 @@ struct usb_serial_driver usb_serial_generic_device = {
2805 + .id_table = generic_device_ids,
2806 + .usb_driver = &generic_driver,
2807 + .num_ports = 1,
2808 +- .shutdown = usb_serial_generic_shutdown,
2809 ++ .disconnect = usb_serial_generic_disconnect,
2810 ++ .release = usb_serial_generic_release,
2811 + .throttle = usb_serial_generic_throttle,
2812 + .unthrottle = usb_serial_generic_unthrottle,
2813 + .resume = usb_serial_generic_resume,
2814 +@@ -413,7 +414,7 @@ void usb_serial_generic_unthrottle(struct tty_struct *tty)
2815 + }
2816 + }
2817 +
2818 +-void usb_serial_generic_shutdown(struct usb_serial *serial)
2819 ++void usb_serial_generic_disconnect(struct usb_serial *serial)
2820 + {
2821 + int i;
2822 +
2823 +@@ -424,3 +425,7 @@ void usb_serial_generic_shutdown(struct usb_serial *serial)
2824 + generic_cleanup(serial->port[i]);
2825 + }
2826 +
2827 ++void usb_serial_generic_release(struct usb_serial *serial)
2828 ++{
2829 ++ dbg("%s", __func__);
2830 ++}
2831 +diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
2832 +index fb4a73d..fc509bb 100644
2833 +--- a/drivers/usb/serial/io_edgeport.c
2834 ++++ b/drivers/usb/serial/io_edgeport.c
2835 +@@ -225,7 +225,8 @@ static int edge_tiocmget(struct tty_struct *tty, struct file *file);
2836 + static int edge_tiocmset(struct tty_struct *tty, struct file *file,
2837 + unsigned int set, unsigned int clear);
2838 + static int edge_startup(struct usb_serial *serial);
2839 +-static void edge_shutdown(struct usb_serial *serial);
2840 ++static void edge_disconnect(struct usb_serial *serial);
2841 ++static void edge_release(struct usb_serial *serial);
2842 +
2843 + #include "io_tables.h" /* all of the devices that this driver supports */
2844 +
2845 +@@ -3195,21 +3196,16 @@ static int edge_startup(struct usb_serial *serial)
2846 +
2847 +
2848 + /****************************************************************************
2849 +- * edge_shutdown
2850 ++ * edge_disconnect
2851 + * This function is called whenever the device is removed from the usb bus.
2852 + ****************************************************************************/
2853 +-static void edge_shutdown(struct usb_serial *serial)
2854 ++static void edge_disconnect(struct usb_serial *serial)
2855 + {
2856 + struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
2857 +- int i;
2858 +
2859 + dbg("%s", __func__);
2860 +
2861 + /* stop reads and writes on all ports */
2862 +- for (i = 0; i < serial->num_ports; ++i) {
2863 +- kfree(usb_get_serial_port_data(serial->port[i]));
2864 +- usb_set_serial_port_data(serial->port[i], NULL);
2865 +- }
2866 + /* free up our endpoint stuff */
2867 + if (edge_serial->is_epic) {
2868 + usb_kill_urb(edge_serial->interrupt_read_urb);
2869 +@@ -3220,9 +3216,24 @@ static void edge_shutdown(struct usb_serial *serial)
2870 + usb_free_urb(edge_serial->read_urb);
2871 + kfree(edge_serial->bulk_in_buffer);
2872 + }
2873 ++}
2874 ++
2875 ++
2876 ++/****************************************************************************
2877 ++ * edge_release
2878 ++ * This function is called when the device structure is deallocated.
2879 ++ ****************************************************************************/
2880 ++static void edge_release(struct usb_serial *serial)
2881 ++{
2882 ++ struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
2883 ++ int i;
2884 ++
2885 ++ dbg("%s", __func__);
2886 ++
2887 ++ for (i = 0; i < serial->num_ports; ++i)
2888 ++ kfree(usb_get_serial_port_data(serial->port[i]));
2889 +
2890 + kfree(edge_serial);
2891 +- usb_set_serial_data(serial, NULL);
2892 + }
2893 +
2894 +
2895 +diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h
2896 +index 7eb9d67..9241d31 100644
2897 +--- a/drivers/usb/serial/io_tables.h
2898 ++++ b/drivers/usb/serial/io_tables.h
2899 +@@ -117,7 +117,8 @@ static struct usb_serial_driver edgeport_2port_device = {
2900 + .throttle = edge_throttle,
2901 + .unthrottle = edge_unthrottle,
2902 + .attach = edge_startup,
2903 +- .shutdown = edge_shutdown,
2904 ++ .disconnect = edge_disconnect,
2905 ++ .release = edge_release,
2906 + .ioctl = edge_ioctl,
2907 + .set_termios = edge_set_termios,
2908 + .tiocmget = edge_tiocmget,
2909 +@@ -145,7 +146,8 @@ static struct usb_serial_driver edgeport_4port_device = {
2910 + .throttle = edge_throttle,
2911 + .unthrottle = edge_unthrottle,
2912 + .attach = edge_startup,
2913 +- .shutdown = edge_shutdown,
2914 ++ .disconnect = edge_disconnect,
2915 ++ .release = edge_release,
2916 + .ioctl = edge_ioctl,
2917 + .set_termios = edge_set_termios,
2918 + .tiocmget = edge_tiocmget,
2919 +@@ -173,7 +175,8 @@ static struct usb_serial_driver edgeport_8port_device = {
2920 + .throttle = edge_throttle,
2921 + .unthrottle = edge_unthrottle,
2922 + .attach = edge_startup,
2923 +- .shutdown = edge_shutdown,
2924 ++ .disconnect = edge_disconnect,
2925 ++ .release = edge_release,
2926 + .ioctl = edge_ioctl,
2927 + .set_termios = edge_set_termios,
2928 + .tiocmget = edge_tiocmget,
2929 +@@ -200,7 +203,8 @@ static struct usb_serial_driver epic_device = {
2930 + .throttle = edge_throttle,
2931 + .unthrottle = edge_unthrottle,
2932 + .attach = edge_startup,
2933 +- .shutdown = edge_shutdown,
2934 ++ .disconnect = edge_disconnect,
2935 ++ .release = edge_release,
2936 + .ioctl = edge_ioctl,
2937 + .set_termios = edge_set_termios,
2938 + .tiocmget = edge_tiocmget,
2939 +diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
2940 +index 513b25e..3139246 100644
2941 +--- a/drivers/usb/serial/io_ti.c
2942 ++++ b/drivers/usb/serial/io_ti.c
2943 +@@ -2664,7 +2664,7 @@ cleanup:
2944 + return -ENOMEM;
2945 + }
2946 +
2947 +-static void edge_shutdown(struct usb_serial *serial)
2948 ++static void edge_disconnect(struct usb_serial *serial)
2949 + {
2950 + int i;
2951 + struct edgeport_port *edge_port;
2952 +@@ -2674,12 +2674,22 @@ static void edge_shutdown(struct usb_serial *serial)
2953 + for (i = 0; i < serial->num_ports; ++i) {
2954 + edge_port = usb_get_serial_port_data(serial->port[i]);
2955 + edge_remove_sysfs_attrs(edge_port->port);
2956 ++ }
2957 ++}
2958 ++
2959 ++static void edge_release(struct usb_serial *serial)
2960 ++{
2961 ++ int i;
2962 ++ struct edgeport_port *edge_port;
2963 ++
2964 ++ dbg("%s", __func__);
2965 ++
2966 ++ for (i = 0; i < serial->num_ports; ++i) {
2967 ++ edge_port = usb_get_serial_port_data(serial->port[i]);
2968 + edge_buf_free(edge_port->ep_out_buf);
2969 + kfree(edge_port);
2970 +- usb_set_serial_port_data(serial->port[i], NULL);
2971 + }
2972 + kfree(usb_get_serial_data(serial));
2973 +- usb_set_serial_data(serial, NULL);
2974 + }
2975 +
2976 +
2977 +@@ -2916,7 +2926,8 @@ static struct usb_serial_driver edgeport_1port_device = {
2978 + .throttle = edge_throttle,
2979 + .unthrottle = edge_unthrottle,
2980 + .attach = edge_startup,
2981 +- .shutdown = edge_shutdown,
2982 ++ .disconnect = edge_disconnect,
2983 ++ .release = edge_release,
2984 + .port_probe = edge_create_sysfs_attrs,
2985 + .ioctl = edge_ioctl,
2986 + .set_termios = edge_set_termios,
2987 +@@ -2945,7 +2956,8 @@ static struct usb_serial_driver edgeport_2port_device = {
2988 + .throttle = edge_throttle,
2989 + .unthrottle = edge_unthrottle,
2990 + .attach = edge_startup,
2991 +- .shutdown = edge_shutdown,
2992 ++ .disconnect = edge_disconnect,
2993 ++ .release = edge_release,
2994 + .port_probe = edge_create_sysfs_attrs,
2995 + .ioctl = edge_ioctl,
2996 + .set_termios = edge_set_termios,
2997 +diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
2998 +index cd62825..b70b0a0 100644
2999 +--- a/drivers/usb/serial/ipaq.c
3000 ++++ b/drivers/usb/serial/ipaq.c
3001 +@@ -80,7 +80,6 @@ static void ipaq_close(struct tty_struct *tty,
3002 + struct usb_serial_port *port, struct file *filp);
3003 + static int ipaq_calc_num_ports(struct usb_serial *serial);
3004 + static int ipaq_startup(struct usb_serial *serial);
3005 +-static void ipaq_shutdown(struct usb_serial *serial);
3006 + static int ipaq_write(struct tty_struct *tty, struct usb_serial_port *port,
3007 + const unsigned char *buf, int count);
3008 + static int ipaq_write_bulk(struct usb_serial_port *port,
3009 +@@ -577,7 +576,6 @@ static struct usb_serial_driver ipaq_device = {
3010 + .close = ipaq_close,
3011 + .attach = ipaq_startup,
3012 + .calc_num_ports = ipaq_calc_num_ports,
3013 +- .shutdown = ipaq_shutdown,
3014 + .write = ipaq_write,
3015 + .write_room = ipaq_write_room,
3016 + .chars_in_buffer = ipaq_chars_in_buffer,
3017 +@@ -992,11 +990,6 @@ static int ipaq_startup(struct usb_serial *serial)
3018 + return usb_reset_configuration(serial->dev);
3019 + }
3020 +
3021 +-static void ipaq_shutdown(struct usb_serial *serial)
3022 +-{
3023 +- dbg("%s", __func__);
3024 +-}
3025 +-
3026 + static int __init ipaq_init(void)
3027 + {
3028 + int retval;
3029 +diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
3030 +index 4473d44..c03015b 100644
3031 +--- a/drivers/usb/serial/iuu_phoenix.c
3032 ++++ b/drivers/usb/serial/iuu_phoenix.c
3033 +@@ -122,8 +122,8 @@ static int iuu_startup(struct usb_serial *serial)
3034 + return 0;
3035 + }
3036 +
3037 +-/* Shutdown function */
3038 +-static void iuu_shutdown(struct usb_serial *serial)
3039 ++/* Release function */
3040 ++static void iuu_release(struct usb_serial *serial)
3041 + {
3042 + struct usb_serial_port *port = serial->port[0];
3043 + struct iuu_private *priv = usb_get_serial_port_data(port);
3044 +@@ -1176,7 +1176,7 @@ static struct usb_serial_driver iuu_device = {
3045 + .tiocmget = iuu_tiocmget,
3046 + .tiocmset = iuu_tiocmset,
3047 + .attach = iuu_startup,
3048 +- .shutdown = iuu_shutdown,
3049 ++ .release = iuu_release,
3050 + };
3051 +
3052 + static int __init iuu_init(void)
3053 +diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
3054 +index 00daa8f..8c69c3c 100644
3055 +--- a/drivers/usb/serial/keyspan.c
3056 ++++ b/drivers/usb/serial/keyspan.c
3057 +@@ -2682,7 +2682,7 @@ static int keyspan_startup(struct usb_serial *serial)
3058 + return 0;
3059 + }
3060 +
3061 +-static void keyspan_shutdown(struct usb_serial *serial)
3062 ++static void keyspan_disconnect(struct usb_serial *serial)
3063 + {
3064 + int i, j;
3065 + struct usb_serial_port *port;
3066 +@@ -2722,6 +2722,17 @@ static void keyspan_shutdown(struct usb_serial *serial)
3067 + usb_free_urb(p_priv->out_urbs[j]);
3068 + }
3069 + }
3070 ++}
3071 ++
3072 ++static void keyspan_release(struct usb_serial *serial)
3073 ++{
3074 ++ int i;
3075 ++ struct usb_serial_port *port;
3076 ++ struct keyspan_serial_private *s_priv;
3077 ++
3078 ++ dbg("%s", __func__);
3079 ++
3080 ++ s_priv = usb_get_serial_data(serial);
3081 +
3082 + /* dbg("Freeing serial->private."); */
3083 + kfree(s_priv);
3084 +diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h
3085 +index 38b4582..4961c26 100644
3086 +--- a/drivers/usb/serial/keyspan.h
3087 ++++ b/drivers/usb/serial/keyspan.h
3088 +@@ -42,7 +42,8 @@ static void keyspan_close (struct tty_struct *tty,
3089 + struct usb_serial_port *port,
3090 + struct file *filp);
3091 + static int keyspan_startup (struct usb_serial *serial);
3092 +-static void keyspan_shutdown (struct usb_serial *serial);
3093 ++static void keyspan_disconnect (struct usb_serial *serial);
3094 ++static void keyspan_release (struct usb_serial *serial);
3095 + static int keyspan_write_room (struct tty_struct *tty);
3096 +
3097 + static int keyspan_write (struct tty_struct *tty,
3098 +@@ -569,7 +570,8 @@ static struct usb_serial_driver keyspan_1port_device = {
3099 + .tiocmget = keyspan_tiocmget,
3100 + .tiocmset = keyspan_tiocmset,
3101 + .attach = keyspan_startup,
3102 +- .shutdown = keyspan_shutdown,
3103 ++ .disconnect = keyspan_disconnect,
3104 ++ .release = keyspan_release,
3105 + };
3106 +
3107 + static struct usb_serial_driver keyspan_2port_device = {
3108 +@@ -589,7 +591,8 @@ static struct usb_serial_driver keyspan_2port_device = {
3109 + .tiocmget = keyspan_tiocmget,
3110 + .tiocmset = keyspan_tiocmset,
3111 + .attach = keyspan_startup,
3112 +- .shutdown = keyspan_shutdown,
3113 ++ .disconnect = keyspan_disconnect,
3114 ++ .release = keyspan_release,
3115 + };
3116 +
3117 + static struct usb_serial_driver keyspan_4port_device = {
3118 +@@ -609,7 +612,8 @@ static struct usb_serial_driver keyspan_4port_device = {
3119 + .tiocmget = keyspan_tiocmget,
3120 + .tiocmset = keyspan_tiocmset,
3121 + .attach = keyspan_startup,
3122 +- .shutdown = keyspan_shutdown,
3123 ++ .disconnect = keyspan_disconnect,
3124 ++ .release = keyspan_release,
3125 + };
3126 +
3127 + #endif
3128 +diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
3129 +index bf1ae24..d2e2b91 100644
3130 +--- a/drivers/usb/serial/keyspan_pda.c
3131 ++++ b/drivers/usb/serial/keyspan_pda.c
3132 +@@ -795,7 +795,7 @@ static int keyspan_pda_startup(struct usb_serial *serial)
3133 + return 0;
3134 + }
3135 +
3136 +-static void keyspan_pda_shutdown(struct usb_serial *serial)
3137 ++static void keyspan_pda_release(struct usb_serial *serial)
3138 + {
3139 + dbg("%s", __func__);
3140 +
3141 +@@ -853,7 +853,7 @@ static struct usb_serial_driver keyspan_pda_device = {
3142 + .tiocmget = keyspan_pda_tiocmget,
3143 + .tiocmset = keyspan_pda_tiocmset,
3144 + .attach = keyspan_pda_startup,
3145 +- .shutdown = keyspan_pda_shutdown,
3146 ++ .release = keyspan_pda_release,
3147 + };
3148 +
3149 +
3150 +diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
3151 +index fcd9082..272a94f 100644
3152 +--- a/drivers/usb/serial/kl5kusb105.c
3153 ++++ b/drivers/usb/serial/kl5kusb105.c
3154 +@@ -73,7 +73,8 @@ static int debug;
3155 + * Function prototypes
3156 + */
3157 + static int klsi_105_startup(struct usb_serial *serial);
3158 +-static void klsi_105_shutdown(struct usb_serial *serial);
3159 ++static void klsi_105_disconnect(struct usb_serial *serial);
3160 ++static void klsi_105_release(struct usb_serial *serial);
3161 + static int klsi_105_open(struct tty_struct *tty,
3162 + struct usb_serial_port *port, struct file *filp);
3163 + static void klsi_105_close(struct tty_struct *tty,
3164 +@@ -132,7 +133,8 @@ static struct usb_serial_driver kl5kusb105d_device = {
3165 + .tiocmget = klsi_105_tiocmget,
3166 + .tiocmset = klsi_105_tiocmset,
3167 + .attach = klsi_105_startup,
3168 +- .shutdown = klsi_105_shutdown,
3169 ++ .disconnect = klsi_105_disconnect,
3170 ++ .release = klsi_105_release,
3171 + .throttle = klsi_105_throttle,
3172 + .unthrottle = klsi_105_unthrottle,
3173 + };
3174 +@@ -316,7 +318,7 @@ err_cleanup:
3175 + } /* klsi_105_startup */
3176 +
3177 +
3178 +-static void klsi_105_shutdown(struct usb_serial *serial)
3179 ++static void klsi_105_disconnect(struct usb_serial *serial)
3180 + {
3181 + int i;
3182 +
3183 +@@ -326,33 +328,36 @@ static void klsi_105_shutdown(struct usb_serial *serial)
3184 + for (i = 0; i < serial->num_ports; ++i) {
3185 + struct klsi_105_private *priv =
3186 + usb_get_serial_port_data(serial->port[i]);
3187 +- unsigned long flags;
3188 +
3189 + if (priv) {
3190 + /* kill our write urb pool */
3191 + int j;
3192 + struct urb **write_urbs = priv->write_urb_pool;
3193 +- spin_lock_irqsave(&priv->lock, flags);
3194 +
3195 + for (j = 0; j < NUM_URBS; j++) {
3196 + if (write_urbs[j]) {
3197 +- /* FIXME - uncomment the following
3198 +- * usb_kill_urb call when the host
3199 +- * controllers get fixed to set
3200 +- * urb->dev = NULL after the urb is
3201 +- * finished. Otherwise this call
3202 +- * oopses. */
3203 +- /* usb_kill_urb(write_urbs[j]); */
3204 +- kfree(write_urbs[j]->transfer_buffer);
3205 ++ usb_kill_urb(write_urbs[j]);
3206 + usb_free_urb(write_urbs[j]);
3207 + }
3208 + }
3209 +- spin_unlock_irqrestore(&priv->lock, flags);
3210 +- kfree(priv);
3211 +- usb_set_serial_port_data(serial->port[i], NULL);
3212 + }
3213 + }
3214 +-} /* klsi_105_shutdown */
3215 ++} /* klsi_105_disconnect */
3216 ++
3217 ++
3218 ++static void klsi_105_release(struct usb_serial *serial)
3219 ++{
3220 ++ int i;
3221 ++
3222 ++ dbg("%s", __func__);
3223 ++
3224 ++ for (i = 0; i < serial->num_ports; ++i) {
3225 ++ struct klsi_105_private *priv =
3226 ++ usb_get_serial_port_data(serial->port[i]);
3227 ++
3228 ++ kfree(priv);
3229 ++ }
3230 ++} /* klsi_105_release */
3231 +
3232 + static int klsi_105_open(struct tty_struct *tty,
3233 + struct usb_serial_port *port, struct file *filp)
3234 +diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
3235 +index c148544..d88368c 100644
3236 +--- a/drivers/usb/serial/kobil_sct.c
3237 ++++ b/drivers/usb/serial/kobil_sct.c
3238 +@@ -69,7 +69,7 @@ static int debug;
3239 +
3240 + /* Function prototypes */
3241 + static int kobil_startup(struct usb_serial *serial);
3242 +-static void kobil_shutdown(struct usb_serial *serial);
3243 ++static void kobil_release(struct usb_serial *serial);
3244 + static int kobil_open(struct tty_struct *tty,
3245 + struct usb_serial_port *port, struct file *filp);
3246 + static void kobil_close(struct tty_struct *tty, struct usb_serial_port *port,
3247 +@@ -118,7 +118,7 @@ static struct usb_serial_driver kobil_device = {
3248 + .id_table = id_table,
3249 + .num_ports = 1,
3250 + .attach = kobil_startup,
3251 +- .shutdown = kobil_shutdown,
3252 ++ .release = kobil_release,
3253 + .ioctl = kobil_ioctl,
3254 + .set_termios = kobil_set_termios,
3255 + .tiocmget = kobil_tiocmget,
3256 +@@ -202,17 +202,13 @@ static int kobil_startup(struct usb_serial *serial)
3257 + }
3258 +
3259 +
3260 +-static void kobil_shutdown(struct usb_serial *serial)
3261 ++static void kobil_release(struct usb_serial *serial)
3262 + {
3263 + int i;
3264 + dbg("%s - port %d", __func__, serial->port[0]->number);
3265 +
3266 +- for (i = 0; i < serial->num_ports; ++i) {
3267 +- while (serial->port[i]->port.count > 0)
3268 +- kobil_close(NULL, serial->port[i], NULL);
3269 ++ for (i = 0; i < serial->num_ports; ++i)
3270 + kfree(usb_get_serial_port_data(serial->port[i]));
3271 +- usb_set_serial_port_data(serial->port[i], NULL);
3272 +- }
3273 + }
3274 +
3275 +
3276 +diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
3277 +index 82930a7..08ba8e6 100644
3278 +--- a/drivers/usb/serial/mct_u232.c
3279 ++++ b/drivers/usb/serial/mct_u232.c
3280 +@@ -92,7 +92,7 @@ static int debug;
3281 + * Function prototypes
3282 + */
3283 + static int mct_u232_startup(struct usb_serial *serial);
3284 +-static void mct_u232_shutdown(struct usb_serial *serial);
3285 ++static void mct_u232_release(struct usb_serial *serial);
3286 + static int mct_u232_open(struct tty_struct *tty,
3287 + struct usb_serial_port *port, struct file *filp);
3288 + static void mct_u232_close(struct tty_struct *tty,
3289 +@@ -148,7 +148,7 @@ static struct usb_serial_driver mct_u232_device = {
3290 + .tiocmget = mct_u232_tiocmget,
3291 + .tiocmset = mct_u232_tiocmset,
3292 + .attach = mct_u232_startup,
3293 +- .shutdown = mct_u232_shutdown,
3294 ++ .release = mct_u232_release,
3295 + };
3296 +
3297 +
3298 +@@ -406,7 +406,7 @@ static int mct_u232_startup(struct usb_serial *serial)
3299 + } /* mct_u232_startup */
3300 +
3301 +
3302 +-static void mct_u232_shutdown(struct usb_serial *serial)
3303 ++static void mct_u232_release(struct usb_serial *serial)
3304 + {
3305 + struct mct_u232_private *priv;
3306 + int i;
3307 +@@ -416,12 +416,9 @@ static void mct_u232_shutdown(struct usb_serial *serial)
3308 + for (i = 0; i < serial->num_ports; ++i) {
3309 + /* My special items, the standard routines free my urbs */
3310 + priv = usb_get_serial_port_data(serial->port[i]);
3311 +- if (priv) {
3312 +- usb_set_serial_port_data(serial->port[i], NULL);
3313 +- kfree(priv);
3314 +- }
3315 ++ kfree(priv);
3316 + }
3317 +-} /* mct_u232_shutdown */
3318 ++} /* mct_u232_release */
3319 +
3320 + static int mct_u232_open(struct tty_struct *tty,
3321 + struct usb_serial_port *port, struct file *filp)
3322 +diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
3323 +index 24e3b5d..e0137ec 100644
3324 +--- a/drivers/usb/serial/mos7720.c
3325 ++++ b/drivers/usb/serial/mos7720.c
3326 +@@ -1522,19 +1522,16 @@ static int mos7720_startup(struct usb_serial *serial)
3327 + return 0;
3328 + }
3329 +
3330 +-static void mos7720_shutdown(struct usb_serial *serial)
3331 ++static void mos7720_release(struct usb_serial *serial)
3332 + {
3333 + int i;
3334 +
3335 + /* free private structure allocated for serial port */
3336 +- for (i = 0; i < serial->num_ports; ++i) {
3337 ++ for (i = 0; i < serial->num_ports; ++i)
3338 + kfree(usb_get_serial_port_data(serial->port[i]));
3339 +- usb_set_serial_port_data(serial->port[i], NULL);
3340 +- }
3341 +
3342 + /* free private structure allocated for serial device */
3343 + kfree(usb_get_serial_data(serial));
3344 +- usb_set_serial_data(serial, NULL);
3345 + }
3346 +
3347 + static struct usb_driver usb_driver = {
3348 +@@ -1559,7 +1556,7 @@ static struct usb_serial_driver moschip7720_2port_driver = {
3349 + .throttle = mos7720_throttle,
3350 + .unthrottle = mos7720_unthrottle,
3351 + .attach = mos7720_startup,
3352 +- .shutdown = mos7720_shutdown,
3353 ++ .release = mos7720_release,
3354 + .ioctl = mos7720_ioctl,
3355 + .set_termios = mos7720_set_termios,
3356 + .write = mos7720_write,
3357 +diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
3358 +index 84fb1dc..3d30268 100644
3359 +--- a/drivers/usb/serial/mos7840.c
3360 ++++ b/drivers/usb/serial/mos7840.c
3361 +@@ -2673,16 +2673,16 @@ error:
3362 + }
3363 +
3364 + /****************************************************************************
3365 +- * mos7840_shutdown
3366 ++ * mos7840_disconnect
3367 + * This function is called whenever the device is removed from the usb bus.
3368 + ****************************************************************************/
3369 +
3370 +-static void mos7840_shutdown(struct usb_serial *serial)
3371 ++static void mos7840_disconnect(struct usb_serial *serial)
3372 + {
3373 + int i;
3374 + unsigned long flags;
3375 + struct moschip_port *mos7840_port;
3376 +- dbg("%s \n", " shutdown :entering..........");
3377 ++ dbg("%s \n", " disconnect :entering..........");
3378 +
3379 + if (!serial) {
3380 + dbg("%s", "Invalid Handler \n");
3381 +@@ -2702,11 +2702,42 @@ static void mos7840_shutdown(struct usb_serial *serial)
3382 + mos7840_port->zombie = 1;
3383 + spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
3384 + usb_kill_urb(mos7840_port->control_urb);
3385 ++ }
3386 ++ }
3387 ++
3388 ++ dbg("%s", "Thank u :: ");
3389 ++
3390 ++}
3391 ++
3392 ++/****************************************************************************
3393 ++ * mos7840_release
3394 ++ * This function is called when the usb_serial structure is freed.
3395 ++ ****************************************************************************/
3396 ++
3397 ++static void mos7840_release(struct usb_serial *serial)
3398 ++{
3399 ++ int i;
3400 ++ struct moschip_port *mos7840_port;
3401 ++ dbg("%s", " release :entering..........");
3402 ++
3403 ++ if (!serial) {
3404 ++ dbg("%s", "Invalid Handler");
3405 ++ return;
3406 ++ }
3407 ++
3408 ++ /* check for the ports to be closed,close the ports and disconnect */
3409 ++
3410 ++ /* free private structure allocated for serial port *
3411 ++ * stop reads and writes on all ports */
3412 ++
3413 ++ for (i = 0; i < serial->num_ports; ++i) {
3414 ++ mos7840_port = mos7840_get_port_private(serial->port[i]);
3415 ++ dbg("mos7840_port %d = %p", i, mos7840_port);
3416 ++ if (mos7840_port) {
3417 + kfree(mos7840_port->ctrl_buf);
3418 + kfree(mos7840_port->dr);
3419 + kfree(mos7840_port);
3420 + }
3421 +- mos7840_set_port_private(serial->port[i], NULL);
3422 + }
3423 +
3424 + dbg("%s\n", "Thank u :: ");
3425 +@@ -2747,7 +2778,8 @@ static struct usb_serial_driver moschip7840_4port_device = {
3426 + .tiocmget = mos7840_tiocmget,
3427 + .tiocmset = mos7840_tiocmset,
3428 + .attach = mos7840_startup,
3429 +- .shutdown = mos7840_shutdown,
3430 ++ .disconnect = mos7840_disconnect,
3431 ++ .release = mos7840_release,
3432 + .read_bulk_callback = mos7840_bulk_in_callback,
3433 + .read_int_callback = mos7840_interrupt_callback,
3434 + };
3435 +diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
3436 +index df65397..65fb5c6 100644
3437 +--- a/drivers/usb/serial/omninet.c
3438 ++++ b/drivers/usb/serial/omninet.c
3439 +@@ -73,7 +73,8 @@ static void omninet_write_bulk_callback(struct urb *urb);
3440 + static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port,
3441 + const unsigned char *buf, int count);
3442 + static int omninet_write_room(struct tty_struct *tty);
3443 +-static void omninet_shutdown(struct usb_serial *serial);
3444 ++static void omninet_disconnect(struct usb_serial *serial);
3445 ++static void omninet_release(struct usb_serial *serial);
3446 + static int omninet_attach(struct usb_serial *serial);
3447 +
3448 + static struct usb_device_id id_table[] = {
3449 +@@ -109,7 +110,8 @@ static struct usb_serial_driver zyxel_omninet_device = {
3450 + .write_room = omninet_write_room,
3451 + .read_bulk_callback = omninet_read_bulk_callback,
3452 + .write_bulk_callback = omninet_write_bulk_callback,
3453 +- .shutdown = omninet_shutdown,
3454 ++ .disconnect = omninet_disconnect,
3455 ++ .release = omninet_release,
3456 + };
3457 +
3458 +
3459 +@@ -347,13 +349,22 @@ static void omninet_write_bulk_callback(struct urb *urb)
3460 + }
3461 +
3462 +
3463 +-static void omninet_shutdown(struct usb_serial *serial)
3464 ++static void omninet_disconnect(struct usb_serial *serial)
3465 + {
3466 + struct usb_serial_port *wport = serial->port[1];
3467 +- struct usb_serial_port *port = serial->port[0];
3468 ++
3469 + dbg("%s", __func__);
3470 +
3471 + usb_kill_urb(wport->write_urb);
3472 ++}
3473 ++
3474 ++
3475 ++static void omninet_release(struct usb_serial *serial)
3476 ++{
3477 ++ struct usb_serial_port *port = serial->port[0];
3478 ++
3479 ++ dbg("%s", __func__);
3480 ++
3481 + kfree(usb_get_serial_port_data(port));
3482 + }
3483 +
3484 +diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c
3485 +index b500ad1..1e99ae0 100644
3486 +--- a/drivers/usb/serial/opticon.c
3487 ++++ b/drivers/usb/serial/opticon.c
3488 +@@ -464,7 +464,7 @@ error:
3489 + return retval;
3490 + }
3491 +
3492 +-static void opticon_shutdown(struct usb_serial *serial)
3493 ++static void opticon_disconnect(struct usb_serial *serial)
3494 + {
3495 + struct opticon_private *priv = usb_get_serial_data(serial);
3496 +
3497 +@@ -472,9 +472,16 @@ static void opticon_shutdown(struct usb_serial *serial)
3498 +
3499 + usb_kill_urb(priv->bulk_read_urb);
3500 + usb_free_urb(priv->bulk_read_urb);
3501 ++}
3502 ++
3503 ++static void opticon_release(struct usb_serial *serial)
3504 ++{
3505 ++ struct opticon_private *priv = usb_get_serial_data(serial);
3506 ++
3507 ++ dbg("%s", __func__);
3508 ++
3509 + kfree(priv->bulk_in_buffer);
3510 + kfree(priv);
3511 +- usb_set_serial_data(serial, NULL);
3512 + }
3513 +
3514 + static int opticon_suspend(struct usb_interface *intf, pm_message_t message)
3515 +@@ -525,7 +532,8 @@ static struct usb_serial_driver opticon_device = {
3516 + .close = opticon_close,
3517 + .write = opticon_write,
3518 + .write_room = opticon_write_room,
3519 +- .shutdown = opticon_shutdown,
3520 ++ .disconnect = opticon_disconnect,
3521 ++ .release = opticon_release,
3522 + .throttle = opticon_throttle,
3523 + .unthrottle = opticon_unthrottle,
3524 + .ioctl = opticon_ioctl,
3525 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
3526 +index 7817b82..ab3d883 100644
3527 +--- a/drivers/usb/serial/option.c
3528 ++++ b/drivers/usb/serial/option.c
3529 +@@ -48,7 +48,8 @@ static int option_open(struct tty_struct *tty, struct usb_serial_port *port,
3530 + static void option_close(struct tty_struct *tty, struct usb_serial_port *port,
3531 + struct file *filp);
3532 + static int option_startup(struct usb_serial *serial);
3533 +-static void option_shutdown(struct usb_serial *serial);
3534 ++static void option_disconnect(struct usb_serial *serial);
3535 ++static void option_release(struct usb_serial *serial);
3536 + static int option_write_room(struct tty_struct *tty);
3537 +
3538 + static void option_instat_callback(struct urb *urb);
3539 +@@ -558,7 +559,8 @@ static struct usb_serial_driver option_1port_device = {
3540 + .tiocmget = option_tiocmget,
3541 + .tiocmset = option_tiocmset,
3542 + .attach = option_startup,
3543 +- .shutdown = option_shutdown,
3544 ++ .disconnect = option_disconnect,
3545 ++ .release = option_release,
3546 + .read_int_callback = option_instat_callback,
3547 + .suspend = option_suspend,
3548 + .resume = option_resume,
3549 +@@ -1129,7 +1131,14 @@ static void stop_read_write_urbs(struct usb_serial *serial)
3550 + }
3551 + }
3552 +
3553 +-static void option_shutdown(struct usb_serial *serial)
3554 ++static void option_disconnect(struct usb_serial *serial)
3555 ++{
3556 ++ dbg("%s", __func__);
3557 ++
3558 ++ stop_read_write_urbs(serial);
3559 ++}
3560 ++
3561 ++static void option_release(struct usb_serial *serial)
3562 + {
3563 + int i, j;
3564 + struct usb_serial_port *port;
3565 +@@ -1137,8 +1146,6 @@ static void option_shutdown(struct usb_serial *serial)
3566 +
3567 + dbg("%s", __func__);
3568 +
3569 +- stop_read_write_urbs(serial);
3570 +-
3571 + /* Now free them */
3572 + for (i = 0; i < serial->num_ports; ++i) {
3573 + port = serial->port[i];
3574 +diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
3575 +index ba551f0..f7388ef 100644
3576 +--- a/drivers/usb/serial/oti6858.c
3577 ++++ b/drivers/usb/serial/oti6858.c
3578 +@@ -160,7 +160,7 @@ static int oti6858_tiocmget(struct tty_struct *tty, struct file *file);
3579 + static int oti6858_tiocmset(struct tty_struct *tty, struct file *file,
3580 + unsigned int set, unsigned int clear);
3581 + static int oti6858_startup(struct usb_serial *serial);
3582 +-static void oti6858_shutdown(struct usb_serial *serial);
3583 ++static void oti6858_release(struct usb_serial *serial);
3584 +
3585 + /* functions operating on buffers */
3586 + static struct oti6858_buf *oti6858_buf_alloc(unsigned int size);
3587 +@@ -195,7 +195,7 @@ static struct usb_serial_driver oti6858_device = {
3588 + .write_room = oti6858_write_room,
3589 + .chars_in_buffer = oti6858_chars_in_buffer,
3590 + .attach = oti6858_startup,
3591 +- .shutdown = oti6858_shutdown,
3592 ++ .release = oti6858_release,
3593 + };
3594 +
3595 + struct oti6858_private {
3596 +@@ -829,7 +829,7 @@ static int oti6858_ioctl(struct tty_struct *tty, struct file *file,
3597 + }
3598 +
3599 +
3600 +-static void oti6858_shutdown(struct usb_serial *serial)
3601 ++static void oti6858_release(struct usb_serial *serial)
3602 + {
3603 + struct oti6858_private *priv;
3604 + int i;
3605 +@@ -841,7 +841,6 @@ static void oti6858_shutdown(struct usb_serial *serial)
3606 + if (priv) {
3607 + oti6858_buf_free(priv->buf);
3608 + kfree(priv);
3609 +- usb_set_serial_port_data(serial->port[i], NULL);
3610 + }
3611 + }
3612 + }
3613 +diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
3614 +index 751a533..4cf1ed1 100644
3615 +--- a/drivers/usb/serial/pl2303.c
3616 ++++ b/drivers/usb/serial/pl2303.c
3617 +@@ -897,7 +897,7 @@ static void pl2303_break_ctl(struct tty_struct *tty, int break_state)
3618 + dbg("%s - error sending break = %d", __func__, result);
3619 + }
3620 +
3621 +-static void pl2303_shutdown(struct usb_serial *serial)
3622 ++static void pl2303_release(struct usb_serial *serial)
3623 + {
3624 + int i;
3625 + struct pl2303_private *priv;
3626 +@@ -909,7 +909,6 @@ static void pl2303_shutdown(struct usb_serial *serial)
3627 + if (priv) {
3628 + pl2303_buf_free(priv->buf);
3629 + kfree(priv);
3630 +- usb_set_serial_port_data(serial->port[i], NULL);
3631 + }
3632 + }
3633 + }
3634 +@@ -1137,7 +1136,7 @@ static struct usb_serial_driver pl2303_device = {
3635 + .write_room = pl2303_write_room,
3636 + .chars_in_buffer = pl2303_chars_in_buffer,
3637 + .attach = pl2303_startup,
3638 +- .shutdown = pl2303_shutdown,
3639 ++ .release = pl2303_release,
3640 + };
3641 +
3642 + static int __init pl2303_init(void)
3643 +diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
3644 +index 913225c..5a26ed8 100644
3645 +--- a/drivers/usb/serial/sierra.c
3646 ++++ b/drivers/usb/serial/sierra.c
3647 +@@ -699,7 +699,7 @@ static int sierra_startup(struct usb_serial *serial)
3648 + return 0;
3649 + }
3650 +
3651 +-static void sierra_shutdown(struct usb_serial *serial)
3652 ++static void sierra_disconnect(struct usb_serial *serial)
3653 + {
3654 + int i, j;
3655 + struct usb_serial_port *port;
3656 +@@ -718,10 +718,29 @@ static void sierra_shutdown(struct usb_serial *serial)
3657 + for (j = 0; j < N_IN_URB; j++) {
3658 + usb_kill_urb(portdata->in_urbs[j]);
3659 + usb_free_urb(portdata->in_urbs[j]);
3660 +- kfree(portdata->in_buffer[j]);
3661 + }
3662 ++ }
3663 ++}
3664 ++
3665 ++static void sierra_release(struct usb_serial *serial)
3666 ++{
3667 ++ int i, j;
3668 ++ struct usb_serial_port *port;
3669 ++ struct sierra_port_private *portdata;
3670 ++
3671 ++ dev_dbg(&serial->dev->dev, "%s\n", __func__);
3672 ++
3673 ++ for (i = 0; i < serial->num_ports; ++i) {
3674 ++ port = serial->port[i];
3675 ++ if (!port)
3676 ++ continue;
3677 ++ portdata = usb_get_serial_port_data(port);
3678 ++ if (!portdata)
3679 ++ continue;
3680 ++
3681 ++ for (j = 0; j < N_IN_URB; j++)
3682 ++ kfree(portdata->in_buffer[j]);
3683 + kfree(portdata);
3684 +- usb_set_serial_port_data(port, NULL);
3685 + }
3686 + }
3687 +
3688 +@@ -743,7 +762,8 @@ static struct usb_serial_driver sierra_device = {
3689 + .tiocmget = sierra_tiocmget,
3690 + .tiocmset = sierra_tiocmset,
3691 + .attach = sierra_startup,
3692 +- .shutdown = sierra_shutdown,
3693 ++ .disconnect = sierra_disconnect,
3694 ++ .release = sierra_release,
3695 + .read_int_callback = sierra_instat_callback,
3696 + };
3697 +
3698 +diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
3699 +index 5e7528c..f5403b0 100644
3700 +--- a/drivers/usb/serial/spcp8x5.c
3701 ++++ b/drivers/usb/serial/spcp8x5.c
3702 +@@ -356,7 +356,7 @@ cleanup:
3703 + }
3704 +
3705 + /* call when the device plug out. free all the memory alloced by probe */
3706 +-static void spcp8x5_shutdown(struct usb_serial *serial)
3707 ++static void spcp8x5_release(struct usb_serial *serial)
3708 + {
3709 + int i;
3710 + struct spcp8x5_private *priv;
3711 +@@ -366,7 +366,6 @@ static void spcp8x5_shutdown(struct usb_serial *serial)
3712 + if (priv) {
3713 + free_ringbuf(priv->buf);
3714 + kfree(priv);
3715 +- usb_set_serial_port_data(serial->port[i] , NULL);
3716 + }
3717 + }
3718 + }
3719 +@@ -1043,7 +1042,7 @@ static struct usb_serial_driver spcp8x5_device = {
3720 + .write_bulk_callback = spcp8x5_write_bulk_callback,
3721 + .chars_in_buffer = spcp8x5_chars_in_buffer,
3722 + .attach = spcp8x5_startup,
3723 +- .shutdown = spcp8x5_shutdown,
3724 ++ .release = spcp8x5_release,
3725 + };
3726 +
3727 + static int __init spcp8x5_init(void)
3728 +diff --git a/drivers/usb/serial/symbolserial.c b/drivers/usb/serial/symbolserial.c
3729 +index 69879e4..b7a6bc8 100644
3730 +--- a/drivers/usb/serial/symbolserial.c
3731 ++++ b/drivers/usb/serial/symbolserial.c
3732 +@@ -268,7 +268,7 @@ error:
3733 + return retval;
3734 + }
3735 +
3736 +-static void symbol_shutdown(struct usb_serial *serial)
3737 ++static void symbol_disconnect(struct usb_serial *serial)
3738 + {
3739 + struct symbol_private *priv = usb_get_serial_data(serial);
3740 +
3741 +@@ -276,9 +276,16 @@ static void symbol_shutdown(struct usb_serial *serial)
3742 +
3743 + usb_kill_urb(priv->int_urb);
3744 + usb_free_urb(priv->int_urb);
3745 ++}
3746 ++
3747 ++static void symbol_release(struct usb_serial *serial)
3748 ++{
3749 ++ struct symbol_private *priv = usb_get_serial_data(serial);
3750 ++
3751 ++ dbg("%s", __func__);
3752 ++
3753 + kfree(priv->int_buffer);
3754 + kfree(priv);
3755 +- usb_set_serial_data(serial, NULL);
3756 + }
3757 +
3758 + static struct usb_driver symbol_driver = {
3759 +@@ -300,7 +307,8 @@ static struct usb_serial_driver symbol_device = {
3760 + .attach = symbol_startup,
3761 + .open = symbol_open,
3762 + .close = symbol_close,
3763 +- .shutdown = symbol_shutdown,
3764 ++ .disconnect = symbol_disconnect,
3765 ++ .release = symbol_release,
3766 + .throttle = symbol_throttle,
3767 + .unthrottle = symbol_unthrottle,
3768 + };
3769 +diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
3770 +index 0a64bac..ef5f756 100644
3771 +--- a/drivers/usb/serial/ti_usb_3410_5052.c
3772 ++++ b/drivers/usb/serial/ti_usb_3410_5052.c
3773 +@@ -97,7 +97,7 @@ struct ti_device {
3774 + /* Function Declarations */
3775 +
3776 + static int ti_startup(struct usb_serial *serial);
3777 +-static void ti_shutdown(struct usb_serial *serial);
3778 ++static void ti_release(struct usb_serial *serial);
3779 + static int ti_open(struct tty_struct *tty, struct usb_serial_port *port,
3780 + struct file *file);
3781 + static void ti_close(struct tty_struct *tty, struct usb_serial_port *port,
3782 +@@ -231,7 +231,7 @@ static struct usb_serial_driver ti_1port_device = {
3783 + .id_table = ti_id_table_3410,
3784 + .num_ports = 1,
3785 + .attach = ti_startup,
3786 +- .shutdown = ti_shutdown,
3787 ++ .release = ti_release,
3788 + .open = ti_open,
3789 + .close = ti_close,
3790 + .write = ti_write,
3791 +@@ -259,7 +259,7 @@ static struct usb_serial_driver ti_2port_device = {
3792 + .id_table = ti_id_table_5052,
3793 + .num_ports = 2,
3794 + .attach = ti_startup,
3795 +- .shutdown = ti_shutdown,
3796 ++ .release = ti_release,
3797 + .open = ti_open,
3798 + .close = ti_close,
3799 + .write = ti_write,
3800 +@@ -474,7 +474,7 @@ free_tdev:
3801 + }
3802 +
3803 +
3804 +-static void ti_shutdown(struct usb_serial *serial)
3805 ++static void ti_release(struct usb_serial *serial)
3806 + {
3807 + int i;
3808 + struct ti_device *tdev = usb_get_serial_data(serial);
3809 +@@ -487,12 +487,10 @@ static void ti_shutdown(struct usb_serial *serial)
3810 + if (tport) {
3811 + ti_buf_free(tport->tp_write_buf);
3812 + kfree(tport);
3813 +- usb_set_serial_port_data(serial->port[i], NULL);
3814 + }
3815 + }
3816 +
3817 + kfree(tdev);
3818 +- usb_set_serial_data(serial, NULL);
3819 + }
3820 +
3821 +
3822 +diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
3823 +index f331e2b..131fc74 100644
3824 +--- a/drivers/usb/serial/usb-serial.c
3825 ++++ b/drivers/usb/serial/usb-serial.c
3826 +@@ -141,6 +141,14 @@ static void destroy_serial(struct kref *kref)
3827 + if (serial->minor != SERIAL_TTY_NO_MINOR)
3828 + return_serial(serial);
3829 +
3830 ++ serial->type->release(serial);
3831 ++
3832 ++ for (i = 0; i < serial->num_ports; ++i) {
3833 ++ port = serial->port[i];
3834 ++ if (port)
3835 ++ put_device(&port->dev);
3836 ++ }
3837 ++
3838 + /* If this is a "fake" port, we have to clean it up here, as it will
3839 + * not get cleaned up in port_release() as it was never registered with
3840 + * the driver core */
3841 +@@ -148,9 +156,8 @@ static void destroy_serial(struct kref *kref)
3842 + for (i = serial->num_ports;
3843 + i < serial->num_port_pointers; ++i) {
3844 + port = serial->port[i];
3845 +- if (!port)
3846 +- continue;
3847 +- port_free(port);
3848 ++ if (port)
3849 ++ port_free(port);
3850 + }
3851 + }
3852 +
3853 +@@ -1062,10 +1069,6 @@ void usb_serial_disconnect(struct usb_interface *interface)
3854 + serial->disconnected = 1;
3855 + mutex_unlock(&serial->disc_mutex);
3856 +
3857 +- /* Unfortunately, many of the sub-drivers expect the port structures
3858 +- * to exist when their shutdown method is called, so we have to go
3859 +- * through this awkward two-step unregistration procedure.
3860 +- */
3861 + for (i = 0; i < serial->num_ports; ++i) {
3862 + port = serial->port[i];
3863 + if (port) {
3864 +@@ -1079,14 +1082,7 @@ void usb_serial_disconnect(struct usb_interface *interface)
3865 + device_del(&port->dev);
3866 + }
3867 + }
3868 +- serial->type->shutdown(serial);
3869 +- for (i = 0; i < serial->num_ports; ++i) {
3870 +- port = serial->port[i];
3871 +- if (port) {
3872 +- put_device(&port->dev);
3873 +- serial->port[i] = NULL;
3874 +- }
3875 +- }
3876 ++ serial->type->disconnect(serial);
3877 +
3878 + /* let the last holder of this object
3879 + * cause it to be cleaned up */
3880 +@@ -1262,7 +1258,8 @@ static void fixup_generic(struct usb_serial_driver *device)
3881 + set_to_generic_if_null(device, chars_in_buffer);
3882 + set_to_generic_if_null(device, read_bulk_callback);
3883 + set_to_generic_if_null(device, write_bulk_callback);
3884 +- set_to_generic_if_null(device, shutdown);
3885 ++ set_to_generic_if_null(device, disconnect);
3886 ++ set_to_generic_if_null(device, release);
3887 + }
3888 +
3889 + int usb_serial_register(struct usb_serial_driver *driver)
3890 +diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
3891 +index 5ac414b..e50f397 100644
3892 +--- a/drivers/usb/serial/visor.c
3893 ++++ b/drivers/usb/serial/visor.c
3894 +@@ -48,7 +48,7 @@ static void visor_unthrottle(struct tty_struct *tty);
3895 + static int visor_probe(struct usb_serial *serial,
3896 + const struct usb_device_id *id);
3897 + static int visor_calc_num_ports(struct usb_serial *serial);
3898 +-static void visor_shutdown(struct usb_serial *serial);
3899 ++static void visor_release(struct usb_serial *serial);
3900 + static void visor_write_bulk_callback(struct urb *urb);
3901 + static void visor_read_bulk_callback(struct urb *urb);
3902 + static void visor_read_int_callback(struct urb *urb);
3903 +@@ -203,7 +203,7 @@ static struct usb_serial_driver handspring_device = {
3904 + .attach = treo_attach,
3905 + .probe = visor_probe,
3906 + .calc_num_ports = visor_calc_num_ports,
3907 +- .shutdown = visor_shutdown,
3908 ++ .release = visor_release,
3909 + .write = visor_write,
3910 + .write_room = visor_write_room,
3911 + .write_bulk_callback = visor_write_bulk_callback,
3912 +@@ -228,7 +228,7 @@ static struct usb_serial_driver clie_5_device = {
3913 + .attach = clie_5_attach,
3914 + .probe = visor_probe,
3915 + .calc_num_ports = visor_calc_num_ports,
3916 +- .shutdown = visor_shutdown,
3917 ++ .release = visor_release,
3918 + .write = visor_write,
3919 + .write_room = visor_write_room,
3920 + .write_bulk_callback = visor_write_bulk_callback,
3921 +@@ -920,7 +920,7 @@ static int clie_5_attach(struct usb_serial *serial)
3922 + return generic_startup(serial);
3923 + }
3924 +
3925 +-static void visor_shutdown(struct usb_serial *serial)
3926 ++static void visor_release(struct usb_serial *serial)
3927 + {
3928 + struct visor_private *priv;
3929 + int i;
3930 +@@ -929,10 +929,7 @@ static void visor_shutdown(struct usb_serial *serial)
3931 +
3932 + for (i = 0; i < serial->num_ports; i++) {
3933 + priv = usb_get_serial_port_data(serial->port[i]);
3934 +- if (priv) {
3935 +- usb_set_serial_port_data(serial->port[i], NULL);
3936 +- kfree(priv);
3937 +- }
3938 ++ kfree(priv);
3939 + }
3940 + }
3941 +
3942 +diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
3943 +index 5335d32..319ec07 100644
3944 +--- a/drivers/usb/serial/whiteheat.c
3945 ++++ b/drivers/usb/serial/whiteheat.c
3946 +@@ -144,7 +144,7 @@ static int whiteheat_firmware_attach(struct usb_serial *serial);
3947 +
3948 + /* function prototypes for the Connect Tech WhiteHEAT serial converter */
3949 + static int whiteheat_attach(struct usb_serial *serial);
3950 +-static void whiteheat_shutdown(struct usb_serial *serial);
3951 ++static void whiteheat_release(struct usb_serial *serial);
3952 + static int whiteheat_open(struct tty_struct *tty,
3953 + struct usb_serial_port *port, struct file *filp);
3954 + static void whiteheat_close(struct tty_struct *tty,
3955 +@@ -190,7 +190,7 @@ static struct usb_serial_driver whiteheat_device = {
3956 + .id_table = id_table_std,
3957 + .num_ports = 4,
3958 + .attach = whiteheat_attach,
3959 +- .shutdown = whiteheat_shutdown,
3960 ++ .release = whiteheat_release,
3961 + .open = whiteheat_open,
3962 + .close = whiteheat_close,
3963 + .write = whiteheat_write,
3964 +@@ -618,7 +618,7 @@ no_command_buffer:
3965 + }
3966 +
3967 +
3968 +-static void whiteheat_shutdown(struct usb_serial *serial)
3969 ++static void whiteheat_release(struct usb_serial *serial)
3970 + {
3971 + struct usb_serial_port *command_port;
3972 + struct usb_serial_port *port;
3973 +diff --git a/fs/Kconfig b/fs/Kconfig
3974 +index 9f7270f..ab3ccc1 100644
3975 +--- a/fs/Kconfig
3976 ++++ b/fs/Kconfig
3977 +@@ -39,6 +39,13 @@ config FS_POSIX_ACL
3978 + bool
3979 + default n
3980 +
3981 ++source "fs/xfs/Kconfig"
3982 ++source "fs/gfs2/Kconfig"
3983 ++source "fs/ocfs2/Kconfig"
3984 ++source "fs/btrfs/Kconfig"
3985 ++
3986 ++endif # BLOCK
3987 ++
3988 + config FILE_LOCKING
3989 + bool "Enable POSIX file locking API" if EMBEDDED
3990 + default y
3991 +@@ -47,13 +54,6 @@ config FILE_LOCKING
3992 + for filesystems like NFS and for the flock() system
3993 + call. Disabling this option saves about 11k.
3994 +
3995 +-source "fs/xfs/Kconfig"
3996 +-source "fs/gfs2/Kconfig"
3997 +-source "fs/ocfs2/Kconfig"
3998 +-source "fs/btrfs/Kconfig"
3999 +-
4000 +-endif # BLOCK
4001 +-
4002 + source "fs/notify/Kconfig"
4003 +
4004 + source "fs/quota/Kconfig"
4005 +diff --git a/fs/cifs/file.c b/fs/cifs/file.c
4006 +index 302ea15..bd44591 100644
4007 +--- a/fs/cifs/file.c
4008 ++++ b/fs/cifs/file.c
4009 +@@ -491,9 +491,9 @@ static int cifs_reopen_file(struct file *file, bool can_flush)
4010 + return -EBADF;
4011 +
4012 + xid = GetXid();
4013 +- mutex_unlock(&pCifsFile->fh_mutex);
4014 ++ mutex_lock(&pCifsFile->fh_mutex);
4015 + if (!pCifsFile->invalidHandle) {
4016 +- mutex_lock(&pCifsFile->fh_mutex);
4017 ++ mutex_unlock(&pCifsFile->fh_mutex);
4018 + FreeXid(xid);
4019 + return 0;
4020 + }
4021 +@@ -524,7 +524,7 @@ static int cifs_reopen_file(struct file *file, bool can_flush)
4022 + if (full_path == NULL) {
4023 + rc = -ENOMEM;
4024 + reopen_error_exit:
4025 +- mutex_lock(&pCifsFile->fh_mutex);
4026 ++ mutex_unlock(&pCifsFile->fh_mutex);
4027 + FreeXid(xid);
4028 + return rc;
4029 + }
4030 +@@ -566,14 +566,14 @@ reopen_error_exit:
4031 + cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
4032 + CIFS_MOUNT_MAP_SPECIAL_CHR);
4033 + if (rc) {
4034 +- mutex_lock(&pCifsFile->fh_mutex);
4035 ++ mutex_unlock(&pCifsFile->fh_mutex);
4036 + cFYI(1, ("cifs_open returned 0x%x", rc));
4037 + cFYI(1, ("oplock: %d", oplock));
4038 + } else {
4039 + reopen_success:
4040 + pCifsFile->netfid = netfid;
4041 + pCifsFile->invalidHandle = false;
4042 +- mutex_lock(&pCifsFile->fh_mutex);
4043 ++ mutex_unlock(&pCifsFile->fh_mutex);
4044 + pCifsInode = CIFS_I(inode);
4045 + if (pCifsInode) {
4046 + if (can_flush) {
4047 +diff --git a/fs/eventpoll.c b/fs/eventpoll.c
4048 +index 5458e80..085c5c0 100644
4049 +--- a/fs/eventpoll.c
4050 ++++ b/fs/eventpoll.c
4051 +@@ -98,7 +98,7 @@ struct epoll_filefd {
4052 + struct nested_call_node {
4053 + struct list_head llink;
4054 + void *cookie;
4055 +- int cpu;
4056 ++ void *ctx;
4057 + };
4058 +
4059 + /*
4060 +@@ -317,17 +317,17 @@ static void ep_nested_calls_init(struct nested_calls *ncalls)
4061 + * @nproc: Nested call core function pointer.
4062 + * @priv: Opaque data to be passed to the @nproc callback.
4063 + * @cookie: Cookie to be used to identify this nested call.
4064 ++ * @ctx: This instance context.
4065 + *
4066 + * Returns: Returns the code returned by the @nproc callback, or -1 if
4067 + * the maximum recursion limit has been exceeded.
4068 + */
4069 + static int ep_call_nested(struct nested_calls *ncalls, int max_nests,
4070 + int (*nproc)(void *, void *, int), void *priv,
4071 +- void *cookie)
4072 ++ void *cookie, void *ctx)
4073 + {
4074 + int error, call_nests = 0;
4075 + unsigned long flags;
4076 +- int this_cpu = get_cpu();
4077 + struct list_head *lsthead = &ncalls->tasks_call_list;
4078 + struct nested_call_node *tncur;
4079 + struct nested_call_node tnode;
4080 +@@ -340,7 +340,7 @@ static int ep_call_nested(struct nested_calls *ncalls, int max_nests,
4081 + * very much limited.
4082 + */
4083 + list_for_each_entry(tncur, lsthead, llink) {
4084 +- if (tncur->cpu == this_cpu &&
4085 ++ if (tncur->ctx == ctx &&
4086 + (tncur->cookie == cookie || ++call_nests > max_nests)) {
4087 + /*
4088 + * Ops ... loop detected or maximum nest level reached.
4089 +@@ -352,7 +352,7 @@ static int ep_call_nested(struct nested_calls *ncalls, int max_nests,
4090 + }
4091 +
4092 + /* Add the current task and cookie to the list */
4093 +- tnode.cpu = this_cpu;
4094 ++ tnode.ctx = ctx;
4095 + tnode.cookie = cookie;
4096 + list_add(&tnode.llink, lsthead);
4097 +
4098 +@@ -364,10 +364,9 @@ static int ep_call_nested(struct nested_calls *ncalls, int max_nests,
4099 + /* Remove the current task from the list */
4100 + spin_lock_irqsave(&ncalls->lock, flags);
4101 + list_del(&tnode.llink);
4102 +- out_unlock:
4103 ++out_unlock:
4104 + spin_unlock_irqrestore(&ncalls->lock, flags);
4105 +
4106 +- put_cpu();
4107 + return error;
4108 + }
4109 +
4110 +@@ -408,8 +407,12 @@ static int ep_poll_wakeup_proc(void *priv, void *cookie, int call_nests)
4111 + */
4112 + static void ep_poll_safewake(wait_queue_head_t *wq)
4113 + {
4114 ++ int this_cpu = get_cpu();
4115 ++
4116 + ep_call_nested(&poll_safewake_ncalls, EP_MAX_NESTS,
4117 +- ep_poll_wakeup_proc, NULL, wq);
4118 ++ ep_poll_wakeup_proc, NULL, wq, (void *) (long) this_cpu);
4119 ++
4120 ++ put_cpu();
4121 + }
4122 +
4123 + /*
4124 +@@ -663,7 +666,7 @@ static unsigned int ep_eventpoll_poll(struct file *file, poll_table *wait)
4125 + * could re-enter here.
4126 + */
4127 + pollflags = ep_call_nested(&poll_readywalk_ncalls, EP_MAX_NESTS,
4128 +- ep_poll_readyevents_proc, ep, ep);
4129 ++ ep_poll_readyevents_proc, ep, ep, current);
4130 +
4131 + return pollflags != -1 ? pollflags : 0;
4132 + }
4133 +diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
4134 +index 91013ff..39083e4 100644
4135 +--- a/fs/fs-writeback.c
4136 ++++ b/fs/fs-writeback.c
4137 +@@ -289,7 +289,6 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
4138 + int ret;
4139 +
4140 + BUG_ON(inode->i_state & I_SYNC);
4141 +- WARN_ON(inode->i_state & I_NEW);
4142 +
4143 + /* Set I_SYNC, reset I_DIRTY */
4144 + dirty = inode->i_state & I_DIRTY;
4145 +@@ -314,7 +313,6 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
4146 + }
4147 +
4148 + spin_lock(&inode_lock);
4149 +- WARN_ON(inode->i_state & I_NEW);
4150 + inode->i_state &= ~I_SYNC;
4151 + if (!(inode->i_state & I_FREEING)) {
4152 + if (!(inode->i_state & I_DIRTY) &&
4153 +diff --git a/fs/jfs/jfs_extent.c b/fs/jfs/jfs_extent.c
4154 +index bbbd5f2..41d6045 100644
4155 +--- a/fs/jfs/jfs_extent.c
4156 ++++ b/fs/jfs/jfs_extent.c
4157 +@@ -391,6 +391,7 @@ int extHint(struct inode *ip, s64 offset, xad_t * xp)
4158 + }
4159 + XADaddress(xp, xaddr);
4160 + XADlength(xp, xlen);
4161 ++ XADoffset(xp, prev);
4162 + /*
4163 + * only preserve the abnr flag within the xad flags
4164 + * of the returned hint.
4165 +diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
4166 +index 79ff8d9..1a0f632 100644
4167 +--- a/fs/ocfs2/super.c
4168 ++++ b/fs/ocfs2/super.c
4169 +@@ -232,20 +232,24 @@ static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len)
4170 + "%10s => Opts: 0x%lX AtimeQuanta: %u\n", "Mount",
4171 + osb->s_mount_opt, osb->s_atime_quantum);
4172 +
4173 +- out += snprintf(buf + out, len - out,
4174 +- "%10s => Stack: %s Name: %*s Version: %d.%d\n",
4175 +- "Cluster",
4176 +- (*osb->osb_cluster_stack == '\0' ?
4177 +- "o2cb" : osb->osb_cluster_stack),
4178 +- cconn->cc_namelen, cconn->cc_name,
4179 +- cconn->cc_version.pv_major, cconn->cc_version.pv_minor);
4180 ++ if (cconn) {
4181 ++ out += snprintf(buf + out, len - out,
4182 ++ "%10s => Stack: %s Name: %*s "
4183 ++ "Version: %d.%d\n", "Cluster",
4184 ++ (*osb->osb_cluster_stack == '\0' ?
4185 ++ "o2cb" : osb->osb_cluster_stack),
4186 ++ cconn->cc_namelen, cconn->cc_name,
4187 ++ cconn->cc_version.pv_major,
4188 ++ cconn->cc_version.pv_minor);
4189 ++ }
4190 +
4191 + spin_lock(&osb->dc_task_lock);
4192 + out += snprintf(buf + out, len - out,
4193 + "%10s => Pid: %d Count: %lu WakeSeq: %lu "
4194 + "WorkSeq: %lu\n", "DownCnvt",
4195 +- task_pid_nr(osb->dc_task), osb->blocked_lock_count,
4196 +- osb->dc_wake_sequence, osb->dc_work_sequence);
4197 ++ (osb->dc_task ? task_pid_nr(osb->dc_task) : -1),
4198 ++ osb->blocked_lock_count, osb->dc_wake_sequence,
4199 ++ osb->dc_work_sequence);
4200 + spin_unlock(&osb->dc_task_lock);
4201 +
4202 + spin_lock(&osb->osb_lock);
4203 +@@ -265,14 +269,15 @@ static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len)
4204 +
4205 + out += snprintf(buf + out, len - out,
4206 + "%10s => Pid: %d Interval: %lu Needs: %d\n", "Commit",
4207 +- task_pid_nr(osb->commit_task), osb->osb_commit_interval,
4208 ++ (osb->commit_task ? task_pid_nr(osb->commit_task) : -1),
4209 ++ osb->osb_commit_interval,
4210 + atomic_read(&osb->needs_checkpoint));
4211 +
4212 + out += snprintf(buf + out, len - out,
4213 +- "%10s => State: %d NumTxns: %d TxnId: %lu\n",
4214 ++ "%10s => State: %d TxnId: %lu NumTxns: %d\n",
4215 + "Journal", osb->journal->j_state,
4216 +- atomic_read(&osb->journal->j_num_trans),
4217 +- osb->journal->j_trans_id);
4218 ++ osb->journal->j_trans_id,
4219 ++ atomic_read(&osb->journal->j_num_trans));
4220 +
4221 + out += snprintf(buf + out, len - out,
4222 + "%10s => GlobalAllocs: %d LocalAllocs: %d "
4223 +@@ -300,7 +305,6 @@ static int ocfs2_osb_dump(struct ocfs2_super *osb, char *buf, int len)
4224 +
4225 + out += snprintf(buf + out, len - out, "%10s => %3s %10s\n",
4226 + "Slots", "Num", "RecoGen");
4227 +-
4228 + for (i = 0; i < osb->max_slots; ++i) {
4229 + out += snprintf(buf + out, len - out,
4230 + "%10s %c %3d %10d\n",
4231 +diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
4232 +index 3a6b193..0ff7566 100644
4233 +--- a/fs/ramfs/inode.c
4234 ++++ b/fs/ramfs/inode.c
4235 +@@ -202,9 +202,12 @@ static int ramfs_parse_options(char *data, struct ramfs_mount_opts *opts)
4236 + return -EINVAL;
4237 + opts->mode = option & S_IALLUGO;
4238 + break;
4239 +- default:
4240 +- printk(KERN_ERR "ramfs: bad mount option: %s\n", p);
4241 +- return -EINVAL;
4242 ++ /*
4243 ++ * We might like to report bad mount options here;
4244 ++ * but traditionally ramfs has ignored all mount options,
4245 ++ * and as it is used as a !CONFIG_SHMEM simple substitute
4246 ++ * for tmpfs, better continue to ignore other mount options.
4247 ++ */
4248 + }
4249 + }
4250 +
4251 +diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
4252 +index ca7c600..b5cba98 100644
4253 +--- a/fs/xfs/xfs_bmap.c
4254 ++++ b/fs/xfs/xfs_bmap.c
4255 +@@ -6085,6 +6085,7 @@ xfs_getbmap(
4256 + break;
4257 + }
4258 +
4259 ++ kmem_free(out);
4260 + return error;
4261 + }
4262 +
4263 +diff --git a/include/linux/firmware-map.h b/include/linux/firmware-map.h
4264 +index cca686b..875451f 100644
4265 +--- a/include/linux/firmware-map.h
4266 ++++ b/include/linux/firmware-map.h
4267 +@@ -24,21 +24,17 @@
4268 + */
4269 + #ifdef CONFIG_FIRMWARE_MEMMAP
4270 +
4271 +-int firmware_map_add(resource_size_t start, resource_size_t end,
4272 +- const char *type);
4273 +-int firmware_map_add_early(resource_size_t start, resource_size_t end,
4274 +- const char *type);
4275 ++int firmware_map_add(u64 start, u64 end, const char *type);
4276 ++int firmware_map_add_early(u64 start, u64 end, const char *type);
4277 +
4278 + #else /* CONFIG_FIRMWARE_MEMMAP */
4279 +
4280 +-static inline int firmware_map_add(resource_size_t start, resource_size_t end,
4281 +- const char *type)
4282 ++static inline int firmware_map_add(u64 start, u64 end, const char *type)
4283 + {
4284 + return 0;
4285 + }
4286 +
4287 +-static inline int firmware_map_add_early(resource_size_t start,
4288 +- resource_size_t end, const char *type)
4289 ++static inline int firmware_map_add_early(u64 start, u64 end, const char *type)
4290 + {
4291 + return 0;
4292 + }
4293 +diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
4294 +index 894a56e..5eed8fa 100644
4295 +--- a/include/linux/kvm_host.h
4296 ++++ b/include/linux/kvm_host.h
4297 +@@ -125,6 +125,7 @@ struct kvm_kernel_irq_routing_entry {
4298 + struct kvm {
4299 + struct mutex lock; /* protects the vcpus array and APIC accesses */
4300 + spinlock_t mmu_lock;
4301 ++ spinlock_t requests_lock;
4302 + struct rw_semaphore slots_lock;
4303 + struct mm_struct *mm; /* userspace tied to this vm */
4304 + int nmemslots;
4305 +diff --git a/include/linux/mlx4/qp.h b/include/linux/mlx4/qp.h
4306 +index bf8f119..9f29d86 100644
4307 +--- a/include/linux/mlx4/qp.h
4308 ++++ b/include/linux/mlx4/qp.h
4309 +@@ -165,6 +165,7 @@ enum {
4310 + MLX4_WQE_CTRL_IP_CSUM = 1 << 4,
4311 + MLX4_WQE_CTRL_TCP_UDP_CSUM = 1 << 5,
4312 + MLX4_WQE_CTRL_INS_VLAN = 1 << 6,
4313 ++ MLX4_WQE_CTRL_STRONG_ORDER = 1 << 7,
4314 + };
4315 +
4316 + struct mlx4_wqe_ctrl_seg {
4317 +diff --git a/include/linux/serial.h b/include/linux/serial.h
4318 +index 9136cc5..e5bb75a 100644
4319 +--- a/include/linux/serial.h
4320 ++++ b/include/linux/serial.h
4321 +@@ -96,54 +96,76 @@ struct serial_uart_config {
4322 +
4323 + /*
4324 + * Definitions for async_struct (and serial_struct) flags field
4325 ++ *
4326 ++ * Define ASYNCB_* for convenient use with {test,set,clear}_bit.
4327 + */
4328 +-#define ASYNC_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes
4329 +- on the callout port */
4330 +-#define ASYNC_FOURPORT 0x0002 /* Set OU1, OUT2 per AST Fourport settings */
4331 +-#define ASYNC_SAK 0x0004 /* Secure Attention Key (Orange book) */
4332 +-#define ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */
4333 +-
4334 +-#define ASYNC_SPD_MASK 0x1030
4335 +-#define ASYNC_SPD_HI 0x0010 /* Use 56000 instead of 38400 bps */
4336 +-
4337 +-#define ASYNC_SPD_VHI 0x0020 /* Use 115200 instead of 38400 bps */
4338 +-#define ASYNC_SPD_CUST 0x0030 /* Use user-specified divisor */
4339 +-
4340 +-#define ASYNC_SKIP_TEST 0x0040 /* Skip UART test during autoconfiguration */
4341 +-#define ASYNC_AUTO_IRQ 0x0080 /* Do automatic IRQ during autoconfiguration */
4342 +-#define ASYNC_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
4343 +-#define ASYNC_PGRP_LOCKOUT 0x0200 /* Lock out cua opens based on pgrp */
4344 +-#define ASYNC_CALLOUT_NOHUP 0x0400 /* Don't do hangups for cua device */
4345 +-
4346 +-#define ASYNC_HARDPPS_CD 0x0800 /* Call hardpps when CD goes high */
4347 +-
4348 +-#define ASYNC_SPD_SHI 0x1000 /* Use 230400 instead of 38400 bps */
4349 +-#define ASYNC_SPD_WARP 0x1010 /* Use 460800 instead of 38400 bps */
4350 +-
4351 +-#define ASYNC_LOW_LATENCY 0x2000 /* Request low latency behaviour */
4352 +-
4353 +-#define ASYNC_BUGGY_UART 0x4000 /* This is a buggy UART, skip some safety
4354 +- * checks. Note: can be dangerous! */
4355 +-
4356 +-#define ASYNC_AUTOPROBE 0x8000 /* Port was autoprobed by PCI or PNP code */
4357 +-
4358 +-#define ASYNC_FLAGS 0x7FFF /* Possible legal async flags */
4359 +-#define ASYNC_USR_MASK 0x3430 /* Legal flags that non-privileged
4360 +- * users can set or reset */
4361 +-
4362 +-/* Internal flags used only by kernel/chr_drv/serial.c */
4363 +-#define ASYNC_INITIALIZED 0x80000000 /* Serial port was initialized */
4364 +-#define ASYNC_NORMAL_ACTIVE 0x20000000 /* Normal device is active */
4365 +-#define ASYNC_BOOT_AUTOCONF 0x10000000 /* Autoconfigure port on bootup */
4366 +-#define ASYNC_CLOSING 0x08000000 /* Serial port is closing */
4367 +-#define ASYNC_CTS_FLOW 0x04000000 /* Do CTS flow control */
4368 +-#define ASYNC_CHECK_CD 0x02000000 /* i.e., CLOCAL */
4369 +-#define ASYNC_SHARE_IRQ 0x01000000 /* for multifunction cards
4370 +- --- no longer used */
4371 +-#define ASYNC_CONS_FLOW 0x00800000 /* flow control for console */
4372 +-
4373 +-#define ASYNC_BOOT_ONLYMCA 0x00400000 /* Probe only if MCA bus */
4374 +-#define ASYNC_INTERNAL_FLAGS 0xFFC00000 /* Internal flags */
4375 ++#define ASYNCB_HUP_NOTIFY 0 /* Notify getty on hangups and closes
4376 ++ * on the callout port */
4377 ++#define ASYNCB_FOURPORT 1 /* Set OU1, OUT2 per AST Fourport settings */
4378 ++#define ASYNCB_SAK 2 /* Secure Attention Key (Orange book) */
4379 ++#define ASYNCB_SPLIT_TERMIOS 3 /* Separate termios for dialin/callout */
4380 ++#define ASYNCB_SPD_HI 4 /* Use 56000 instead of 38400 bps */
4381 ++#define ASYNCB_SPD_VHI 5 /* Use 115200 instead of 38400 bps */
4382 ++#define ASYNCB_SKIP_TEST 6 /* Skip UART test during autoconfiguration */
4383 ++#define ASYNCB_AUTO_IRQ 7 /* Do automatic IRQ during
4384 ++ * autoconfiguration */
4385 ++#define ASYNCB_SESSION_LOCKOUT 8 /* Lock out cua opens based on session */
4386 ++#define ASYNCB_PGRP_LOCKOUT 9 /* Lock out cua opens based on pgrp */
4387 ++#define ASYNCB_CALLOUT_NOHUP 10 /* Don't do hangups for cua device */
4388 ++#define ASYNCB_HARDPPS_CD 11 /* Call hardpps when CD goes high */
4389 ++#define ASYNCB_SPD_SHI 12 /* Use 230400 instead of 38400 bps */
4390 ++#define ASYNCB_LOW_LATENCY 13 /* Request low latency behaviour */
4391 ++#define ASYNCB_BUGGY_UART 14 /* This is a buggy UART, skip some safety
4392 ++ * checks. Note: can be dangerous! */
4393 ++#define ASYNCB_AUTOPROBE 15 /* Port was autoprobed by PCI or PNP code */
4394 ++#define ASYNCB_LAST_USER 15
4395 ++
4396 ++/* Internal flags used only by kernel */
4397 ++#define ASYNCB_INITIALIZED 31 /* Serial port was initialized */
4398 ++#define ASYNCB_NORMAL_ACTIVE 29 /* Normal device is active */
4399 ++#define ASYNCB_BOOT_AUTOCONF 28 /* Autoconfigure port on bootup */
4400 ++#define ASYNCB_CLOSING 27 /* Serial port is closing */
4401 ++#define ASYNCB_CTS_FLOW 26 /* Do CTS flow control */
4402 ++#define ASYNCB_CHECK_CD 25 /* i.e., CLOCAL */
4403 ++#define ASYNCB_SHARE_IRQ 24 /* for multifunction cards, no longer used */
4404 ++#define ASYNCB_CONS_FLOW 23 /* flow control for console */
4405 ++#define ASYNCB_BOOT_ONLYMCA 22 /* Probe only if MCA bus */
4406 ++#define ASYNCB_FIRST_KERNEL 22
4407 ++
4408 ++#define ASYNC_HUP_NOTIFY (1U << ASYNCB_HUP_NOTIFY)
4409 ++#define ASYNC_FOURPORT (1U << ASYNCB_FOURPORT)
4410 ++#define ASYNC_SAK (1U << ASYNCB_SAK)
4411 ++#define ASYNC_SPLIT_TERMIOS (1U << ASYNCB_SPLIT_TERMIOS)
4412 ++#define ASYNC_SPD_HI (1U << ASYNCB_SPD_HI)
4413 ++#define ASYNC_SPD_VHI (1U << ASYNCB_SPD_VHI)
4414 ++#define ASYNC_SKIP_TEST (1U << ASYNCB_SKIP_TEST)
4415 ++#define ASYNC_AUTO_IRQ (1U << ASYNCB_AUTO_IRQ)
4416 ++#define ASYNC_SESSION_LOCKOUT (1U << ASYNCB_SESSION_LOCKOUT)
4417 ++#define ASYNC_PGRP_LOCKOUT (1U << ASYNCB_PGRP_LOCKOUT)
4418 ++#define ASYNC_CALLOUT_NOHUP (1U << ASYNCB_CALLOUT_NOHUP)
4419 ++#define ASYNC_HARDPPS_CD (1U << ASYNCB_HARDPPS_CD)
4420 ++#define ASYNC_SPD_SHI (1U << ASYNCB_SPD_SHI)
4421 ++#define ASYNC_LOW_LATENCY (1U << ASYNCB_LOW_LATENCY)
4422 ++#define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART)
4423 ++#define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE)
4424 ++
4425 ++#define ASYNC_FLAGS ((1U << ASYNCB_LAST_USER) - 1)
4426 ++#define ASYNC_USR_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI| \
4427 ++ ASYNC_CALLOUT_NOHUP|ASYNC_SPD_SHI|ASYNC_LOW_LATENCY)
4428 ++#define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI)
4429 ++#define ASYNC_SPD_WARP (ASYNC_SPD_HI|ASYNC_SPD_SHI)
4430 ++#define ASYNC_SPD_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI|ASYNC_SPD_SHI)
4431 ++
4432 ++#define ASYNC_INITIALIZED (1U << ASYNCB_INITIALIZED)
4433 ++#define ASYNC_NORMAL_ACTIVE (1U << ASYNCB_NORMAL_ACTIVE)
4434 ++#define ASYNC_BOOT_AUTOCONF (1U << ASYNCB_BOOT_AUTOCONF)
4435 ++#define ASYNC_CLOSING (1U << ASYNCB_CLOSING)
4436 ++#define ASYNC_CTS_FLOW (1U << ASYNCB_CTS_FLOW)
4437 ++#define ASYNC_CHECK_CD (1U << ASYNCB_CHECK_CD)
4438 ++#define ASYNC_SHARE_IRQ (1U << ASYNCB_SHARE_IRQ)
4439 ++#define ASYNC_CONS_FLOW (1U << ASYNCB_CONS_FLOW)
4440 ++#define ASYNC_BOOT_ONLYMCA (1U << ASYNCB_BOOT_ONLYMCA)
4441 ++#define ASYNC_INTERNAL_FLAGS (~((1U << ASYNCB_FIRST_KERNEL) - 1))
4442 +
4443 + /*
4444 + * Multiport serial configuration structure --- external structure
4445 +diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
4446 +index 625e9e4..6d6c3b8 100644
4447 +--- a/include/linux/usb/serial.h
4448 ++++ b/include/linux/usb/serial.h
4449 +@@ -181,8 +181,10 @@ static inline void usb_set_serial_data(struct usb_serial *serial, void *data)
4450 + * This will be called when the struct usb_serial structure is fully set
4451 + * set up. Do any local initialization of the device, or any private
4452 + * memory structure allocation at this point in time.
4453 +- * @shutdown: pointer to the driver's shutdown function. This will be
4454 +- * called when the device is removed from the system.
4455 ++ * @disconnect: pointer to the driver's disconnect function. This will be
4456 ++ * called when the device is unplugged or unbound from the driver.
4457 ++ * @release: pointer to the driver's release function. This will be called
4458 ++ * when the usb_serial data structure is about to be destroyed.
4459 + * @usb_driver: pointer to the struct usb_driver that controls this
4460 + * device. This is necessary to allow dynamic ids to be added to
4461 + * the driver from sysfs.
4462 +@@ -212,7 +214,8 @@ struct usb_serial_driver {
4463 + int (*attach)(struct usb_serial *serial);
4464 + int (*calc_num_ports) (struct usb_serial *serial);
4465 +
4466 +- void (*shutdown)(struct usb_serial *serial);
4467 ++ void (*disconnect)(struct usb_serial *serial);
4468 ++ void (*release)(struct usb_serial *serial);
4469 +
4470 + int (*port_probe)(struct usb_serial_port *port);
4471 + int (*port_remove)(struct usb_serial_port *port);
4472 +@@ -292,7 +295,8 @@ extern void usb_serial_generic_read_bulk_callback(struct urb *urb);
4473 + extern void usb_serial_generic_write_bulk_callback(struct urb *urb);
4474 + extern void usb_serial_generic_throttle(struct tty_struct *tty);
4475 + extern void usb_serial_generic_unthrottle(struct tty_struct *tty);
4476 +-extern void usb_serial_generic_shutdown(struct usb_serial *serial);
4477 ++extern void usb_serial_generic_disconnect(struct usb_serial *serial);
4478 ++extern void usb_serial_generic_release(struct usb_serial *serial);
4479 + extern int usb_serial_generic_register(int debug);
4480 + extern void usb_serial_generic_deregister(void);
4481 +
4482 +diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
4483 +index 524cd1b..cfdd3ca 100644
4484 +--- a/include/linux/vmstat.h
4485 ++++ b/include/linux/vmstat.h
4486 +@@ -36,6 +36,9 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
4487 + FOR_ALL_ZONES(PGSTEAL),
4488 + FOR_ALL_ZONES(PGSCAN_KSWAPD),
4489 + FOR_ALL_ZONES(PGSCAN_DIRECT),
4490 ++#ifdef CONFIG_NUMA
4491 ++ PGSCAN_ZONE_RECLAIM_FAILED,
4492 ++#endif
4493 + PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL,
4494 + PAGEOUTRUN, ALLOCSTALL, PGROTATED,
4495 + #ifdef CONFIG_HUGETLB_PAGE
4496 +diff --git a/include/net/x25.h b/include/net/x25.h
4497 +index fc3f03d..2cda040 100644
4498 +--- a/include/net/x25.h
4499 ++++ b/include/net/x25.h
4500 +@@ -187,7 +187,7 @@ extern int x25_addr_ntoa(unsigned char *, struct x25_address *,
4501 + extern int x25_addr_aton(unsigned char *, struct x25_address *,
4502 + struct x25_address *);
4503 + extern struct sock *x25_find_socket(unsigned int, struct x25_neigh *);
4504 +-extern void x25_destroy_socket(struct sock *);
4505 ++extern void x25_destroy_socket_from_timer(struct sock *);
4506 + extern int x25_rx_call_request(struct sk_buff *, struct x25_neigh *, unsigned int);
4507 + extern void x25_kill_by_neigh(struct x25_neigh *);
4508 +
4509 +diff --git a/kernel/acct.c b/kernel/acct.c
4510 +index 7afa315..9f33910 100644
4511 +--- a/kernel/acct.c
4512 ++++ b/kernel/acct.c
4513 +@@ -215,6 +215,7 @@ static void acct_file_reopen(struct bsd_acct_struct *acct, struct file *file,
4514 + static int acct_on(char *name)
4515 + {
4516 + struct file *file;
4517 ++ struct vfsmount *mnt;
4518 + int error;
4519 + struct pid_namespace *ns;
4520 + struct bsd_acct_struct *acct = NULL;
4521 +@@ -256,11 +257,12 @@ static int acct_on(char *name)
4522 + acct = NULL;
4523 + }
4524 +
4525 +- mnt_pin(file->f_path.mnt);
4526 ++ mnt = file->f_path.mnt;
4527 ++ mnt_pin(mnt);
4528 + acct_file_reopen(ns->bacct, file, ns);
4529 + spin_unlock(&acct_lock);
4530 +
4531 +- mntput(file->f_path.mnt); /* it's pinned, now give up active reference */
4532 ++ mntput(mnt); /* it's pinned, now give up active reference */
4533 + kfree(acct);
4534 +
4535 + return 0;
4536 +diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
4537 +index c9a0b7d..90f1347 100644
4538 +--- a/kernel/trace/trace_functions.c
4539 ++++ b/kernel/trace/trace_functions.c
4540 +@@ -193,9 +193,11 @@ static void tracing_start_function_trace(void)
4541 + static void tracing_stop_function_trace(void)
4542 + {
4543 + ftrace_function_enabled = 0;
4544 +- /* OK if they are not registered */
4545 +- unregister_ftrace_function(&trace_stack_ops);
4546 +- unregister_ftrace_function(&trace_ops);
4547 ++
4548 ++ if (func_flags.val & TRACE_FUNC_OPT_STACK)
4549 ++ unregister_ftrace_function(&trace_stack_ops);
4550 ++ else
4551 ++ unregister_ftrace_function(&trace_ops);
4552 + }
4553 +
4554 + static int func_set_flag(u32 old_flags, u32 bit, int set)
4555 +diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
4556 +index 6cdcf38..3be4b7c 100644
4557 +--- a/lib/Kconfig.debug
4558 ++++ b/lib/Kconfig.debug
4559 +@@ -440,7 +440,7 @@ config LOCKDEP
4560 + bool
4561 + depends on DEBUG_KERNEL && TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
4562 + select STACKTRACE
4563 +- select FRAME_POINTER if !X86 && !MIPS && !PPC && !ARM_UNWIND && !S390
4564 ++ select FRAME_POINTER if !MIPS && !PPC && !ARM_UNWIND && !S390
4565 + select KALLSYMS
4566 + select KALLSYMS_ALL
4567 +
4568 +diff --git a/lib/dma-debug.c b/lib/dma-debug.c
4569 +index 69da09a..2b16536 100644
4570 +--- a/lib/dma-debug.c
4571 ++++ b/lib/dma-debug.c
4572 +@@ -185,15 +185,50 @@ static void put_hash_bucket(struct hash_bucket *bucket,
4573 + static struct dma_debug_entry *hash_bucket_find(struct hash_bucket *bucket,
4574 + struct dma_debug_entry *ref)
4575 + {
4576 +- struct dma_debug_entry *entry;
4577 ++ struct dma_debug_entry *entry, *ret = NULL;
4578 ++ int matches = 0, match_lvl, last_lvl = 0;
4579 +
4580 + list_for_each_entry(entry, &bucket->list, list) {
4581 +- if ((entry->dev_addr == ref->dev_addr) &&
4582 +- (entry->dev == ref->dev))
4583 ++ if ((entry->dev_addr != ref->dev_addr) ||
4584 ++ (entry->dev != ref->dev))
4585 ++ continue;
4586 ++
4587 ++ /*
4588 ++ * Some drivers map the same physical address multiple
4589 ++ * times. Without a hardware IOMMU this results in the
4590 ++ * same device addresses being put into the dma-debug
4591 ++ * hash multiple times too. This can result in false
4592 ++ * positives being reported. Therfore we implement a
4593 ++ * best-fit algorithm here which returns the entry from
4594 ++ * the hash which fits best to the reference value
4595 ++ * instead of the first-fit.
4596 ++ */
4597 ++ matches += 1;
4598 ++ match_lvl = 0;
4599 ++ entry->size == ref->size ? ++match_lvl : match_lvl;
4600 ++ entry->type == ref->type ? ++match_lvl : match_lvl;
4601 ++ entry->direction == ref->direction ? ++match_lvl : match_lvl;
4602 ++
4603 ++ if (match_lvl == 3) {
4604 ++ /* perfect-fit - return the result */
4605 + return entry;
4606 ++ } else if (match_lvl > last_lvl) {
4607 ++ /*
4608 ++ * We found an entry that fits better then the
4609 ++ * previous one
4610 ++ */
4611 ++ last_lvl = match_lvl;
4612 ++ ret = entry;
4613 ++ }
4614 + }
4615 +
4616 +- return NULL;
4617 ++ /*
4618 ++ * If we have multiple matches but no perfect-fit, just return
4619 ++ * NULL.
4620 ++ */
4621 ++ ret = (matches == 1) ? ret : NULL;
4622 ++
4623 ++ return ret;
4624 + }
4625 +
4626 + /*
4627 +diff --git a/lib/genalloc.c b/lib/genalloc.c
4628 +index f6d276d..eed2bdb 100644
4629 +--- a/lib/genalloc.c
4630 ++++ b/lib/genalloc.c
4631 +@@ -85,7 +85,6 @@ void gen_pool_destroy(struct gen_pool *pool)
4632 + int bit, end_bit;
4633 +
4634 +
4635 +- write_lock(&pool->lock);
4636 + list_for_each_safe(_chunk, _next_chunk, &pool->chunks) {
4637 + chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk);
4638 + list_del(&chunk->next_chunk);
4639 +diff --git a/mm/page_alloc.c b/mm/page_alloc.c
4640 +index fe753ec..f820383 100644
4641 +--- a/mm/page_alloc.c
4642 ++++ b/mm/page_alloc.c
4643 +@@ -2812,7 +2812,7 @@ bad:
4644 + if (dzone == zone)
4645 + break;
4646 + kfree(zone_pcp(dzone, cpu));
4647 +- zone_pcp(dzone, cpu) = NULL;
4648 ++ zone_pcp(dzone, cpu) = &boot_pageset[cpu];
4649 + }
4650 + return -ENOMEM;
4651 + }
4652 +@@ -2827,7 +2827,7 @@ static inline void free_zone_pagesets(int cpu)
4653 + /* Free per_cpu_pageset if it is slab allocated */
4654 + if (pset != &boot_pageset[cpu])
4655 + kfree(pset);
4656 +- zone_pcp(zone, cpu) = NULL;
4657 ++ zone_pcp(zone, cpu) = &boot_pageset[cpu];
4658 + }
4659 + }
4660 +
4661 +@@ -4501,7 +4501,7 @@ int percpu_pagelist_fraction_sysctl_handler(ctl_table *table, int write,
4662 + ret = proc_dointvec_minmax(table, write, file, buffer, length, ppos);
4663 + if (!write || (ret == -EINVAL))
4664 + return ret;
4665 +- for_each_zone(zone) {
4666 ++ for_each_populated_zone(zone) {
4667 + for_each_online_cpu(cpu) {
4668 + unsigned long high;
4669 + high = zone->present_pages / percpu_pagelist_fraction;
4670 +diff --git a/mm/vmscan.c b/mm/vmscan.c
4671 +index d254306..2500b01 100644
4672 +--- a/mm/vmscan.c
4673 ++++ b/mm/vmscan.c
4674 +@@ -2290,6 +2290,48 @@ int sysctl_min_unmapped_ratio = 1;
4675 + */
4676 + int sysctl_min_slab_ratio = 5;
4677 +
4678 ++static inline unsigned long zone_unmapped_file_pages(struct zone *zone)
4679 ++{
4680 ++ unsigned long file_mapped = zone_page_state(zone, NR_FILE_MAPPED);
4681 ++ unsigned long file_lru = zone_page_state(zone, NR_INACTIVE_FILE) +
4682 ++ zone_page_state(zone, NR_ACTIVE_FILE);
4683 ++
4684 ++ /*
4685 ++ * It's possible for there to be more file mapped pages than
4686 ++ * accounted for by the pages on the file LRU lists because
4687 ++ * tmpfs pages accounted for as ANON can also be FILE_MAPPED
4688 ++ */
4689 ++ return (file_lru > file_mapped) ? (file_lru - file_mapped) : 0;
4690 ++}
4691 ++
4692 ++/* Work out how many page cache pages we can reclaim in this reclaim_mode */
4693 ++static long zone_pagecache_reclaimable(struct zone *zone)
4694 ++{
4695 ++ long nr_pagecache_reclaimable;
4696 ++ long delta = 0;
4697 ++
4698 ++ /*
4699 ++ * If RECLAIM_SWAP is set, then all file pages are considered
4700 ++ * potentially reclaimable. Otherwise, we have to worry about
4701 ++ * pages like swapcache and zone_unmapped_file_pages() provides
4702 ++ * a better estimate
4703 ++ */
4704 ++ if (zone_reclaim_mode & RECLAIM_SWAP)
4705 ++ nr_pagecache_reclaimable = zone_page_state(zone, NR_FILE_PAGES);
4706 ++ else
4707 ++ nr_pagecache_reclaimable = zone_unmapped_file_pages(zone);
4708 ++
4709 ++ /* If we can't clean pages, remove dirty pages from consideration */
4710 ++ if (!(zone_reclaim_mode & RECLAIM_WRITE))
4711 ++ delta += zone_page_state(zone, NR_FILE_DIRTY);
4712 ++
4713 ++ /* Watch for any possible underflows due to delta */
4714 ++ if (unlikely(delta > nr_pagecache_reclaimable))
4715 ++ delta = nr_pagecache_reclaimable;
4716 ++
4717 ++ return nr_pagecache_reclaimable - delta;
4718 ++}
4719 ++
4720 + /*
4721 + * Try to free up some pages from this zone through reclaim.
4722 + */
4723 +@@ -2324,9 +2366,7 @@ static int __zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
4724 + reclaim_state.reclaimed_slab = 0;
4725 + p->reclaim_state = &reclaim_state;
4726 +
4727 +- if (zone_page_state(zone, NR_FILE_PAGES) -
4728 +- zone_page_state(zone, NR_FILE_MAPPED) >
4729 +- zone->min_unmapped_pages) {
4730 ++ if (zone_pagecache_reclaimable(zone) > zone->min_unmapped_pages) {
4731 + /*
4732 + * Free memory by calling shrink zone with increasing
4733 + * priorities until we have enough memory freed.
4734 +@@ -2384,10 +2424,8 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
4735 + * if less than a specified percentage of the zone is used by
4736 + * unmapped file backed pages.
4737 + */
4738 +- if (zone_page_state(zone, NR_FILE_PAGES) -
4739 +- zone_page_state(zone, NR_FILE_MAPPED) <= zone->min_unmapped_pages
4740 +- && zone_page_state(zone, NR_SLAB_RECLAIMABLE)
4741 +- <= zone->min_slab_pages)
4742 ++ if (zone_pagecache_reclaimable(zone) <= zone->min_unmapped_pages &&
4743 ++ zone_page_state(zone, NR_SLAB_RECLAIMABLE) <= zone->min_slab_pages)
4744 + return 0;
4745 +
4746 + if (zone_is_all_unreclaimable(zone))
4747 +@@ -2414,6 +2452,9 @@ int zone_reclaim(struct zone *zone, gfp_t gfp_mask, unsigned int order)
4748 + ret = __zone_reclaim(zone, gfp_mask, order);
4749 + zone_clear_flag(zone, ZONE_RECLAIM_LOCKED);
4750 +
4751 ++ if (!ret)
4752 ++ count_vm_event(PGSCAN_ZONE_RECLAIM_FAILED);
4753 ++
4754 + return ret;
4755 + }
4756 + #endif
4757 +diff --git a/mm/vmstat.c b/mm/vmstat.c
4758 +index 74d66db..ddb360a 100644
4759 +--- a/mm/vmstat.c
4760 ++++ b/mm/vmstat.c
4761 +@@ -675,6 +675,9 @@ static const char * const vmstat_text[] = {
4762 + TEXTS_FOR_ZONES("pgscan_kswapd")
4763 + TEXTS_FOR_ZONES("pgscan_direct")
4764 +
4765 ++#ifdef CONFIG_NUMA
4766 ++ "zone_reclaim_failed",
4767 ++#endif
4768 + "pginodesteal",
4769 + "slabs_scanned",
4770 + "kswapd_steal",
4771 +diff --git a/net/ipv4/route.c b/net/ipv4/route.c
4772 +index 28205e5..d777f84 100644
4773 +--- a/net/ipv4/route.c
4774 ++++ b/net/ipv4/route.c
4775 +@@ -1081,8 +1081,35 @@ restart:
4776 + now = jiffies;
4777 +
4778 + if (!rt_caching(dev_net(rt->u.dst.dev))) {
4779 +- rt_drop(rt);
4780 +- return 0;
4781 ++ /*
4782 ++ * If we're not caching, just tell the caller we
4783 ++ * were successful and don't touch the route. The
4784 ++ * caller hold the sole reference to the cache entry, and
4785 ++ * it will be released when the caller is done with it.
4786 ++ * If we drop it here, the callers have no way to resolve routes
4787 ++ * when we're not caching. Instead, just point *rp at rt, so
4788 ++ * the caller gets a single use out of the route
4789 ++ * Note that we do rt_free on this new route entry, so that
4790 ++ * once its refcount hits zero, we are still able to reap it
4791 ++ * (Thanks Alexey)
4792 ++ * Note also the rt_free uses call_rcu. We don't actually
4793 ++ * need rcu protection here, this is just our path to get
4794 ++ * on the route gc list.
4795 ++ */
4796 ++
4797 ++ if (rt->rt_type == RTN_UNICAST || rt->fl.iif == 0) {
4798 ++ int err = arp_bind_neighbour(&rt->u.dst);
4799 ++ if (err) {
4800 ++ if (net_ratelimit())
4801 ++ printk(KERN_WARNING
4802 ++ "Neighbour table failure & not caching routes.\n");
4803 ++ rt_drop(rt);
4804 ++ return err;
4805 ++ }
4806 ++ }
4807 ++
4808 ++ rt_free(rt);
4809 ++ goto skip_hashing;
4810 + }
4811 +
4812 + rthp = &rt_hash_table[hash].chain;
4813 +@@ -1196,7 +1223,8 @@ restart:
4814 + #if RT_CACHE_DEBUG >= 2
4815 + if (rt->u.dst.rt_next) {
4816 + struct rtable *trt;
4817 +- printk(KERN_DEBUG "rt_cache @%02x: %pI4", hash, &rt->rt_dst);
4818 ++ printk(KERN_DEBUG "rt_cache @%02x: %pI4",
4819 ++ hash, &rt->rt_dst);
4820 + for (trt = rt->u.dst.rt_next; trt; trt = trt->u.dst.rt_next)
4821 + printk(" . %pI4", &trt->rt_dst);
4822 + printk("\n");
4823 +@@ -1210,6 +1238,8 @@ restart:
4824 + rcu_assign_pointer(rt_hash_table[hash].chain, rt);
4825 +
4826 + spin_unlock_bh(rt_hash_lock_addr(hash));
4827 ++
4828 ++skip_hashing:
4829 + *rp = rt;
4830 + return 0;
4831 + }
4832 +diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
4833 +index d9233ec..2681dfa 100644
4834 +--- a/net/mac80211/rc80211_minstrel.c
4835 ++++ b/net/mac80211/rc80211_minstrel.c
4836 +@@ -216,7 +216,7 @@ minstrel_get_next_sample(struct minstrel_sta_info *mi)
4837 + unsigned int sample_ndx;
4838 + sample_ndx = SAMPLE_TBL(mi, mi->sample_idx, mi->sample_column);
4839 + mi->sample_idx++;
4840 +- if (mi->sample_idx > (mi->n_rates - 2)) {
4841 ++ if ((int) mi->sample_idx > (mi->n_rates - 2)) {
4842 + mi->sample_idx = 0;
4843 + mi->sample_column++;
4844 + if (mi->sample_column >= SAMPLE_COLUMNS)
4845 +diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
4846 +index 2456e4e..b759106 100644
4847 +--- a/net/wireless/nl80211.c
4848 ++++ b/net/wireless/nl80211.c
4849 +@@ -2385,18 +2385,24 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info)
4850 + rem_reg_rules) {
4851 + num_rules++;
4852 + if (num_rules > NL80211_MAX_SUPP_REG_RULES)
4853 +- goto bad_reg;
4854 ++ return -EINVAL;
4855 + }
4856 +
4857 +- if (!reg_is_valid_request(alpha2))
4858 +- return -EINVAL;
4859 ++ mutex_lock(&cfg80211_mutex);
4860 ++
4861 ++ if (!reg_is_valid_request(alpha2)) {
4862 ++ r = -EINVAL;
4863 ++ goto bad_reg;
4864 ++ }
4865 +
4866 + size_of_regd = sizeof(struct ieee80211_regdomain) +
4867 + (num_rules * sizeof(struct ieee80211_reg_rule));
4868 +
4869 + rd = kzalloc(size_of_regd, GFP_KERNEL);
4870 +- if (!rd)
4871 +- return -ENOMEM;
4872 ++ if (!rd) {
4873 ++ r = -ENOMEM;
4874 ++ goto bad_reg;
4875 ++ }
4876 +
4877 + rd->n_reg_rules = num_rules;
4878 + rd->alpha2[0] = alpha2[0];
4879 +@@ -2413,20 +2419,24 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info)
4880 +
4881 + rule_idx++;
4882 +
4883 +- if (rule_idx > NL80211_MAX_SUPP_REG_RULES)
4884 ++ if (rule_idx > NL80211_MAX_SUPP_REG_RULES) {
4885 ++ r = -EINVAL;
4886 + goto bad_reg;
4887 ++ }
4888 + }
4889 +
4890 + BUG_ON(rule_idx != num_rules);
4891 +
4892 +- mutex_lock(&cfg80211_mutex);
4893 + r = set_regdom(rd);
4894 ++
4895 + mutex_unlock(&cfg80211_mutex);
4896 ++
4897 + return r;
4898 +
4899 + bad_reg:
4900 ++ mutex_unlock(&cfg80211_mutex);
4901 + kfree(rd);
4902 +- return -EINVAL;
4903 ++ return r;
4904 + }
4905 +
4906 + static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
4907 +diff --git a/net/wireless/reg.c b/net/wireless/reg.c
4908 +index 487cb62..9765bc8 100644
4909 +--- a/net/wireless/reg.c
4910 ++++ b/net/wireless/reg.c
4911 +@@ -389,6 +389,8 @@ static int call_crda(const char *alpha2)
4912 + /* Used by nl80211 before kmalloc'ing our regulatory domain */
4913 + bool reg_is_valid_request(const char *alpha2)
4914 + {
4915 ++ assert_cfg80211_lock();
4916 ++
4917 + if (!last_request)
4918 + return false;
4919 +
4920 +@@ -2042,7 +2044,13 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
4921 + * the country IE rd with what CRDA believes that country should have
4922 + */
4923 +
4924 +- BUG_ON(!country_ie_regdomain);
4925 ++ /*
4926 ++ * Userspace could have sent two replies with only
4927 ++ * one kernel request. By the second reply we would have
4928 ++ * already processed and consumed the country_ie_regdomain.
4929 ++ */
4930 ++ if (!country_ie_regdomain)
4931 ++ return -EALREADY;
4932 + BUG_ON(rd == country_ie_regdomain);
4933 +
4934 + /*
4935 +diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c
4936 +index ed80af8..c51f309 100644
4937 +--- a/net/x25/af_x25.c
4938 ++++ b/net/x25/af_x25.c
4939 +@@ -332,14 +332,14 @@ static unsigned int x25_new_lci(struct x25_neigh *nb)
4940 + /*
4941 + * Deferred destroy.
4942 + */
4943 +-void x25_destroy_socket(struct sock *);
4944 ++static void __x25_destroy_socket(struct sock *);
4945 +
4946 + /*
4947 + * handler for deferred kills.
4948 + */
4949 + static void x25_destroy_timer(unsigned long data)
4950 + {
4951 +- x25_destroy_socket((struct sock *)data);
4952 ++ x25_destroy_socket_from_timer((struct sock *)data);
4953 + }
4954 +
4955 + /*
4956 +@@ -349,12 +349,10 @@ static void x25_destroy_timer(unsigned long data)
4957 + * will touch it and we are (fairly 8-) ) safe.
4958 + * Not static as it's used by the timer
4959 + */
4960 +-void x25_destroy_socket(struct sock *sk)
4961 ++static void __x25_destroy_socket(struct sock *sk)
4962 + {
4963 + struct sk_buff *skb;
4964 +
4965 +- sock_hold(sk);
4966 +- lock_sock(sk);
4967 + x25_stop_heartbeat(sk);
4968 + x25_stop_timer(sk);
4969 +
4970 +@@ -385,7 +383,22 @@ void x25_destroy_socket(struct sock *sk)
4971 + /* drop last reference so sock_put will free */
4972 + __sock_put(sk);
4973 + }
4974 ++}
4975 +
4976 ++void x25_destroy_socket_from_timer(struct sock *sk)
4977 ++{
4978 ++ sock_hold(sk);
4979 ++ bh_lock_sock(sk);
4980 ++ __x25_destroy_socket(sk);
4981 ++ bh_unlock_sock(sk);
4982 ++ sock_put(sk);
4983 ++}
4984 ++
4985 ++static void x25_destroy_socket(struct sock *sk)
4986 ++{
4987 ++ sock_hold(sk);
4988 ++ lock_sock(sk);
4989 ++ __x25_destroy_socket(sk);
4990 + release_sock(sk);
4991 + sock_put(sk);
4992 + }
4993 +diff --git a/net/x25/x25_timer.c b/net/x25/x25_timer.c
4994 +index d3e3e54..5c5db1a 100644
4995 +--- a/net/x25/x25_timer.c
4996 ++++ b/net/x25/x25_timer.c
4997 +@@ -113,7 +113,7 @@ static void x25_heartbeat_expiry(unsigned long param)
4998 + (sk->sk_state == TCP_LISTEN &&
4999 + sock_flag(sk, SOCK_DEAD))) {
5000 + bh_unlock_sock(sk);
5001 +- x25_destroy_socket(sk);
5002 ++ x25_destroy_socket_from_timer(sk);
5003 + return;
5004 + }
5005 + break;
5006 +diff --git a/security/integrity/ima/ima_audit.c b/security/integrity/ima/ima_audit.c
5007 +index 1e082bb..97a80fb 100644
5008 +--- a/security/integrity/ima/ima_audit.c
5009 ++++ b/security/integrity/ima/ima_audit.c
5010 +@@ -50,7 +50,7 @@ void integrity_audit_msg(int audit_msgno, struct inode *inode,
5011 +
5012 + ab = audit_log_start(current->audit_context, GFP_KERNEL, audit_msgno);
5013 + audit_log_format(ab, "integrity: pid=%d uid=%u auid=%u ses=%u",
5014 +- current->pid, current->cred->uid,
5015 ++ current->pid, current_cred()->uid,
5016 + audit_get_loginuid(current),
5017 + audit_get_sessionid(current));
5018 + audit_log_task_context(ab);
5019 +diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
5020 +index f4e7266..88407e5 100644
5021 +--- a/security/integrity/ima/ima_main.c
5022 ++++ b/security/integrity/ima/ima_main.c
5023 +@@ -128,10 +128,6 @@ static int get_path_measurement(struct ima_iint_cache *iint, struct file *file,
5024 + {
5025 + int rc = 0;
5026 +
5027 +- if (IS_ERR(file)) {
5028 +- pr_info("%s dentry_open failed\n", filename);
5029 +- return rc;
5030 +- }
5031 + iint->opencount++;
5032 + iint->readcount++;
5033 +
5034 +@@ -196,7 +192,14 @@ int ima_path_check(struct path *path, int mask)
5035 + struct dentry *dentry = dget(path->dentry);
5036 + struct vfsmount *mnt = mntget(path->mnt);
5037 +
5038 +- file = dentry_open(dentry, mnt, O_RDONLY, current->cred);
5039 ++ file = dentry_open(dentry, mnt, O_RDONLY | O_LARGEFILE,
5040 ++ current_cred());
5041 ++ if (IS_ERR(file)) {
5042 ++ pr_info("%s dentry_open failed\n", dentry->d_name.name);
5043 ++ rc = PTR_ERR(file);
5044 ++ file = NULL;
5045 ++ goto out;
5046 ++ }
5047 + rc = get_path_measurement(iint, file, dentry->d_name.name);
5048 + }
5049 + out:
5050 +diff --git a/sound/core/seq/seq_midi_event.c b/sound/core/seq/seq_midi_event.c
5051 +index 8284f17..b5d6ea4 100644
5052 +--- a/sound/core/seq/seq_midi_event.c
5053 ++++ b/sound/core/seq/seq_midi_event.c
5054 +@@ -504,10 +504,10 @@ static int extra_decode_xrpn(struct snd_midi_event *dev, unsigned char *buf,
5055 + if (dev->nostat && count < 12)
5056 + return -ENOMEM;
5057 + cmd = MIDI_CMD_CONTROL|(ev->data.control.channel & 0x0f);
5058 +- bytes[0] = ev->data.control.param & 0x007f;
5059 +- bytes[1] = (ev->data.control.param & 0x3f80) >> 7;
5060 +- bytes[2] = ev->data.control.value & 0x007f;
5061 +- bytes[3] = (ev->data.control.value & 0x3f80) >> 7;
5062 ++ bytes[0] = (ev->data.control.param & 0x3f80) >> 7;
5063 ++ bytes[1] = ev->data.control.param & 0x007f;
5064 ++ bytes[2] = (ev->data.control.value & 0x3f80) >> 7;
5065 ++ bytes[3] = ev->data.control.value & 0x007f;
5066 + if (cmd != dev->lastcmd && !dev->nostat) {
5067 + if (count < 9)
5068 + return -ENOMEM;
5069 +diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
5070 +index de83608..3ee0269 100644
5071 +--- a/sound/isa/cmi8330.c
5072 ++++ b/sound/isa/cmi8330.c
5073 +@@ -338,7 +338,7 @@ static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard,
5074 + return -EBUSY;
5075 +
5076 + acard->mpu = pnp_request_card_device(card, id->devs[2].id, NULL);
5077 +- if (acard->play == NULL)
5078 ++ if (acard->mpu == NULL)
5079 + return -EBUSY;
5080 +
5081 + pdev = acard->cap;
5082 +diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c
5083 +index c111efe..f143f71 100644
5084 +--- a/sound/pci/ca0106/ca0106_mixer.c
5085 ++++ b/sound/pci/ca0106/ca0106_mixer.c
5086 +@@ -841,6 +841,9 @@ int __devinit snd_ca0106_mixer(struct snd_ca0106 *emu)
5087 + snd_ca0106_master_db_scale);
5088 + if (!vmaster)
5089 + return -ENOMEM;
5090 ++ err = snd_ctl_add(card, vmaster);
5091 ++ if (err < 0)
5092 ++ return err;
5093 + add_slaves(card, vmaster, slave_vols);
5094 +
5095 + if (emu->details->spi_dac == 1) {
5096 +@@ -848,6 +851,9 @@ int __devinit snd_ca0106_mixer(struct snd_ca0106 *emu)
5097 + NULL);
5098 + if (!vmaster)
5099 + return -ENOMEM;
5100 ++ err = snd_ctl_add(card, vmaster);
5101 ++ if (err < 0)
5102 ++ return err;
5103 + add_slaves(card, vmaster, slave_sws);
5104 + }
5105 + return 0;
5106 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
5107 +index 0fd258e..f09324a 100644
5108 +--- a/sound/pci/hda/patch_realtek.c
5109 ++++ b/sound/pci/hda/patch_realtek.c
5110 +@@ -10915,6 +10915,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
5111 + SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO),
5112 + SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
5113 + SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */
5114 ++ SND_PCI_QUIRK(0x104d, 0x9025, "Sony VAIO Z21MN", ALC262_TOSHIBA_S06),
5115 + SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO",
5116 + ALC262_SONY_ASSAMD),
5117 + SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
5118 +@@ -11122,6 +11123,7 @@ static struct alc_config_preset alc262_presets[] = {
5119 + .capsrc_nids = alc262_dmic_capsrc_nids,
5120 + .dac_nids = alc262_dac_nids,
5121 + .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
5122 ++ .num_adc_nids = 1, /* single ADC */
5123 + .dig_out_nid = ALC262_DIGOUT_NID,
5124 + .num_channel_mode = ARRAY_SIZE(alc262_modes),
5125 + .channel_mode = alc262_modes,
5126 +diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
5127 +index 173bebf..8aa5687 100644
5128 +--- a/sound/pci/intel8x0.c
5129 ++++ b/sound/pci/intel8x0.c
5130 +@@ -356,8 +356,6 @@ struct ichdev {
5131 + unsigned int position;
5132 + unsigned int pos_shift;
5133 + unsigned int last_pos;
5134 +- unsigned long last_pos_jiffies;
5135 +- unsigned int jiffy_to_bytes;
5136 + int frags;
5137 + int lvi;
5138 + int lvi_frag;
5139 +@@ -844,7 +842,6 @@ static int snd_intel8x0_pcm_trigger(struct snd_pcm_substream *substream, int cmd
5140 + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
5141 + val = ICH_IOCE | ICH_STARTBM;
5142 + ichdev->last_pos = ichdev->position;
5143 +- ichdev->last_pos_jiffies = jiffies;
5144 + break;
5145 + case SNDRV_PCM_TRIGGER_SUSPEND:
5146 + ichdev->suspended = 1;
5147 +@@ -1048,7 +1045,6 @@ static int snd_intel8x0_pcm_prepare(struct snd_pcm_substream *substream)
5148 + ichdev->pos_shift = (runtime->sample_bits > 16) ? 2 : 1;
5149 + }
5150 + snd_intel8x0_setup_periods(chip, ichdev);
5151 +- ichdev->jiffy_to_bytes = (runtime->rate * 4 * ichdev->pos_shift) / HZ;
5152 + return 0;
5153 + }
5154 +
5155 +@@ -1073,19 +1069,23 @@ static snd_pcm_uframes_t snd_intel8x0_pcm_pointer(struct snd_pcm_substream *subs
5156 + ptr1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb))
5157 + break;
5158 + } while (timeout--);
5159 ++ ptr = ichdev->last_pos;
5160 + if (ptr1 != 0) {
5161 + ptr1 <<= ichdev->pos_shift;
5162 + ptr = ichdev->fragsize1 - ptr1;
5163 + ptr += position;
5164 +- ichdev->last_pos = ptr;
5165 +- ichdev->last_pos_jiffies = jiffies;
5166 +- } else {
5167 +- ptr1 = jiffies - ichdev->last_pos_jiffies;
5168 +- if (ptr1)
5169 +- ptr1 -= 1;
5170 +- ptr = ichdev->last_pos + ptr1 * ichdev->jiffy_to_bytes;
5171 +- ptr %= ichdev->size;
5172 ++ if (ptr < ichdev->last_pos) {
5173 ++ unsigned int pos_base, last_base;
5174 ++ pos_base = position / ichdev->fragsize1;
5175 ++ last_base = ichdev->last_pos / ichdev->fragsize1;
5176 ++ /* another sanity check; ptr1 can go back to full
5177 ++ * before the base position is updated
5178 ++ */
5179 ++ if (pos_base == last_base)
5180 ++ ptr = ichdev->last_pos;
5181 ++ }
5182 + }
5183 ++ ichdev->last_pos = ptr;
5184 + spin_unlock(&chip->reg_lock);
5185 + if (ptr >= ichdev->size)
5186 + return 0;
5187 +diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
5188 +index 8cf571f..39805ce 100644
5189 +--- a/sound/soc/codecs/wm8903.c
5190 ++++ b/sound/soc/codecs/wm8903.c
5191 +@@ -1215,22 +1215,18 @@ static struct {
5192 + int div;
5193 + } bclk_divs[] = {
5194 + { 10, 0 },
5195 +- { 15, 1 },
5196 + { 20, 2 },
5197 + { 30, 3 },
5198 + { 40, 4 },
5199 + { 50, 5 },
5200 +- { 55, 6 },
5201 + { 60, 7 },
5202 + { 80, 8 },
5203 + { 100, 9 },
5204 +- { 110, 10 },
5205 + { 120, 11 },
5206 + { 160, 12 },
5207 + { 200, 13 },
5208 + { 220, 14 },
5209 + { 240, 15 },
5210 +- { 250, 16 },
5211 + { 300, 17 },
5212 + { 320, 18 },
5213 + { 440, 19 },
5214 +diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
5215 +index 4d0dd39..1489829 100644
5216 +--- a/virt/kvm/kvm_main.c
5217 ++++ b/virt/kvm/kvm_main.c
5218 +@@ -581,6 +581,7 @@ static bool make_all_cpus_request(struct kvm *kvm, unsigned int req)
5219 + cpumask_clear(cpus);
5220 +
5221 + me = get_cpu();
5222 ++ spin_lock(&kvm->requests_lock);
5223 + for (i = 0; i < KVM_MAX_VCPUS; ++i) {
5224 + vcpu = kvm->vcpus[i];
5225 + if (!vcpu)
5226 +@@ -597,6 +598,7 @@ static bool make_all_cpus_request(struct kvm *kvm, unsigned int req)
5227 + smp_call_function_many(cpus, ack_flush, NULL, 1);
5228 + else
5229 + called = false;
5230 ++ spin_unlock(&kvm->requests_lock);
5231 + put_cpu();
5232 + free_cpumask_var(cpus);
5233 + return called;
5234 +@@ -817,6 +819,7 @@ static struct kvm *kvm_create_vm(void)
5235 + kvm->mm = current->mm;
5236 + atomic_inc(&kvm->mm->mm_count);
5237 + spin_lock_init(&kvm->mmu_lock);
5238 ++ spin_lock_init(&kvm->requests_lock);
5239 + kvm_io_bus_init(&kvm->pio_bus);
5240 + mutex_init(&kvm->lock);
5241 + kvm_io_bus_init(&kvm->mmio_bus);
5242 +@@ -919,9 +922,8 @@ int __kvm_set_memory_region(struct kvm *kvm,
5243 + {
5244 + int r;
5245 + gfn_t base_gfn;
5246 +- unsigned long npages;
5247 +- int largepages;
5248 +- unsigned long i;
5249 ++ unsigned long npages, ugfn;
5250 ++ unsigned long largepages, i;
5251 + struct kvm_memory_slot *memslot;
5252 + struct kvm_memory_slot old, new;
5253 +
5254 +@@ -1010,6 +1012,14 @@ int __kvm_set_memory_region(struct kvm *kvm,
5255 + new.lpage_info[0].write_count = 1;
5256 + if ((base_gfn+npages) % KVM_PAGES_PER_HPAGE)
5257 + new.lpage_info[largepages-1].write_count = 1;
5258 ++ ugfn = new.userspace_addr >> PAGE_SHIFT;
5259 ++ /*
5260 ++ * If the gfn and userspace address are not aligned wrt each
5261 ++ * other, disable large page support for this slot
5262 ++ */
5263 ++ if ((base_gfn ^ ugfn) & (KVM_PAGES_PER_HPAGE - 1))
5264 ++ for (i = 0; i < largepages; ++i)
5265 ++ new.lpage_info[i].write_count = 1;
5266 + }
5267 +
5268 + /* Allocate page dirty bitmap if needed */
5269 +@@ -1020,6 +1030,8 @@ int __kvm_set_memory_region(struct kvm *kvm,
5270 + if (!new.dirty_bitmap)
5271 + goto out_free;
5272 + memset(new.dirty_bitmap, 0, dirty_bytes);
5273 ++ if (old.npages)
5274 ++ kvm_arch_flush_shadow(kvm);
5275 + }
5276 + #endif /* not defined CONFIG_S390 */
5277 +