/[linux-patches]/genpatches-2.6/tags/2.6.30-10/1000_linux-2.6.30.1.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.30-10/1000_linux-2.6.30.1.patch

Parent Directory Parent Directory | Revision Log Revision Log


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

  ViewVC Help
Powered by ViewVC 1.1.20