1 |
Author: mpagano |
2 |
Date: 2012-04-04 17:14:14 +0000 (Wed, 04 Apr 2012) |
3 |
New Revision: 2117 |
4 |
|
5 |
Added: |
6 |
genpatches-2.6/trunk/3.2/1013_linux-3.2.14.patch |
7 |
Modified: |
8 |
genpatches-2.6/trunk/3.2/0000_README |
9 |
Log: |
10 |
Linux patch 3.2.14 |
11 |
|
12 |
Modified: genpatches-2.6/trunk/3.2/0000_README |
13 |
=================================================================== |
14 |
--- genpatches-2.6/trunk/3.2/0000_README 2012-04-04 15:06:07 UTC (rev 2116) |
15 |
+++ genpatches-2.6/trunk/3.2/0000_README 2012-04-04 17:14:14 UTC (rev 2117) |
16 |
@@ -92,6 +92,10 @@ |
17 |
From: http://www.kernel.org |
18 |
Desc: Linux 3.2.13 |
19 |
|
20 |
+Patch: 1013_linux-3.2.14.patch |
21 |
+From: http://www.kernel.org |
22 |
+Desc: Linux 3.2.14 |
23 |
+ |
24 |
Patch: 2300_per-pci-device-msi-irq-listing.patch |
25 |
From: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=da8d1c8ba4dcb16d60be54b233deca9a7cac98dc |
26 |
Desc: Add a per-pci-device subdirectory in sysfs |
27 |
|
28 |
Added: genpatches-2.6/trunk/3.2/1013_linux-3.2.14.patch |
29 |
=================================================================== |
30 |
--- genpatches-2.6/trunk/3.2/1013_linux-3.2.14.patch (rev 0) |
31 |
+++ genpatches-2.6/trunk/3.2/1013_linux-3.2.14.patch 2012-04-04 17:14:14 UTC (rev 2117) |
32 |
@@ -0,0 +1,6098 @@ |
33 |
+diff --git a/Makefile b/Makefile |
34 |
+index 172e041..afe4c7d 100644 |
35 |
+--- a/Makefile |
36 |
++++ b/Makefile |
37 |
+@@ -1,6 +1,6 @@ |
38 |
+ VERSION = 3 |
39 |
+ PATCHLEVEL = 2 |
40 |
+-SUBLEVEL = 13 |
41 |
++SUBLEVEL = 14 |
42 |
+ EXTRAVERSION = |
43 |
+ NAME = Saber-toothed Squirrel |
44 |
+ |
45 |
+diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig |
46 |
+index 91aff7c..dbc59fa 100644 |
47 |
+--- a/arch/arm/mach-tegra/Kconfig |
48 |
++++ b/arch/arm/mach-tegra/Kconfig |
49 |
+@@ -13,6 +13,13 @@ config ARCH_TEGRA_2x_SOC |
50 |
+ select USB_ARCH_HAS_EHCI if USB_SUPPORT |
51 |
+ select USB_ULPI if USB_SUPPORT |
52 |
+ select USB_ULPI_VIEWPORT if USB_SUPPORT |
53 |
++ select ARM_ERRATA_720789 |
54 |
++ select ARM_ERRATA_742230 |
55 |
++ select ARM_ERRATA_751472 |
56 |
++ select ARM_ERRATA_754327 |
57 |
++ select ARM_ERRATA_764369 |
58 |
++ select PL310_ERRATA_727915 if CACHE_L2X0 |
59 |
++ select PL310_ERRATA_769419 if CACHE_L2X0 |
60 |
+ help |
61 |
+ Support for NVIDIA Tegra AP20 and T20 processors, based on the |
62 |
+ ARM CortexA9MP CPU and the ARM PL310 L2 cache controller |
63 |
+@@ -54,6 +61,11 @@ config MACH_SEABOARD |
64 |
+ config MACH_TEGRA_DT |
65 |
+ bool "Generic Tegra board (FDT support)" |
66 |
+ select USE_OF |
67 |
++ select ARM_ERRATA_743622 |
68 |
++ select ARM_ERRATA_751472 |
69 |
++ select ARM_ERRATA_754322 |
70 |
++ select ARM_ERRATA_764369 |
71 |
++ select PL310_ERRATA_769419 if CACHE_L2X0 |
72 |
+ help |
73 |
+ Support for generic nVidia Tegra boards using Flattened Device Tree |
74 |
+ |
75 |
+diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h |
76 |
+index a026507..70ea6fd 100644 |
77 |
+--- a/arch/x86/include/asm/kvm_emulate.h |
78 |
++++ b/arch/x86/include/asm/kvm_emulate.h |
79 |
+@@ -189,6 +189,9 @@ struct x86_emulate_ops { |
80 |
+ int (*intercept)(struct x86_emulate_ctxt *ctxt, |
81 |
+ struct x86_instruction_info *info, |
82 |
+ enum x86_intercept_stage stage); |
83 |
++ |
84 |
++ bool (*get_cpuid)(struct x86_emulate_ctxt *ctxt, |
85 |
++ u32 *eax, u32 *ebx, u32 *ecx, u32 *edx); |
86 |
+ }; |
87 |
+ |
88 |
+ typedef u32 __attribute__((vector_size(16))) sse128_t; |
89 |
+@@ -297,6 +300,19 @@ struct x86_emulate_ctxt { |
90 |
+ #define X86EMUL_MODE_PROT (X86EMUL_MODE_PROT16|X86EMUL_MODE_PROT32| \ |
91 |
+ X86EMUL_MODE_PROT64) |
92 |
+ |
93 |
++/* CPUID vendors */ |
94 |
++#define X86EMUL_CPUID_VENDOR_AuthenticAMD_ebx 0x68747541 |
95 |
++#define X86EMUL_CPUID_VENDOR_AuthenticAMD_ecx 0x444d4163 |
96 |
++#define X86EMUL_CPUID_VENDOR_AuthenticAMD_edx 0x69746e65 |
97 |
++ |
98 |
++#define X86EMUL_CPUID_VENDOR_AMDisbetterI_ebx 0x69444d41 |
99 |
++#define X86EMUL_CPUID_VENDOR_AMDisbetterI_ecx 0x21726574 |
100 |
++#define X86EMUL_CPUID_VENDOR_AMDisbetterI_edx 0x74656273 |
101 |
++ |
102 |
++#define X86EMUL_CPUID_VENDOR_GenuineIntel_ebx 0x756e6547 |
103 |
++#define X86EMUL_CPUID_VENDOR_GenuineIntel_ecx 0x6c65746e |
104 |
++#define X86EMUL_CPUID_VENDOR_GenuineIntel_edx 0x49656e69 |
105 |
++ |
106 |
+ enum x86_intercept_stage { |
107 |
+ X86_ICTP_NONE = 0, /* Allow zero-init to not match anything */ |
108 |
+ X86_ICPT_PRE_EXCEPT, |
109 |
+diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c |
110 |
+index 6d939d7..a25e276 100644 |
111 |
+--- a/arch/x86/kernel/apic/io_apic.c |
112 |
++++ b/arch/x86/kernel/apic/io_apic.c |
113 |
+@@ -3963,18 +3963,36 @@ int mp_find_ioapic_pin(int ioapic, u32 gsi) |
114 |
+ static __init int bad_ioapic(unsigned long address) |
115 |
+ { |
116 |
+ if (nr_ioapics >= MAX_IO_APICS) { |
117 |
+- printk(KERN_WARNING "WARNING: Max # of I/O APICs (%d) exceeded " |
118 |
+- "(found %d), skipping\n", MAX_IO_APICS, nr_ioapics); |
119 |
++ pr_warn("WARNING: Max # of I/O APICs (%d) exceeded (found %d), skipping\n", |
120 |
++ MAX_IO_APICS, nr_ioapics); |
121 |
+ return 1; |
122 |
+ } |
123 |
+ if (!address) { |
124 |
+- printk(KERN_WARNING "WARNING: Bogus (zero) I/O APIC address" |
125 |
+- " found in table, skipping!\n"); |
126 |
++ pr_warn("WARNING: Bogus (zero) I/O APIC address found in table, skipping!\n"); |
127 |
+ return 1; |
128 |
+ } |
129 |
+ return 0; |
130 |
+ } |
131 |
+ |
132 |
++static __init int bad_ioapic_register(int idx) |
133 |
++{ |
134 |
++ union IO_APIC_reg_00 reg_00; |
135 |
++ union IO_APIC_reg_01 reg_01; |
136 |
++ union IO_APIC_reg_02 reg_02; |
137 |
++ |
138 |
++ reg_00.raw = io_apic_read(idx, 0); |
139 |
++ reg_01.raw = io_apic_read(idx, 1); |
140 |
++ reg_02.raw = io_apic_read(idx, 2); |
141 |
++ |
142 |
++ if (reg_00.raw == -1 && reg_01.raw == -1 && reg_02.raw == -1) { |
143 |
++ pr_warn("I/O APIC 0x%x registers return all ones, skipping!\n", |
144 |
++ mpc_ioapic_addr(idx)); |
145 |
++ return 1; |
146 |
++ } |
147 |
++ |
148 |
++ return 0; |
149 |
++} |
150 |
++ |
151 |
+ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) |
152 |
+ { |
153 |
+ int idx = 0; |
154 |
+@@ -3991,6 +4009,12 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) |
155 |
+ ioapics[idx].mp_config.apicaddr = address; |
156 |
+ |
157 |
+ set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); |
158 |
++ |
159 |
++ if (bad_ioapic_register(idx)) { |
160 |
++ clear_fixmap(FIX_IO_APIC_BASE_0 + idx); |
161 |
++ return; |
162 |
++ } |
163 |
++ |
164 |
+ ioapics[idx].mp_config.apicid = io_apic_unique_id(id); |
165 |
+ ioapics[idx].mp_config.apicver = io_apic_get_version(idx); |
166 |
+ |
167 |
+@@ -4011,10 +4035,10 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) |
168 |
+ if (gsi_cfg->gsi_end >= gsi_top) |
169 |
+ gsi_top = gsi_cfg->gsi_end + 1; |
170 |
+ |
171 |
+- printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " |
172 |
+- "GSI %d-%d\n", idx, mpc_ioapic_id(idx), |
173 |
+- mpc_ioapic_ver(idx), mpc_ioapic_addr(idx), |
174 |
+- gsi_cfg->gsi_base, gsi_cfg->gsi_end); |
175 |
++ pr_info("IOAPIC[%d]: apic_id %d, version %d, address 0x%x, GSI %d-%d\n", |
176 |
++ idx, mpc_ioapic_id(idx), |
177 |
++ mpc_ioapic_ver(idx), mpc_ioapic_addr(idx), |
178 |
++ gsi_cfg->gsi_base, gsi_cfg->gsi_end); |
179 |
+ |
180 |
+ nr_ioapics++; |
181 |
+ } |
182 |
+diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S |
183 |
+index f3f6f53..bcda816 100644 |
184 |
+--- a/arch/x86/kernel/entry_32.S |
185 |
++++ b/arch/x86/kernel/entry_32.S |
186 |
+@@ -99,12 +99,6 @@ |
187 |
+ #endif |
188 |
+ .endm |
189 |
+ |
190 |
+-#ifdef CONFIG_VM86 |
191 |
+-#define resume_userspace_sig check_userspace |
192 |
+-#else |
193 |
+-#define resume_userspace_sig resume_userspace |
194 |
+-#endif |
195 |
+- |
196 |
+ /* |
197 |
+ * User gs save/restore |
198 |
+ * |
199 |
+@@ -328,10 +322,19 @@ ret_from_exception: |
200 |
+ preempt_stop(CLBR_ANY) |
201 |
+ ret_from_intr: |
202 |
+ GET_THREAD_INFO(%ebp) |
203 |
+-check_userspace: |
204 |
++resume_userspace_sig: |
205 |
++#ifdef CONFIG_VM86 |
206 |
+ movl PT_EFLAGS(%esp), %eax # mix EFLAGS and CS |
207 |
+ movb PT_CS(%esp), %al |
208 |
+ andl $(X86_EFLAGS_VM | SEGMENT_RPL_MASK), %eax |
209 |
++#else |
210 |
++ /* |
211 |
++ * We can be coming here from a syscall done in the kernel space, |
212 |
++ * e.g. a failed kernel_execve(). |
213 |
++ */ |
214 |
++ movl PT_CS(%esp), %eax |
215 |
++ andl $SEGMENT_RPL_MASK, %eax |
216 |
++#endif |
217 |
+ cmpl $USER_RPL, %eax |
218 |
+ jb resume_kernel # not returning to v8086 or userspace |
219 |
+ |
220 |
+diff --git a/arch/x86/kernel/tls.c b/arch/x86/kernel/tls.c |
221 |
+index 6bb7b85..bcfec2d 100644 |
222 |
+--- a/arch/x86/kernel/tls.c |
223 |
++++ b/arch/x86/kernel/tls.c |
224 |
+@@ -163,7 +163,7 @@ int regset_tls_get(struct task_struct *target, const struct user_regset *regset, |
225 |
+ { |
226 |
+ const struct desc_struct *tls; |
227 |
+ |
228 |
+- if (pos > GDT_ENTRY_TLS_ENTRIES * sizeof(struct user_desc) || |
229 |
++ if (pos >= GDT_ENTRY_TLS_ENTRIES * sizeof(struct user_desc) || |
230 |
+ (pos % sizeof(struct user_desc)) != 0 || |
231 |
+ (count % sizeof(struct user_desc)) != 0) |
232 |
+ return -EINVAL; |
233 |
+@@ -198,7 +198,7 @@ int regset_tls_set(struct task_struct *target, const struct user_regset *regset, |
234 |
+ struct user_desc infobuf[GDT_ENTRY_TLS_ENTRIES]; |
235 |
+ const struct user_desc *info; |
236 |
+ |
237 |
+- if (pos > GDT_ENTRY_TLS_ENTRIES * sizeof(struct user_desc) || |
238 |
++ if (pos >= GDT_ENTRY_TLS_ENTRIES * sizeof(struct user_desc) || |
239 |
+ (pos % sizeof(struct user_desc)) != 0 || |
240 |
+ (count % sizeof(struct user_desc)) != 0) |
241 |
+ return -EINVAL; |
242 |
+diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c |
243 |
+index db48336..3fe298a 100644 |
244 |
+--- a/arch/x86/kernel/tsc.c |
245 |
++++ b/arch/x86/kernel/tsc.c |
246 |
+@@ -934,6 +934,16 @@ static int __init init_tsc_clocksource(void) |
247 |
+ clocksource_tsc.rating = 0; |
248 |
+ clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS; |
249 |
+ } |
250 |
++ |
251 |
++ /* |
252 |
++ * Trust the results of the earlier calibration on systems |
253 |
++ * exporting a reliable TSC. |
254 |
++ */ |
255 |
++ if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE)) { |
256 |
++ clocksource_register_khz(&clocksource_tsc, tsc_khz); |
257 |
++ return 0; |
258 |
++ } |
259 |
++ |
260 |
+ schedule_delayed_work(&tsc_irqwork, 0); |
261 |
+ return 0; |
262 |
+ } |
263 |
+diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c |
264 |
+index 863f875..04b8726 100644 |
265 |
+--- a/arch/x86/kernel/vm86_32.c |
266 |
++++ b/arch/x86/kernel/vm86_32.c |
267 |
+@@ -172,6 +172,7 @@ static void mark_screen_rdonly(struct mm_struct *mm) |
268 |
+ spinlock_t *ptl; |
269 |
+ int i; |
270 |
+ |
271 |
++ down_write(&mm->mmap_sem); |
272 |
+ pgd = pgd_offset(mm, 0xA0000); |
273 |
+ if (pgd_none_or_clear_bad(pgd)) |
274 |
+ goto out; |
275 |
+@@ -190,6 +191,7 @@ static void mark_screen_rdonly(struct mm_struct *mm) |
276 |
+ } |
277 |
+ pte_unmap_unlock(pte, ptl); |
278 |
+ out: |
279 |
++ up_write(&mm->mmap_sem); |
280 |
+ flush_tlb(); |
281 |
+ } |
282 |
+ |
283 |
+diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c |
284 |
+index f1e3be18..f5302da 100644 |
285 |
+--- a/arch/x86/kvm/emulate.c |
286 |
++++ b/arch/x86/kvm/emulate.c |
287 |
+@@ -1877,6 +1877,51 @@ setup_syscalls_segments(struct x86_emulate_ctxt *ctxt, |
288 |
+ ss->p = 1; |
289 |
+ } |
290 |
+ |
291 |
++static bool em_syscall_is_enabled(struct x86_emulate_ctxt *ctxt) |
292 |
++{ |
293 |
++ struct x86_emulate_ops *ops = ctxt->ops; |
294 |
++ u32 eax, ebx, ecx, edx; |
295 |
++ |
296 |
++ /* |
297 |
++ * syscall should always be enabled in longmode - so only become |
298 |
++ * vendor specific (cpuid) if other modes are active... |
299 |
++ */ |
300 |
++ if (ctxt->mode == X86EMUL_MODE_PROT64) |
301 |
++ return true; |
302 |
++ |
303 |
++ eax = 0x00000000; |
304 |
++ ecx = 0x00000000; |
305 |
++ if (ops->get_cpuid(ctxt, &eax, &ebx, &ecx, &edx)) { |
306 |
++ /* |
307 |
++ * Intel ("GenuineIntel") |
308 |
++ * remark: Intel CPUs only support "syscall" in 64bit |
309 |
++ * longmode. Also an 64bit guest with a |
310 |
++ * 32bit compat-app running will #UD !! While this |
311 |
++ * behaviour can be fixed (by emulating) into AMD |
312 |
++ * response - CPUs of AMD can't behave like Intel. |
313 |
++ */ |
314 |
++ if (ebx == X86EMUL_CPUID_VENDOR_GenuineIntel_ebx && |
315 |
++ ecx == X86EMUL_CPUID_VENDOR_GenuineIntel_ecx && |
316 |
++ edx == X86EMUL_CPUID_VENDOR_GenuineIntel_edx) |
317 |
++ return false; |
318 |
++ |
319 |
++ /* AMD ("AuthenticAMD") */ |
320 |
++ if (ebx == X86EMUL_CPUID_VENDOR_AuthenticAMD_ebx && |
321 |
++ ecx == X86EMUL_CPUID_VENDOR_AuthenticAMD_ecx && |
322 |
++ edx == X86EMUL_CPUID_VENDOR_AuthenticAMD_edx) |
323 |
++ return true; |
324 |
++ |
325 |
++ /* AMD ("AMDisbetter!") */ |
326 |
++ if (ebx == X86EMUL_CPUID_VENDOR_AMDisbetterI_ebx && |
327 |
++ ecx == X86EMUL_CPUID_VENDOR_AMDisbetterI_ecx && |
328 |
++ edx == X86EMUL_CPUID_VENDOR_AMDisbetterI_edx) |
329 |
++ return true; |
330 |
++ } |
331 |
++ |
332 |
++ /* default: (not Intel, not AMD), apply Intel's stricter rules... */ |
333 |
++ return false; |
334 |
++} |
335 |
++ |
336 |
+ static int em_syscall(struct x86_emulate_ctxt *ctxt) |
337 |
+ { |
338 |
+ struct x86_emulate_ops *ops = ctxt->ops; |
339 |
+@@ -1890,9 +1935,15 @@ static int em_syscall(struct x86_emulate_ctxt *ctxt) |
340 |
+ ctxt->mode == X86EMUL_MODE_VM86) |
341 |
+ return emulate_ud(ctxt); |
342 |
+ |
343 |
++ if (!(em_syscall_is_enabled(ctxt))) |
344 |
++ return emulate_ud(ctxt); |
345 |
++ |
346 |
+ ops->get_msr(ctxt, MSR_EFER, &efer); |
347 |
+ setup_syscalls_segments(ctxt, &cs, &ss); |
348 |
+ |
349 |
++ if (!(efer & EFER_SCE)) |
350 |
++ return emulate_ud(ctxt); |
351 |
++ |
352 |
+ ops->get_msr(ctxt, MSR_STAR, &msr_data); |
353 |
+ msr_data >>= 32; |
354 |
+ cs_sel = (u16)(msr_data & 0xfffc); |
355 |
+diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
356 |
+index 4c938da..e04cae1 100644 |
357 |
+--- a/arch/x86/kvm/x86.c |
358 |
++++ b/arch/x86/kvm/x86.c |
359 |
+@@ -4655,6 +4655,28 @@ static int emulator_intercept(struct x86_emulate_ctxt *ctxt, |
360 |
+ return kvm_x86_ops->check_intercept(emul_to_vcpu(ctxt), info, stage); |
361 |
+ } |
362 |
+ |
363 |
++static bool emulator_get_cpuid(struct x86_emulate_ctxt *ctxt, |
364 |
++ u32 *eax, u32 *ebx, u32 *ecx, u32 *edx) |
365 |
++{ |
366 |
++ struct kvm_cpuid_entry2 *cpuid = NULL; |
367 |
++ |
368 |
++ if (eax && ecx) |
369 |
++ cpuid = kvm_find_cpuid_entry(emul_to_vcpu(ctxt), |
370 |
++ *eax, *ecx); |
371 |
++ |
372 |
++ if (cpuid) { |
373 |
++ *eax = cpuid->eax; |
374 |
++ *ecx = cpuid->ecx; |
375 |
++ if (ebx) |
376 |
++ *ebx = cpuid->ebx; |
377 |
++ if (edx) |
378 |
++ *edx = cpuid->edx; |
379 |
++ return true; |
380 |
++ } |
381 |
++ |
382 |
++ return false; |
383 |
++} |
384 |
++ |
385 |
+ static struct x86_emulate_ops emulate_ops = { |
386 |
+ .read_std = kvm_read_guest_virt_system, |
387 |
+ .write_std = kvm_write_guest_virt_system, |
388 |
+@@ -4685,6 +4707,7 @@ static struct x86_emulate_ops emulate_ops = { |
389 |
+ .get_fpu = emulator_get_fpu, |
390 |
+ .put_fpu = emulator_put_fpu, |
391 |
+ .intercept = emulator_intercept, |
392 |
++ .get_cpuid = emulator_get_cpuid, |
393 |
+ }; |
394 |
+ |
395 |
+ static void cache_all_regs(struct kvm_vcpu *vcpu) |
396 |
+diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c |
397 |
+index 7c1b765..5671752 100644 |
398 |
+--- a/arch/x86/net/bpf_jit_comp.c |
399 |
++++ b/arch/x86/net/bpf_jit_comp.c |
400 |
+@@ -475,8 +475,10 @@ void bpf_jit_compile(struct sk_filter *fp) |
401 |
+ case BPF_S_LD_W_ABS: |
402 |
+ func = sk_load_word; |
403 |
+ common_load: seen |= SEEN_DATAREF; |
404 |
+- if ((int)K < 0) |
405 |
++ if ((int)K < 0) { |
406 |
++ /* Abort the JIT because __load_pointer() is needed. */ |
407 |
+ goto out; |
408 |
++ } |
409 |
+ t_offset = func - (image + addrs[i]); |
410 |
+ EMIT1_off32(0xbe, K); /* mov imm32,%esi */ |
411 |
+ EMIT1_off32(0xe8, t_offset); /* call */ |
412 |
+@@ -489,14 +491,8 @@ common_load: seen |= SEEN_DATAREF; |
413 |
+ goto common_load; |
414 |
+ case BPF_S_LDX_B_MSH: |
415 |
+ if ((int)K < 0) { |
416 |
+- if (pc_ret0 > 0) { |
417 |
+- /* addrs[pc_ret0 - 1] is the start address */ |
418 |
+- EMIT_JMP(addrs[pc_ret0 - 1] - addrs[i]); |
419 |
+- break; |
420 |
+- } |
421 |
+- CLEAR_A(); |
422 |
+- EMIT_JMP(cleanup_addr - addrs[i]); |
423 |
+- break; |
424 |
++ /* Abort the JIT because __load_pointer() is needed. */ |
425 |
++ goto out; |
426 |
+ } |
427 |
+ seen |= SEEN_DATAREF | SEEN_XREG; |
428 |
+ t_offset = sk_load_byte_msh - (image + addrs[i]); |
429 |
+diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c |
430 |
+index 35aca7d..4fe9d21 100644 |
431 |
+--- a/drivers/ata/pata_legacy.c |
432 |
++++ b/drivers/ata/pata_legacy.c |
433 |
+@@ -401,8 +401,7 @@ static void ht6560b_set_piomode(struct ata_port *ap, struct ata_device *adev) |
434 |
+ ata_timing_compute(adev, adev->pio_mode, &t, 20000, 1000); |
435 |
+ |
436 |
+ active = clamp_val(t.active, 2, 15); |
437 |
+- recover = clamp_val(t.recover, 2, 16); |
438 |
+- recover &= 0x15; |
439 |
++ recover = clamp_val(t.recover, 2, 16) & 0x0F; |
440 |
+ |
441 |
+ inb(0x3E6); |
442 |
+ inb(0x3E6); |
443 |
+diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c |
444 |
+index 6790cf7..79038e5 100644 |
445 |
+--- a/drivers/base/power/domain.c |
446 |
++++ b/drivers/base/power/domain.c |
447 |
+@@ -751,7 +751,8 @@ static int pm_genpd_resume_noirq(struct device *dev) |
448 |
+ if (IS_ERR(genpd)) |
449 |
+ return -EINVAL; |
450 |
+ |
451 |
+- if (genpd->suspend_power_off) |
452 |
++ if (genpd->suspend_power_off |
453 |
++ || (dev->power.wakeup_path && genpd_dev_active_wakeup(genpd, dev))) |
454 |
+ return 0; |
455 |
+ |
456 |
+ /* |
457 |
+diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c |
458 |
+index 106beb1..db811d2 100644 |
459 |
+--- a/drivers/bluetooth/ath3k.c |
460 |
++++ b/drivers/bluetooth/ath3k.c |
461 |
+@@ -64,6 +64,7 @@ static struct usb_device_id ath3k_table[] = { |
462 |
+ { USB_DEVICE(0x0CF3, 0x3002) }, |
463 |
+ { USB_DEVICE(0x13d3, 0x3304) }, |
464 |
+ { USB_DEVICE(0x0930, 0x0215) }, |
465 |
++ { USB_DEVICE(0x0489, 0xE03D) }, |
466 |
+ |
467 |
+ /* Atheros AR9285 Malbec with sflash firmware */ |
468 |
+ { USB_DEVICE(0x03F0, 0x311D) }, |
469 |
+diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
470 |
+index eabc437..c16c750 100644 |
471 |
+--- a/drivers/bluetooth/btusb.c |
472 |
++++ b/drivers/bluetooth/btusb.c |
473 |
+@@ -119,6 +119,7 @@ static struct usb_device_id blacklist_table[] = { |
474 |
+ { USB_DEVICE(0x0cf3, 0x3002), .driver_info = BTUSB_IGNORE }, |
475 |
+ { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE }, |
476 |
+ { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE }, |
477 |
++ { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE }, |
478 |
+ |
479 |
+ /* Atheros AR9285 Malbec with sflash firmware */ |
480 |
+ { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, |
481 |
+@@ -506,15 +507,10 @@ static int btusb_submit_isoc_urb(struct hci_dev *hdev, gfp_t mem_flags) |
482 |
+ |
483 |
+ pipe = usb_rcvisocpipe(data->udev, data->isoc_rx_ep->bEndpointAddress); |
484 |
+ |
485 |
+- urb->dev = data->udev; |
486 |
+- urb->pipe = pipe; |
487 |
+- urb->context = hdev; |
488 |
+- urb->complete = btusb_isoc_complete; |
489 |
+- urb->interval = data->isoc_rx_ep->bInterval; |
490 |
++ usb_fill_int_urb(urb, data->udev, pipe, buf, size, btusb_isoc_complete, |
491 |
++ hdev, data->isoc_rx_ep->bInterval); |
492 |
+ |
493 |
+ urb->transfer_flags = URB_FREE_BUFFER | URB_ISO_ASAP; |
494 |
+- urb->transfer_buffer = buf; |
495 |
+- urb->transfer_buffer_length = size; |
496 |
+ |
497 |
+ __fill_isoc_descriptor(urb, size, |
498 |
+ le16_to_cpu(data->isoc_rx_ep->wMaxPacketSize)); |
499 |
+diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig |
500 |
+index fa567f1..c9e045c 100644 |
501 |
+--- a/drivers/char/tpm/Kconfig |
502 |
++++ b/drivers/char/tpm/Kconfig |
503 |
+@@ -5,7 +5,6 @@ |
504 |
+ menuconfig TCG_TPM |
505 |
+ tristate "TPM Hardware Support" |
506 |
+ depends on HAS_IOMEM |
507 |
+- depends on EXPERIMENTAL |
508 |
+ select SECURITYFS |
509 |
+ ---help--- |
510 |
+ If you have a TPM security chip in your system, which |
511 |
+diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c |
512 |
+index 361a1df..b366b34 100644 |
513 |
+--- a/drivers/char/tpm/tpm.c |
514 |
++++ b/drivers/char/tpm/tpm.c |
515 |
+@@ -1115,12 +1115,13 @@ ssize_t tpm_read(struct file *file, char __user *buf, |
516 |
+ ret_size = atomic_read(&chip->data_pending); |
517 |
+ atomic_set(&chip->data_pending, 0); |
518 |
+ if (ret_size > 0) { /* relay data */ |
519 |
++ ssize_t orig_ret_size = ret_size; |
520 |
+ if (size < ret_size) |
521 |
+ ret_size = size; |
522 |
+ |
523 |
+ mutex_lock(&chip->buffer_mutex); |
524 |
+ rc = copy_to_user(buf, chip->data_buffer, ret_size); |
525 |
+- memset(chip->data_buffer, 0, ret_size); |
526 |
++ memset(chip->data_buffer, 0, orig_ret_size); |
527 |
+ if (rc) |
528 |
+ ret_size = -EFAULT; |
529 |
+ |
530 |
+diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c |
531 |
+index 7f5f0da..0a0225a 100644 |
532 |
+--- a/drivers/firewire/ohci.c |
533 |
++++ b/drivers/firewire/ohci.c |
534 |
+@@ -2748,7 +2748,7 @@ static int handle_ir_buffer_fill(struct context *context, |
535 |
+ container_of(context, struct iso_context, context); |
536 |
+ u32 buffer_dma; |
537 |
+ |
538 |
+- if (!last->transfer_status) |
539 |
++ if (last->res_count != 0) |
540 |
+ /* Descriptor(s) not done yet, stop iteration */ |
541 |
+ return 0; |
542 |
+ |
543 |
+@@ -2762,8 +2762,7 @@ static int handle_ir_buffer_fill(struct context *context, |
544 |
+ if (le16_to_cpu(last->control) & DESCRIPTOR_IRQ_ALWAYS) |
545 |
+ ctx->base.callback.mc(&ctx->base, |
546 |
+ le32_to_cpu(last->data_address) + |
547 |
+- le16_to_cpu(last->req_count) - |
548 |
+- le16_to_cpu(last->res_count), |
549 |
++ le16_to_cpu(last->req_count), |
550 |
+ ctx->base.callback_data); |
551 |
+ |
552 |
+ return 1; |
553 |
+diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c |
554 |
+index df0d595..3d00016 100644 |
555 |
+--- a/drivers/gpio/gpio-davinci.c |
556 |
++++ b/drivers/gpio/gpio-davinci.c |
557 |
+@@ -313,10 +313,16 @@ static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset) |
558 |
+ return -ENODEV; |
559 |
+ } |
560 |
+ |
561 |
+-static int gpio_irq_type_unbanked(struct irq_data *d, unsigned trigger) |
562 |
++static int gpio_irq_type_unbanked(struct irq_data *data, unsigned trigger) |
563 |
+ { |
564 |
+- struct davinci_gpio_regs __iomem *g = irq2regs(d->irq); |
565 |
+- u32 mask = (u32) irq_data_get_irq_handler_data(d); |
566 |
++ struct davinci_gpio_controller *d; |
567 |
++ struct davinci_gpio_regs __iomem *g; |
568 |
++ struct davinci_soc_info *soc_info = &davinci_soc_info; |
569 |
++ u32 mask; |
570 |
++ |
571 |
++ d = (struct davinci_gpio_controller *)data->handler_data; |
572 |
++ g = (struct davinci_gpio_regs __iomem *)d->regs; |
573 |
++ mask = __gpio_mask(data->irq - soc_info->gpio_irq); |
574 |
+ |
575 |
+ if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) |
576 |
+ return -EINVAL; |
577 |
+@@ -380,7 +386,7 @@ static int __init davinci_gpio_irq_setup(void) |
578 |
+ * IRQ mux conflicts; gpio_irq_type_unbanked() is only for GPIOs. |
579 |
+ */ |
580 |
+ if (soc_info->gpio_unbanked) { |
581 |
+- static struct irq_chip gpio_irqchip_unbanked; |
582 |
++ static struct irq_chip_type gpio_unbanked; |
583 |
+ |
584 |
+ /* pass "bank 0" GPIO IRQs to AINTC */ |
585 |
+ chips[0].chip.to_irq = gpio_to_irq_unbanked; |
586 |
+@@ -388,9 +394,10 @@ static int __init davinci_gpio_irq_setup(void) |
587 |
+ |
588 |
+ /* AINTC handles mask/unmask; GPIO handles triggering */ |
589 |
+ irq = bank_irq; |
590 |
+- gpio_irqchip_unbanked = *irq_get_chip(irq); |
591 |
+- gpio_irqchip_unbanked.name = "GPIO-AINTC"; |
592 |
+- gpio_irqchip_unbanked.irq_set_type = gpio_irq_type_unbanked; |
593 |
++ gpio_unbanked = *container_of(irq_get_chip(irq), |
594 |
++ struct irq_chip_type, chip); |
595 |
++ gpio_unbanked.chip.name = "GPIO-AINTC"; |
596 |
++ gpio_unbanked.chip.irq_set_type = gpio_irq_type_unbanked; |
597 |
+ |
598 |
+ /* default trigger: both edges */ |
599 |
+ g = gpio2regs(0); |
600 |
+@@ -399,9 +406,8 @@ static int __init davinci_gpio_irq_setup(void) |
601 |
+ |
602 |
+ /* set the direct IRQs up to use that irqchip */ |
603 |
+ for (gpio = 0; gpio < soc_info->gpio_unbanked; gpio++, irq++) { |
604 |
+- irq_set_chip(irq, &gpio_irqchip_unbanked); |
605 |
+- irq_set_handler_data(irq, (void *)__gpio_mask(gpio)); |
606 |
+- irq_set_chip_data(irq, (__force void *)g); |
607 |
++ irq_set_chip(irq, &gpio_unbanked.chip); |
608 |
++ irq_set_handler_data(irq, &chips[gpio / 32]); |
609 |
+ irq_set_status_flags(irq, IRQ_TYPE_EDGE_BOTH); |
610 |
+ } |
611 |
+ |
612 |
+diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c |
613 |
+index 0b05629..a6c10e8 100644 |
614 |
+--- a/drivers/gpio/gpio-omap.c |
615 |
++++ b/drivers/gpio/gpio-omap.c |
616 |
+@@ -508,7 +508,10 @@ static void _disable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask) |
617 |
+ |
618 |
+ static inline void _set_gpio_irqenable(struct gpio_bank *bank, int gpio, int enable) |
619 |
+ { |
620 |
+- _enable_gpio_irqbank(bank, GPIO_BIT(bank, gpio)); |
621 |
++ if (enable) |
622 |
++ _enable_gpio_irqbank(bank, GPIO_BIT(bank, gpio)); |
623 |
++ else |
624 |
++ _disable_gpio_irqbank(bank, GPIO_BIT(bank, gpio)); |
625 |
+ } |
626 |
+ |
627 |
+ /* |
628 |
+diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c |
629 |
+index e2d85a9..d04597d 100644 |
630 |
+--- a/drivers/gpu/drm/i915/i915_drv.c |
631 |
++++ b/drivers/gpu/drm/i915/i915_drv.c |
632 |
+@@ -442,6 +442,10 @@ static int i915_drm_freeze(struct drm_device *dev) |
633 |
+ /* Modeset on resume, not lid events */ |
634 |
+ dev_priv->modeset_on_lid = 0; |
635 |
+ |
636 |
++ console_lock(); |
637 |
++ intel_fbdev_set_suspend(dev, 1); |
638 |
++ console_unlock(); |
639 |
++ |
640 |
+ return 0; |
641 |
+ } |
642 |
+ |
643 |
+@@ -514,6 +518,9 @@ static int i915_drm_thaw(struct drm_device *dev) |
644 |
+ |
645 |
+ dev_priv->modeset_on_lid = 0; |
646 |
+ |
647 |
++ console_lock(); |
648 |
++ intel_fbdev_set_suspend(dev, 0); |
649 |
++ console_unlock(); |
650 |
+ return error; |
651 |
+ } |
652 |
+ |
653 |
+diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c |
654 |
+index 8359dc7..3e7c478 100644 |
655 |
+--- a/drivers/gpu/drm/i915/i915_gem.c |
656 |
++++ b/drivers/gpu/drm/i915/i915_gem.c |
657 |
+@@ -3084,10 +3084,13 @@ i915_gem_object_finish_gpu(struct drm_i915_gem_object *obj) |
658 |
+ return ret; |
659 |
+ } |
660 |
+ |
661 |
++ ret = i915_gem_object_wait_rendering(obj); |
662 |
++ if (ret) |
663 |
++ return ret; |
664 |
++ |
665 |
+ /* Ensure that we invalidate the GPU's caches and TLBs. */ |
666 |
+ obj->base.read_domains &= ~I915_GEM_GPU_DOMAINS; |
667 |
+- |
668 |
+- return i915_gem_object_wait_rendering(obj); |
669 |
++ return 0; |
670 |
+ } |
671 |
+ |
672 |
+ /** |
673 |
+diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h |
674 |
+index a1b4343..83e820e 100644 |
675 |
+--- a/drivers/gpu/drm/i915/intel_drv.h |
676 |
++++ b/drivers/gpu/drm/i915/intel_drv.h |
677 |
+@@ -364,7 +364,7 @@ extern int intel_framebuffer_init(struct drm_device *dev, |
678 |
+ struct drm_i915_gem_object *obj); |
679 |
+ extern int intel_fbdev_init(struct drm_device *dev); |
680 |
+ extern void intel_fbdev_fini(struct drm_device *dev); |
681 |
+- |
682 |
++extern void intel_fbdev_set_suspend(struct drm_device *dev, int state); |
683 |
+ extern void intel_prepare_page_flip(struct drm_device *dev, int plane); |
684 |
+ extern void intel_finish_page_flip(struct drm_device *dev, int pipe); |
685 |
+ extern void intel_finish_page_flip_plane(struct drm_device *dev, int plane); |
686 |
+diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c |
687 |
+index ec49bae..d0ce34b 100644 |
688 |
+--- a/drivers/gpu/drm/i915/intel_fb.c |
689 |
++++ b/drivers/gpu/drm/i915/intel_fb.c |
690 |
+@@ -257,6 +257,16 @@ void intel_fbdev_fini(struct drm_device *dev) |
691 |
+ kfree(dev_priv->fbdev); |
692 |
+ dev_priv->fbdev = NULL; |
693 |
+ } |
694 |
++ |
695 |
++void intel_fbdev_set_suspend(struct drm_device *dev, int state) |
696 |
++{ |
697 |
++ drm_i915_private_t *dev_priv = dev->dev_private; |
698 |
++ if (!dev_priv->fbdev) |
699 |
++ return; |
700 |
++ |
701 |
++ fb_set_suspend(dev_priv->fbdev->helper.fbdev, state); |
702 |
++} |
703 |
++ |
704 |
+ MODULE_LICENSE("GPL and additional rights"); |
705 |
+ |
706 |
+ void intel_fb_output_poll_changed(struct drm_device *dev) |
707 |
+diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c |
708 |
+index 5082d17..8e1532f 100644 |
709 |
+--- a/drivers/gpu/drm/radeon/radeon_atombios.c |
710 |
++++ b/drivers/gpu/drm/radeon/radeon_atombios.c |
711 |
+@@ -442,6 +442,20 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev, |
712 |
+ struct radeon_device *rdev = dev->dev_private; |
713 |
+ *i2c_bus = radeon_lookup_i2c_gpio(rdev, 0x93); |
714 |
+ } |
715 |
++ |
716 |
++ /* Fujitsu D3003-S2 board lists DVI-I as DVI-D and VGA */ |
717 |
++ if ((dev->pdev->device == 0x9802) && |
718 |
++ (dev->pdev->subsystem_vendor == 0x1734) && |
719 |
++ (dev->pdev->subsystem_device == 0x11bd)) { |
720 |
++ if (*connector_type == DRM_MODE_CONNECTOR_VGA) { |
721 |
++ *connector_type = DRM_MODE_CONNECTOR_DVII; |
722 |
++ *line_mux = 0x3103; |
723 |
++ } else if (*connector_type == DRM_MODE_CONNECTOR_DVID) { |
724 |
++ *connector_type = DRM_MODE_CONNECTOR_DVII; |
725 |
++ } |
726 |
++ } |
727 |
++ |
728 |
++ |
729 |
+ return true; |
730 |
+ } |
731 |
+ |
732 |
+diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c |
733 |
+index e7cb3ab..f7d39ac 100644 |
734 |
+--- a/drivers/gpu/drm/radeon/radeon_connectors.c |
735 |
++++ b/drivers/gpu/drm/radeon/radeon_connectors.c |
736 |
+@@ -946,6 +946,10 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) |
737 |
+ |
738 |
+ encoder = obj_to_encoder(obj); |
739 |
+ |
740 |
++ if (encoder->encoder_type != DRM_MODE_ENCODER_DAC || |
741 |
++ encoder->encoder_type != DRM_MODE_ENCODER_TVDAC) |
742 |
++ continue; |
743 |
++ |
744 |
+ encoder_funcs = encoder->helper_private; |
745 |
+ if (encoder_funcs->detect) { |
746 |
+ if (ret != connector_status_connected) { |
747 |
+diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c |
748 |
+index fde25c0..986d608 100644 |
749 |
+--- a/drivers/gpu/drm/radeon/radeon_cursor.c |
750 |
++++ b/drivers/gpu/drm/radeon/radeon_cursor.c |
751 |
+@@ -151,7 +151,9 @@ int radeon_crtc_cursor_set(struct drm_crtc *crtc, |
752 |
+ uint32_t height) |
753 |
+ { |
754 |
+ struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
755 |
++ struct radeon_device *rdev = crtc->dev->dev_private; |
756 |
+ struct drm_gem_object *obj; |
757 |
++ struct radeon_bo *robj; |
758 |
+ uint64_t gpu_addr; |
759 |
+ int ret; |
760 |
+ |
761 |
+@@ -173,7 +175,15 @@ int radeon_crtc_cursor_set(struct drm_crtc *crtc, |
762 |
+ return -ENOENT; |
763 |
+ } |
764 |
+ |
765 |
+- ret = radeon_gem_object_pin(obj, RADEON_GEM_DOMAIN_VRAM, &gpu_addr); |
766 |
++ robj = gem_to_radeon_bo(obj); |
767 |
++ ret = radeon_bo_reserve(robj, false); |
768 |
++ if (unlikely(ret != 0)) |
769 |
++ goto fail; |
770 |
++ /* Only 27 bit offset for legacy cursor */ |
771 |
++ ret = radeon_bo_pin_restricted(robj, RADEON_GEM_DOMAIN_VRAM, |
772 |
++ ASIC_IS_AVIVO(rdev) ? 0 : 1 << 27, |
773 |
++ &gpu_addr); |
774 |
++ radeon_bo_unreserve(robj); |
775 |
+ if (ret) |
776 |
+ goto fail; |
777 |
+ |
778 |
+@@ -181,7 +191,6 @@ int radeon_crtc_cursor_set(struct drm_crtc *crtc, |
779 |
+ radeon_crtc->cursor_height = height; |
780 |
+ |
781 |
+ radeon_lock_cursor(crtc, true); |
782 |
+- /* XXX only 27 bit offset for legacy cursor */ |
783 |
+ radeon_set_cursor(crtc, obj, gpu_addr); |
784 |
+ radeon_show_cursor(crtc); |
785 |
+ radeon_lock_cursor(crtc, false); |
786 |
+diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c |
787 |
+index 1c85152..f3ae607 100644 |
788 |
+--- a/drivers/gpu/drm/radeon/radeon_object.c |
789 |
++++ b/drivers/gpu/drm/radeon/radeon_object.c |
790 |
+@@ -204,7 +204,8 @@ void radeon_bo_unref(struct radeon_bo **bo) |
791 |
+ *bo = NULL; |
792 |
+ } |
793 |
+ |
794 |
+-int radeon_bo_pin(struct radeon_bo *bo, u32 domain, u64 *gpu_addr) |
795 |
++int radeon_bo_pin_restricted(struct radeon_bo *bo, u32 domain, u64 max_offset, |
796 |
++ u64 *gpu_addr) |
797 |
+ { |
798 |
+ int r, i; |
799 |
+ |
800 |
+@@ -212,6 +213,7 @@ int radeon_bo_pin(struct radeon_bo *bo, u32 domain, u64 *gpu_addr) |
801 |
+ bo->pin_count++; |
802 |
+ if (gpu_addr) |
803 |
+ *gpu_addr = radeon_bo_gpu_offset(bo); |
804 |
++ WARN_ON_ONCE(max_offset != 0); |
805 |
+ return 0; |
806 |
+ } |
807 |
+ radeon_ttm_placement_from_domain(bo, domain); |
808 |
+@@ -219,6 +221,15 @@ int radeon_bo_pin(struct radeon_bo *bo, u32 domain, u64 *gpu_addr) |
809 |
+ /* force to pin into visible video ram */ |
810 |
+ bo->placement.lpfn = bo->rdev->mc.visible_vram_size >> PAGE_SHIFT; |
811 |
+ } |
812 |
++ if (max_offset) { |
813 |
++ u64 lpfn = max_offset >> PAGE_SHIFT; |
814 |
++ |
815 |
++ if (!bo->placement.lpfn) |
816 |
++ bo->placement.lpfn = bo->rdev->mc.gtt_size >> PAGE_SHIFT; |
817 |
++ |
818 |
++ if (lpfn < bo->placement.lpfn) |
819 |
++ bo->placement.lpfn = lpfn; |
820 |
++ } |
821 |
+ for (i = 0; i < bo->placement.num_placement; i++) |
822 |
+ bo->placements[i] |= TTM_PL_FLAG_NO_EVICT; |
823 |
+ r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false, false); |
824 |
+@@ -232,6 +243,11 @@ int radeon_bo_pin(struct radeon_bo *bo, u32 domain, u64 *gpu_addr) |
825 |
+ return r; |
826 |
+ } |
827 |
+ |
828 |
++int radeon_bo_pin(struct radeon_bo *bo, u32 domain, u64 *gpu_addr) |
829 |
++{ |
830 |
++ return radeon_bo_pin_restricted(bo, domain, 0, gpu_addr); |
831 |
++} |
832 |
++ |
833 |
+ int radeon_bo_unpin(struct radeon_bo *bo) |
834 |
+ { |
835 |
+ int r, i; |
836 |
+diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h |
837 |
+index b07f0f9..fb3f433 100644 |
838 |
+--- a/drivers/gpu/drm/radeon/radeon_object.h |
839 |
++++ b/drivers/gpu/drm/radeon/radeon_object.h |
840 |
+@@ -108,6 +108,8 @@ extern int radeon_bo_kmap(struct radeon_bo *bo, void **ptr); |
841 |
+ extern void radeon_bo_kunmap(struct radeon_bo *bo); |
842 |
+ extern void radeon_bo_unref(struct radeon_bo **bo); |
843 |
+ extern int radeon_bo_pin(struct radeon_bo *bo, u32 domain, u64 *gpu_addr); |
844 |
++extern int radeon_bo_pin_restricted(struct radeon_bo *bo, u32 domain, |
845 |
++ u64 max_offset, u64 *gpu_addr); |
846 |
+ extern int radeon_bo_unpin(struct radeon_bo *bo); |
847 |
+ extern int radeon_bo_evict_vram(struct radeon_device *rdev); |
848 |
+ extern void radeon_bo_force_delete(struct radeon_device *rdev); |
849 |
+diff --git a/drivers/hid/hid-chicony.c b/drivers/hid/hid-chicony.c |
850 |
+index 8965ad9..b99af34 100644 |
851 |
+--- a/drivers/hid/hid-chicony.c |
852 |
++++ b/drivers/hid/hid-chicony.c |
853 |
+@@ -45,6 +45,12 @@ static int ch_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
854 |
+ case 0xff09: ch_map_key_clear(BTN_9); break; |
855 |
+ case 0xff0a: ch_map_key_clear(BTN_A); break; |
856 |
+ case 0xff0b: ch_map_key_clear(BTN_B); break; |
857 |
++ case 0x00f1: ch_map_key_clear(KEY_WLAN); break; |
858 |
++ case 0x00f2: ch_map_key_clear(KEY_BRIGHTNESSDOWN); break; |
859 |
++ case 0x00f3: ch_map_key_clear(KEY_BRIGHTNESSUP); break; |
860 |
++ case 0x00f4: ch_map_key_clear(KEY_DISPLAY_OFF); break; |
861 |
++ case 0x00f7: ch_map_key_clear(KEY_CAMERA); break; |
862 |
++ case 0x00f8: ch_map_key_clear(KEY_PROG1); break; |
863 |
+ default: |
864 |
+ return 0; |
865 |
+ } |
866 |
+@@ -53,6 +59,7 @@ static int ch_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
867 |
+ |
868 |
+ static const struct hid_device_id ch_devices[] = { |
869 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, |
870 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, |
871 |
+ { } |
872 |
+ }; |
873 |
+ MODULE_DEVICE_TABLE(hid, ch_devices); |
874 |
+diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c |
875 |
+index bb656d8..c27b402 100644 |
876 |
+--- a/drivers/hid/hid-core.c |
877 |
++++ b/drivers/hid/hid-core.c |
878 |
+@@ -1394,6 +1394,7 @@ static const struct hid_device_id hid_have_special_driver[] = { |
879 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION_SOLAR) }, |
880 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, |
881 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, |
882 |
++ { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, |
883 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT, USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) }, |
884 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, |
885 |
+ { HID_USB_DEVICE(USB_VENDOR_ID_CVTOUCH, USB_DEVICE_ID_CVTOUCH_SCREEN) }, |
886 |
+diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h |
887 |
+index 3c3daec..fba3fc4 100644 |
888 |
+--- a/drivers/hid/hid-ids.h |
889 |
++++ b/drivers/hid/hid-ids.h |
890 |
+@@ -192,6 +192,7 @@ |
891 |
+ #define USB_DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418 |
892 |
+ #define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d |
893 |
+ #define USB_DEVICE_ID_CHICONY_WIRELESS 0x0618 |
894 |
++#define USB_DEVICE_ID_CHICONY_WIRELESS2 0x1123 |
895 |
+ |
896 |
+ #define USB_VENDOR_ID_CHUNGHWAT 0x2247 |
897 |
+ #define USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH 0x0001 |
898 |
+diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c |
899 |
+index 523f8fb..930370d 100644 |
900 |
+--- a/drivers/hwmon/fam15h_power.c |
901 |
++++ b/drivers/hwmon/fam15h_power.c |
902 |
+@@ -60,7 +60,7 @@ static ssize_t show_power(struct device *dev, |
903 |
+ pci_bus_read_config_dword(f4->bus, PCI_DEVFN(PCI_SLOT(f4->devfn), 5), |
904 |
+ REG_TDP_RUNNING_AVERAGE, &val); |
905 |
+ running_avg_capture = (val >> 4) & 0x3fffff; |
906 |
+- running_avg_capture = sign_extend32(running_avg_capture, 22); |
907 |
++ running_avg_capture = sign_extend32(running_avg_capture, 21); |
908 |
+ running_avg_range = val & 0xf; |
909 |
+ |
910 |
+ pci_bus_read_config_dword(f4->bus, PCI_DEVFN(PCI_SLOT(f4->devfn), 5), |
911 |
+diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c |
912 |
+index 7e7373a..d5f3b69 100644 |
913 |
+--- a/drivers/infiniband/ulp/iser/iscsi_iser.c |
914 |
++++ b/drivers/infiniband/ulp/iser/iscsi_iser.c |
915 |
+@@ -364,6 +364,9 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session, |
916 |
+ } |
917 |
+ ib_conn = ep->dd_data; |
918 |
+ |
919 |
++ if (iser_alloc_rx_descriptors(ib_conn)) |
920 |
++ return -ENOMEM; |
921 |
++ |
922 |
+ /* binds the iSER connection retrieved from the previously |
923 |
+ * connected ep_handle to the iSCSI layer connection. exchanges |
924 |
+ * connection pointers */ |
925 |
+@@ -398,19 +401,6 @@ iscsi_iser_conn_stop(struct iscsi_cls_conn *cls_conn, int flag) |
926 |
+ iser_conn->ib_conn = NULL; |
927 |
+ } |
928 |
+ |
929 |
+-static int |
930 |
+-iscsi_iser_conn_start(struct iscsi_cls_conn *cls_conn) |
931 |
+-{ |
932 |
+- struct iscsi_conn *conn = cls_conn->dd_data; |
933 |
+- int err; |
934 |
+- |
935 |
+- err = iser_conn_set_full_featured_mode(conn); |
936 |
+- if (err) |
937 |
+- return err; |
938 |
+- |
939 |
+- return iscsi_conn_start(cls_conn); |
940 |
+-} |
941 |
+- |
942 |
+ static void iscsi_iser_session_destroy(struct iscsi_cls_session *cls_session) |
943 |
+ { |
944 |
+ struct Scsi_Host *shost = iscsi_session_to_shost(cls_session); |
945 |
+@@ -724,7 +714,7 @@ static struct iscsi_transport iscsi_iser_transport = { |
946 |
+ .get_conn_param = iscsi_conn_get_param, |
947 |
+ .get_ep_param = iscsi_iser_get_ep_param, |
948 |
+ .get_session_param = iscsi_session_get_param, |
949 |
+- .start_conn = iscsi_iser_conn_start, |
950 |
++ .start_conn = iscsi_conn_start, |
951 |
+ .stop_conn = iscsi_iser_conn_stop, |
952 |
+ /* iscsi host params */ |
953 |
+ .get_host_param = iscsi_host_get_param, |
954 |
+diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h |
955 |
+index db7ea37..296be43 100644 |
956 |
+--- a/drivers/infiniband/ulp/iser/iscsi_iser.h |
957 |
++++ b/drivers/infiniband/ulp/iser/iscsi_iser.h |
958 |
+@@ -366,4 +366,5 @@ int iser_dma_map_task_data(struct iscsi_iser_task *iser_task, |
959 |
+ void iser_dma_unmap_task_data(struct iscsi_iser_task *iser_task); |
960 |
+ int iser_initialize_task_headers(struct iscsi_task *task, |
961 |
+ struct iser_tx_desc *tx_desc); |
962 |
++int iser_alloc_rx_descriptors(struct iser_conn *ib_conn); |
963 |
+ #endif |
964 |
+diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c |
965 |
+index a607542..738a149 100644 |
966 |
+--- a/drivers/infiniband/ulp/iser/iser_initiator.c |
967 |
++++ b/drivers/infiniband/ulp/iser/iser_initiator.c |
968 |
+@@ -170,7 +170,7 @@ static void iser_create_send_desc(struct iser_conn *ib_conn, |
969 |
+ } |
970 |
+ |
971 |
+ |
972 |
+-static int iser_alloc_rx_descriptors(struct iser_conn *ib_conn) |
973 |
++int iser_alloc_rx_descriptors(struct iser_conn *ib_conn) |
974 |
+ { |
975 |
+ int i, j; |
976 |
+ u64 dma_addr; |
977 |
+@@ -242,23 +242,24 @@ void iser_free_rx_descriptors(struct iser_conn *ib_conn) |
978 |
+ kfree(ib_conn->rx_descs); |
979 |
+ } |
980 |
+ |
981 |
+-/** |
982 |
+- * iser_conn_set_full_featured_mode - (iSER API) |
983 |
+- */ |
984 |
+-int iser_conn_set_full_featured_mode(struct iscsi_conn *conn) |
985 |
++static int iser_post_rx_bufs(struct iscsi_conn *conn, struct iscsi_hdr *req) |
986 |
+ { |
987 |
+ struct iscsi_iser_conn *iser_conn = conn->dd_data; |
988 |
+ |
989 |
+- iser_dbg("Initially post: %d\n", ISER_MIN_POSTED_RX); |
990 |
+- |
991 |
+- /* Check that there is no posted recv or send buffers left - */ |
992 |
+- /* they must be consumed during the login phase */ |
993 |
+- BUG_ON(iser_conn->ib_conn->post_recv_buf_count != 0); |
994 |
+- BUG_ON(atomic_read(&iser_conn->ib_conn->post_send_buf_count) != 0); |
995 |
++ iser_dbg("req op %x flags %x\n", req->opcode, req->flags); |
996 |
++ /* check if this is the last login - going to full feature phase */ |
997 |
++ if ((req->flags & ISCSI_FULL_FEATURE_PHASE) != ISCSI_FULL_FEATURE_PHASE) |
998 |
++ return 0; |
999 |
+ |
1000 |
+- if (iser_alloc_rx_descriptors(iser_conn->ib_conn)) |
1001 |
+- return -ENOMEM; |
1002 |
++ /* |
1003 |
++ * Check that there is one posted recv buffer (for the last login |
1004 |
++ * response) and no posted send buffers left - they must have been |
1005 |
++ * consumed during previous login phases. |
1006 |
++ */ |
1007 |
++ WARN_ON(iser_conn->ib_conn->post_recv_buf_count != 1); |
1008 |
++ WARN_ON(atomic_read(&iser_conn->ib_conn->post_send_buf_count) != 0); |
1009 |
+ |
1010 |
++ iser_dbg("Initially post: %d\n", ISER_MIN_POSTED_RX); |
1011 |
+ /* Initial post receive buffers */ |
1012 |
+ if (iser_post_recvm(iser_conn->ib_conn, ISER_MIN_POSTED_RX)) |
1013 |
+ return -ENOMEM; |
1014 |
+@@ -438,6 +439,9 @@ int iser_send_control(struct iscsi_conn *conn, |
1015 |
+ err = iser_post_recvl(iser_conn->ib_conn); |
1016 |
+ if (err) |
1017 |
+ goto send_control_error; |
1018 |
++ err = iser_post_rx_bufs(conn, task->hdr); |
1019 |
++ if (err) |
1020 |
++ goto send_control_error; |
1021 |
+ } |
1022 |
+ |
1023 |
+ err = iser_post_send(iser_conn->ib_conn, mdesc); |
1024 |
+diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c |
1025 |
+index e0b3e33..966a6e7 100644 |
1026 |
+--- a/drivers/iommu/amd_iommu.c |
1027 |
++++ b/drivers/iommu/amd_iommu.c |
1028 |
+@@ -2432,7 +2432,7 @@ static int amd_iommu_dma_supported(struct device *dev, u64 mask) |
1029 |
+ * we don't need to preallocate the protection domains anymore. |
1030 |
+ * For now we have to. |
1031 |
+ */ |
1032 |
+-static void prealloc_protection_domains(void) |
1033 |
++static void __init prealloc_protection_domains(void) |
1034 |
+ { |
1035 |
+ struct pci_dev *dev = NULL; |
1036 |
+ struct dma_ops_domain *dma_dom; |
1037 |
+diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c |
1038 |
+index 6d03774..2a8722b 100644 |
1039 |
+--- a/drivers/md/bitmap.c |
1040 |
++++ b/drivers/md/bitmap.c |
1041 |
+@@ -1904,6 +1904,8 @@ location_store(struct mddev *mddev, const char *buf, size_t len) |
1042 |
+ if (mddev->pers) { |
1043 |
+ mddev->pers->quiesce(mddev, 1); |
1044 |
+ rv = bitmap_create(mddev); |
1045 |
++ if (!rv) |
1046 |
++ rv = bitmap_load(mddev); |
1047 |
+ if (rv) { |
1048 |
+ bitmap_destroy(mddev); |
1049 |
+ mddev->bitmap_info.offset = 0; |
1050 |
+diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c |
1051 |
+index 8c2a000..58d8c6d 100644 |
1052 |
+--- a/drivers/md/dm-crypt.c |
1053 |
++++ b/drivers/md/dm-crypt.c |
1054 |
+@@ -176,7 +176,6 @@ struct crypt_config { |
1055 |
+ |
1056 |
+ #define MIN_IOS 16 |
1057 |
+ #define MIN_POOL_PAGES 32 |
1058 |
+-#define MIN_BIO_PAGES 8 |
1059 |
+ |
1060 |
+ static struct kmem_cache *_crypt_io_pool; |
1061 |
+ |
1062 |
+@@ -848,12 +847,11 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned size, |
1063 |
+ } |
1064 |
+ |
1065 |
+ /* |
1066 |
+- * if additional pages cannot be allocated without waiting, |
1067 |
+- * return a partially allocated bio, the caller will then try |
1068 |
+- * to allocate additional bios while submitting this partial bio |
1069 |
++ * If additional pages cannot be allocated without waiting, |
1070 |
++ * return a partially-allocated bio. The caller will then try |
1071 |
++ * to allocate more bios while submitting this partial bio. |
1072 |
+ */ |
1073 |
+- if (i == (MIN_BIO_PAGES - 1)) |
1074 |
+- gfp_mask = (gfp_mask | __GFP_NOWARN) & ~__GFP_WAIT; |
1075 |
++ gfp_mask = (gfp_mask | __GFP_NOWARN) & ~__GFP_WAIT; |
1076 |
+ |
1077 |
+ len = (size > PAGE_SIZE) ? PAGE_SIZE : size; |
1078 |
+ |
1079 |
+@@ -1046,16 +1044,14 @@ static void kcryptd_queue_io(struct dm_crypt_io *io) |
1080 |
+ queue_work(cc->io_queue, &io->work); |
1081 |
+ } |
1082 |
+ |
1083 |
+-static void kcryptd_crypt_write_io_submit(struct dm_crypt_io *io, |
1084 |
+- int error, int async) |
1085 |
++static void kcryptd_crypt_write_io_submit(struct dm_crypt_io *io, int async) |
1086 |
+ { |
1087 |
+ struct bio *clone = io->ctx.bio_out; |
1088 |
+ struct crypt_config *cc = io->target->private; |
1089 |
+ |
1090 |
+- if (unlikely(error < 0)) { |
1091 |
++ if (unlikely(io->error < 0)) { |
1092 |
+ crypt_free_buffer_pages(cc, clone); |
1093 |
+ bio_put(clone); |
1094 |
+- io->error = -EIO; |
1095 |
+ crypt_dec_pending(io); |
1096 |
+ return; |
1097 |
+ } |
1098 |
+@@ -1106,12 +1102,16 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io) |
1099 |
+ sector += bio_sectors(clone); |
1100 |
+ |
1101 |
+ crypt_inc_pending(io); |
1102 |
++ |
1103 |
+ r = crypt_convert(cc, &io->ctx); |
1104 |
++ if (r < 0) |
1105 |
++ io->error = -EIO; |
1106 |
++ |
1107 |
+ crypt_finished = atomic_dec_and_test(&io->ctx.pending); |
1108 |
+ |
1109 |
+ /* Encryption was already finished, submit io now */ |
1110 |
+ if (crypt_finished) { |
1111 |
+- kcryptd_crypt_write_io_submit(io, r, 0); |
1112 |
++ kcryptd_crypt_write_io_submit(io, 0); |
1113 |
+ |
1114 |
+ /* |
1115 |
+ * If there was an error, do not try next fragments. |
1116 |
+@@ -1162,11 +1162,8 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io) |
1117 |
+ crypt_dec_pending(io); |
1118 |
+ } |
1119 |
+ |
1120 |
+-static void kcryptd_crypt_read_done(struct dm_crypt_io *io, int error) |
1121 |
++static void kcryptd_crypt_read_done(struct dm_crypt_io *io) |
1122 |
+ { |
1123 |
+- if (unlikely(error < 0)) |
1124 |
+- io->error = -EIO; |
1125 |
+- |
1126 |
+ crypt_dec_pending(io); |
1127 |
+ } |
1128 |
+ |
1129 |
+@@ -1181,9 +1178,11 @@ static void kcryptd_crypt_read_convert(struct dm_crypt_io *io) |
1130 |
+ io->sector); |
1131 |
+ |
1132 |
+ r = crypt_convert(cc, &io->ctx); |
1133 |
++ if (r < 0) |
1134 |
++ io->error = -EIO; |
1135 |
+ |
1136 |
+ if (atomic_dec_and_test(&io->ctx.pending)) |
1137 |
+- kcryptd_crypt_read_done(io, r); |
1138 |
++ kcryptd_crypt_read_done(io); |
1139 |
+ |
1140 |
+ crypt_dec_pending(io); |
1141 |
+ } |
1142 |
+@@ -1204,15 +1203,18 @@ static void kcryptd_async_done(struct crypto_async_request *async_req, |
1143 |
+ if (!error && cc->iv_gen_ops && cc->iv_gen_ops->post) |
1144 |
+ error = cc->iv_gen_ops->post(cc, iv_of_dmreq(cc, dmreq), dmreq); |
1145 |
+ |
1146 |
++ if (error < 0) |
1147 |
++ io->error = -EIO; |
1148 |
++ |
1149 |
+ mempool_free(req_of_dmreq(cc, dmreq), cc->req_pool); |
1150 |
+ |
1151 |
+ if (!atomic_dec_and_test(&ctx->pending)) |
1152 |
+ return; |
1153 |
+ |
1154 |
+ if (bio_data_dir(io->base_bio) == READ) |
1155 |
+- kcryptd_crypt_read_done(io, error); |
1156 |
++ kcryptd_crypt_read_done(io); |
1157 |
+ else |
1158 |
+- kcryptd_crypt_write_io_submit(io, error, 1); |
1159 |
++ kcryptd_crypt_write_io_submit(io, 1); |
1160 |
+ } |
1161 |
+ |
1162 |
+ static void kcryptd_crypt(struct work_struct *work) |
1163 |
+diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c |
1164 |
+index 042e719..aa70f7d 100644 |
1165 |
+--- a/drivers/md/dm-exception-store.c |
1166 |
++++ b/drivers/md/dm-exception-store.c |
1167 |
+@@ -283,7 +283,7 @@ int dm_exception_store_init(void) |
1168 |
+ return 0; |
1169 |
+ |
1170 |
+ persistent_fail: |
1171 |
+- dm_persistent_snapshot_exit(); |
1172 |
++ dm_transient_snapshot_exit(); |
1173 |
+ transient_fail: |
1174 |
+ return r; |
1175 |
+ } |
1176 |
+diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c |
1177 |
+index c308757..da2f021 100644 |
1178 |
+--- a/drivers/md/dm-thin.c |
1179 |
++++ b/drivers/md/dm-thin.c |
1180 |
+@@ -124,7 +124,7 @@ struct cell { |
1181 |
+ struct hlist_node list; |
1182 |
+ struct bio_prison *prison; |
1183 |
+ struct cell_key key; |
1184 |
+- unsigned count; |
1185 |
++ struct bio *holder; |
1186 |
+ struct bio_list bios; |
1187 |
+ }; |
1188 |
+ |
1189 |
+@@ -220,55 +220,60 @@ static struct cell *__search_bucket(struct hlist_head *bucket, |
1190 |
+ * This may block if a new cell needs allocating. You must ensure that |
1191 |
+ * cells will be unlocked even if the calling thread is blocked. |
1192 |
+ * |
1193 |
+- * Returns the number of entries in the cell prior to the new addition |
1194 |
+- * or < 0 on failure. |
1195 |
++ * Returns 1 if the cell was already held, 0 if @inmate is the new holder. |
1196 |
+ */ |
1197 |
+ static int bio_detain(struct bio_prison *prison, struct cell_key *key, |
1198 |
+ struct bio *inmate, struct cell **ref) |
1199 |
+ { |
1200 |
+- int r; |
1201 |
++ int r = 1; |
1202 |
+ unsigned long flags; |
1203 |
+ uint32_t hash = hash_key(prison, key); |
1204 |
+- struct cell *uninitialized_var(cell), *cell2 = NULL; |
1205 |
++ struct cell *cell, *cell2; |
1206 |
+ |
1207 |
+ BUG_ON(hash > prison->nr_buckets); |
1208 |
+ |
1209 |
+ spin_lock_irqsave(&prison->lock, flags); |
1210 |
++ |
1211 |
+ cell = __search_bucket(prison->cells + hash, key); |
1212 |
++ if (cell) { |
1213 |
++ bio_list_add(&cell->bios, inmate); |
1214 |
++ goto out; |
1215 |
++ } |
1216 |
+ |
1217 |
+- if (!cell) { |
1218 |
+- /* |
1219 |
+- * Allocate a new cell |
1220 |
+- */ |
1221 |
+- spin_unlock_irqrestore(&prison->lock, flags); |
1222 |
+- cell2 = mempool_alloc(prison->cell_pool, GFP_NOIO); |
1223 |
+- spin_lock_irqsave(&prison->lock, flags); |
1224 |
++ /* |
1225 |
++ * Allocate a new cell |
1226 |
++ */ |
1227 |
++ spin_unlock_irqrestore(&prison->lock, flags); |
1228 |
++ cell2 = mempool_alloc(prison->cell_pool, GFP_NOIO); |
1229 |
++ spin_lock_irqsave(&prison->lock, flags); |
1230 |
+ |
1231 |
+- /* |
1232 |
+- * We've been unlocked, so we have to double check that |
1233 |
+- * nobody else has inserted this cell in the meantime. |
1234 |
+- */ |
1235 |
+- cell = __search_bucket(prison->cells + hash, key); |
1236 |
++ /* |
1237 |
++ * We've been unlocked, so we have to double check that |
1238 |
++ * nobody else has inserted this cell in the meantime. |
1239 |
++ */ |
1240 |
++ cell = __search_bucket(prison->cells + hash, key); |
1241 |
++ if (cell) { |
1242 |
++ mempool_free(cell2, prison->cell_pool); |
1243 |
++ bio_list_add(&cell->bios, inmate); |
1244 |
++ goto out; |
1245 |
++ } |
1246 |
++ |
1247 |
++ /* |
1248 |
++ * Use new cell. |
1249 |
++ */ |
1250 |
++ cell = cell2; |
1251 |
+ |
1252 |
+- if (!cell) { |
1253 |
+- cell = cell2; |
1254 |
+- cell2 = NULL; |
1255 |
++ cell->prison = prison; |
1256 |
++ memcpy(&cell->key, key, sizeof(cell->key)); |
1257 |
++ cell->holder = inmate; |
1258 |
++ bio_list_init(&cell->bios); |
1259 |
++ hlist_add_head(&cell->list, prison->cells + hash); |
1260 |
+ |
1261 |
+- cell->prison = prison; |
1262 |
+- memcpy(&cell->key, key, sizeof(cell->key)); |
1263 |
+- cell->count = 0; |
1264 |
+- bio_list_init(&cell->bios); |
1265 |
+- hlist_add_head(&cell->list, prison->cells + hash); |
1266 |
+- } |
1267 |
+- } |
1268 |
++ r = 0; |
1269 |
+ |
1270 |
+- r = cell->count++; |
1271 |
+- bio_list_add(&cell->bios, inmate); |
1272 |
++out: |
1273 |
+ spin_unlock_irqrestore(&prison->lock, flags); |
1274 |
+ |
1275 |
+- if (cell2) |
1276 |
+- mempool_free(cell2, prison->cell_pool); |
1277 |
+- |
1278 |
+ *ref = cell; |
1279 |
+ |
1280 |
+ return r; |
1281 |
+@@ -283,8 +288,8 @@ static void __cell_release(struct cell *cell, struct bio_list *inmates) |
1282 |
+ |
1283 |
+ hlist_del(&cell->list); |
1284 |
+ |
1285 |
+- if (inmates) |
1286 |
+- bio_list_merge(inmates, &cell->bios); |
1287 |
++ bio_list_add(inmates, cell->holder); |
1288 |
++ bio_list_merge(inmates, &cell->bios); |
1289 |
+ |
1290 |
+ mempool_free(cell, prison->cell_pool); |
1291 |
+ } |
1292 |
+@@ -305,22 +310,44 @@ static void cell_release(struct cell *cell, struct bio_list *bios) |
1293 |
+ * bio may be in the cell. This function releases the cell, and also does |
1294 |
+ * a sanity check. |
1295 |
+ */ |
1296 |
++static void __cell_release_singleton(struct cell *cell, struct bio *bio) |
1297 |
++{ |
1298 |
++ hlist_del(&cell->list); |
1299 |
++ BUG_ON(cell->holder != bio); |
1300 |
++ BUG_ON(!bio_list_empty(&cell->bios)); |
1301 |
++} |
1302 |
++ |
1303 |
+ static void cell_release_singleton(struct cell *cell, struct bio *bio) |
1304 |
+ { |
1305 |
+- struct bio_prison *prison = cell->prison; |
1306 |
+- struct bio_list bios; |
1307 |
+- struct bio *b; |
1308 |
+ unsigned long flags; |
1309 |
+- |
1310 |
+- bio_list_init(&bios); |
1311 |
++ struct bio_prison *prison = cell->prison; |
1312 |
+ |
1313 |
+ spin_lock_irqsave(&prison->lock, flags); |
1314 |
+- __cell_release(cell, &bios); |
1315 |
++ __cell_release_singleton(cell, bio); |
1316 |
+ spin_unlock_irqrestore(&prison->lock, flags); |
1317 |
++} |
1318 |
++ |
1319 |
++/* |
1320 |
++ * Sometimes we don't want the holder, just the additional bios. |
1321 |
++ */ |
1322 |
++static void __cell_release_no_holder(struct cell *cell, struct bio_list *inmates) |
1323 |
++{ |
1324 |
++ struct bio_prison *prison = cell->prison; |
1325 |
+ |
1326 |
+- b = bio_list_pop(&bios); |
1327 |
+- BUG_ON(b != bio); |
1328 |
+- BUG_ON(!bio_list_empty(&bios)); |
1329 |
++ hlist_del(&cell->list); |
1330 |
++ bio_list_merge(inmates, &cell->bios); |
1331 |
++ |
1332 |
++ mempool_free(cell, prison->cell_pool); |
1333 |
++} |
1334 |
++ |
1335 |
++static void cell_release_no_holder(struct cell *cell, struct bio_list *inmates) |
1336 |
++{ |
1337 |
++ unsigned long flags; |
1338 |
++ struct bio_prison *prison = cell->prison; |
1339 |
++ |
1340 |
++ spin_lock_irqsave(&prison->lock, flags); |
1341 |
++ __cell_release_no_holder(cell, inmates); |
1342 |
++ spin_unlock_irqrestore(&prison->lock, flags); |
1343 |
+ } |
1344 |
+ |
1345 |
+ static void cell_error(struct cell *cell) |
1346 |
+@@ -800,21 +827,16 @@ static void cell_defer(struct thin_c *tc, struct cell *cell, |
1347 |
+ * Same as cell_defer above, except it omits one particular detainee, |
1348 |
+ * a write bio that covers the block and has already been processed. |
1349 |
+ */ |
1350 |
+-static void cell_defer_except(struct thin_c *tc, struct cell *cell, |
1351 |
+- struct bio *exception) |
1352 |
++static void cell_defer_except(struct thin_c *tc, struct cell *cell) |
1353 |
+ { |
1354 |
+ struct bio_list bios; |
1355 |
+- struct bio *bio; |
1356 |
+ struct pool *pool = tc->pool; |
1357 |
+ unsigned long flags; |
1358 |
+ |
1359 |
+ bio_list_init(&bios); |
1360 |
+- cell_release(cell, &bios); |
1361 |
+ |
1362 |
+ spin_lock_irqsave(&pool->lock, flags); |
1363 |
+- while ((bio = bio_list_pop(&bios))) |
1364 |
+- if (bio != exception) |
1365 |
+- bio_list_add(&pool->deferred_bios, bio); |
1366 |
++ cell_release_no_holder(cell, &pool->deferred_bios); |
1367 |
+ spin_unlock_irqrestore(&pool->lock, flags); |
1368 |
+ |
1369 |
+ wake_worker(pool); |
1370 |
+@@ -854,7 +876,7 @@ static void process_prepared_mapping(struct new_mapping *m) |
1371 |
+ * the bios in the cell. |
1372 |
+ */ |
1373 |
+ if (bio) { |
1374 |
+- cell_defer_except(tc, m->cell, bio); |
1375 |
++ cell_defer_except(tc, m->cell); |
1376 |
+ bio_endio(bio, 0); |
1377 |
+ } else |
1378 |
+ cell_defer(tc, m->cell, m->data_block); |
1379 |
+diff --git a/drivers/md/md.c b/drivers/md/md.c |
1380 |
+index f47f1f8..6f37aa4 100644 |
1381 |
+--- a/drivers/md/md.c |
1382 |
++++ b/drivers/md/md.c |
1383 |
+@@ -1801,13 +1801,13 @@ retry: |
1384 |
+ | BB_LEN(internal_bb)); |
1385 |
+ *bbp++ = cpu_to_le64(store_bb); |
1386 |
+ } |
1387 |
++ bb->changed = 0; |
1388 |
+ if (read_seqretry(&bb->lock, seq)) |
1389 |
+ goto retry; |
1390 |
+ |
1391 |
+ bb->sector = (rdev->sb_start + |
1392 |
+ (int)le32_to_cpu(sb->bblog_offset)); |
1393 |
+ bb->size = le16_to_cpu(sb->bblog_size); |
1394 |
+- bb->changed = 0; |
1395 |
+ } |
1396 |
+ } |
1397 |
+ |
1398 |
+@@ -2362,6 +2362,7 @@ repeat: |
1399 |
+ clear_bit(MD_CHANGE_PENDING, &mddev->flags); |
1400 |
+ list_for_each_entry(rdev, &mddev->disks, same_set) { |
1401 |
+ if (rdev->badblocks.changed) { |
1402 |
++ rdev->badblocks.changed = 0; |
1403 |
+ md_ack_all_badblocks(&rdev->badblocks); |
1404 |
+ md_error(mddev, rdev); |
1405 |
+ } |
1406 |
+@@ -8097,30 +8098,23 @@ static int md_notify_reboot(struct notifier_block *this, |
1407 |
+ struct mddev *mddev; |
1408 |
+ int need_delay = 0; |
1409 |
+ |
1410 |
+- if ((code == SYS_DOWN) || (code == SYS_HALT) || (code == SYS_POWER_OFF)) { |
1411 |
+- |
1412 |
+- printk(KERN_INFO "md: stopping all md devices.\n"); |
1413 |
+- |
1414 |
+- for_each_mddev(mddev, tmp) { |
1415 |
+- if (mddev_trylock(mddev)) { |
1416 |
+- /* Force a switch to readonly even array |
1417 |
+- * appears to still be in use. Hence |
1418 |
+- * the '100'. |
1419 |
+- */ |
1420 |
+- md_set_readonly(mddev, 100); |
1421 |
+- mddev_unlock(mddev); |
1422 |
+- } |
1423 |
+- need_delay = 1; |
1424 |
++ for_each_mddev(mddev, tmp) { |
1425 |
++ if (mddev_trylock(mddev)) { |
1426 |
++ __md_stop_writes(mddev); |
1427 |
++ mddev->safemode = 2; |
1428 |
++ mddev_unlock(mddev); |
1429 |
+ } |
1430 |
+- /* |
1431 |
+- * certain more exotic SCSI devices are known to be |
1432 |
+- * volatile wrt too early system reboots. While the |
1433 |
+- * right place to handle this issue is the given |
1434 |
+- * driver, we do want to have a safe RAID driver ... |
1435 |
+- */ |
1436 |
+- if (need_delay) |
1437 |
+- mdelay(1000*1); |
1438 |
++ need_delay = 1; |
1439 |
+ } |
1440 |
++ /* |
1441 |
++ * certain more exotic SCSI devices are known to be |
1442 |
++ * volatile wrt too early system reboots. While the |
1443 |
++ * right place to handle this issue is the given |
1444 |
++ * driver, we do want to have a safe RAID driver ... |
1445 |
++ */ |
1446 |
++ if (need_delay) |
1447 |
++ mdelay(1000*1); |
1448 |
++ |
1449 |
+ return NOTIFY_DONE; |
1450 |
+ } |
1451 |
+ |
1452 |
+diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c |
1453 |
+index 023fbc2..1a35caf 100644 |
1454 |
+--- a/drivers/md/persistent-data/dm-btree-remove.c |
1455 |
++++ b/drivers/md/persistent-data/dm-btree-remove.c |
1456 |
+@@ -128,18 +128,9 @@ static void delete_at(struct node *n, unsigned index) |
1457 |
+ n->header.nr_entries = cpu_to_le32(nr_entries - 1); |
1458 |
+ } |
1459 |
+ |
1460 |
+-static unsigned del_threshold(struct node *n) |
1461 |
+-{ |
1462 |
+- return le32_to_cpu(n->header.max_entries) / 3; |
1463 |
+-} |
1464 |
+- |
1465 |
+ static unsigned merge_threshold(struct node *n) |
1466 |
+ { |
1467 |
+- /* |
1468 |
+- * The extra one is because we know we're potentially going to |
1469 |
+- * delete an entry. |
1470 |
+- */ |
1471 |
+- return 2 * (le32_to_cpu(n->header.max_entries) / 3) + 1; |
1472 |
++ return le32_to_cpu(n->header.max_entries) / 3; |
1473 |
+ } |
1474 |
+ |
1475 |
+ struct child { |
1476 |
+@@ -188,6 +179,15 @@ static int exit_child(struct dm_btree_info *info, struct child *c) |
1477 |
+ |
1478 |
+ static void shift(struct node *left, struct node *right, int count) |
1479 |
+ { |
1480 |
++ uint32_t nr_left = le32_to_cpu(left->header.nr_entries); |
1481 |
++ uint32_t nr_right = le32_to_cpu(right->header.nr_entries); |
1482 |
++ uint32_t max_entries = le32_to_cpu(left->header.max_entries); |
1483 |
++ uint32_t r_max_entries = le32_to_cpu(right->header.max_entries); |
1484 |
++ |
1485 |
++ BUG_ON(max_entries != r_max_entries); |
1486 |
++ BUG_ON(nr_left - count > max_entries); |
1487 |
++ BUG_ON(nr_right + count > max_entries); |
1488 |
++ |
1489 |
+ if (!count) |
1490 |
+ return; |
1491 |
+ |
1492 |
+@@ -199,13 +199,8 @@ static void shift(struct node *left, struct node *right, int count) |
1493 |
+ node_shift(right, count); |
1494 |
+ } |
1495 |
+ |
1496 |
+- left->header.nr_entries = |
1497 |
+- cpu_to_le32(le32_to_cpu(left->header.nr_entries) - count); |
1498 |
+- BUG_ON(le32_to_cpu(left->header.nr_entries) > le32_to_cpu(left->header.max_entries)); |
1499 |
+- |
1500 |
+- right->header.nr_entries = |
1501 |
+- cpu_to_le32(le32_to_cpu(right->header.nr_entries) + count); |
1502 |
+- BUG_ON(le32_to_cpu(right->header.nr_entries) > le32_to_cpu(right->header.max_entries)); |
1503 |
++ left->header.nr_entries = cpu_to_le32(nr_left - count); |
1504 |
++ right->header.nr_entries = cpu_to_le32(nr_right + count); |
1505 |
+ } |
1506 |
+ |
1507 |
+ static void __rebalance2(struct dm_btree_info *info, struct node *parent, |
1508 |
+@@ -215,8 +210,9 @@ static void __rebalance2(struct dm_btree_info *info, struct node *parent, |
1509 |
+ struct node *right = r->n; |
1510 |
+ uint32_t nr_left = le32_to_cpu(left->header.nr_entries); |
1511 |
+ uint32_t nr_right = le32_to_cpu(right->header.nr_entries); |
1512 |
++ unsigned threshold = 2 * merge_threshold(left) + 1; |
1513 |
+ |
1514 |
+- if (nr_left + nr_right <= merge_threshold(left)) { |
1515 |
++ if (nr_left + nr_right < threshold) { |
1516 |
+ /* |
1517 |
+ * Merge |
1518 |
+ */ |
1519 |
+@@ -234,9 +230,6 @@ static void __rebalance2(struct dm_btree_info *info, struct node *parent, |
1520 |
+ * Rebalance. |
1521 |
+ */ |
1522 |
+ unsigned target_left = (nr_left + nr_right) / 2; |
1523 |
+- unsigned shift_ = nr_left - target_left; |
1524 |
+- BUG_ON(le32_to_cpu(left->header.max_entries) <= nr_left - shift_); |
1525 |
+- BUG_ON(le32_to_cpu(right->header.max_entries) <= nr_right + shift_); |
1526 |
+ shift(left, right, nr_left - target_left); |
1527 |
+ *key_ptr(parent, r->index) = right->keys[0]; |
1528 |
+ } |
1529 |
+@@ -272,6 +265,84 @@ static int rebalance2(struct shadow_spine *s, struct dm_btree_info *info, |
1530 |
+ return exit_child(info, &right); |
1531 |
+ } |
1532 |
+ |
1533 |
++/* |
1534 |
++ * We dump as many entries from center as possible into left, then the rest |
1535 |
++ * in right, then rebalance2. This wastes some cpu, but I want something |
1536 |
++ * simple atm. |
1537 |
++ */ |
1538 |
++static void delete_center_node(struct dm_btree_info *info, struct node *parent, |
1539 |
++ struct child *l, struct child *c, struct child *r, |
1540 |
++ struct node *left, struct node *center, struct node *right, |
1541 |
++ uint32_t nr_left, uint32_t nr_center, uint32_t nr_right) |
1542 |
++{ |
1543 |
++ uint32_t max_entries = le32_to_cpu(left->header.max_entries); |
1544 |
++ unsigned shift = min(max_entries - nr_left, nr_center); |
1545 |
++ |
1546 |
++ BUG_ON(nr_left + shift > max_entries); |
1547 |
++ node_copy(left, center, -shift); |
1548 |
++ left->header.nr_entries = cpu_to_le32(nr_left + shift); |
1549 |
++ |
1550 |
++ if (shift != nr_center) { |
1551 |
++ shift = nr_center - shift; |
1552 |
++ BUG_ON((nr_right + shift) > max_entries); |
1553 |
++ node_shift(right, shift); |
1554 |
++ node_copy(center, right, shift); |
1555 |
++ right->header.nr_entries = cpu_to_le32(nr_right + shift); |
1556 |
++ } |
1557 |
++ *key_ptr(parent, r->index) = right->keys[0]; |
1558 |
++ |
1559 |
++ delete_at(parent, c->index); |
1560 |
++ r->index--; |
1561 |
++ |
1562 |
++ dm_tm_dec(info->tm, dm_block_location(c->block)); |
1563 |
++ __rebalance2(info, parent, l, r); |
1564 |
++} |
1565 |
++ |
1566 |
++/* |
1567 |
++ * Redistributes entries among 3 sibling nodes. |
1568 |
++ */ |
1569 |
++static void redistribute3(struct dm_btree_info *info, struct node *parent, |
1570 |
++ struct child *l, struct child *c, struct child *r, |
1571 |
++ struct node *left, struct node *center, struct node *right, |
1572 |
++ uint32_t nr_left, uint32_t nr_center, uint32_t nr_right) |
1573 |
++{ |
1574 |
++ int s; |
1575 |
++ uint32_t max_entries = le32_to_cpu(left->header.max_entries); |
1576 |
++ unsigned target = (nr_left + nr_center + nr_right) / 3; |
1577 |
++ BUG_ON(target > max_entries); |
1578 |
++ |
1579 |
++ if (nr_left < nr_right) { |
1580 |
++ s = nr_left - target; |
1581 |
++ |
1582 |
++ if (s < 0 && nr_center < -s) { |
1583 |
++ /* not enough in central node */ |
1584 |
++ shift(left, center, nr_center); |
1585 |
++ s = nr_center - target; |
1586 |
++ shift(left, right, s); |
1587 |
++ nr_right += s; |
1588 |
++ } else |
1589 |
++ shift(left, center, s); |
1590 |
++ |
1591 |
++ shift(center, right, target - nr_right); |
1592 |
++ |
1593 |
++ } else { |
1594 |
++ s = target - nr_right; |
1595 |
++ if (s > 0 && nr_center < s) { |
1596 |
++ /* not enough in central node */ |
1597 |
++ shift(center, right, nr_center); |
1598 |
++ s = target - nr_center; |
1599 |
++ shift(left, right, s); |
1600 |
++ nr_left -= s; |
1601 |
++ } else |
1602 |
++ shift(center, right, s); |
1603 |
++ |
1604 |
++ shift(left, center, nr_left - target); |
1605 |
++ } |
1606 |
++ |
1607 |
++ *key_ptr(parent, c->index) = center->keys[0]; |
1608 |
++ *key_ptr(parent, r->index) = right->keys[0]; |
1609 |
++} |
1610 |
++ |
1611 |
+ static void __rebalance3(struct dm_btree_info *info, struct node *parent, |
1612 |
+ struct child *l, struct child *c, struct child *r) |
1613 |
+ { |
1614 |
+@@ -282,62 +353,18 @@ static void __rebalance3(struct dm_btree_info *info, struct node *parent, |
1615 |
+ uint32_t nr_left = le32_to_cpu(left->header.nr_entries); |
1616 |
+ uint32_t nr_center = le32_to_cpu(center->header.nr_entries); |
1617 |
+ uint32_t nr_right = le32_to_cpu(right->header.nr_entries); |
1618 |
+- uint32_t max_entries = le32_to_cpu(left->header.max_entries); |
1619 |
+ |
1620 |
+- unsigned target; |
1621 |
++ unsigned threshold = merge_threshold(left) * 4 + 1; |
1622 |
+ |
1623 |
+ BUG_ON(left->header.max_entries != center->header.max_entries); |
1624 |
+ BUG_ON(center->header.max_entries != right->header.max_entries); |
1625 |
+ |
1626 |
+- if (((nr_left + nr_center + nr_right) / 2) < merge_threshold(center)) { |
1627 |
+- /* |
1628 |
+- * Delete center node: |
1629 |
+- * |
1630 |
+- * We dump as many entries from center as possible into |
1631 |
+- * left, then the rest in right, then rebalance2. This |
1632 |
+- * wastes some cpu, but I want something simple atm. |
1633 |
+- */ |
1634 |
+- unsigned shift = min(max_entries - nr_left, nr_center); |
1635 |
+- |
1636 |
+- BUG_ON(nr_left + shift > max_entries); |
1637 |
+- node_copy(left, center, -shift); |
1638 |
+- left->header.nr_entries = cpu_to_le32(nr_left + shift); |
1639 |
+- |
1640 |
+- if (shift != nr_center) { |
1641 |
+- shift = nr_center - shift; |
1642 |
+- BUG_ON((nr_right + shift) >= max_entries); |
1643 |
+- node_shift(right, shift); |
1644 |
+- node_copy(center, right, shift); |
1645 |
+- right->header.nr_entries = cpu_to_le32(nr_right + shift); |
1646 |
+- } |
1647 |
+- *key_ptr(parent, r->index) = right->keys[0]; |
1648 |
+- |
1649 |
+- delete_at(parent, c->index); |
1650 |
+- r->index--; |
1651 |
+- |
1652 |
+- dm_tm_dec(info->tm, dm_block_location(c->block)); |
1653 |
+- __rebalance2(info, parent, l, r); |
1654 |
+- |
1655 |
+- return; |
1656 |
+- } |
1657 |
+- |
1658 |
+- /* |
1659 |
+- * Rebalance |
1660 |
+- */ |
1661 |
+- target = (nr_left + nr_center + nr_right) / 3; |
1662 |
+- BUG_ON(target > max_entries); |
1663 |
+- |
1664 |
+- /* |
1665 |
+- * Adjust the left node |
1666 |
+- */ |
1667 |
+- shift(left, center, nr_left - target); |
1668 |
+- |
1669 |
+- /* |
1670 |
+- * Adjust the right node |
1671 |
+- */ |
1672 |
+- shift(center, right, target - nr_right); |
1673 |
+- *key_ptr(parent, c->index) = center->keys[0]; |
1674 |
+- *key_ptr(parent, r->index) = right->keys[0]; |
1675 |
++ if ((nr_left + nr_center + nr_right) < threshold) |
1676 |
++ delete_center_node(info, parent, l, c, r, left, center, right, |
1677 |
++ nr_left, nr_center, nr_right); |
1678 |
++ else |
1679 |
++ redistribute3(info, parent, l, c, r, left, center, right, |
1680 |
++ nr_left, nr_center, nr_right); |
1681 |
+ } |
1682 |
+ |
1683 |
+ static int rebalance3(struct shadow_spine *s, struct dm_btree_info *info, |
1684 |
+@@ -441,9 +468,6 @@ static int rebalance_children(struct shadow_spine *s, |
1685 |
+ if (r) |
1686 |
+ return r; |
1687 |
+ |
1688 |
+- if (child_entries > del_threshold(n)) |
1689 |
+- return 0; |
1690 |
+- |
1691 |
+ has_left_sibling = i > 0; |
1692 |
+ has_right_sibling = i < (le32_to_cpu(n->header.nr_entries) - 1); |
1693 |
+ |
1694 |
+diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c |
1695 |
+index 7d9e071..7af60ec 100644 |
1696 |
+--- a/drivers/md/raid1.c |
1697 |
++++ b/drivers/md/raid1.c |
1698 |
+@@ -731,9 +731,22 @@ static void wait_barrier(struct r1conf *conf) |
1699 |
+ spin_lock_irq(&conf->resync_lock); |
1700 |
+ if (conf->barrier) { |
1701 |
+ conf->nr_waiting++; |
1702 |
+- wait_event_lock_irq(conf->wait_barrier, !conf->barrier, |
1703 |
++ /* Wait for the barrier to drop. |
1704 |
++ * However if there are already pending |
1705 |
++ * requests (preventing the barrier from |
1706 |
++ * rising completely), and the |
1707 |
++ * pre-process bio queue isn't empty, |
1708 |
++ * then don't wait, as we need to empty |
1709 |
++ * that queue to get the nr_pending |
1710 |
++ * count down. |
1711 |
++ */ |
1712 |
++ wait_event_lock_irq(conf->wait_barrier, |
1713 |
++ !conf->barrier || |
1714 |
++ (conf->nr_pending && |
1715 |
++ current->bio_list && |
1716 |
++ !bio_list_empty(current->bio_list)), |
1717 |
+ conf->resync_lock, |
1718 |
+- ); |
1719 |
++ ); |
1720 |
+ conf->nr_waiting--; |
1721 |
+ } |
1722 |
+ conf->nr_pending++; |
1723 |
+diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c |
1724 |
+index 685ddf3..b219449 100644 |
1725 |
+--- a/drivers/md/raid10.c |
1726 |
++++ b/drivers/md/raid10.c |
1727 |
+@@ -790,9 +790,22 @@ static void wait_barrier(struct r10conf *conf) |
1728 |
+ spin_lock_irq(&conf->resync_lock); |
1729 |
+ if (conf->barrier) { |
1730 |
+ conf->nr_waiting++; |
1731 |
+- wait_event_lock_irq(conf->wait_barrier, !conf->barrier, |
1732 |
++ /* Wait for the barrier to drop. |
1733 |
++ * However if there are already pending |
1734 |
++ * requests (preventing the barrier from |
1735 |
++ * rising completely), and the |
1736 |
++ * pre-process bio queue isn't empty, |
1737 |
++ * then don't wait, as we need to empty |
1738 |
++ * that queue to get the nr_pending |
1739 |
++ * count down. |
1740 |
++ */ |
1741 |
++ wait_event_lock_irq(conf->wait_barrier, |
1742 |
++ !conf->barrier || |
1743 |
++ (conf->nr_pending && |
1744 |
++ current->bio_list && |
1745 |
++ !bio_list_empty(current->bio_list)), |
1746 |
+ conf->resync_lock, |
1747 |
+- ); |
1748 |
++ ); |
1749 |
+ conf->nr_waiting--; |
1750 |
+ } |
1751 |
+ conf->nr_pending++; |
1752 |
+diff --git a/drivers/media/dvb/dvb-usb/mxl111sf.c b/drivers/media/dvb/dvb-usb/mxl111sf.c |
1753 |
+index b5c98da..bc6ea9f 100644 |
1754 |
+--- a/drivers/media/dvb/dvb-usb/mxl111sf.c |
1755 |
++++ b/drivers/media/dvb/dvb-usb/mxl111sf.c |
1756 |
+@@ -351,15 +351,13 @@ static int mxl111sf_ep6_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) |
1757 |
+ adap_state->ep6_clockphase, |
1758 |
+ 0, 0); |
1759 |
+ mxl_fail(ret); |
1760 |
++#if 0 |
1761 |
+ } else { |
1762 |
+ ret = mxl111sf_disable_656_port(state); |
1763 |
+ mxl_fail(ret); |
1764 |
++#endif |
1765 |
+ } |
1766 |
+ |
1767 |
+- mxl111sf_read_reg(state, 0x12, &tmp); |
1768 |
+- tmp &= ~0x04; |
1769 |
+- mxl111sf_write_reg(state, 0x12, tmp); |
1770 |
+- |
1771 |
+ return ret; |
1772 |
+ } |
1773 |
+ |
1774 |
+diff --git a/drivers/media/dvb/frontends/lgdt330x.c b/drivers/media/dvb/frontends/lgdt330x.c |
1775 |
+index 43971e6..aa63d68 100644 |
1776 |
+--- a/drivers/media/dvb/frontends/lgdt330x.c |
1777 |
++++ b/drivers/media/dvb/frontends/lgdt330x.c |
1778 |
+@@ -104,8 +104,8 @@ static int i2c_write_demod_bytes (struct lgdt330x_state* state, |
1779 |
+ * then reads the data returned for (len) bytes. |
1780 |
+ */ |
1781 |
+ |
1782 |
+-static u8 i2c_read_demod_bytes (struct lgdt330x_state* state, |
1783 |
+- enum I2C_REG reg, u8* buf, int len) |
1784 |
++static int i2c_read_demod_bytes(struct lgdt330x_state *state, |
1785 |
++ enum I2C_REG reg, u8 *buf, int len) |
1786 |
+ { |
1787 |
+ u8 wr [] = { reg }; |
1788 |
+ struct i2c_msg msg [] = { |
1789 |
+@@ -118,6 +118,8 @@ static u8 i2c_read_demod_bytes (struct lgdt330x_state* state, |
1790 |
+ ret = i2c_transfer(state->i2c, msg, 2); |
1791 |
+ if (ret != 2) { |
1792 |
+ printk(KERN_WARNING "lgdt330x: %s: addr 0x%02x select 0x%02x error (ret == %i)\n", __func__, state->config->demod_address, reg, ret); |
1793 |
++ if (ret >= 0) |
1794 |
++ ret = -EIO; |
1795 |
+ } else { |
1796 |
+ ret = 0; |
1797 |
+ } |
1798 |
+diff --git a/drivers/media/video/pvrusb2/pvrusb2-devattr.c b/drivers/media/video/pvrusb2/pvrusb2-devattr.c |
1799 |
+index c6da8f7..d8c8982 100644 |
1800 |
+--- a/drivers/media/video/pvrusb2/pvrusb2-devattr.c |
1801 |
++++ b/drivers/media/video/pvrusb2/pvrusb2-devattr.c |
1802 |
+@@ -320,7 +320,17 @@ static struct tda829x_config tda829x_no_probe = { |
1803 |
+ .probe_tuner = TDA829X_DONT_PROBE, |
1804 |
+ }; |
1805 |
+ |
1806 |
++static struct tda18271_std_map hauppauge_tda18271_dvbt_std_map = { |
1807 |
++ .dvbt_6 = { .if_freq = 3300, .agc_mode = 3, .std = 4, |
1808 |
++ .if_lvl = 1, .rfagc_top = 0x37, }, |
1809 |
++ .dvbt_7 = { .if_freq = 3800, .agc_mode = 3, .std = 5, |
1810 |
++ .if_lvl = 1, .rfagc_top = 0x37, }, |
1811 |
++ .dvbt_8 = { .if_freq = 4300, .agc_mode = 3, .std = 6, |
1812 |
++ .if_lvl = 1, .rfagc_top = 0x37, }, |
1813 |
++}; |
1814 |
++ |
1815 |
+ static struct tda18271_config hauppauge_tda18271_dvb_config = { |
1816 |
++ .std_map = &hauppauge_tda18271_dvbt_std_map, |
1817 |
+ .gate = TDA18271_GATE_ANALOG, |
1818 |
+ .output_opt = TDA18271_OUTPUT_LT_OFF, |
1819 |
+ }; |
1820 |
+diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c |
1821 |
+index 0cb17d9..b99318e 100644 |
1822 |
+--- a/drivers/mtd/ubi/scan.c |
1823 |
++++ b/drivers/mtd/ubi/scan.c |
1824 |
+@@ -1174,7 +1174,7 @@ struct ubi_scan_info *ubi_scan(struct ubi_device *ubi) |
1825 |
+ |
1826 |
+ ech = kzalloc(ubi->ec_hdr_alsize, GFP_KERNEL); |
1827 |
+ if (!ech) |
1828 |
+- goto out_slab; |
1829 |
++ goto out_si; |
1830 |
+ |
1831 |
+ vidh = ubi_zalloc_vid_hdr(ubi, GFP_KERNEL); |
1832 |
+ if (!vidh) |
1833 |
+@@ -1235,8 +1235,6 @@ out_vidh: |
1834 |
+ ubi_free_vid_hdr(ubi, vidh); |
1835 |
+ out_ech: |
1836 |
+ kfree(ech); |
1837 |
+-out_slab: |
1838 |
+- kmem_cache_destroy(si->scan_leb_slab); |
1839 |
+ out_si: |
1840 |
+ ubi_scan_destroy_si(si); |
1841 |
+ return ERR_PTR(err); |
1842 |
+@@ -1325,7 +1323,9 @@ void ubi_scan_destroy_si(struct ubi_scan_info *si) |
1843 |
+ } |
1844 |
+ } |
1845 |
+ |
1846 |
+- kmem_cache_destroy(si->scan_leb_slab); |
1847 |
++ if (si->scan_leb_slab) |
1848 |
++ kmem_cache_destroy(si->scan_leb_slab); |
1849 |
++ |
1850 |
+ kfree(si); |
1851 |
+ } |
1852 |
+ |
1853 |
+diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c |
1854 |
+index 0696e36..cf42971 100644 |
1855 |
+--- a/drivers/mtd/ubi/wl.c |
1856 |
++++ b/drivers/mtd/ubi/wl.c |
1857 |
+@@ -389,7 +389,7 @@ static struct ubi_wl_entry *find_wl_entry(struct rb_root *root, int max) |
1858 |
+ */ |
1859 |
+ int ubi_wl_get_peb(struct ubi_device *ubi, int dtype) |
1860 |
+ { |
1861 |
+- int err, medium_ec; |
1862 |
++ int err; |
1863 |
+ struct ubi_wl_entry *e, *first, *last; |
1864 |
+ |
1865 |
+ ubi_assert(dtype == UBI_LONGTERM || dtype == UBI_SHORTTERM || |
1866 |
+@@ -427,7 +427,7 @@ retry: |
1867 |
+ * For unknown data we pick a physical eraseblock with medium |
1868 |
+ * erase counter. But we by no means can pick a physical |
1869 |
+ * eraseblock with erase counter greater or equivalent than the |
1870 |
+- * lowest erase counter plus %WL_FREE_MAX_DIFF. |
1871 |
++ * lowest erase counter plus %WL_FREE_MAX_DIFF/2. |
1872 |
+ */ |
1873 |
+ first = rb_entry(rb_first(&ubi->free), struct ubi_wl_entry, |
1874 |
+ u.rb); |
1875 |
+@@ -436,10 +436,8 @@ retry: |
1876 |
+ if (last->ec - first->ec < WL_FREE_MAX_DIFF) |
1877 |
+ e = rb_entry(ubi->free.rb_node, |
1878 |
+ struct ubi_wl_entry, u.rb); |
1879 |
+- else { |
1880 |
+- medium_ec = (first->ec + WL_FREE_MAX_DIFF)/2; |
1881 |
+- e = find_wl_entry(&ubi->free, medium_ec); |
1882 |
+- } |
1883 |
++ else |
1884 |
++ e = find_wl_entry(&ubi->free, WL_FREE_MAX_DIFF/2); |
1885 |
+ break; |
1886 |
+ case UBI_SHORTTERM: |
1887 |
+ /* |
1888 |
+diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h |
1889 |
+index 9fe18d1..f478a22 100644 |
1890 |
+--- a/drivers/net/ethernet/intel/e1000e/e1000.h |
1891 |
++++ b/drivers/net/ethernet/intel/e1000e/e1000.h |
1892 |
+@@ -309,6 +309,7 @@ struct e1000_adapter { |
1893 |
+ u32 txd_cmd; |
1894 |
+ |
1895 |
+ bool detect_tx_hung; |
1896 |
++ bool tx_hang_recheck; |
1897 |
+ u8 tx_timeout_factor; |
1898 |
+ |
1899 |
+ u32 tx_int_delay; |
1900 |
+diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c |
1901 |
+index a855db1..4e933d1 100644 |
1902 |
+--- a/drivers/net/ethernet/intel/e1000e/netdev.c |
1903 |
++++ b/drivers/net/ethernet/intel/e1000e/netdev.c |
1904 |
+@@ -1030,6 +1030,7 @@ static void e1000_print_hw_hang(struct work_struct *work) |
1905 |
+ struct e1000_adapter *adapter = container_of(work, |
1906 |
+ struct e1000_adapter, |
1907 |
+ print_hang_task); |
1908 |
++ struct net_device *netdev = adapter->netdev; |
1909 |
+ struct e1000_ring *tx_ring = adapter->tx_ring; |
1910 |
+ unsigned int i = tx_ring->next_to_clean; |
1911 |
+ unsigned int eop = tx_ring->buffer_info[i].next_to_watch; |
1912 |
+@@ -1041,6 +1042,21 @@ static void e1000_print_hw_hang(struct work_struct *work) |
1913 |
+ if (test_bit(__E1000_DOWN, &adapter->state)) |
1914 |
+ return; |
1915 |
+ |
1916 |
++ if (!adapter->tx_hang_recheck && |
1917 |
++ (adapter->flags2 & FLAG2_DMA_BURST)) { |
1918 |
++ /* May be block on write-back, flush and detect again |
1919 |
++ * flush pending descriptor writebacks to memory |
1920 |
++ */ |
1921 |
++ ew32(TIDV, adapter->tx_int_delay | E1000_TIDV_FPD); |
1922 |
++ /* execute the writes immediately */ |
1923 |
++ e1e_flush(); |
1924 |
++ adapter->tx_hang_recheck = true; |
1925 |
++ return; |
1926 |
++ } |
1927 |
++ /* Real hang detected */ |
1928 |
++ adapter->tx_hang_recheck = false; |
1929 |
++ netif_stop_queue(netdev); |
1930 |
++ |
1931 |
+ e1e_rphy(hw, PHY_STATUS, &phy_status); |
1932 |
+ e1e_rphy(hw, PHY_1000T_STATUS, &phy_1000t_status); |
1933 |
+ e1e_rphy(hw, PHY_EXT_STATUS, &phy_ext_status); |
1934 |
+@@ -1154,10 +1170,10 @@ static bool e1000_clean_tx_irq(struct e1000_adapter *adapter) |
1935 |
+ if (tx_ring->buffer_info[i].time_stamp && |
1936 |
+ time_after(jiffies, tx_ring->buffer_info[i].time_stamp |
1937 |
+ + (adapter->tx_timeout_factor * HZ)) && |
1938 |
+- !(er32(STATUS) & E1000_STATUS_TXOFF)) { |
1939 |
++ !(er32(STATUS) & E1000_STATUS_TXOFF)) |
1940 |
+ schedule_work(&adapter->print_hang_task); |
1941 |
+- netif_stop_queue(netdev); |
1942 |
+- } |
1943 |
++ else |
1944 |
++ adapter->tx_hang_recheck = false; |
1945 |
+ } |
1946 |
+ adapter->total_tx_bytes += total_tx_bytes; |
1947 |
+ adapter->total_tx_packets += total_tx_packets; |
1948 |
+@@ -3782,6 +3798,7 @@ static int e1000_open(struct net_device *netdev) |
1949 |
+ |
1950 |
+ e1000_irq_enable(adapter); |
1951 |
+ |
1952 |
++ adapter->tx_hang_recheck = false; |
1953 |
+ netif_start_queue(netdev); |
1954 |
+ |
1955 |
+ adapter->idle_check = true; |
1956 |
+diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c |
1957 |
+index 7803efa..f612b35 100644 |
1958 |
+--- a/drivers/net/ethernet/marvell/sky2.c |
1959 |
++++ b/drivers/net/ethernet/marvell/sky2.c |
1960 |
+@@ -95,6 +95,10 @@ static int disable_msi = 0; |
1961 |
+ module_param(disable_msi, int, 0); |
1962 |
+ MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)"); |
1963 |
+ |
1964 |
++static int legacy_pme = 0; |
1965 |
++module_param(legacy_pme, int, 0); |
1966 |
++MODULE_PARM_DESC(legacy_pme, "Legacy power management"); |
1967 |
++ |
1968 |
+ static DEFINE_PCI_DEVICE_TABLE(sky2_id_table) = { |
1969 |
+ { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9000) }, /* SK-9Sxx */ |
1970 |
+ { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, /* SK-9Exx */ |
1971 |
+@@ -867,6 +871,13 @@ static void sky2_wol_init(struct sky2_port *sky2) |
1972 |
+ /* Disable PiG firmware */ |
1973 |
+ sky2_write16(hw, B0_CTST, Y2_HW_WOL_OFF); |
1974 |
+ |
1975 |
++ /* Needed by some broken BIOSes, use PCI rather than PCI-e for WOL */ |
1976 |
++ if (legacy_pme) { |
1977 |
++ u32 reg1 = sky2_pci_read32(hw, PCI_DEV_REG1); |
1978 |
++ reg1 |= PCI_Y2_PME_LEGACY; |
1979 |
++ sky2_pci_write32(hw, PCI_DEV_REG1, reg1); |
1980 |
++ } |
1981 |
++ |
1982 |
+ /* block receiver */ |
1983 |
+ sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); |
1984 |
+ sky2_read32(hw, B0_CTST); |
1985 |
+diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c |
1986 |
+index 81b96e3..750e330 100644 |
1987 |
+--- a/drivers/net/usb/usbnet.c |
1988 |
++++ b/drivers/net/usb/usbnet.c |
1989 |
+@@ -589,6 +589,14 @@ static int unlink_urbs (struct usbnet *dev, struct sk_buff_head *q) |
1990 |
+ entry = (struct skb_data *) skb->cb; |
1991 |
+ urb = entry->urb; |
1992 |
+ |
1993 |
++ /* |
1994 |
++ * Get reference count of the URB to avoid it to be |
1995 |
++ * freed during usb_unlink_urb, which may trigger |
1996 |
++ * use-after-free problem inside usb_unlink_urb since |
1997 |
++ * usb_unlink_urb is always racing with .complete |
1998 |
++ * handler(include defer_bh). |
1999 |
++ */ |
2000 |
++ usb_get_urb(urb); |
2001 |
+ spin_unlock_irqrestore(&q->lock, flags); |
2002 |
+ // during some PM-driven resume scenarios, |
2003 |
+ // these (async) unlinks complete immediately |
2004 |
+@@ -597,6 +605,7 @@ static int unlink_urbs (struct usbnet *dev, struct sk_buff_head *q) |
2005 |
+ netdev_dbg(dev->net, "unlink urb err, %d\n", retval); |
2006 |
+ else |
2007 |
+ count++; |
2008 |
++ usb_put_urb(urb); |
2009 |
+ spin_lock_irqsave(&q->lock, flags); |
2010 |
+ } |
2011 |
+ spin_unlock_irqrestore (&q->lock, flags); |
2012 |
+@@ -1028,7 +1037,6 @@ static void tx_complete (struct urb *urb) |
2013 |
+ } |
2014 |
+ |
2015 |
+ usb_autopm_put_interface_async(dev->intf); |
2016 |
+- urb->dev = NULL; |
2017 |
+ entry->state = tx_done; |
2018 |
+ defer_bh(dev, skb, &dev->txq); |
2019 |
+ } |
2020 |
+diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c |
2021 |
+index fcf5416..3d75d4c 100644 |
2022 |
+--- a/drivers/net/wireless/iwlwifi/iwl-core.c |
2023 |
++++ b/drivers/net/wireless/iwlwifi/iwl-core.c |
2024 |
+@@ -1787,20 +1787,10 @@ void iwl_bg_watchdog(unsigned long data) |
2025 |
+ if (timeout == 0) |
2026 |
+ return; |
2027 |
+ |
2028 |
+- /* monitor and check for stuck cmd queue */ |
2029 |
+- if (iwl_check_stuck_queue(priv, priv->shrd->cmd_queue)) |
2030 |
+- return; |
2031 |
+- |
2032 |
+- /* monitor and check for other stuck queues */ |
2033 |
+- if (iwl_is_any_associated(priv)) { |
2034 |
+- for (cnt = 0; cnt < hw_params(priv).max_txq_num; cnt++) { |
2035 |
+- /* skip as we already checked the command queue */ |
2036 |
+- if (cnt == priv->shrd->cmd_queue) |
2037 |
+- continue; |
2038 |
+- if (iwl_check_stuck_queue(priv, cnt)) |
2039 |
+- return; |
2040 |
+- } |
2041 |
+- } |
2042 |
++ /* monitor and check for stuck queues */ |
2043 |
++ for (cnt = 0; cnt < hw_params(priv).max_txq_num; cnt++) |
2044 |
++ if (iwl_check_stuck_queue(priv, cnt)) |
2045 |
++ return; |
2046 |
+ |
2047 |
+ mod_timer(&priv->watchdog, jiffies + |
2048 |
+ msecs_to_jiffies(IWL_WD_TICK(timeout))); |
2049 |
+diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c |
2050 |
+index 78d0d69..428401b 100644 |
2051 |
+--- a/drivers/net/wireless/p54/p54spi.c |
2052 |
++++ b/drivers/net/wireless/p54/p54spi.c |
2053 |
+@@ -622,19 +622,19 @@ static int __devinit p54spi_probe(struct spi_device *spi) |
2054 |
+ ret = spi_setup(spi); |
2055 |
+ if (ret < 0) { |
2056 |
+ dev_err(&priv->spi->dev, "spi_setup failed"); |
2057 |
+- goto err_free_common; |
2058 |
++ goto err_free; |
2059 |
+ } |
2060 |
+ |
2061 |
+ ret = gpio_request(p54spi_gpio_power, "p54spi power"); |
2062 |
+ if (ret < 0) { |
2063 |
+ dev_err(&priv->spi->dev, "power GPIO request failed: %d", ret); |
2064 |
+- goto err_free_common; |
2065 |
++ goto err_free; |
2066 |
+ } |
2067 |
+ |
2068 |
+ ret = gpio_request(p54spi_gpio_irq, "p54spi irq"); |
2069 |
+ if (ret < 0) { |
2070 |
+ dev_err(&priv->spi->dev, "irq GPIO request failed: %d", ret); |
2071 |
+- goto err_free_common; |
2072 |
++ goto err_free_gpio_power; |
2073 |
+ } |
2074 |
+ |
2075 |
+ gpio_direction_output(p54spi_gpio_power, 0); |
2076 |
+@@ -645,7 +645,7 @@ static int __devinit p54spi_probe(struct spi_device *spi) |
2077 |
+ priv->spi); |
2078 |
+ if (ret < 0) { |
2079 |
+ dev_err(&priv->spi->dev, "request_irq() failed"); |
2080 |
+- goto err_free_common; |
2081 |
++ goto err_free_gpio_irq; |
2082 |
+ } |
2083 |
+ |
2084 |
+ irq_set_irq_type(gpio_to_irq(p54spi_gpio_irq), IRQ_TYPE_EDGE_RISING); |
2085 |
+@@ -677,6 +677,12 @@ static int __devinit p54spi_probe(struct spi_device *spi) |
2086 |
+ return 0; |
2087 |
+ |
2088 |
+ err_free_common: |
2089 |
++ free_irq(gpio_to_irq(p54spi_gpio_irq), spi); |
2090 |
++err_free_gpio_irq: |
2091 |
++ gpio_free(p54spi_gpio_irq); |
2092 |
++err_free_gpio_power: |
2093 |
++ gpio_free(p54spi_gpio_power); |
2094 |
++err_free: |
2095 |
+ p54_free_common(priv->hw); |
2096 |
+ return ret; |
2097 |
+ } |
2098 |
+diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c |
2099 |
+index 3265b34..cb71e88 100644 |
2100 |
+--- a/drivers/net/wireless/rt2x00/rt2800usb.c |
2101 |
++++ b/drivers/net/wireless/rt2x00/rt2800usb.c |
2102 |
+@@ -935,6 +935,7 @@ static struct usb_device_id rt2800usb_device_table[] = { |
2103 |
+ { USB_DEVICE(0x07d1, 0x3c0f) }, |
2104 |
+ { USB_DEVICE(0x07d1, 0x3c11) }, |
2105 |
+ { USB_DEVICE(0x07d1, 0x3c16) }, |
2106 |
++ { USB_DEVICE(0x2001, 0x3c1b) }, |
2107 |
+ /* Draytek */ |
2108 |
+ { USB_DEVICE(0x07fa, 0x7712) }, |
2109 |
+ /* DVICO */ |
2110 |
+diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c |
2111 |
+index eb61061..9afcad3 100644 |
2112 |
+--- a/drivers/net/wireless/rtlwifi/pci.c |
2113 |
++++ b/drivers/net/wireless/rtlwifi/pci.c |
2114 |
+@@ -657,6 +657,8 @@ static void _rtl_receive_one(struct ieee80211_hw *hw, struct sk_buff *skb, |
2115 |
+ return; |
2116 |
+ |
2117 |
+ uskb = dev_alloc_skb(skb->len + 128); |
2118 |
++ if (!uskb) |
2119 |
++ return; /* exit if allocation failed */ |
2120 |
+ memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status, sizeof(rx_status)); |
2121 |
+ pdata = (u8 *)skb_put(uskb, skb->len); |
2122 |
+ memcpy(pdata, skb->data, skb->len); |
2123 |
+@@ -1153,10 +1155,12 @@ static void _rtl_pci_free_tx_ring(struct ieee80211_hw *hw, |
2124 |
+ ring->idx = (ring->idx + 1) % ring->entries; |
2125 |
+ } |
2126 |
+ |
2127 |
+- pci_free_consistent(rtlpci->pdev, |
2128 |
+- sizeof(*ring->desc) * ring->entries, |
2129 |
+- ring->desc, ring->dma); |
2130 |
+- ring->desc = NULL; |
2131 |
++ if (ring->desc) { |
2132 |
++ pci_free_consistent(rtlpci->pdev, |
2133 |
++ sizeof(*ring->desc) * ring->entries, |
2134 |
++ ring->desc, ring->dma); |
2135 |
++ ring->desc = NULL; |
2136 |
++ } |
2137 |
+ } |
2138 |
+ |
2139 |
+ static void _rtl_pci_free_rx_ring(struct rtl_pci *rtlpci) |
2140 |
+@@ -1180,12 +1184,14 @@ static void _rtl_pci_free_rx_ring(struct rtl_pci *rtlpci) |
2141 |
+ kfree_skb(skb); |
2142 |
+ } |
2143 |
+ |
2144 |
+- pci_free_consistent(rtlpci->pdev, |
2145 |
++ if (rtlpci->rx_ring[rx_queue_idx].desc) { |
2146 |
++ pci_free_consistent(rtlpci->pdev, |
2147 |
+ sizeof(*rtlpci->rx_ring[rx_queue_idx]. |
2148 |
+ desc) * rtlpci->rxringcount, |
2149 |
+ rtlpci->rx_ring[rx_queue_idx].desc, |
2150 |
+ rtlpci->rx_ring[rx_queue_idx].dma); |
2151 |
+- rtlpci->rx_ring[rx_queue_idx].desc = NULL; |
2152 |
++ rtlpci->rx_ring[rx_queue_idx].desc = NULL; |
2153 |
++ } |
2154 |
+ } |
2155 |
+ } |
2156 |
+ |
2157 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c |
2158 |
+index 72a98ca..a004ad7 100644 |
2159 |
+--- a/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c |
2160 |
++++ b/drivers/net/wireless/rtlwifi/rtl8192c/dm_common.c |
2161 |
+@@ -524,6 +524,10 @@ void rtl92c_dm_write_dig(struct ieee80211_hw *hw) |
2162 |
+ dm_digtable.cur_igvalue, dm_digtable.pre_igvalue, |
2163 |
+ dm_digtable.backoff_val)); |
2164 |
+ |
2165 |
++ dm_digtable.cur_igvalue += 2; |
2166 |
++ if (dm_digtable.cur_igvalue > 0x3f) |
2167 |
++ dm_digtable.cur_igvalue = 0x3f; |
2168 |
++ |
2169 |
+ if (dm_digtable.pre_igvalue != dm_digtable.cur_igvalue) { |
2170 |
+ rtl_set_bbreg(hw, ROFDM0_XAAGCCORE1, 0x7f, |
2171 |
+ dm_digtable.cur_igvalue); |
2172 |
+@@ -1219,13 +1223,18 @@ static void rtl92c_dm_refresh_rate_adaptive_mask(struct ieee80211_hw *hw) |
2173 |
+ ("PreState = %d, CurState = %d\n", |
2174 |
+ p_ra->pre_ratr_state, p_ra->ratr_state)); |
2175 |
+ |
2176 |
+- rcu_read_lock(); |
2177 |
+- sta = ieee80211_find_sta(mac->vif, mac->bssid); |
2178 |
++ /* Only the PCI card uses sta in the update rate table |
2179 |
++ * callback routine */ |
2180 |
++ if (rtlhal->interface == INTF_PCI) { |
2181 |
++ rcu_read_lock(); |
2182 |
++ sta = ieee80211_find_sta(mac->vif, mac->bssid); |
2183 |
++ } |
2184 |
+ rtlpriv->cfg->ops->update_rate_tbl(hw, sta, |
2185 |
+ p_ra->ratr_state); |
2186 |
+ |
2187 |
+ p_ra->pre_ratr_state = p_ra->ratr_state; |
2188 |
+- rcu_read_unlock(); |
2189 |
++ if (rtlhal->interface == INTF_PCI) |
2190 |
++ rcu_read_unlock(); |
2191 |
+ } |
2192 |
+ } |
2193 |
+ } |
2194 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c |
2195 |
+index 950c65a..13fc0f9 100644 |
2196 |
+--- a/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c |
2197 |
++++ b/drivers/net/wireless/rtlwifi/rtl8192c/fw_common.c |
2198 |
+@@ -752,6 +752,8 @@ void rtl92c_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished) |
2199 |
+ |
2200 |
+ |
2201 |
+ skb = dev_alloc_skb(totalpacketlen); |
2202 |
++ if (!skb) |
2203 |
++ return; |
2204 |
+ memcpy((u8 *) skb_put(skb, totalpacketlen), |
2205 |
+ &reserved_page_packet, totalpacketlen); |
2206 |
+ |
2207 |
+diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/fw.c b/drivers/net/wireless/rtlwifi/rtl8192de/fw.c |
2208 |
+index 82f060b..c44757f 100644 |
2209 |
+--- a/drivers/net/wireless/rtlwifi/rtl8192de/fw.c |
2210 |
++++ b/drivers/net/wireless/rtlwifi/rtl8192de/fw.c |
2211 |
+@@ -763,12 +763,16 @@ void rtl92d_set_fw_rsvdpagepkt(struct ieee80211_hw *hw, bool dl_finished) |
2212 |
+ "rtl92d_set_fw_rsvdpagepkt(): HW_VAR_SET_TX_CMD: ALL\n", |
2213 |
+ u1RsvdPageLoc, 3); |
2214 |
+ skb = dev_alloc_skb(totalpacketlen); |
2215 |
+- memcpy((u8 *) skb_put(skb, totalpacketlen), &reserved_page_packet, |
2216 |
+- totalpacketlen); |
2217 |
+- rtstatus = _rtl92d_cmd_send_packet(hw, skb); |
2218 |
++ if (!skb) { |
2219 |
++ dlok = false; |
2220 |
++ } else { |
2221 |
++ memcpy((u8 *) skb_put(skb, totalpacketlen), |
2222 |
++ &reserved_page_packet, totalpacketlen); |
2223 |
++ rtstatus = _rtl92d_cmd_send_packet(hw, skb); |
2224 |
+ |
2225 |
+- if (rtstatus) |
2226 |
+- dlok = true; |
2227 |
++ if (rtstatus) |
2228 |
++ dlok = true; |
2229 |
++ } |
2230 |
+ if (dlok) { |
2231 |
+ RT_TRACE(rtlpriv, COMP_POWER, DBG_LOUD, |
2232 |
+ ("Set RSVD page location to Fw.\n")); |
2233 |
+diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c |
2234 |
+index 54cb8a6..2b7bcc8 100644 |
2235 |
+--- a/drivers/net/wireless/rtlwifi/usb.c |
2236 |
++++ b/drivers/net/wireless/rtlwifi/usb.c |
2237 |
+@@ -481,12 +481,14 @@ static void _rtl_usb_rx_process_noagg(struct ieee80211_hw *hw, |
2238 |
+ u8 *pdata; |
2239 |
+ |
2240 |
+ uskb = dev_alloc_skb(skb->len + 128); |
2241 |
+- memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status, |
2242 |
+- sizeof(rx_status)); |
2243 |
+- pdata = (u8 *)skb_put(uskb, skb->len); |
2244 |
+- memcpy(pdata, skb->data, skb->len); |
2245 |
++ if (uskb) { /* drop packet on allocation failure */ |
2246 |
++ memcpy(IEEE80211_SKB_RXCB(uskb), &rx_status, |
2247 |
++ sizeof(rx_status)); |
2248 |
++ pdata = (u8 *)skb_put(uskb, skb->len); |
2249 |
++ memcpy(pdata, skb->data, skb->len); |
2250 |
++ ieee80211_rx_irqsafe(hw, uskb); |
2251 |
++ } |
2252 |
+ dev_kfree_skb_any(skb); |
2253 |
+- ieee80211_rx_irqsafe(hw, uskb); |
2254 |
+ } else { |
2255 |
+ dev_kfree_skb_any(skb); |
2256 |
+ } |
2257 |
+diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c |
2258 |
+index 24f049e..2275162 100644 |
2259 |
+--- a/drivers/pci/pcie/aspm.c |
2260 |
++++ b/drivers/pci/pcie/aspm.c |
2261 |
+@@ -500,9 +500,6 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev) |
2262 |
+ int pos; |
2263 |
+ u32 reg32; |
2264 |
+ |
2265 |
+- if (aspm_disabled) |
2266 |
+- return 0; |
2267 |
+- |
2268 |
+ /* |
2269 |
+ * Some functions in a slot might not all be PCIe functions, |
2270 |
+ * very strange. Disable ASPM for the whole slot |
2271 |
+@@ -511,6 +508,16 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev) |
2272 |
+ pos = pci_pcie_cap(child); |
2273 |
+ if (!pos) |
2274 |
+ return -EINVAL; |
2275 |
++ |
2276 |
++ /* |
2277 |
++ * If ASPM is disabled then we're not going to change |
2278 |
++ * the BIOS state. It's safe to continue even if it's a |
2279 |
++ * pre-1.1 device |
2280 |
++ */ |
2281 |
++ |
2282 |
++ if (aspm_disabled) |
2283 |
++ continue; |
2284 |
++ |
2285 |
+ /* |
2286 |
+ * Disable ASPM for pre-1.1 PCIe device, we follow MS to use |
2287 |
+ * RBER bit to determine if a function is 1.1 version device |
2288 |
+diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c |
2289 |
+index 8a1c031..565742b 100644 |
2290 |
+--- a/drivers/rtc/interface.c |
2291 |
++++ b/drivers/rtc/interface.c |
2292 |
+@@ -445,6 +445,11 @@ int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled) |
2293 |
+ if (rtc->uie_rtctimer.enabled == enabled) |
2294 |
+ goto out; |
2295 |
+ |
2296 |
++ if (rtc->uie_unsupported) { |
2297 |
++ err = -EINVAL; |
2298 |
++ goto out; |
2299 |
++ } |
2300 |
++ |
2301 |
+ if (enabled) { |
2302 |
+ struct rtc_time tm; |
2303 |
+ ktime_t now, onesec; |
2304 |
+@@ -763,6 +768,14 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer) |
2305 |
+ return 0; |
2306 |
+ } |
2307 |
+ |
2308 |
++static void rtc_alarm_disable(struct rtc_device *rtc) |
2309 |
++{ |
2310 |
++ if (!rtc->ops || !rtc->ops->alarm_irq_enable) |
2311 |
++ return; |
2312 |
++ |
2313 |
++ rtc->ops->alarm_irq_enable(rtc->dev.parent, false); |
2314 |
++} |
2315 |
++ |
2316 |
+ /** |
2317 |
+ * rtc_timer_remove - Removes a rtc_timer from the rtc_device timerqueue |
2318 |
+ * @rtc rtc device |
2319 |
+@@ -784,8 +797,10 @@ static void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer) |
2320 |
+ struct rtc_wkalrm alarm; |
2321 |
+ int err; |
2322 |
+ next = timerqueue_getnext(&rtc->timerqueue); |
2323 |
+- if (!next) |
2324 |
++ if (!next) { |
2325 |
++ rtc_alarm_disable(rtc); |
2326 |
+ return; |
2327 |
++ } |
2328 |
+ alarm.time = rtc_ktime_to_tm(next->expires); |
2329 |
+ alarm.enabled = 1; |
2330 |
+ err = __rtc_set_alarm(rtc, &alarm); |
2331 |
+@@ -847,7 +862,8 @@ again: |
2332 |
+ err = __rtc_set_alarm(rtc, &alarm); |
2333 |
+ if (err == -ETIME) |
2334 |
+ goto again; |
2335 |
+- } |
2336 |
++ } else |
2337 |
++ rtc_alarm_disable(rtc); |
2338 |
+ |
2339 |
+ mutex_unlock(&rtc->ops_lock); |
2340 |
+ } |
2341 |
+diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c |
2342 |
+index da60915..0fc2d22 100644 |
2343 |
+--- a/drivers/rtc/rtc-mpc5121.c |
2344 |
++++ b/drivers/rtc/rtc-mpc5121.c |
2345 |
+@@ -360,6 +360,8 @@ static int __devinit mpc5121_rtc_probe(struct platform_device *op) |
2346 |
+ &mpc5200_rtc_ops, THIS_MODULE); |
2347 |
+ } |
2348 |
+ |
2349 |
++ rtc->rtc->uie_unsupported = 1; |
2350 |
++ |
2351 |
+ if (IS_ERR(rtc->rtc)) { |
2352 |
+ err = PTR_ERR(rtc->rtc); |
2353 |
+ goto out_free_irq; |
2354 |
+diff --git a/drivers/staging/rtl8712/Kconfig b/drivers/staging/rtl8712/Kconfig |
2355 |
+index ea37473..6a43312 100644 |
2356 |
+--- a/drivers/staging/rtl8712/Kconfig |
2357 |
++++ b/drivers/staging/rtl8712/Kconfig |
2358 |
+@@ -9,13 +9,6 @@ config R8712U |
2359 |
+ This option adds the Realtek RTL8712 USB device such as the D-Link DWA-130. |
2360 |
+ If built as a module, it will be called r8712u. |
2361 |
+ |
2362 |
+-config R8712_AP |
2363 |
+- bool "Realtek RTL8712U AP code" |
2364 |
+- depends on R8712U |
2365 |
+- default N |
2366 |
+- ---help--- |
2367 |
+- This option allows the Realtek RTL8712 USB device to be an Access Point. |
2368 |
+- |
2369 |
+ config R8712_TX_AGGR |
2370 |
+ bool "Realtek RTL8712U Transmit Aggregation code" |
2371 |
+ depends on R8712U && BROKEN |
2372 |
+diff --git a/drivers/staging/rtl8712/os_intfs.c b/drivers/staging/rtl8712/os_intfs.c |
2373 |
+index 98a3d68..fb11743 100644 |
2374 |
+--- a/drivers/staging/rtl8712/os_intfs.c |
2375 |
++++ b/drivers/staging/rtl8712/os_intfs.c |
2376 |
+@@ -476,8 +476,6 @@ static int netdev_close(struct net_device *pnetdev) |
2377 |
+ r8712_free_assoc_resources(padapter); |
2378 |
+ /*s2-4.*/ |
2379 |
+ r8712_free_network_queue(padapter); |
2380 |
+- /* The interface is no longer Up: */ |
2381 |
+- padapter->bup = false; |
2382 |
+ release_firmware(padapter->fw); |
2383 |
+ /* never exit with a firmware callback pending */ |
2384 |
+ wait_for_completion(&padapter->rtl8712_fw_ready); |
2385 |
+diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c |
2386 |
+index 507584b8..ef35bc2 100644 |
2387 |
+--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c |
2388 |
++++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c |
2389 |
+@@ -2380,13 +2380,7 @@ static struct iw_statistics *r871x_get_wireless_stats(struct net_device *dev) |
2390 |
+ tmp_qual = padapter->recvpriv.signal; |
2391 |
+ tmp_noise = padapter->recvpriv.noise; |
2392 |
+ piwstats->qual.level = tmp_level; |
2393 |
+- /*piwstats->qual.qual = tmp_qual; |
2394 |
+- * The NetworkManager of Fedora 10, 13 will use the link |
2395 |
+- * quality for its display. |
2396 |
+- * So, use the fw_rssi on link quality variable because |
2397 |
+- * fw_rssi will be updated per 2 seconds. |
2398 |
+- */ |
2399 |
+- piwstats->qual.qual = tmp_level; |
2400 |
++ piwstats->qual.qual = tmp_qual; |
2401 |
+ piwstats->qual.noise = tmp_noise; |
2402 |
+ } |
2403 |
+ piwstats->qual.updated = IW_QUAL_ALL_UPDATED; |
2404 |
+diff --git a/drivers/staging/rtl8712/rtl871x_sta_mgt.c b/drivers/staging/rtl8712/rtl871x_sta_mgt.c |
2405 |
+index 64f5696..1247b3d 100644 |
2406 |
+--- a/drivers/staging/rtl8712/rtl871x_sta_mgt.c |
2407 |
++++ b/drivers/staging/rtl8712/rtl871x_sta_mgt.c |
2408 |
+@@ -42,9 +42,8 @@ static void _init_stainfo(struct sta_info *psta) |
2409 |
+ _init_listhead(&psta->hash_list); |
2410 |
+ _r8712_init_sta_xmit_priv(&psta->sta_xmitpriv); |
2411 |
+ _r8712_init_sta_recv_priv(&psta->sta_recvpriv); |
2412 |
+-#ifdef CONFIG_R8712_AP |
2413 |
++ _init_listhead(&psta->asoc_list); |
2414 |
+ _init_listhead(&psta->auth_list); |
2415 |
+-#endif |
2416 |
+ } |
2417 |
+ |
2418 |
+ u32 _r8712_init_sta_priv(struct sta_priv *pstapriv) |
2419 |
+@@ -71,10 +70,8 @@ u32 _r8712_init_sta_priv(struct sta_priv *pstapriv) |
2420 |
+ get_list_head(&pstapriv->free_sta_queue)); |
2421 |
+ psta++; |
2422 |
+ } |
2423 |
+-#ifdef CONFIG_R8712_AP |
2424 |
+ _init_listhead(&pstapriv->asoc_list); |
2425 |
+ _init_listhead(&pstapriv->auth_list); |
2426 |
+-#endif |
2427 |
+ return _SUCCESS; |
2428 |
+ } |
2429 |
+ |
2430 |
+diff --git a/drivers/staging/rtl8712/sta_info.h b/drivers/staging/rtl8712/sta_info.h |
2431 |
+index 48d6a14..f8016e9 100644 |
2432 |
+--- a/drivers/staging/rtl8712/sta_info.h |
2433 |
++++ b/drivers/staging/rtl8712/sta_info.h |
2434 |
+@@ -90,7 +90,6 @@ struct sta_info { |
2435 |
+ * curr_network(mlme_priv/security_priv/qos/ht) : AP CAP/INFO |
2436 |
+ * sta_info: (AP & STA) CAP/INFO |
2437 |
+ */ |
2438 |
+-#ifdef CONFIG_R8712_AP |
2439 |
+ struct list_head asoc_list; |
2440 |
+ struct list_head auth_list; |
2441 |
+ unsigned int expire_to; |
2442 |
+@@ -98,7 +97,6 @@ struct sta_info { |
2443 |
+ unsigned int authalg; |
2444 |
+ unsigned char chg_txt[128]; |
2445 |
+ unsigned int tx_ra_bitmap; |
2446 |
+-#endif |
2447 |
+ }; |
2448 |
+ |
2449 |
+ struct sta_priv { |
2450 |
+@@ -111,13 +109,11 @@ struct sta_priv { |
2451 |
+ struct __queue sleep_q; |
2452 |
+ struct __queue wakeup_q; |
2453 |
+ struct _adapter *padapter; |
2454 |
+-#ifdef CONFIG_R8712_AP |
2455 |
+ struct list_head asoc_list; |
2456 |
+ struct list_head auth_list; |
2457 |
+ unsigned int auth_to; /* sec, time to expire in authenticating. */ |
2458 |
+ unsigned int assoc_to; /* sec, time to expire before associating. */ |
2459 |
+ unsigned int expire_to; /* sec , time to expire after associated. */ |
2460 |
+-#endif |
2461 |
+ }; |
2462 |
+ |
2463 |
+ static inline u32 wifi_mac_hash(u8 *mac) |
2464 |
+diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c |
2465 |
+index f5e469d..16ad9fe 100644 |
2466 |
+--- a/drivers/staging/zcache/zcache-main.c |
2467 |
++++ b/drivers/staging/zcache/zcache-main.c |
2468 |
+@@ -299,10 +299,12 @@ static void zbud_free_and_delist(struct zbud_hdr *zh) |
2469 |
+ struct zbud_page *zbpg = |
2470 |
+ container_of(zh, struct zbud_page, buddy[budnum]); |
2471 |
+ |
2472 |
++ spin_lock(&zbud_budlists_spinlock); |
2473 |
+ spin_lock(&zbpg->lock); |
2474 |
+ if (list_empty(&zbpg->bud_list)) { |
2475 |
+ /* ignore zombie page... see zbud_evict_pages() */ |
2476 |
+ spin_unlock(&zbpg->lock); |
2477 |
++ spin_unlock(&zbud_budlists_spinlock); |
2478 |
+ return; |
2479 |
+ } |
2480 |
+ size = zbud_free(zh); |
2481 |
+@@ -310,7 +312,6 @@ static void zbud_free_and_delist(struct zbud_hdr *zh) |
2482 |
+ zh_other = &zbpg->buddy[(budnum == 0) ? 1 : 0]; |
2483 |
+ if (zh_other->size == 0) { /* was unbuddied: unlist and free */ |
2484 |
+ chunks = zbud_size_to_chunks(size) ; |
2485 |
+- spin_lock(&zbud_budlists_spinlock); |
2486 |
+ BUG_ON(list_empty(&zbud_unbuddied[chunks].list)); |
2487 |
+ list_del_init(&zbpg->bud_list); |
2488 |
+ zbud_unbuddied[chunks].count--; |
2489 |
+@@ -318,7 +319,6 @@ static void zbud_free_and_delist(struct zbud_hdr *zh) |
2490 |
+ zbud_free_raw_page(zbpg); |
2491 |
+ } else { /* was buddied: move remaining buddy to unbuddied list */ |
2492 |
+ chunks = zbud_size_to_chunks(zh_other->size) ; |
2493 |
+- spin_lock(&zbud_budlists_spinlock); |
2494 |
+ list_del_init(&zbpg->bud_list); |
2495 |
+ zcache_zbud_buddied_count--; |
2496 |
+ list_add_tail(&zbpg->bud_list, &zbud_unbuddied[chunks].list); |
2497 |
+diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c |
2498 |
+index 03d3528..0842cc7 100644 |
2499 |
+--- a/drivers/target/iscsi/iscsi_target.c |
2500 |
++++ b/drivers/target/iscsi/iscsi_target.c |
2501 |
+@@ -781,7 +781,7 @@ static int iscsit_alloc_buffs(struct iscsi_cmd *cmd) |
2502 |
+ struct scatterlist *sgl; |
2503 |
+ u32 length = cmd->se_cmd.data_length; |
2504 |
+ int nents = DIV_ROUND_UP(length, PAGE_SIZE); |
2505 |
+- int i = 0, ret; |
2506 |
++ int i = 0, j = 0, ret; |
2507 |
+ /* |
2508 |
+ * If no SCSI payload is present, allocate the default iovecs used for |
2509 |
+ * iSCSI PDU Header |
2510 |
+@@ -822,17 +822,15 @@ static int iscsit_alloc_buffs(struct iscsi_cmd *cmd) |
2511 |
+ */ |
2512 |
+ ret = iscsit_allocate_iovecs(cmd); |
2513 |
+ if (ret < 0) |
2514 |
+- goto page_alloc_failed; |
2515 |
++ return -ENOMEM; |
2516 |
+ |
2517 |
+ return 0; |
2518 |
+ |
2519 |
+ page_alloc_failed: |
2520 |
+- while (i >= 0) { |
2521 |
+- __free_page(sg_page(&sgl[i])); |
2522 |
+- i--; |
2523 |
+- } |
2524 |
+- kfree(cmd->t_mem_sg); |
2525 |
+- cmd->t_mem_sg = NULL; |
2526 |
++ while (j < i) |
2527 |
++ __free_page(sg_page(&sgl[j++])); |
2528 |
++ |
2529 |
++ kfree(sgl); |
2530 |
+ return -ENOMEM; |
2531 |
+ } |
2532 |
+ |
2533 |
+diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c |
2534 |
+index db32784..83dcf49 100644 |
2535 |
+--- a/drivers/target/iscsi/iscsi_target_configfs.c |
2536 |
++++ b/drivers/target/iscsi/iscsi_target_configfs.c |
2537 |
+@@ -816,9 +816,6 @@ static struct se_node_acl *lio_target_make_nodeacl( |
2538 |
+ if (!se_nacl_new) |
2539 |
+ return ERR_PTR(-ENOMEM); |
2540 |
+ |
2541 |
+- acl = container_of(se_nacl_new, struct iscsi_node_acl, |
2542 |
+- se_node_acl); |
2543 |
+- |
2544 |
+ cmdsn_depth = ISCSI_TPG_ATTRIB(tpg)->default_cmdsn_depth; |
2545 |
+ /* |
2546 |
+ * se_nacl_new may be released by core_tpg_add_initiator_node_acl() |
2547 |
+@@ -829,7 +826,8 @@ static struct se_node_acl *lio_target_make_nodeacl( |
2548 |
+ if (IS_ERR(se_nacl)) |
2549 |
+ return se_nacl; |
2550 |
+ |
2551 |
+- stats_cg = &acl->se_node_acl.acl_fabric_stat_group; |
2552 |
++ acl = container_of(se_nacl, struct iscsi_node_acl, se_node_acl); |
2553 |
++ stats_cg = &se_nacl->acl_fabric_stat_group; |
2554 |
+ |
2555 |
+ stats_cg->default_groups = kzalloc(sizeof(struct config_group) * 2, |
2556 |
+ GFP_KERNEL); |
2557 |
+diff --git a/drivers/target/loopback/tcm_loop.c b/drivers/target/loopback/tcm_loop.c |
2558 |
+index 81d5832..5d1d4f2 100644 |
2559 |
+--- a/drivers/target/loopback/tcm_loop.c |
2560 |
++++ b/drivers/target/loopback/tcm_loop.c |
2561 |
+@@ -866,6 +866,9 @@ static int tcm_loop_queue_data_in(struct se_cmd *se_cmd) |
2562 |
+ |
2563 |
+ sc->result = SAM_STAT_GOOD; |
2564 |
+ set_host_byte(sc, DID_OK); |
2565 |
++ if ((se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) || |
2566 |
++ (se_cmd->se_cmd_flags & SCF_UNDERFLOW_BIT)) |
2567 |
++ scsi_set_resid(sc, se_cmd->residual_count); |
2568 |
+ sc->scsi_done(sc); |
2569 |
+ return 0; |
2570 |
+ } |
2571 |
+@@ -891,6 +894,9 @@ static int tcm_loop_queue_status(struct se_cmd *se_cmd) |
2572 |
+ sc->result = se_cmd->scsi_status; |
2573 |
+ |
2574 |
+ set_host_byte(sc, DID_OK); |
2575 |
++ if ((se_cmd->se_cmd_flags & SCF_OVERFLOW_BIT) || |
2576 |
++ (se_cmd->se_cmd_flags & SCF_UNDERFLOW_BIT)) |
2577 |
++ scsi_set_resid(sc, se_cmd->residual_count); |
2578 |
+ sc->scsi_done(sc); |
2579 |
+ return 0; |
2580 |
+ } |
2581 |
+diff --git a/drivers/target/target_core_alua.c b/drivers/target/target_core_alua.c |
2582 |
+index 1d24512..5b05744 100644 |
2583 |
+--- a/drivers/target/target_core_alua.c |
2584 |
++++ b/drivers/target/target_core_alua.c |
2585 |
+@@ -30,6 +30,7 @@ |
2586 |
+ #include <linux/export.h> |
2587 |
+ #include <scsi/scsi.h> |
2588 |
+ #include <scsi/scsi_cmnd.h> |
2589 |
++#include <asm/unaligned.h> |
2590 |
+ |
2591 |
+ #include <target/target_core_base.h> |
2592 |
+ #include <target/target_core_device.h> |
2593 |
+@@ -268,8 +269,7 @@ int target_emulate_set_target_port_groups(struct se_task *task) |
2594 |
+ * changed. |
2595 |
+ */ |
2596 |
+ if (primary) { |
2597 |
+- tg_pt_id = ((ptr[2] << 8) & 0xff); |
2598 |
+- tg_pt_id |= (ptr[3] & 0xff); |
2599 |
++ tg_pt_id = get_unaligned_be16(ptr + 2); |
2600 |
+ /* |
2601 |
+ * Locate the matching target port group ID from |
2602 |
+ * the global tg_pt_gp list |
2603 |
+@@ -313,8 +313,7 @@ int target_emulate_set_target_port_groups(struct se_task *task) |
2604 |
+ * the Target Port in question for the the incoming |
2605 |
+ * SET_TARGET_PORT_GROUPS op. |
2606 |
+ */ |
2607 |
+- rtpi = ((ptr[2] << 8) & 0xff); |
2608 |
+- rtpi |= (ptr[3] & 0xff); |
2609 |
++ rtpi = get_unaligned_be16(ptr + 2); |
2610 |
+ /* |
2611 |
+ * Locate the matching relative target port identifer |
2612 |
+ * for the struct se_device storage object. |
2613 |
+diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c |
2614 |
+index 8facd33..65ea65a 100644 |
2615 |
+--- a/drivers/target/target_core_cdb.c |
2616 |
++++ b/drivers/target/target_core_cdb.c |
2617 |
+@@ -116,7 +116,7 @@ target_emulate_inquiry_std(struct se_cmd *cmd) |
2618 |
+ goto out; |
2619 |
+ } |
2620 |
+ |
2621 |
+- buf[7] = 0x32; /* Sync=1 and CmdQue=1 */ |
2622 |
++ buf[7] = 0x2; /* CmdQue=1 */ |
2623 |
+ |
2624 |
+ /* |
2625 |
+ * Do not include vendor, product, reversion info in INQUIRY |
2626 |
+diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c |
2627 |
+index 19f8aca..f8773ae 100644 |
2628 |
+--- a/drivers/target/target_core_device.c |
2629 |
++++ b/drivers/target/target_core_device.c |
2630 |
+@@ -658,7 +658,9 @@ int target_report_luns(struct se_task *se_task) |
2631 |
+ unsigned char *buf; |
2632 |
+ u32 cdb_offset = 0, lun_count = 0, offset = 8, i; |
2633 |
+ |
2634 |
+- buf = (unsigned char *) transport_kmap_data_sg(se_cmd); |
2635 |
++ buf = transport_kmap_data_sg(se_cmd); |
2636 |
++ if (!buf) |
2637 |
++ return -ENOMEM; |
2638 |
+ |
2639 |
+ /* |
2640 |
+ * If no struct se_session pointer is present, this struct se_cmd is |
2641 |
+@@ -696,12 +698,12 @@ int target_report_luns(struct se_task *se_task) |
2642 |
+ * See SPC3 r07, page 159. |
2643 |
+ */ |
2644 |
+ done: |
2645 |
+- transport_kunmap_data_sg(se_cmd); |
2646 |
+ lun_count *= 8; |
2647 |
+ buf[0] = ((lun_count >> 24) & 0xff); |
2648 |
+ buf[1] = ((lun_count >> 16) & 0xff); |
2649 |
+ buf[2] = ((lun_count >> 8) & 0xff); |
2650 |
+ buf[3] = (lun_count & 0xff); |
2651 |
++ transport_kunmap_data_sg(se_cmd); |
2652 |
+ |
2653 |
+ se_task->task_scsi_status = GOOD; |
2654 |
+ transport_complete_task(se_task, 1); |
2655 |
+diff --git a/drivers/target/tcm_fc/tfc_cmd.c b/drivers/target/tcm_fc/tfc_cmd.c |
2656 |
+index 71fc9ce..754b669 100644 |
2657 |
+--- a/drivers/target/tcm_fc/tfc_cmd.c |
2658 |
++++ b/drivers/target/tcm_fc/tfc_cmd.c |
2659 |
+@@ -329,10 +329,12 @@ static void ft_send_resp_status(struct fc_lport *lport, |
2660 |
+ |
2661 |
+ fc_fill_reply_hdr(fp, rx_fp, FC_RCTL_DD_CMD_STATUS, 0); |
2662 |
+ sp = fr_seq(fp); |
2663 |
+- if (sp) |
2664 |
++ if (sp) { |
2665 |
+ lport->tt.seq_send(lport, sp, fp); |
2666 |
+- else |
2667 |
++ lport->tt.exch_done(sp); |
2668 |
++ } else { |
2669 |
+ lport->tt.frame_send(lport, fp); |
2670 |
++ } |
2671 |
+ } |
2672 |
+ |
2673 |
+ /* |
2674 |
+diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c |
2675 |
+index d15a071..0174d2d 100644 |
2676 |
+--- a/drivers/tty/moxa.c |
2677 |
++++ b/drivers/tty/moxa.c |
2678 |
+@@ -1331,7 +1331,7 @@ static void moxa_start(struct tty_struct *tty) |
2679 |
+ if (ch == NULL) |
2680 |
+ return; |
2681 |
+ |
2682 |
+- if (!(ch->statusflags & TXSTOPPED)) |
2683 |
++ if (!test_bit(TXSTOPPED, &ch->statusflags)) |
2684 |
+ return; |
2685 |
+ |
2686 |
+ MoxaPortTxEnable(ch); |
2687 |
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c |
2688 |
+index aff9d61..829e51a 100644 |
2689 |
+--- a/drivers/tty/serial/sh-sci.c |
2690 |
++++ b/drivers/tty/serial/sh-sci.c |
2691 |
+@@ -1123,17 +1123,20 @@ static void sci_dma_tx_complete(void *arg) |
2692 |
+ port->icount.tx += sg_dma_len(&s->sg_tx); |
2693 |
+ |
2694 |
+ async_tx_ack(s->desc_tx); |
2695 |
+- s->cookie_tx = -EINVAL; |
2696 |
+ s->desc_tx = NULL; |
2697 |
+ |
2698 |
+ if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) |
2699 |
+ uart_write_wakeup(port); |
2700 |
+ |
2701 |
+ if (!uart_circ_empty(xmit)) { |
2702 |
++ s->cookie_tx = 0; |
2703 |
+ schedule_work(&s->work_tx); |
2704 |
+- } else if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { |
2705 |
+- u16 ctrl = sci_in(port, SCSCR); |
2706 |
+- sci_out(port, SCSCR, ctrl & ~SCSCR_TIE); |
2707 |
++ } else { |
2708 |
++ s->cookie_tx = -EINVAL; |
2709 |
++ if (port->type == PORT_SCIFA || port->type == PORT_SCIFB) { |
2710 |
++ u16 ctrl = sci_in(port, SCSCR); |
2711 |
++ sci_out(port, SCSCR, ctrl & ~SCSCR_TIE); |
2712 |
++ } |
2713 |
+ } |
2714 |
+ |
2715 |
+ spin_unlock_irqrestore(&port->lock, flags); |
2716 |
+@@ -1395,8 +1398,10 @@ static void sci_start_tx(struct uart_port *port) |
2717 |
+ } |
2718 |
+ |
2719 |
+ if (s->chan_tx && !uart_circ_empty(&s->port.state->xmit) && |
2720 |
+- s->cookie_tx < 0) |
2721 |
++ s->cookie_tx < 0) { |
2722 |
++ s->cookie_tx = 0; |
2723 |
+ schedule_work(&s->work_tx); |
2724 |
++ } |
2725 |
+ #endif |
2726 |
+ |
2727 |
+ if (!s->chan_tx || port->type == PORT_SCIFA || port->type == PORT_SCIFB) { |
2728 |
+diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c |
2729 |
+index 45d3e80..f343808 100644 |
2730 |
+--- a/drivers/tty/vt/consolemap.c |
2731 |
++++ b/drivers/tty/vt/consolemap.c |
2732 |
+@@ -516,6 +516,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list) |
2733 |
+ int err = 0, err1, i; |
2734 |
+ struct uni_pagedir *p, *q; |
2735 |
+ |
2736 |
++ /* Save original vc_unipagdir_loc in case we allocate a new one */ |
2737 |
+ p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; |
2738 |
+ if (p->readonly) return -EIO; |
2739 |
+ |
2740 |
+@@ -528,26 +529,57 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list) |
2741 |
+ err1 = con_clear_unimap(vc, NULL); |
2742 |
+ if (err1) return err1; |
2743 |
+ |
2744 |
++ /* |
2745 |
++ * Since refcount was > 1, con_clear_unimap() allocated a |
2746 |
++ * a new uni_pagedir for this vc. Re: p != q |
2747 |
++ */ |
2748 |
+ q = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; |
2749 |
+- for (i = 0, l = 0; i < 32; i++) |
2750 |
++ |
2751 |
++ /* |
2752 |
++ * uni_pgdir is a 32*32*64 table with rows allocated |
2753 |
++ * when its first entry is added. The unicode value must |
2754 |
++ * still be incremented for empty rows. We are copying |
2755 |
++ * entries from "p" (old) to "q" (new). |
2756 |
++ */ |
2757 |
++ l = 0; /* unicode value */ |
2758 |
++ for (i = 0; i < 32; i++) |
2759 |
+ if ((p1 = p->uni_pgdir[i])) |
2760 |
+ for (j = 0; j < 32; j++) |
2761 |
+- if ((p2 = p1[j])) |
2762 |
++ if ((p2 = p1[j])) { |
2763 |
+ for (k = 0; k < 64; k++, l++) |
2764 |
+ if (p2[k] != 0xffff) { |
2765 |
++ /* |
2766 |
++ * Found one, copy entry for unicode |
2767 |
++ * l with fontpos value p2[k]. |
2768 |
++ */ |
2769 |
+ err1 = con_insert_unipair(q, l, p2[k]); |
2770 |
+ if (err1) { |
2771 |
+ p->refcount++; |
2772 |
+ *vc->vc_uni_pagedir_loc = (unsigned long)p; |
2773 |
+ con_release_unimap(q); |
2774 |
+ kfree(q); |
2775 |
+- return err1; |
2776 |
++ return err1; |
2777 |
+ } |
2778 |
+- } |
2779 |
+- p = q; |
2780 |
+- } else if (p == dflt) |
2781 |
++ } |
2782 |
++ } else { |
2783 |
++ /* Account for row of 64 empty entries */ |
2784 |
++ l += 64; |
2785 |
++ } |
2786 |
++ else |
2787 |
++ /* Account for empty table */ |
2788 |
++ l += 32 * 64; |
2789 |
++ |
2790 |
++ /* |
2791 |
++ * Finished copying font table, set vc_uni_pagedir to new table |
2792 |
++ */ |
2793 |
++ p = q; |
2794 |
++ } else if (p == dflt) { |
2795 |
+ dflt = NULL; |
2796 |
+- |
2797 |
++ } |
2798 |
++ |
2799 |
++ /* |
2800 |
++ * Insert user specified unicode pairs into new table. |
2801 |
++ */ |
2802 |
+ while (ct--) { |
2803 |
+ unsigned short unicode, fontpos; |
2804 |
+ __get_user(unicode, &list->unicode); |
2805 |
+@@ -557,11 +589,14 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list) |
2806 |
+ list++; |
2807 |
+ } |
2808 |
+ |
2809 |
++ /* |
2810 |
++ * Merge with fontmaps of any other virtual consoles. |
2811 |
++ */ |
2812 |
+ if (con_unify_unimap(vc, p)) |
2813 |
+ return err; |
2814 |
+ |
2815 |
+ for (i = 0; i <= 3; i++) |
2816 |
+- set_inverse_transl(vc, p, i); /* Update all inverse translations */ |
2817 |
++ set_inverse_transl(vc, p, i); /* Update inverse translations */ |
2818 |
+ set_inverse_trans_unicode(vc, p); |
2819 |
+ |
2820 |
+ return err; |
2821 |
+diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c |
2822 |
+index fd4aee1..9eb71d8 100644 |
2823 |
+--- a/drivers/usb/class/cdc-wdm.c |
2824 |
++++ b/drivers/usb/class/cdc-wdm.c |
2825 |
+@@ -397,7 +397,7 @@ outnl: |
2826 |
+ static ssize_t wdm_read |
2827 |
+ (struct file *file, char __user *buffer, size_t count, loff_t *ppos) |
2828 |
+ { |
2829 |
+- int rv, cntr = 0; |
2830 |
++ int rv, cntr; |
2831 |
+ int i = 0; |
2832 |
+ struct wdm_device *desc = file->private_data; |
2833 |
+ |
2834 |
+@@ -406,7 +406,8 @@ static ssize_t wdm_read |
2835 |
+ if (rv < 0) |
2836 |
+ return -ERESTARTSYS; |
2837 |
+ |
2838 |
+- if (desc->length == 0) { |
2839 |
++ cntr = ACCESS_ONCE(desc->length); |
2840 |
++ if (cntr == 0) { |
2841 |
+ desc->read = 0; |
2842 |
+ retry: |
2843 |
+ if (test_bit(WDM_DISCONNECTING, &desc->flags)) { |
2844 |
+@@ -456,26 +457,30 @@ retry: |
2845 |
+ spin_unlock_irq(&desc->iuspin); |
2846 |
+ goto retry; |
2847 |
+ } |
2848 |
+- clear_bit(WDM_READ, &desc->flags); |
2849 |
++ cntr = desc->length; |
2850 |
+ spin_unlock_irq(&desc->iuspin); |
2851 |
+ } |
2852 |
+ |
2853 |
+- cntr = count > desc->length ? desc->length : count; |
2854 |
++ if (cntr > count) |
2855 |
++ cntr = count; |
2856 |
+ rv = copy_to_user(buffer, desc->ubuf, cntr); |
2857 |
+ if (rv > 0) { |
2858 |
+ rv = -EFAULT; |
2859 |
+ goto err; |
2860 |
+ } |
2861 |
+ |
2862 |
++ spin_lock_irq(&desc->iuspin); |
2863 |
++ |
2864 |
+ for (i = 0; i < desc->length - cntr; i++) |
2865 |
+ desc->ubuf[i] = desc->ubuf[i + cntr]; |
2866 |
+ |
2867 |
+- spin_lock_irq(&desc->iuspin); |
2868 |
+ desc->length -= cntr; |
2869 |
+- spin_unlock_irq(&desc->iuspin); |
2870 |
+ /* in case we had outstanding data */ |
2871 |
+ if (!desc->length) |
2872 |
+ clear_bit(WDM_READ, &desc->flags); |
2873 |
++ |
2874 |
++ spin_unlock_irq(&desc->iuspin); |
2875 |
++ |
2876 |
+ rv = cntr; |
2877 |
+ |
2878 |
+ err: |
2879 |
+diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c |
2880 |
+index 25dbd86..3700aa6 100644 |
2881 |
+--- a/drivers/usb/dwc3/gadget.c |
2882 |
++++ b/drivers/usb/dwc3/gadget.c |
2883 |
+@@ -449,16 +449,16 @@ static int dwc3_gadget_ep_enable(struct usb_ep *ep, |
2884 |
+ |
2885 |
+ switch (usb_endpoint_type(desc)) { |
2886 |
+ case USB_ENDPOINT_XFER_CONTROL: |
2887 |
+- strncat(dep->name, "-control", sizeof(dep->name)); |
2888 |
++ strlcat(dep->name, "-control", sizeof(dep->name)); |
2889 |
+ break; |
2890 |
+ case USB_ENDPOINT_XFER_ISOC: |
2891 |
+- strncat(dep->name, "-isoc", sizeof(dep->name)); |
2892 |
++ strlcat(dep->name, "-isoc", sizeof(dep->name)); |
2893 |
+ break; |
2894 |
+ case USB_ENDPOINT_XFER_BULK: |
2895 |
+- strncat(dep->name, "-bulk", sizeof(dep->name)); |
2896 |
++ strlcat(dep->name, "-bulk", sizeof(dep->name)); |
2897 |
+ break; |
2898 |
+ case USB_ENDPOINT_XFER_INT: |
2899 |
+- strncat(dep->name, "-int", sizeof(dep->name)); |
2900 |
++ strlcat(dep->name, "-int", sizeof(dep->name)); |
2901 |
+ break; |
2902 |
+ default: |
2903 |
+ dev_err(dwc->dev, "invalid endpoint transfer type\n"); |
2904 |
+@@ -1405,7 +1405,7 @@ static void dwc3_endpoint_transfer_complete(struct dwc3 *dwc, |
2905 |
+ static void dwc3_gadget_start_isoc(struct dwc3 *dwc, |
2906 |
+ struct dwc3_ep *dep, const struct dwc3_event_depevt *event) |
2907 |
+ { |
2908 |
+- u32 uf; |
2909 |
++ u32 uf, mask; |
2910 |
+ |
2911 |
+ if (list_empty(&dep->request_list)) { |
2912 |
+ dev_vdbg(dwc->dev, "ISOC ep %s run out for requests.\n", |
2913 |
+@@ -1413,16 +1413,10 @@ static void dwc3_gadget_start_isoc(struct dwc3 *dwc, |
2914 |
+ return; |
2915 |
+ } |
2916 |
+ |
2917 |
+- if (event->parameters) { |
2918 |
+- u32 mask; |
2919 |
+- |
2920 |
+- mask = ~(dep->interval - 1); |
2921 |
+- uf = event->parameters & mask; |
2922 |
+- /* 4 micro frames in the future */ |
2923 |
+- uf += dep->interval * 4; |
2924 |
+- } else { |
2925 |
+- uf = 0; |
2926 |
+- } |
2927 |
++ mask = ~(dep->interval - 1); |
2928 |
++ uf = event->parameters & mask; |
2929 |
++ /* 4 micro frames in the future */ |
2930 |
++ uf += dep->interval * 4; |
2931 |
+ |
2932 |
+ __dwc3_gadget_kick_transfer(dep, uf, 1); |
2933 |
+ } |
2934 |
+diff --git a/drivers/usb/gadget/f_subset.c b/drivers/usb/gadget/f_subset.c |
2935 |
+index c154064..21ab474 100644 |
2936 |
+--- a/drivers/usb/gadget/f_subset.c |
2937 |
++++ b/drivers/usb/gadget/f_subset.c |
2938 |
+@@ -74,7 +74,7 @@ static inline struct f_gether *func_to_geth(struct usb_function *f) |
2939 |
+ |
2940 |
+ /* interface descriptor: */ |
2941 |
+ |
2942 |
+-static struct usb_interface_descriptor subset_data_intf __initdata = { |
2943 |
++static struct usb_interface_descriptor subset_data_intf = { |
2944 |
+ .bLength = sizeof subset_data_intf, |
2945 |
+ .bDescriptorType = USB_DT_INTERFACE, |
2946 |
+ |
2947 |
+@@ -87,7 +87,7 @@ static struct usb_interface_descriptor subset_data_intf __initdata = { |
2948 |
+ /* .iInterface = DYNAMIC */ |
2949 |
+ }; |
2950 |
+ |
2951 |
+-static struct usb_cdc_header_desc mdlm_header_desc __initdata = { |
2952 |
++static struct usb_cdc_header_desc mdlm_header_desc = { |
2953 |
+ .bLength = sizeof mdlm_header_desc, |
2954 |
+ .bDescriptorType = USB_DT_CS_INTERFACE, |
2955 |
+ .bDescriptorSubType = USB_CDC_HEADER_TYPE, |
2956 |
+@@ -95,7 +95,7 @@ static struct usb_cdc_header_desc mdlm_header_desc __initdata = { |
2957 |
+ .bcdCDC = cpu_to_le16(0x0110), |
2958 |
+ }; |
2959 |
+ |
2960 |
+-static struct usb_cdc_mdlm_desc mdlm_desc __initdata = { |
2961 |
++static struct usb_cdc_mdlm_desc mdlm_desc = { |
2962 |
+ .bLength = sizeof mdlm_desc, |
2963 |
+ .bDescriptorType = USB_DT_CS_INTERFACE, |
2964 |
+ .bDescriptorSubType = USB_CDC_MDLM_TYPE, |
2965 |
+@@ -111,7 +111,7 @@ static struct usb_cdc_mdlm_desc mdlm_desc __initdata = { |
2966 |
+ * can't really use its struct. All we do here is say that we're using |
2967 |
+ * the submode of "SAFE" which directly matches the CDC Subset. |
2968 |
+ */ |
2969 |
+-static u8 mdlm_detail_desc[] __initdata = { |
2970 |
++static u8 mdlm_detail_desc[] = { |
2971 |
+ 6, |
2972 |
+ USB_DT_CS_INTERFACE, |
2973 |
+ USB_CDC_MDLM_DETAIL_TYPE, |
2974 |
+@@ -121,7 +121,7 @@ static u8 mdlm_detail_desc[] __initdata = { |
2975 |
+ 0, /* network data capabilities ("raw" encapsulation) */ |
2976 |
+ }; |
2977 |
+ |
2978 |
+-static struct usb_cdc_ether_desc ether_desc __initdata = { |
2979 |
++static struct usb_cdc_ether_desc ether_desc = { |
2980 |
+ .bLength = sizeof ether_desc, |
2981 |
+ .bDescriptorType = USB_DT_CS_INTERFACE, |
2982 |
+ .bDescriptorSubType = USB_CDC_ETHERNET_TYPE, |
2983 |
+@@ -136,7 +136,7 @@ static struct usb_cdc_ether_desc ether_desc __initdata = { |
2984 |
+ |
2985 |
+ /* full speed support: */ |
2986 |
+ |
2987 |
+-static struct usb_endpoint_descriptor fs_subset_in_desc __initdata = { |
2988 |
++static struct usb_endpoint_descriptor fs_subset_in_desc = { |
2989 |
+ .bLength = USB_DT_ENDPOINT_SIZE, |
2990 |
+ .bDescriptorType = USB_DT_ENDPOINT, |
2991 |
+ |
2992 |
+@@ -144,7 +144,7 @@ static struct usb_endpoint_descriptor fs_subset_in_desc __initdata = { |
2993 |
+ .bmAttributes = USB_ENDPOINT_XFER_BULK, |
2994 |
+ }; |
2995 |
+ |
2996 |
+-static struct usb_endpoint_descriptor fs_subset_out_desc __initdata = { |
2997 |
++static struct usb_endpoint_descriptor fs_subset_out_desc = { |
2998 |
+ .bLength = USB_DT_ENDPOINT_SIZE, |
2999 |
+ .bDescriptorType = USB_DT_ENDPOINT, |
3000 |
+ |
3001 |
+@@ -152,7 +152,7 @@ static struct usb_endpoint_descriptor fs_subset_out_desc __initdata = { |
3002 |
+ .bmAttributes = USB_ENDPOINT_XFER_BULK, |
3003 |
+ }; |
3004 |
+ |
3005 |
+-static struct usb_descriptor_header *fs_eth_function[] __initdata = { |
3006 |
++static struct usb_descriptor_header *fs_eth_function[] = { |
3007 |
+ (struct usb_descriptor_header *) &subset_data_intf, |
3008 |
+ (struct usb_descriptor_header *) &mdlm_header_desc, |
3009 |
+ (struct usb_descriptor_header *) &mdlm_desc, |
3010 |
+@@ -165,7 +165,7 @@ static struct usb_descriptor_header *fs_eth_function[] __initdata = { |
3011 |
+ |
3012 |
+ /* high speed support: */ |
3013 |
+ |
3014 |
+-static struct usb_endpoint_descriptor hs_subset_in_desc __initdata = { |
3015 |
++static struct usb_endpoint_descriptor hs_subset_in_desc = { |
3016 |
+ .bLength = USB_DT_ENDPOINT_SIZE, |
3017 |
+ .bDescriptorType = USB_DT_ENDPOINT, |
3018 |
+ |
3019 |
+@@ -173,7 +173,7 @@ static struct usb_endpoint_descriptor hs_subset_in_desc __initdata = { |
3020 |
+ .wMaxPacketSize = cpu_to_le16(512), |
3021 |
+ }; |
3022 |
+ |
3023 |
+-static struct usb_endpoint_descriptor hs_subset_out_desc __initdata = { |
3024 |
++static struct usb_endpoint_descriptor hs_subset_out_desc = { |
3025 |
+ .bLength = USB_DT_ENDPOINT_SIZE, |
3026 |
+ .bDescriptorType = USB_DT_ENDPOINT, |
3027 |
+ |
3028 |
+@@ -181,7 +181,7 @@ static struct usb_endpoint_descriptor hs_subset_out_desc __initdata = { |
3029 |
+ .wMaxPacketSize = cpu_to_le16(512), |
3030 |
+ }; |
3031 |
+ |
3032 |
+-static struct usb_descriptor_header *hs_eth_function[] __initdata = { |
3033 |
++static struct usb_descriptor_header *hs_eth_function[] = { |
3034 |
+ (struct usb_descriptor_header *) &subset_data_intf, |
3035 |
+ (struct usb_descriptor_header *) &mdlm_header_desc, |
3036 |
+ (struct usb_descriptor_header *) &mdlm_desc, |
3037 |
+@@ -194,7 +194,7 @@ static struct usb_descriptor_header *hs_eth_function[] __initdata = { |
3038 |
+ |
3039 |
+ /* super speed support: */ |
3040 |
+ |
3041 |
+-static struct usb_endpoint_descriptor ss_subset_in_desc __initdata = { |
3042 |
++static struct usb_endpoint_descriptor ss_subset_in_desc = { |
3043 |
+ .bLength = USB_DT_ENDPOINT_SIZE, |
3044 |
+ .bDescriptorType = USB_DT_ENDPOINT, |
3045 |
+ |
3046 |
+@@ -202,7 +202,7 @@ static struct usb_endpoint_descriptor ss_subset_in_desc __initdata = { |
3047 |
+ .wMaxPacketSize = cpu_to_le16(1024), |
3048 |
+ }; |
3049 |
+ |
3050 |
+-static struct usb_endpoint_descriptor ss_subset_out_desc __initdata = { |
3051 |
++static struct usb_endpoint_descriptor ss_subset_out_desc = { |
3052 |
+ .bLength = USB_DT_ENDPOINT_SIZE, |
3053 |
+ .bDescriptorType = USB_DT_ENDPOINT, |
3054 |
+ |
3055 |
+@@ -210,7 +210,7 @@ static struct usb_endpoint_descriptor ss_subset_out_desc __initdata = { |
3056 |
+ .wMaxPacketSize = cpu_to_le16(1024), |
3057 |
+ }; |
3058 |
+ |
3059 |
+-static struct usb_ss_ep_comp_descriptor ss_subset_bulk_comp_desc __initdata = { |
3060 |
++static struct usb_ss_ep_comp_descriptor ss_subset_bulk_comp_desc = { |
3061 |
+ .bLength = sizeof ss_subset_bulk_comp_desc, |
3062 |
+ .bDescriptorType = USB_DT_SS_ENDPOINT_COMP, |
3063 |
+ |
3064 |
+@@ -219,7 +219,7 @@ static struct usb_ss_ep_comp_descriptor ss_subset_bulk_comp_desc __initdata = { |
3065 |
+ /* .bmAttributes = 0, */ |
3066 |
+ }; |
3067 |
+ |
3068 |
+-static struct usb_descriptor_header *ss_eth_function[] __initdata = { |
3069 |
++static struct usb_descriptor_header *ss_eth_function[] = { |
3070 |
+ (struct usb_descriptor_header *) &subset_data_intf, |
3071 |
+ (struct usb_descriptor_header *) &mdlm_header_desc, |
3072 |
+ (struct usb_descriptor_header *) &mdlm_desc, |
3073 |
+@@ -290,7 +290,7 @@ static void geth_disable(struct usb_function *f) |
3074 |
+ |
3075 |
+ /* serial function driver setup/binding */ |
3076 |
+ |
3077 |
+-static int __init |
3078 |
++static int |
3079 |
+ geth_bind(struct usb_configuration *c, struct usb_function *f) |
3080 |
+ { |
3081 |
+ struct usb_composite_dev *cdev = c->cdev; |
3082 |
+@@ -404,7 +404,7 @@ geth_unbind(struct usb_configuration *c, struct usb_function *f) |
3083 |
+ * Caller must have called @gether_setup(). Caller is also responsible |
3084 |
+ * for calling @gether_cleanup() before module unload. |
3085 |
+ */ |
3086 |
+-int __init geth_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]) |
3087 |
++int geth_bind_config(struct usb_configuration *c, u8 ethaddr[ETH_ALEN]) |
3088 |
+ { |
3089 |
+ struct f_gether *geth; |
3090 |
+ int status; |
3091 |
+diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c |
3092 |
+index dd28ef3..8e3e509 100644 |
3093 |
+--- a/drivers/usb/gadget/fsl_udc_core.c |
3094 |
++++ b/drivers/usb/gadget/fsl_udc_core.c |
3095 |
+@@ -768,7 +768,7 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req) |
3096 |
+ * @is_last: return flag if it is the last dTD of the request |
3097 |
+ * return: pointer to the built dTD */ |
3098 |
+ static struct ep_td_struct *fsl_build_dtd(struct fsl_req *req, unsigned *length, |
3099 |
+- dma_addr_t *dma, int *is_last) |
3100 |
++ dma_addr_t *dma, int *is_last, gfp_t gfp_flags) |
3101 |
+ { |
3102 |
+ u32 swap_temp; |
3103 |
+ struct ep_td_struct *dtd; |
3104 |
+@@ -777,7 +777,7 @@ static struct ep_td_struct *fsl_build_dtd(struct fsl_req *req, unsigned *length, |
3105 |
+ *length = min(req->req.length - req->req.actual, |
3106 |
+ (unsigned)EP_MAX_LENGTH_TRANSFER); |
3107 |
+ |
3108 |
+- dtd = dma_pool_alloc(udc_controller->td_pool, GFP_KERNEL, dma); |
3109 |
++ dtd = dma_pool_alloc(udc_controller->td_pool, gfp_flags, dma); |
3110 |
+ if (dtd == NULL) |
3111 |
+ return dtd; |
3112 |
+ |
3113 |
+@@ -827,7 +827,7 @@ static struct ep_td_struct *fsl_build_dtd(struct fsl_req *req, unsigned *length, |
3114 |
+ } |
3115 |
+ |
3116 |
+ /* Generate dtd chain for a request */ |
3117 |
+-static int fsl_req_to_dtd(struct fsl_req *req) |
3118 |
++static int fsl_req_to_dtd(struct fsl_req *req, gfp_t gfp_flags) |
3119 |
+ { |
3120 |
+ unsigned count; |
3121 |
+ int is_last; |
3122 |
+@@ -836,7 +836,7 @@ static int fsl_req_to_dtd(struct fsl_req *req) |
3123 |
+ dma_addr_t dma; |
3124 |
+ |
3125 |
+ do { |
3126 |
+- dtd = fsl_build_dtd(req, &count, &dma, &is_last); |
3127 |
++ dtd = fsl_build_dtd(req, &count, &dma, &is_last, gfp_flags); |
3128 |
+ if (dtd == NULL) |
3129 |
+ return -ENOMEM; |
3130 |
+ |
3131 |
+@@ -910,13 +910,11 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) |
3132 |
+ req->req.actual = 0; |
3133 |
+ req->dtd_count = 0; |
3134 |
+ |
3135 |
+- spin_lock_irqsave(&udc->lock, flags); |
3136 |
+- |
3137 |
+ /* build dtds and push them to device queue */ |
3138 |
+- if (!fsl_req_to_dtd(req)) { |
3139 |
++ if (!fsl_req_to_dtd(req, gfp_flags)) { |
3140 |
++ spin_lock_irqsave(&udc->lock, flags); |
3141 |
+ fsl_queue_td(ep, req); |
3142 |
+ } else { |
3143 |
+- spin_unlock_irqrestore(&udc->lock, flags); |
3144 |
+ return -ENOMEM; |
3145 |
+ } |
3146 |
+ |
3147 |
+@@ -1295,7 +1293,7 @@ static int ep0_prime_status(struct fsl_udc *udc, int direction) |
3148 |
+ ep_is_in(ep) ? DMA_TO_DEVICE : DMA_FROM_DEVICE); |
3149 |
+ req->mapped = 1; |
3150 |
+ |
3151 |
+- if (fsl_req_to_dtd(req) == 0) |
3152 |
++ if (fsl_req_to_dtd(req, GFP_ATOMIC) == 0) |
3153 |
+ fsl_queue_td(ep, req); |
3154 |
+ else |
3155 |
+ return -ENOMEM; |
3156 |
+@@ -1379,7 +1377,7 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value, |
3157 |
+ req->mapped = 1; |
3158 |
+ |
3159 |
+ /* prime the data phase */ |
3160 |
+- if ((fsl_req_to_dtd(req) == 0)) |
3161 |
++ if ((fsl_req_to_dtd(req, GFP_ATOMIC) == 0)) |
3162 |
+ fsl_queue_td(ep, req); |
3163 |
+ else /* no mem */ |
3164 |
+ goto stall; |
3165 |
+diff --git a/drivers/usb/gadget/hid.c b/drivers/usb/gadget/hid.c |
3166 |
+index f888c3e..3493adf 100644 |
3167 |
+--- a/drivers/usb/gadget/hid.c |
3168 |
++++ b/drivers/usb/gadget/hid.c |
3169 |
+@@ -60,9 +60,9 @@ static struct usb_device_descriptor device_desc = { |
3170 |
+ /* .bDeviceClass = USB_CLASS_COMM, */ |
3171 |
+ /* .bDeviceSubClass = 0, */ |
3172 |
+ /* .bDeviceProtocol = 0, */ |
3173 |
+- .bDeviceClass = 0xEF, |
3174 |
+- .bDeviceSubClass = 2, |
3175 |
+- .bDeviceProtocol = 1, |
3176 |
++ .bDeviceClass = USB_CLASS_PER_INTERFACE, |
3177 |
++ .bDeviceSubClass = 0, |
3178 |
++ .bDeviceProtocol = 0, |
3179 |
+ /* .bMaxPacketSize0 = f(hardware) */ |
3180 |
+ |
3181 |
+ /* Vendor and product id can be overridden by module parameters. */ |
3182 |
+diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c |
3183 |
+index 6ccae27..7138540 100644 |
3184 |
+--- a/drivers/usb/gadget/inode.c |
3185 |
++++ b/drivers/usb/gadget/inode.c |
3186 |
+@@ -1043,6 +1043,8 @@ ep0_read (struct file *fd, char __user *buf, size_t len, loff_t *ptr) |
3187 |
+ // FIXME don't call this with the spinlock held ... |
3188 |
+ if (copy_to_user (buf, dev->req->buf, len)) |
3189 |
+ retval = -EFAULT; |
3190 |
++ else |
3191 |
++ retval = len; |
3192 |
+ clean_req (dev->gadget->ep0, dev->req); |
3193 |
+ /* NOTE userspace can't yet choose to stall */ |
3194 |
+ } |
3195 |
+diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c |
3196 |
+index b556a72..da487fd 100644 |
3197 |
+--- a/drivers/usb/host/ehci-fsl.c |
3198 |
++++ b/drivers/usb/host/ehci-fsl.c |
3199 |
+@@ -216,6 +216,8 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci, |
3200 |
+ unsigned int port_offset) |
3201 |
+ { |
3202 |
+ u32 portsc; |
3203 |
++ struct usb_hcd *hcd = ehci_to_hcd(ehci); |
3204 |
++ void __iomem *non_ehci = hcd->regs; |
3205 |
+ |
3206 |
+ portsc = ehci_readl(ehci, &ehci->regs->port_status[port_offset]); |
3207 |
+ portsc &= ~(PORT_PTS_MSK | PORT_PTS_PTW); |
3208 |
+@@ -231,6 +233,8 @@ static void ehci_fsl_setup_phy(struct ehci_hcd *ehci, |
3209 |
+ portsc |= PORT_PTS_PTW; |
3210 |
+ /* fall through */ |
3211 |
+ case FSL_USB2_PHY_UTMI: |
3212 |
++ /* enable UTMI PHY */ |
3213 |
++ setbits32(non_ehci + FSL_SOC_USB_CTRL, CTRL_UTMI_PHY_EN); |
3214 |
+ portsc |= PORT_PTS_UTMI; |
3215 |
+ break; |
3216 |
+ case FSL_USB2_PHY_NONE: |
3217 |
+diff --git a/drivers/usb/host/ehci-fsl.h b/drivers/usb/host/ehci-fsl.h |
3218 |
+index 4918062..bea5013 100644 |
3219 |
+--- a/drivers/usb/host/ehci-fsl.h |
3220 |
++++ b/drivers/usb/host/ehci-fsl.h |
3221 |
+@@ -45,5 +45,6 @@ |
3222 |
+ #define FSL_SOC_USB_PRICTRL 0x40c /* NOTE: big-endian */ |
3223 |
+ #define FSL_SOC_USB_SICTRL 0x410 /* NOTE: big-endian */ |
3224 |
+ #define FSL_SOC_USB_CTRL 0x500 /* NOTE: big-endian */ |
3225 |
++#define CTRL_UTMI_PHY_EN (1<<9) |
3226 |
+ #define SNOOP_SIZE_2GB 0x1e |
3227 |
+ #endif /* _EHCI_FSL_H */ |
3228 |
+diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c |
3229 |
+index 9037035..5a42cf0 100644 |
3230 |
+--- a/drivers/usb/host/fsl-mph-dr-of.c |
3231 |
++++ b/drivers/usb/host/fsl-mph-dr-of.c |
3232 |
+@@ -94,7 +94,6 @@ struct platform_device * __devinit fsl_usb2_device_register( |
3233 |
+ pdev->dev.parent = &ofdev->dev; |
3234 |
+ |
3235 |
+ pdev->dev.coherent_dma_mask = ofdev->dev.coherent_dma_mask; |
3236 |
+- pdev->dev.dma_mask = &pdev->archdata.dma_mask; |
3237 |
+ *pdev->dev.dma_mask = *ofdev->dev.dma_mask; |
3238 |
+ |
3239 |
+ retval = platform_device_add_data(pdev, pdata, sizeof(*pdata)); |
3240 |
+diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c |
3241 |
+index 922148f..c860597 100644 |
3242 |
+--- a/drivers/usb/musb/musb_gadget.c |
3243 |
++++ b/drivers/usb/musb/musb_gadget.c |
3244 |
+@@ -576,6 +576,15 @@ void musb_g_tx(struct musb *musb, u8 epnum) |
3245 |
+ |
3246 |
+ if (request->actual == request->length) { |
3247 |
+ musb_g_giveback(musb_ep, request, 0); |
3248 |
++ /* |
3249 |
++ * In the giveback function the MUSB lock is |
3250 |
++ * released and acquired after sometime. During |
3251 |
++ * this time period the INDEX register could get |
3252 |
++ * changed by the gadget_queue function especially |
3253 |
++ * on SMP systems. Reselect the INDEX to be sure |
3254 |
++ * we are reading/modifying the right registers |
3255 |
++ */ |
3256 |
++ musb_ep_select(mbase, epnum); |
3257 |
+ req = musb_ep->desc ? next_request(musb_ep) : NULL; |
3258 |
+ if (!req) { |
3259 |
+ dev_dbg(musb->controller, "%s idle now\n", |
3260 |
+@@ -985,6 +994,15 @@ void musb_g_rx(struct musb *musb, u8 epnum) |
3261 |
+ } |
3262 |
+ #endif |
3263 |
+ musb_g_giveback(musb_ep, request, 0); |
3264 |
++ /* |
3265 |
++ * In the giveback function the MUSB lock is |
3266 |
++ * released and acquired after sometime. During |
3267 |
++ * this time period the INDEX register could get |
3268 |
++ * changed by the gadget_queue function especially |
3269 |
++ * on SMP systems. Reselect the INDEX to be sure |
3270 |
++ * we are reading/modifying the right registers |
3271 |
++ */ |
3272 |
++ musb_ep_select(mbase, epnum); |
3273 |
+ |
3274 |
+ req = next_request(musb_ep); |
3275 |
+ if (!req) |
3276 |
+diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c |
3277 |
+index 7f4e803..aa0d183 100644 |
3278 |
+--- a/drivers/usb/renesas_usbhs/mod_gadget.c |
3279 |
++++ b/drivers/usb/renesas_usbhs/mod_gadget.c |
3280 |
+@@ -816,6 +816,11 @@ static int usbhsg_stop(struct usbhs_priv *priv) |
3281 |
+ return usbhsg_try_stop(priv, USBHSG_STATUS_STARTED); |
3282 |
+ } |
3283 |
+ |
3284 |
++static void usbhs_mod_gadget_release(struct device *pdev) |
3285 |
++{ |
3286 |
++ /* do nothing */ |
3287 |
++} |
3288 |
++ |
3289 |
+ int usbhs_mod_gadget_probe(struct usbhs_priv *priv) |
3290 |
+ { |
3291 |
+ struct usbhsg_gpriv *gpriv; |
3292 |
+@@ -864,6 +869,7 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv) |
3293 |
+ */ |
3294 |
+ dev_set_name(&gpriv->gadget.dev, "gadget"); |
3295 |
+ gpriv->gadget.dev.parent = dev; |
3296 |
++ gpriv->gadget.dev.release = usbhs_mod_gadget_release; |
3297 |
+ gpriv->gadget.name = "renesas_usbhs_udc"; |
3298 |
+ gpriv->gadget.ops = &usbhsg_gadget_ops; |
3299 |
+ gpriv->gadget.is_dualspeed = 1; |
3300 |
+diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c |
3301 |
+index 33d25d4..4c12404 100644 |
3302 |
+--- a/drivers/usb/serial/cp210x.c |
3303 |
++++ b/drivers/usb/serial/cp210x.c |
3304 |
+@@ -49,6 +49,7 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, |
3305 |
+ unsigned int, unsigned int); |
3306 |
+ static void cp210x_break_ctl(struct tty_struct *, int); |
3307 |
+ static int cp210x_startup(struct usb_serial *); |
3308 |
++static void cp210x_release(struct usb_serial *); |
3309 |
+ static void cp210x_dtr_rts(struct usb_serial_port *p, int on); |
3310 |
+ |
3311 |
+ static int debug; |
3312 |
+@@ -121,6 +122,8 @@ static const struct usb_device_id id_table[] = { |
3313 |
+ { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */ |
3314 |
+ { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ |
3315 |
+ { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ |
3316 |
++ { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ |
3317 |
++ { USB_DEVICE(0x10C4, 0xEA80) }, /* Silicon Labs factory default */ |
3318 |
+ { USB_DEVICE(0x10C4, 0xEA71) }, /* Infinity GPS-MIC-1 Radio Monophone */ |
3319 |
+ { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */ |
3320 |
+ { USB_DEVICE(0x10C4, 0xF002) }, /* Elan Digital Systems USBwave12 */ |
3321 |
+@@ -149,6 +152,10 @@ static const struct usb_device_id id_table[] = { |
3322 |
+ |
3323 |
+ MODULE_DEVICE_TABLE(usb, id_table); |
3324 |
+ |
3325 |
++struct cp210x_port_private { |
3326 |
++ __u8 bInterfaceNumber; |
3327 |
++}; |
3328 |
++ |
3329 |
+ static struct usb_driver cp210x_driver = { |
3330 |
+ .name = "cp210x", |
3331 |
+ .probe = usb_serial_probe, |
3332 |
+@@ -174,6 +181,7 @@ static struct usb_serial_driver cp210x_device = { |
3333 |
+ .tiocmget = cp210x_tiocmget, |
3334 |
+ .tiocmset = cp210x_tiocmset, |
3335 |
+ .attach = cp210x_startup, |
3336 |
++ .release = cp210x_release, |
3337 |
+ .dtr_rts = cp210x_dtr_rts |
3338 |
+ }; |
3339 |
+ |
3340 |
+@@ -261,6 +269,7 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request, |
3341 |
+ unsigned int *data, int size) |
3342 |
+ { |
3343 |
+ struct usb_serial *serial = port->serial; |
3344 |
++ struct cp210x_port_private *port_priv = usb_get_serial_port_data(port); |
3345 |
+ __le32 *buf; |
3346 |
+ int result, i, length; |
3347 |
+ |
3348 |
+@@ -276,7 +285,7 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request, |
3349 |
+ /* Issue the request, attempting to read 'size' bytes */ |
3350 |
+ result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
3351 |
+ request, REQTYPE_DEVICE_TO_HOST, 0x0000, |
3352 |
+- 0, buf, size, 300); |
3353 |
++ port_priv->bInterfaceNumber, buf, size, 300); |
3354 |
+ |
3355 |
+ /* Convert data into an array of integers */ |
3356 |
+ for (i = 0; i < length; i++) |
3357 |
+@@ -304,6 +313,7 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request, |
3358 |
+ unsigned int *data, int size) |
3359 |
+ { |
3360 |
+ struct usb_serial *serial = port->serial; |
3361 |
++ struct cp210x_port_private *port_priv = usb_get_serial_port_data(port); |
3362 |
+ __le32 *buf; |
3363 |
+ int result, i, length; |
3364 |
+ |
3365 |
+@@ -325,12 +335,12 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request, |
3366 |
+ result = usb_control_msg(serial->dev, |
3367 |
+ usb_sndctrlpipe(serial->dev, 0), |
3368 |
+ request, REQTYPE_HOST_TO_DEVICE, 0x0000, |
3369 |
+- 0, buf, size, 300); |
3370 |
++ port_priv->bInterfaceNumber, buf, size, 300); |
3371 |
+ } else { |
3372 |
+ result = usb_control_msg(serial->dev, |
3373 |
+ usb_sndctrlpipe(serial->dev, 0), |
3374 |
+ request, REQTYPE_HOST_TO_DEVICE, data[0], |
3375 |
+- 0, NULL, 0, 300); |
3376 |
++ port_priv->bInterfaceNumber, NULL, 0, 300); |
3377 |
+ } |
3378 |
+ |
3379 |
+ kfree(buf); |
3380 |
+@@ -830,11 +840,39 @@ static void cp210x_break_ctl (struct tty_struct *tty, int break_state) |
3381 |
+ |
3382 |
+ static int cp210x_startup(struct usb_serial *serial) |
3383 |
+ { |
3384 |
++ struct cp210x_port_private *port_priv; |
3385 |
++ int i; |
3386 |
++ |
3387 |
+ /* cp210x buffers behave strangely unless device is reset */ |
3388 |
+ usb_reset_device(serial->dev); |
3389 |
++ |
3390 |
++ for (i = 0; i < serial->num_ports; i++) { |
3391 |
++ port_priv = kzalloc(sizeof(*port_priv), GFP_KERNEL); |
3392 |
++ if (!port_priv) |
3393 |
++ return -ENOMEM; |
3394 |
++ |
3395 |
++ memset(port_priv, 0x00, sizeof(*port_priv)); |
3396 |
++ port_priv->bInterfaceNumber = |
3397 |
++ serial->interface->cur_altsetting->desc.bInterfaceNumber; |
3398 |
++ |
3399 |
++ usb_set_serial_port_data(serial->port[i], port_priv); |
3400 |
++ } |
3401 |
++ |
3402 |
+ return 0; |
3403 |
+ } |
3404 |
+ |
3405 |
++static void cp210x_release(struct usb_serial *serial) |
3406 |
++{ |
3407 |
++ struct cp210x_port_private *port_priv; |
3408 |
++ int i; |
3409 |
++ |
3410 |
++ for (i = 0; i < serial->num_ports; i++) { |
3411 |
++ port_priv = usb_get_serial_port_data(serial->port[i]); |
3412 |
++ kfree(port_priv); |
3413 |
++ usb_set_serial_port_data(serial->port[i], NULL); |
3414 |
++ } |
3415 |
++} |
3416 |
++ |
3417 |
+ static int __init cp210x_init(void) |
3418 |
+ { |
3419 |
+ int retval; |
3420 |
+diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
3421 |
+index f030471..f2c9ef7 100644 |
3422 |
+--- a/drivers/usb/serial/ftdi_sio.c |
3423 |
++++ b/drivers/usb/serial/ftdi_sio.c |
3424 |
+@@ -188,6 +188,7 @@ static struct usb_device_id id_table_combined [] = { |
3425 |
+ .driver_info = (kernel_ulong_t)&ftdi_8u2232c_quirk }, |
3426 |
+ { USB_DEVICE(FTDI_VID, FTDI_4232H_PID) }, |
3427 |
+ { USB_DEVICE(FTDI_VID, FTDI_232H_PID) }, |
3428 |
++ { USB_DEVICE(FTDI_VID, FTDI_FTX_PID) }, |
3429 |
+ { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) }, |
3430 |
+ { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) }, |
3431 |
+ { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_PID) }, |
3432 |
+@@ -536,6 +537,10 @@ static struct usb_device_id id_table_combined [] = { |
3433 |
+ { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_6_PID) }, |
3434 |
+ { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_7_PID) }, |
3435 |
+ { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) }, |
3436 |
++ { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803R_1_PID) }, |
3437 |
++ { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803R_2_PID) }, |
3438 |
++ { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803R_3_PID) }, |
3439 |
++ { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803R_4_PID) }, |
3440 |
+ { USB_DEVICE(IDTECH_VID, IDTECH_IDT1221U_PID) }, |
3441 |
+ { USB_DEVICE(OCT_VID, OCT_US101_PID) }, |
3442 |
+ { USB_DEVICE(OCT_VID, OCT_DK201_PID) }, |
3443 |
+@@ -797,7 +802,7 @@ static struct usb_device_id id_table_combined [] = { |
3444 |
+ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
3445 |
+ { USB_DEVICE(ADI_VID, ADI_GNICEPLUS_PID), |
3446 |
+ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
3447 |
+- { USB_DEVICE(HORNBY_VID, HORNBY_ELITE_PID) }, |
3448 |
++ { USB_DEVICE(MICROCHIP_VID, MICROCHIP_USB_BOARD_PID) }, |
3449 |
+ { USB_DEVICE(JETI_VID, JETI_SPC1201_PID) }, |
3450 |
+ { USB_DEVICE(MARVELL_VID, MARVELL_SHEEVAPLUG_PID), |
3451 |
+ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
3452 |
+@@ -846,6 +851,9 @@ static struct usb_device_id id_table_combined [] = { |
3453 |
+ { USB_DEVICE(ST_VID, ST_STMCLT1030_PID), |
3454 |
+ .driver_info = (kernel_ulong_t)&ftdi_stmclite_quirk }, |
3455 |
+ { USB_DEVICE(FTDI_VID, FTDI_RF_R106) }, |
3456 |
++ { USB_DEVICE(FTDI_VID, FTDI_DISTORTEC_JTAG_LOCK_PICK_PID), |
3457 |
++ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
3458 |
++ { USB_DEVICE(FTDI_VID, FTDI_LUMEL_PD12_PID) }, |
3459 |
+ { }, /* Optional parameter entry */ |
3460 |
+ { } /* Terminating entry */ |
3461 |
+ }; |
3462 |
+@@ -868,7 +876,8 @@ static const char *ftdi_chip_name[] = { |
3463 |
+ [FT232RL] = "FT232RL", |
3464 |
+ [FT2232H] = "FT2232H", |
3465 |
+ [FT4232H] = "FT4232H", |
3466 |
+- [FT232H] = "FT232H" |
3467 |
++ [FT232H] = "FT232H", |
3468 |
++ [FTX] = "FT-X" |
3469 |
+ }; |
3470 |
+ |
3471 |
+ |
3472 |
+@@ -1169,7 +1178,8 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty, |
3473 |
+ break; |
3474 |
+ case FT232BM: /* FT232BM chip */ |
3475 |
+ case FT2232C: /* FT2232C chip */ |
3476 |
+- case FT232RL: |
3477 |
++ case FT232RL: /* FT232RL chip */ |
3478 |
++ case FTX: /* FT-X series */ |
3479 |
+ if (baud <= 3000000) { |
3480 |
+ __u16 product_id = le16_to_cpu( |
3481 |
+ port->serial->dev->descriptor.idProduct); |
3482 |
+@@ -1458,10 +1468,14 @@ static void ftdi_determine_type(struct usb_serial_port *port) |
3483 |
+ } else if (version < 0x900) { |
3484 |
+ /* Assume it's an FT232RL */ |
3485 |
+ priv->chip_type = FT232RL; |
3486 |
+- } else { |
3487 |
++ } else if (version < 0x1000) { |
3488 |
+ /* Assume it's an FT232H */ |
3489 |
+ priv->chip_type = FT232H; |
3490 |
++ } else { |
3491 |
++ /* Assume it's an FT-X series device */ |
3492 |
++ priv->chip_type = FTX; |
3493 |
+ } |
3494 |
++ |
3495 |
+ dev_info(&udev->dev, "Detected %s\n", ftdi_chip_name[priv->chip_type]); |
3496 |
+ } |
3497 |
+ |
3498 |
+@@ -1589,7 +1603,8 @@ static int create_sysfs_attrs(struct usb_serial_port *port) |
3499 |
+ priv->chip_type == FT232RL || |
3500 |
+ priv->chip_type == FT2232H || |
3501 |
+ priv->chip_type == FT4232H || |
3502 |
+- priv->chip_type == FT232H)) { |
3503 |
++ priv->chip_type == FT232H || |
3504 |
++ priv->chip_type == FTX)) { |
3505 |
+ retval = device_create_file(&port->dev, |
3506 |
+ &dev_attr_latency_timer); |
3507 |
+ } |
3508 |
+@@ -1611,7 +1626,8 @@ static void remove_sysfs_attrs(struct usb_serial_port *port) |
3509 |
+ priv->chip_type == FT232RL || |
3510 |
+ priv->chip_type == FT2232H || |
3511 |
+ priv->chip_type == FT4232H || |
3512 |
+- priv->chip_type == FT232H) { |
3513 |
++ priv->chip_type == FT232H || |
3514 |
++ priv->chip_type == FTX) { |
3515 |
+ device_remove_file(&port->dev, &dev_attr_latency_timer); |
3516 |
+ } |
3517 |
+ } |
3518 |
+@@ -1763,7 +1779,8 @@ static int ftdi_8u2232c_probe(struct usb_serial *serial) |
3519 |
+ |
3520 |
+ dbg("%s", __func__); |
3521 |
+ |
3522 |
+- if (strcmp(udev->manufacturer, "CALAO Systems") == 0) |
3523 |
++ if ((udev->manufacturer && !strcmp(udev->manufacturer, "CALAO Systems")) || |
3524 |
++ (udev->product && !strcmp(udev->product, "BeagleBone/XDS100"))) |
3525 |
+ return ftdi_jtag_probe(serial); |
3526 |
+ |
3527 |
+ return 0; |
3528 |
+@@ -2284,6 +2301,7 @@ static int ftdi_tiocmget(struct tty_struct *tty) |
3529 |
+ case FT2232H: |
3530 |
+ case FT4232H: |
3531 |
+ case FT232H: |
3532 |
++ case FTX: |
3533 |
+ len = 2; |
3534 |
+ break; |
3535 |
+ default: |
3536 |
+diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h |
3537 |
+index 19584fa..ed58c6f 100644 |
3538 |
+--- a/drivers/usb/serial/ftdi_sio.h |
3539 |
++++ b/drivers/usb/serial/ftdi_sio.h |
3540 |
+@@ -157,7 +157,8 @@ enum ftdi_chip_type { |
3541 |
+ FT232RL = 5, |
3542 |
+ FT2232H = 6, |
3543 |
+ FT4232H = 7, |
3544 |
+- FT232H = 8 |
3545 |
++ FT232H = 8, |
3546 |
++ FTX = 9, |
3547 |
+ }; |
3548 |
+ |
3549 |
+ enum ftdi_sio_baudrate { |
3550 |
+diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h |
3551 |
+index 4eb7715..c6dd18e 100644 |
3552 |
+--- a/drivers/usb/serial/ftdi_sio_ids.h |
3553 |
++++ b/drivers/usb/serial/ftdi_sio_ids.h |
3554 |
+@@ -23,12 +23,15 @@ |
3555 |
+ #define FTDI_8U2232C_PID 0x6010 /* Dual channel device */ |
3556 |
+ #define FTDI_4232H_PID 0x6011 /* Quad channel hi-speed device */ |
3557 |
+ #define FTDI_232H_PID 0x6014 /* Single channel hi-speed device */ |
3558 |
++#define FTDI_FTX_PID 0x6015 /* FT-X series (FT201X, FT230X, FT231X, etc) */ |
3559 |
+ #define FTDI_SIO_PID 0x8372 /* Product Id SIO application of 8U100AX */ |
3560 |
+ #define FTDI_232RL_PID 0xFBFA /* Product ID for FT232RL */ |
3561 |
+ |
3562 |
+ |
3563 |
+ /*** third-party PIDs (using FTDI_VID) ***/ |
3564 |
+ |
3565 |
++#define FTDI_LUMEL_PD12_PID 0x6002 |
3566 |
++ |
3567 |
+ /* |
3568 |
+ * Marvell OpenRD Base, Client |
3569 |
+ * http://www.open-rd.org |
3570 |
+@@ -97,6 +100,8 @@ |
3571 |
+ #define FTDI_TACTRIX_OPENPORT_13S_PID 0xCC49 /* OpenPort 1.3 Subaru */ |
3572 |
+ #define FTDI_TACTRIX_OPENPORT_13U_PID 0xCC4A /* OpenPort 1.3 Universal */ |
3573 |
+ |
3574 |
++#define FTDI_DISTORTEC_JTAG_LOCK_PICK_PID 0xCFF8 |
3575 |
++ |
3576 |
+ /* SCS HF Radio Modems PID's (http://www.scs-ptc.com) */ |
3577 |
+ /* the VID is the standard ftdi vid (FTDI_VID) */ |
3578 |
+ #define FTDI_SCS_DEVICE_0_PID 0xD010 /* SCS PTC-IIusb */ |
3579 |
+@@ -532,10 +537,14 @@ |
3580 |
+ #define ADI_GNICEPLUS_PID 0xF001 |
3581 |
+ |
3582 |
+ /* |
3583 |
+- * Hornby Elite |
3584 |
++ * Microchip Technology, Inc. |
3585 |
++ * |
3586 |
++ * MICROCHIP_VID (0x04D8) and MICROCHIP_USB_BOARD_PID (0x000A) are also used by: |
3587 |
++ * Hornby Elite - Digital Command Control Console |
3588 |
++ * http://www.hornby.com/hornby-dcc/controllers/ |
3589 |
+ */ |
3590 |
+-#define HORNBY_VID 0x04D8 |
3591 |
+-#define HORNBY_ELITE_PID 0x000A |
3592 |
++#define MICROCHIP_VID 0x04D8 |
3593 |
++#define MICROCHIP_USB_BOARD_PID 0x000A /* CDC RS-232 Emulation Demo */ |
3594 |
+ |
3595 |
+ /* |
3596 |
+ * RATOC REX-USB60F |
3597 |
+@@ -680,6 +689,10 @@ |
3598 |
+ #define SEALEVEL_2803_6_PID 0X2863 /* SeaLINK+8 (2803) Port 6 */ |
3599 |
+ #define SEALEVEL_2803_7_PID 0X2873 /* SeaLINK+8 (2803) Port 7 */ |
3600 |
+ #define SEALEVEL_2803_8_PID 0X2883 /* SeaLINK+8 (2803) Port 8 */ |
3601 |
++#define SEALEVEL_2803R_1_PID 0Xa02a /* SeaLINK+8 (2803-ROHS) Port 1+2 */ |
3602 |
++#define SEALEVEL_2803R_2_PID 0Xa02b /* SeaLINK+8 (2803-ROHS) Port 3+4 */ |
3603 |
++#define SEALEVEL_2803R_3_PID 0Xa02c /* SeaLINK+8 (2803-ROHS) Port 5+6 */ |
3604 |
++#define SEALEVEL_2803R_4_PID 0Xa02d /* SeaLINK+8 (2803-ROHS) Port 7+8 */ |
3605 |
+ |
3606 |
+ /* |
3607 |
+ * JETI SPECTROMETER SPECBOS 1201 |
3608 |
+diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c |
3609 |
+index e4db5ad..9f0b2bf 100644 |
3610 |
+--- a/drivers/usb/serial/generic.c |
3611 |
++++ b/drivers/usb/serial/generic.c |
3612 |
+@@ -215,8 +215,10 @@ retry: |
3613 |
+ clear_bit(i, &port->write_urbs_free); |
3614 |
+ result = usb_submit_urb(urb, GFP_ATOMIC); |
3615 |
+ if (result) { |
3616 |
+- dev_err(&port->dev, "%s - error submitting urb: %d\n", |
3617 |
++ if (!port->port.console) { |
3618 |
++ dev_err(&port->dev, "%s - error submitting urb: %d\n", |
3619 |
+ __func__, result); |
3620 |
++ } |
3621 |
+ set_bit(i, &port->write_urbs_free); |
3622 |
+ spin_lock_irqsave(&port->lock, flags); |
3623 |
+ port->tx_bytes -= count; |
3624 |
+diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c |
3625 |
+index c72abd5..5c7d654 100644 |
3626 |
+--- a/drivers/usb/serial/mos7840.c |
3627 |
++++ b/drivers/usb/serial/mos7840.c |
3628 |
+@@ -174,6 +174,7 @@ |
3629 |
+ |
3630 |
+ #define CLK_MULTI_REGISTER ((__u16)(0x02)) |
3631 |
+ #define CLK_START_VALUE_REGISTER ((__u16)(0x03)) |
3632 |
++#define GPIO_REGISTER ((__u16)(0x07)) |
3633 |
+ |
3634 |
+ #define SERIAL_LCR_DLAB ((__u16)(0x0080)) |
3635 |
+ |
3636 |
+@@ -1103,14 +1104,25 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) |
3637 |
+ mos7840_port->read_urb = port->read_urb; |
3638 |
+ |
3639 |
+ /* set up our bulk in urb */ |
3640 |
+- |
3641 |
+- usb_fill_bulk_urb(mos7840_port->read_urb, |
3642 |
+- serial->dev, |
3643 |
+- usb_rcvbulkpipe(serial->dev, |
3644 |
+- port->bulk_in_endpointAddress), |
3645 |
+- port->bulk_in_buffer, |
3646 |
+- mos7840_port->read_urb->transfer_buffer_length, |
3647 |
+- mos7840_bulk_in_callback, mos7840_port); |
3648 |
++ if ((serial->num_ports == 2) |
3649 |
++ && ((((__u16)port->number - |
3650 |
++ (__u16)(port->serial->minor)) % 2) != 0)) { |
3651 |
++ usb_fill_bulk_urb(mos7840_port->read_urb, |
3652 |
++ serial->dev, |
3653 |
++ usb_rcvbulkpipe(serial->dev, |
3654 |
++ (port->bulk_in_endpointAddress) + 2), |
3655 |
++ port->bulk_in_buffer, |
3656 |
++ mos7840_port->read_urb->transfer_buffer_length, |
3657 |
++ mos7840_bulk_in_callback, mos7840_port); |
3658 |
++ } else { |
3659 |
++ usb_fill_bulk_urb(mos7840_port->read_urb, |
3660 |
++ serial->dev, |
3661 |
++ usb_rcvbulkpipe(serial->dev, |
3662 |
++ port->bulk_in_endpointAddress), |
3663 |
++ port->bulk_in_buffer, |
3664 |
++ mos7840_port->read_urb->transfer_buffer_length, |
3665 |
++ mos7840_bulk_in_callback, mos7840_port); |
3666 |
++ } |
3667 |
+ |
3668 |
+ dbg("mos7840_open: bulkin endpoint is %d", |
3669 |
+ port->bulk_in_endpointAddress); |
3670 |
+@@ -1521,13 +1533,25 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, |
3671 |
+ memcpy(urb->transfer_buffer, current_position, transfer_size); |
3672 |
+ |
3673 |
+ /* fill urb with data and submit */ |
3674 |
+- usb_fill_bulk_urb(urb, |
3675 |
+- serial->dev, |
3676 |
+- usb_sndbulkpipe(serial->dev, |
3677 |
+- port->bulk_out_endpointAddress), |
3678 |
+- urb->transfer_buffer, |
3679 |
+- transfer_size, |
3680 |
+- mos7840_bulk_out_data_callback, mos7840_port); |
3681 |
++ if ((serial->num_ports == 2) |
3682 |
++ && ((((__u16)port->number - |
3683 |
++ (__u16)(port->serial->minor)) % 2) != 0)) { |
3684 |
++ usb_fill_bulk_urb(urb, |
3685 |
++ serial->dev, |
3686 |
++ usb_sndbulkpipe(serial->dev, |
3687 |
++ (port->bulk_out_endpointAddress) + 2), |
3688 |
++ urb->transfer_buffer, |
3689 |
++ transfer_size, |
3690 |
++ mos7840_bulk_out_data_callback, mos7840_port); |
3691 |
++ } else { |
3692 |
++ usb_fill_bulk_urb(urb, |
3693 |
++ serial->dev, |
3694 |
++ usb_sndbulkpipe(serial->dev, |
3695 |
++ port->bulk_out_endpointAddress), |
3696 |
++ urb->transfer_buffer, |
3697 |
++ transfer_size, |
3698 |
++ mos7840_bulk_out_data_callback, mos7840_port); |
3699 |
++ } |
3700 |
+ |
3701 |
+ data1 = urb->transfer_buffer; |
3702 |
+ dbg("bulkout endpoint is %d", port->bulk_out_endpointAddress); |
3703 |
+@@ -1840,7 +1864,7 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port, |
3704 |
+ |
3705 |
+ } else { |
3706 |
+ #ifdef HW_flow_control |
3707 |
+- / *setting h/w flow control bit to 0 */ |
3708 |
++ /* setting h/w flow control bit to 0 */ |
3709 |
+ Data = 0xb; |
3710 |
+ mos7840_port->shadowMCR = Data; |
3711 |
+ status = mos7840_set_uart_reg(port, MODEM_CONTROL_REGISTER, |
3712 |
+@@ -2309,19 +2333,26 @@ static int mos7840_ioctl(struct tty_struct *tty, |
3713 |
+ |
3714 |
+ static int mos7840_calc_num_ports(struct usb_serial *serial) |
3715 |
+ { |
3716 |
+- int mos7840_num_ports = 0; |
3717 |
+- |
3718 |
+- dbg("numberofendpoints: cur %d, alt %d", |
3719 |
+- (int)serial->interface->cur_altsetting->desc.bNumEndpoints, |
3720 |
+- (int)serial->interface->altsetting->desc.bNumEndpoints); |
3721 |
+- if (serial->interface->cur_altsetting->desc.bNumEndpoints == 5) { |
3722 |
+- mos7840_num_ports = serial->num_ports = 2; |
3723 |
+- } else if (serial->interface->cur_altsetting->desc.bNumEndpoints == 9) { |
3724 |
++ __u16 Data = 0x00; |
3725 |
++ int ret = 0; |
3726 |
++ int mos7840_num_ports; |
3727 |
++ |
3728 |
++ ret = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), |
3729 |
++ MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, &Data, |
3730 |
++ VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); |
3731 |
++ |
3732 |
++ if ((Data & 0x01) == 0) { |
3733 |
++ mos7840_num_ports = 2; |
3734 |
++ serial->num_bulk_in = 2; |
3735 |
++ serial->num_bulk_out = 2; |
3736 |
++ serial->num_ports = 2; |
3737 |
++ } else { |
3738 |
++ mos7840_num_ports = 4; |
3739 |
+ serial->num_bulk_in = 4; |
3740 |
+ serial->num_bulk_out = 4; |
3741 |
+- mos7840_num_ports = serial->num_ports = 4; |
3742 |
++ serial->num_ports = 4; |
3743 |
+ } |
3744 |
+- dbg ("mos7840_num_ports = %d", mos7840_num_ports); |
3745 |
++ |
3746 |
+ return mos7840_num_ports; |
3747 |
+ } |
3748 |
+ |
3749 |
+diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
3750 |
+index 68fa8c7..54898c9 100644 |
3751 |
+--- a/drivers/usb/serial/option.c |
3752 |
++++ b/drivers/usb/serial/option.c |
3753 |
+@@ -307,6 +307,9 @@ static void option_instat_callback(struct urb *urb); |
3754 |
+ #define TELIT_VENDOR_ID 0x1bc7 |
3755 |
+ #define TELIT_PRODUCT_UC864E 0x1003 |
3756 |
+ #define TELIT_PRODUCT_UC864G 0x1004 |
3757 |
++#define TELIT_PRODUCT_CC864_DUAL 0x1005 |
3758 |
++#define TELIT_PRODUCT_CC864_SINGLE 0x1006 |
3759 |
++#define TELIT_PRODUCT_DE910_DUAL 0x1010 |
3760 |
+ |
3761 |
+ /* ZTE PRODUCTS */ |
3762 |
+ #define ZTE_VENDOR_ID 0x19d2 |
3763 |
+@@ -484,6 +487,9 @@ static void option_instat_callback(struct urb *urb); |
3764 |
+ #define LG_VENDOR_ID 0x1004 |
3765 |
+ #define LG_PRODUCT_L02C 0x618f |
3766 |
+ |
3767 |
++/* MediaTek products */ |
3768 |
++#define MEDIATEK_VENDOR_ID 0x0e8d |
3769 |
++ |
3770 |
+ /* some devices interfaces need special handling due to a number of reasons */ |
3771 |
+ enum option_blacklist_reason { |
3772 |
+ OPTION_BLACKLIST_NONE = 0, |
3773 |
+@@ -768,6 +774,9 @@ static const struct usb_device_id option_ids[] = { |
3774 |
+ { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6008) }, |
3775 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) }, |
3776 |
+ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864G) }, |
3777 |
++ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_DUAL) }, |
3778 |
++ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) }, |
3779 |
++ { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) }, |
3780 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ |
3781 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0002, 0xff, 0xff, 0xff), |
3782 |
+ .driver_info = (kernel_ulong_t)&net_intf1_blacklist }, |
3783 |
+@@ -892,6 +901,8 @@ static const struct usb_device_id option_ids[] = { |
3784 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0162, 0xff, 0xff, 0xff) }, |
3785 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0164, 0xff, 0xff, 0xff) }, |
3786 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) }, |
3787 |
++ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0167, 0xff, 0xff, 0xff), |
3788 |
++ .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, |
3789 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff) }, |
3790 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff) }, |
3791 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) }, |
3792 |
+@@ -1198,6 +1209,10 @@ static const struct usb_device_id option_ids[] = { |
3793 |
+ { USB_DEVICE_AND_INTERFACE_INFO(VIETTEL_VENDOR_ID, VIETTEL_PRODUCT_VT1000, 0xff, 0xff, 0xff) }, |
3794 |
+ { USB_DEVICE_AND_INTERFACE_INFO(ZD_VENDOR_ID, ZD_PRODUCT_7000, 0xff, 0xff, 0xff) }, |
3795 |
+ { USB_DEVICE(LG_VENDOR_ID, LG_PRODUCT_L02C) }, /* docomo L-02C modem */ |
3796 |
++ { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a1, 0xff, 0x00, 0x00) }, |
3797 |
++ { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a1, 0xff, 0x02, 0x01) }, |
3798 |
++ { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x00, 0x00) }, |
3799 |
++ { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, 0x00a2, 0xff, 0x02, 0x01) }, /* MediaTek MT6276M modem & app port */ |
3800 |
+ { } /* Terminating entry */ |
3801 |
+ }; |
3802 |
+ MODULE_DEVICE_TABLE(usb, option_ids); |
3803 |
+@@ -1360,6 +1375,7 @@ static int option_probe(struct usb_serial *serial, |
3804 |
+ serial->interface->cur_altsetting->desc.bInterfaceNumber, |
3805 |
+ OPTION_BLACKLIST_RESERVED_IF, |
3806 |
+ (const struct option_blacklist_info *) id->driver_info)) |
3807 |
++ return -ENODEV; |
3808 |
+ |
3809 |
+ /* Don't bind network interface on Samsung GT-B3730, it is handled by a separate module */ |
3810 |
+ if (serial->dev->descriptor.idVendor == SAMSUNG_VENDOR_ID && |
3811 |
+diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c |
3812 |
+index aa9367f..3187d8b 100644 |
3813 |
+--- a/drivers/usb/serial/qcserial.c |
3814 |
++++ b/drivers/usb/serial/qcserial.c |
3815 |
+@@ -24,34 +24,44 @@ |
3816 |
+ |
3817 |
+ static int debug; |
3818 |
+ |
3819 |
++#define DEVICE_G1K(v, p) \ |
3820 |
++ USB_DEVICE(v, p), .driver_info = 1 |
3821 |
++ |
3822 |
+ static const struct usb_device_id id_table[] = { |
3823 |
+- {USB_DEVICE(0x05c6, 0x9211)}, /* Acer Gobi QDL device */ |
3824 |
+- {USB_DEVICE(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
3825 |
+- {USB_DEVICE(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ |
3826 |
+- {USB_DEVICE(0x03f0, 0x201d)}, /* HP un2400 Gobi QDL Device */ |
3827 |
+- {USB_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Mobile Broadband Module */ |
3828 |
+- {USB_DEVICE(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */ |
3829 |
+- {USB_DEVICE(0x04da, 0x250c)}, /* Panasonic Gobi QDL device */ |
3830 |
+- {USB_DEVICE(0x413c, 0x8172)}, /* Dell Gobi Modem device */ |
3831 |
+- {USB_DEVICE(0x413c, 0x8171)}, /* Dell Gobi QDL device */ |
3832 |
+- {USB_DEVICE(0x1410, 0xa001)}, /* Novatel Gobi Modem device */ |
3833 |
+- {USB_DEVICE(0x1410, 0xa008)}, /* Novatel Gobi QDL device */ |
3834 |
+- {USB_DEVICE(0x0b05, 0x1776)}, /* Asus Gobi Modem device */ |
3835 |
+- {USB_DEVICE(0x0b05, 0x1774)}, /* Asus Gobi QDL device */ |
3836 |
+- {USB_DEVICE(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */ |
3837 |
+- {USB_DEVICE(0x19d2, 0xfff2)}, /* ONDA Gobi QDL device */ |
3838 |
+- {USB_DEVICE(0x1557, 0x0a80)}, /* OQO Gobi QDL device */ |
3839 |
+- {USB_DEVICE(0x05c6, 0x9001)}, /* Generic Gobi Modem device */ |
3840 |
+- {USB_DEVICE(0x05c6, 0x9002)}, /* Generic Gobi Modem device */ |
3841 |
+- {USB_DEVICE(0x05c6, 0x9202)}, /* Generic Gobi Modem device */ |
3842 |
+- {USB_DEVICE(0x05c6, 0x9203)}, /* Generic Gobi Modem device */ |
3843 |
+- {USB_DEVICE(0x05c6, 0x9222)}, /* Generic Gobi Modem device */ |
3844 |
+- {USB_DEVICE(0x05c6, 0x9008)}, /* Generic Gobi QDL device */ |
3845 |
+- {USB_DEVICE(0x05c6, 0x9009)}, /* Generic Gobi Modem device */ |
3846 |
+- {USB_DEVICE(0x05c6, 0x9201)}, /* Generic Gobi QDL device */ |
3847 |
+- {USB_DEVICE(0x05c6, 0x9221)}, /* Generic Gobi QDL device */ |
3848 |
+- {USB_DEVICE(0x05c6, 0x9231)}, /* Generic Gobi QDL device */ |
3849 |
+- {USB_DEVICE(0x1f45, 0x0001)}, /* Unknown Gobi QDL device */ |
3850 |
++ /* Gobi 1000 devices */ |
3851 |
++ {DEVICE_G1K(0x05c6, 0x9211)}, /* Acer Gobi QDL device */ |
3852 |
++ {DEVICE_G1K(0x05c6, 0x9212)}, /* Acer Gobi Modem Device */ |
3853 |
++ {DEVICE_G1K(0x03f0, 0x1f1d)}, /* HP un2400 Gobi Modem Device */ |
3854 |
++ {DEVICE_G1K(0x03f0, 0x201d)}, /* HP un2400 Gobi QDL Device */ |
3855 |
++ {DEVICE_G1K(0x04da, 0x250d)}, /* Panasonic Gobi Modem device */ |
3856 |
++ {DEVICE_G1K(0x04da, 0x250c)}, /* Panasonic Gobi QDL device */ |
3857 |
++ {DEVICE_G1K(0x413c, 0x8172)}, /* Dell Gobi Modem device */ |
3858 |
++ {DEVICE_G1K(0x413c, 0x8171)}, /* Dell Gobi QDL device */ |
3859 |
++ {DEVICE_G1K(0x1410, 0xa001)}, /* Novatel Gobi Modem device */ |
3860 |
++ {DEVICE_G1K(0x1410, 0xa008)}, /* Novatel Gobi QDL device */ |
3861 |
++ {DEVICE_G1K(0x0b05, 0x1776)}, /* Asus Gobi Modem device */ |
3862 |
++ {DEVICE_G1K(0x0b05, 0x1774)}, /* Asus Gobi QDL device */ |
3863 |
++ {DEVICE_G1K(0x19d2, 0xfff3)}, /* ONDA Gobi Modem device */ |
3864 |
++ {DEVICE_G1K(0x19d2, 0xfff2)}, /* ONDA Gobi QDL device */ |
3865 |
++ {DEVICE_G1K(0x1557, 0x0a80)}, /* OQO Gobi QDL device */ |
3866 |
++ {DEVICE_G1K(0x05c6, 0x9001)}, /* Generic Gobi Modem device */ |
3867 |
++ {DEVICE_G1K(0x05c6, 0x9002)}, /* Generic Gobi Modem device */ |
3868 |
++ {DEVICE_G1K(0x05c6, 0x9202)}, /* Generic Gobi Modem device */ |
3869 |
++ {DEVICE_G1K(0x05c6, 0x9203)}, /* Generic Gobi Modem device */ |
3870 |
++ {DEVICE_G1K(0x05c6, 0x9222)}, /* Generic Gobi Modem device */ |
3871 |
++ {DEVICE_G1K(0x05c6, 0x9008)}, /* Generic Gobi QDL device */ |
3872 |
++ {DEVICE_G1K(0x05c6, 0x9009)}, /* Generic Gobi Modem device */ |
3873 |
++ {DEVICE_G1K(0x05c6, 0x9201)}, /* Generic Gobi QDL device */ |
3874 |
++ {DEVICE_G1K(0x05c6, 0x9221)}, /* Generic Gobi QDL device */ |
3875 |
++ {DEVICE_G1K(0x05c6, 0x9231)}, /* Generic Gobi QDL device */ |
3876 |
++ {DEVICE_G1K(0x1f45, 0x0001)}, /* Unknown Gobi QDL device */ |
3877 |
++ |
3878 |
++ /* Gobi 2000 devices */ |
3879 |
++ {USB_DEVICE(0x1410, 0xa010)}, /* Novatel Gobi 2000 QDL device */ |
3880 |
++ {USB_DEVICE(0x1410, 0xa011)}, /* Novatel Gobi 2000 QDL device */ |
3881 |
++ {USB_DEVICE(0x1410, 0xa012)}, /* Novatel Gobi 2000 QDL device */ |
3882 |
++ {USB_DEVICE(0x1410, 0xa013)}, /* Novatel Gobi 2000 QDL device */ |
3883 |
++ {USB_DEVICE(0x1410, 0xa014)}, /* Novatel Gobi 2000 QDL device */ |
3884 |
+ {USB_DEVICE(0x413c, 0x8185)}, /* Dell Gobi 2000 QDL device (N0218, VU936) */ |
3885 |
+ {USB_DEVICE(0x413c, 0x8186)}, /* Dell Gobi 2000 Modem device (N0218, VU936) */ |
3886 |
+ {USB_DEVICE(0x05c6, 0x9208)}, /* Generic Gobi 2000 QDL device */ |
3887 |
+@@ -86,7 +96,18 @@ static const struct usb_device_id id_table[] = { |
3888 |
+ {USB_DEVICE(0x16d8, 0x8002)}, /* CMDTech Gobi 2000 Modem device (VU922) */ |
3889 |
+ {USB_DEVICE(0x05c6, 0x9204)}, /* Gobi 2000 QDL device */ |
3890 |
+ {USB_DEVICE(0x05c6, 0x9205)}, /* Gobi 2000 Modem device */ |
3891 |
++ |
3892 |
++ /* Gobi 3000 devices */ |
3893 |
++ {USB_DEVICE(0x03f0, 0x371d)}, /* HP un2430 Gobi 3000 QDL */ |
3894 |
++ {USB_DEVICE(0x05c6, 0x920c)}, /* Gobi 3000 QDL */ |
3895 |
++ {USB_DEVICE(0x05c6, 0x920d)}, /* Gobi 3000 Composite */ |
3896 |
++ {USB_DEVICE(0x1410, 0xa020)}, /* Novatel Gobi 3000 QDL */ |
3897 |
++ {USB_DEVICE(0x1410, 0xa021)}, /* Novatel Gobi 3000 Composite */ |
3898 |
++ {USB_DEVICE(0x413c, 0x8193)}, /* Dell Gobi 3000 QDL */ |
3899 |
++ {USB_DEVICE(0x413c, 0x8194)}, /* Dell Gobi 3000 Composite */ |
3900 |
+ {USB_DEVICE(0x1199, 0x9013)}, /* Sierra Wireless Gobi 3000 Modem device (MC8355) */ |
3901 |
++ {USB_DEVICE(0x12D1, 0x14F0)}, /* Sony Gobi 3000 QDL */ |
3902 |
++ {USB_DEVICE(0x12D1, 0x14F1)}, /* Sony Gobi 3000 Composite */ |
3903 |
+ { } /* Terminating entry */ |
3904 |
+ }; |
3905 |
+ MODULE_DEVICE_TABLE(usb, id_table); |
3906 |
+@@ -108,8 +129,10 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) |
3907 |
+ int retval = -ENODEV; |
3908 |
+ __u8 nintf; |
3909 |
+ __u8 ifnum; |
3910 |
++ bool is_gobi1k = id->driver_info ? true : false; |
3911 |
+ |
3912 |
+ dbg("%s", __func__); |
3913 |
++ dbg("Is Gobi 1000 = %d", is_gobi1k); |
3914 |
+ |
3915 |
+ nintf = serial->dev->actconfig->desc.bNumInterfaces; |
3916 |
+ dbg("Num Interfaces = %d", nintf); |
3917 |
+@@ -157,15 +180,25 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) |
3918 |
+ |
3919 |
+ case 3: |
3920 |
+ case 4: |
3921 |
+- /* Composite mode */ |
3922 |
+- /* ifnum == 0 is a broadband network adapter */ |
3923 |
+- if (ifnum == 1) { |
3924 |
+- /* |
3925 |
+- * Diagnostics Monitor (serial line 9600 8N1) |
3926 |
+- * Qualcomm DM protocol |
3927 |
+- * use "libqcdm" (ModemManager) for communication |
3928 |
+- */ |
3929 |
+- dbg("Diagnostics Monitor found"); |
3930 |
++ /* Composite mode; don't bind to the QMI/net interface as that |
3931 |
++ * gets handled by other drivers. |
3932 |
++ */ |
3933 |
++ |
3934 |
++ /* Gobi 1K USB layout: |
3935 |
++ * 0: serial port (doesn't respond) |
3936 |
++ * 1: serial port (doesn't respond) |
3937 |
++ * 2: AT-capable modem port |
3938 |
++ * 3: QMI/net |
3939 |
++ * |
3940 |
++ * Gobi 2K+ USB layout: |
3941 |
++ * 0: QMI/net |
3942 |
++ * 1: DM/DIAG (use libqcdm from ModemManager for communication) |
3943 |
++ * 2: AT-capable modem port |
3944 |
++ * 3: NMEA |
3945 |
++ */ |
3946 |
++ |
3947 |
++ if (ifnum == 1 && !is_gobi1k) { |
3948 |
++ dbg("Gobi 2K+ DM/DIAG interface found"); |
3949 |
+ retval = usb_set_interface(serial->dev, ifnum, 0); |
3950 |
+ if (retval < 0) { |
3951 |
+ dev_err(&serial->dev->dev, |
3952 |
+@@ -184,13 +217,13 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) |
3953 |
+ retval = -ENODEV; |
3954 |
+ kfree(data); |
3955 |
+ } |
3956 |
+- } else if (ifnum==3) { |
3957 |
++ } else if (ifnum==3 && !is_gobi1k) { |
3958 |
+ /* |
3959 |
+ * NMEA (serial line 9600 8N1) |
3960 |
+ * # echo "\$GPS_START" > /dev/ttyUSBx |
3961 |
+ * # echo "\$GPS_STOP" > /dev/ttyUSBx |
3962 |
+ */ |
3963 |
+- dbg("NMEA GPS interface found"); |
3964 |
++ dbg("Gobi 2K+ NMEA GPS interface found"); |
3965 |
+ retval = usb_set_interface(serial->dev, ifnum, 0); |
3966 |
+ if (retval < 0) { |
3967 |
+ dev_err(&serial->dev->dev, |
3968 |
+diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c |
3969 |
+index 32c93d7..e39b188 100644 |
3970 |
+--- a/drivers/usb/storage/realtek_cr.c |
3971 |
++++ b/drivers/usb/storage/realtek_cr.c |
3972 |
+@@ -509,9 +509,14 @@ static int __do_config_autodelink(struct us_data *us, u8 *data, u16 len) |
3973 |
+ int retval; |
3974 |
+ u16 addr = 0xFE47; |
3975 |
+ u8 cmnd[12] = {0}; |
3976 |
++ u8 *buf; |
3977 |
+ |
3978 |
+ US_DEBUGP("%s, addr = 0x%x, len = %d\n", __FUNCTION__, addr, len); |
3979 |
+ |
3980 |
++ buf = kmemdup(data, len, GFP_NOIO); |
3981 |
++ if (!buf) |
3982 |
++ return USB_STOR_TRANSPORT_ERROR; |
3983 |
++ |
3984 |
+ cmnd[0] = 0xF0; |
3985 |
+ cmnd[1] = 0x0E; |
3986 |
+ cmnd[2] = (u8)(addr >> 8); |
3987 |
+@@ -519,7 +524,8 @@ static int __do_config_autodelink(struct us_data *us, u8 *data, u16 len) |
3988 |
+ cmnd[4] = (u8)(len >> 8); |
3989 |
+ cmnd[5] = (u8)len; |
3990 |
+ |
3991 |
+- retval = rts51x_bulk_transport_special(us, 0, cmnd, 12, data, len, DMA_TO_DEVICE, NULL); |
3992 |
++ retval = rts51x_bulk_transport_special(us, 0, cmnd, 12, buf, len, DMA_TO_DEVICE, NULL); |
3993 |
++ kfree(buf); |
3994 |
+ if (retval != USB_STOR_TRANSPORT_GOOD) { |
3995 |
+ return -EIO; |
3996 |
+ } |
3997 |
+diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c |
3998 |
+index 772f601..6f54f74 100644 |
3999 |
+--- a/drivers/video/backlight/tosa_lcd.c |
4000 |
++++ b/drivers/video/backlight/tosa_lcd.c |
4001 |
+@@ -271,7 +271,7 @@ static int tosa_lcd_resume(struct spi_device *spi) |
4002 |
+ } |
4003 |
+ #else |
4004 |
+ #define tosa_lcd_suspend NULL |
4005 |
+-#define tosa_lcd_reume NULL |
4006 |
++#define tosa_lcd_resume NULL |
4007 |
+ #endif |
4008 |
+ |
4009 |
+ static struct spi_driver tosa_lcd_driver = { |
4010 |
+diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c |
4011 |
+index ad93629..7a41220 100644 |
4012 |
+--- a/drivers/video/fbmem.c |
4013 |
++++ b/drivers/video/fbmem.c |
4014 |
+@@ -1651,6 +1651,7 @@ static int do_unregister_framebuffer(struct fb_info *fb_info) |
4015 |
+ if (ret) |
4016 |
+ return -EINVAL; |
4017 |
+ |
4018 |
++ unlink_framebuffer(fb_info); |
4019 |
+ if (fb_info->pixmap.addr && |
4020 |
+ (fb_info->pixmap.flags & FB_PIXMAP_DEFAULT)) |
4021 |
+ kfree(fb_info->pixmap.addr); |
4022 |
+@@ -1658,7 +1659,6 @@ static int do_unregister_framebuffer(struct fb_info *fb_info) |
4023 |
+ registered_fb[i] = NULL; |
4024 |
+ num_registered_fb--; |
4025 |
+ fb_cleanup_device(fb_info); |
4026 |
+- device_destroy(fb_class, MKDEV(FB_MAJOR, i)); |
4027 |
+ event.info = fb_info; |
4028 |
+ fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event); |
4029 |
+ |
4030 |
+@@ -1667,6 +1667,22 @@ static int do_unregister_framebuffer(struct fb_info *fb_info) |
4031 |
+ return 0; |
4032 |
+ } |
4033 |
+ |
4034 |
++int unlink_framebuffer(struct fb_info *fb_info) |
4035 |
++{ |
4036 |
++ int i; |
4037 |
++ |
4038 |
++ i = fb_info->node; |
4039 |
++ if (i < 0 || i >= FB_MAX || registered_fb[i] != fb_info) |
4040 |
++ return -EINVAL; |
4041 |
++ |
4042 |
++ if (fb_info->dev) { |
4043 |
++ device_destroy(fb_class, MKDEV(FB_MAJOR, i)); |
4044 |
++ fb_info->dev = NULL; |
4045 |
++ } |
4046 |
++ return 0; |
4047 |
++} |
4048 |
++EXPORT_SYMBOL(unlink_framebuffer); |
4049 |
++ |
4050 |
+ void remove_conflicting_framebuffers(struct apertures_struct *a, |
4051 |
+ const char *name, bool primary) |
4052 |
+ { |
4053 |
+diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c |
4054 |
+index 3473e75..41746bb 100644 |
4055 |
+--- a/drivers/video/udlfb.c |
4056 |
++++ b/drivers/video/udlfb.c |
4057 |
+@@ -1739,7 +1739,7 @@ static void dlfb_usb_disconnect(struct usb_interface *interface) |
4058 |
+ for (i = 0; i < ARRAY_SIZE(fb_device_attrs); i++) |
4059 |
+ device_remove_file(info->dev, &fb_device_attrs[i]); |
4060 |
+ device_remove_bin_file(info->dev, &edid_attr); |
4061 |
+- |
4062 |
++ unlink_framebuffer(info); |
4063 |
+ usb_set_intfdata(interface, NULL); |
4064 |
+ |
4065 |
+ /* if clients still have us open, will be freed on last close */ |
4066 |
+diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c |
4067 |
+index 8f1fe32..b4c2c99 100644 |
4068 |
+--- a/fs/cifs/cifsfs.c |
4069 |
++++ b/fs/cifs/cifsfs.c |
4070 |
+@@ -76,7 +76,7 @@ MODULE_PARM_DESC(cifs_min_small, "Small network buffers in pool. Default: 30 " |
4071 |
+ unsigned int cifs_max_pending = CIFS_MAX_REQ; |
4072 |
+ module_param(cifs_max_pending, int, 0444); |
4073 |
+ MODULE_PARM_DESC(cifs_max_pending, "Simultaneous requests to server. " |
4074 |
+- "Default: 50 Range: 2 to 256"); |
4075 |
++ "Default: 32767 Range: 2 to 32767."); |
4076 |
+ unsigned short echo_retries = 5; |
4077 |
+ module_param(echo_retries, ushort, 0644); |
4078 |
+ MODULE_PARM_DESC(echo_retries, "Number of echo attempts before giving up and " |
4079 |
+@@ -1116,9 +1116,9 @@ init_cifs(void) |
4080 |
+ if (cifs_max_pending < 2) { |
4081 |
+ cifs_max_pending = 2; |
4082 |
+ cFYI(1, "cifs_max_pending set to min of 2"); |
4083 |
+- } else if (cifs_max_pending > 256) { |
4084 |
+- cifs_max_pending = 256; |
4085 |
+- cFYI(1, "cifs_max_pending set to max of 256"); |
4086 |
++ } else if (cifs_max_pending > CIFS_MAX_REQ) { |
4087 |
++ cifs_max_pending = CIFS_MAX_REQ; |
4088 |
++ cFYI(1, "cifs_max_pending set to max of %u", CIFS_MAX_REQ); |
4089 |
+ } |
4090 |
+ |
4091 |
+ rc = cifs_fscache_register(); |
4092 |
+diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h |
4093 |
+index 8238aa1..c467ac8 100644 |
4094 |
+--- a/fs/cifs/cifsglob.h |
4095 |
++++ b/fs/cifs/cifsglob.h |
4096 |
+@@ -55,14 +55,9 @@ |
4097 |
+ |
4098 |
+ /* |
4099 |
+ * MAX_REQ is the maximum number of requests that WE will send |
4100 |
+- * on one socket concurrently. It also matches the most common |
4101 |
+- * value of max multiplex returned by servers. We may |
4102 |
+- * eventually want to use the negotiated value (in case |
4103 |
+- * future servers can handle more) when we are more confident that |
4104 |
+- * we will not have problems oveloading the socket with pending |
4105 |
+- * write data. |
4106 |
++ * on one socket concurrently. |
4107 |
+ */ |
4108 |
+-#define CIFS_MAX_REQ 50 |
4109 |
++#define CIFS_MAX_REQ 32767 |
4110 |
+ |
4111 |
+ #define RFC1001_NAME_LEN 15 |
4112 |
+ #define RFC1001_NAME_LEN_WITH_NULL (RFC1001_NAME_LEN + 1) |
4113 |
+@@ -263,6 +258,7 @@ struct TCP_Server_Info { |
4114 |
+ bool session_estab; /* mark when very first sess is established */ |
4115 |
+ u16 dialect; /* dialect index that server chose */ |
4116 |
+ enum securityEnum secType; |
4117 |
++ bool oplocks:1; /* enable oplocks */ |
4118 |
+ unsigned int maxReq; /* Clients should submit no more */ |
4119 |
+ /* than maxReq distinct unanswered SMBs to the server when using */ |
4120 |
+ /* multiplexed reads or writes */ |
4121 |
+diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c |
4122 |
+index 6600aa2..0e6adac 100644 |
4123 |
+--- a/fs/cifs/cifssmb.c |
4124 |
++++ b/fs/cifs/cifssmb.c |
4125 |
+@@ -458,7 +458,10 @@ CIFSSMBNegotiate(unsigned int xid, struct cifs_ses *ses) |
4126 |
+ goto neg_err_exit; |
4127 |
+ } |
4128 |
+ server->sec_mode = (__u8)le16_to_cpu(rsp->SecurityMode); |
4129 |
+- server->maxReq = le16_to_cpu(rsp->MaxMpxCount); |
4130 |
++ server->maxReq = min_t(unsigned int, |
4131 |
++ le16_to_cpu(rsp->MaxMpxCount), |
4132 |
++ cifs_max_pending); |
4133 |
++ server->oplocks = server->maxReq > 1 ? enable_oplocks : false; |
4134 |
+ server->maxBuf = le16_to_cpu(rsp->MaxBufSize); |
4135 |
+ server->max_vcs = le16_to_cpu(rsp->MaxNumberVcs); |
4136 |
+ /* even though we do not use raw we might as well set this |
4137 |
+@@ -564,7 +567,9 @@ CIFSSMBNegotiate(unsigned int xid, struct cifs_ses *ses) |
4138 |
+ |
4139 |
+ /* one byte, so no need to convert this or EncryptionKeyLen from |
4140 |
+ little endian */ |
4141 |
+- server->maxReq = le16_to_cpu(pSMBr->MaxMpxCount); |
4142 |
++ server->maxReq = min_t(unsigned int, le16_to_cpu(pSMBr->MaxMpxCount), |
4143 |
++ cifs_max_pending); |
4144 |
++ server->oplocks = server->maxReq > 1 ? enable_oplocks : false; |
4145 |
+ /* probably no need to store and check maxvcs */ |
4146 |
+ server->maxBuf = le32_to_cpu(pSMBr->MaxBufferSize); |
4147 |
+ server->max_rw = le32_to_cpu(pSMBr->MaxRawSize); |
4148 |
+diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c |
4149 |
+index 720edf5..9e0675a 100644 |
4150 |
+--- a/fs/cifs/connect.c |
4151 |
++++ b/fs/cifs/connect.c |
4152 |
+@@ -625,14 +625,10 @@ static void clean_demultiplex_info(struct TCP_Server_Info *server) |
4153 |
+ spin_unlock(&GlobalMid_Lock); |
4154 |
+ wake_up_all(&server->response_q); |
4155 |
+ |
4156 |
+- /* |
4157 |
+- * Check if we have blocked requests that need to free. Note that |
4158 |
+- * cifs_max_pending is normally 50, but can be set at module install |
4159 |
+- * time to as little as two. |
4160 |
+- */ |
4161 |
++ /* Check if we have blocked requests that need to free. */ |
4162 |
+ spin_lock(&GlobalMid_Lock); |
4163 |
+- if (atomic_read(&server->inFlight) >= cifs_max_pending) |
4164 |
+- atomic_set(&server->inFlight, cifs_max_pending - 1); |
4165 |
++ if (atomic_read(&server->inFlight) >= server->maxReq) |
4166 |
++ atomic_set(&server->inFlight, server->maxReq - 1); |
4167 |
+ /* |
4168 |
+ * We do not want to set the max_pending too low or we could end up |
4169 |
+ * with the counter going negative. |
4170 |
+@@ -1890,6 +1886,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info) |
4171 |
+ tcp_ses->noautotune = volume_info->noautotune; |
4172 |
+ tcp_ses->tcp_nodelay = volume_info->sockopt_tcp_nodelay; |
4173 |
+ atomic_set(&tcp_ses->inFlight, 0); |
4174 |
++ tcp_ses->maxReq = 1; /* enough to send negotiate request */ |
4175 |
+ init_waitqueue_head(&tcp_ses->response_q); |
4176 |
+ init_waitqueue_head(&tcp_ses->request_q); |
4177 |
+ INIT_LIST_HEAD(&tcp_ses->pending_mid_q); |
4178 |
+@@ -3220,7 +3217,7 @@ cifs_ra_pages(struct cifs_sb_info *cifs_sb) |
4179 |
+ int |
4180 |
+ cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info) |
4181 |
+ { |
4182 |
+- int rc = 0; |
4183 |
++ int rc; |
4184 |
+ int xid; |
4185 |
+ struct cifs_ses *pSesInfo; |
4186 |
+ struct cifs_tcon *tcon; |
4187 |
+@@ -3247,6 +3244,7 @@ try_mount_again: |
4188 |
+ FreeXid(xid); |
4189 |
+ } |
4190 |
+ #endif |
4191 |
++ rc = 0; |
4192 |
+ tcon = NULL; |
4193 |
+ pSesInfo = NULL; |
4194 |
+ srvTcp = NULL; |
4195 |
+diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c |
4196 |
+index bf68b4f..6937e7c 100644 |
4197 |
+--- a/fs/cifs/dir.c |
4198 |
++++ b/fs/cifs/dir.c |
4199 |
+@@ -171,7 +171,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, |
4200 |
+ } |
4201 |
+ tcon = tlink_tcon(tlink); |
4202 |
+ |
4203 |
+- if (enable_oplocks) |
4204 |
++ if (tcon->ses->server->oplocks) |
4205 |
+ oplock = REQ_OPLOCK; |
4206 |
+ |
4207 |
+ if (nd) |
4208 |
+@@ -492,7 +492,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, |
4209 |
+ { |
4210 |
+ int xid; |
4211 |
+ int rc = 0; /* to get around spurious gcc warning, set to zero here */ |
4212 |
+- __u32 oplock = enable_oplocks ? REQ_OPLOCK : 0; |
4213 |
++ __u32 oplock; |
4214 |
+ __u16 fileHandle = 0; |
4215 |
+ bool posix_open = false; |
4216 |
+ struct cifs_sb_info *cifs_sb; |
4217 |
+@@ -518,6 +518,8 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, |
4218 |
+ } |
4219 |
+ pTcon = tlink_tcon(tlink); |
4220 |
+ |
4221 |
++ oplock = pTcon->ses->server->oplocks ? REQ_OPLOCK : 0; |
4222 |
++ |
4223 |
+ /* |
4224 |
+ * Don't allow the separator character in a path component. |
4225 |
+ * The VFS will not allow "/", but "\" is allowed by posix. |
4226 |
+diff --git a/fs/cifs/file.c b/fs/cifs/file.c |
4227 |
+index 5e64748..159fcc5 100644 |
4228 |
+--- a/fs/cifs/file.c |
4229 |
++++ b/fs/cifs/file.c |
4230 |
+@@ -380,7 +380,7 @@ int cifs_open(struct inode *inode, struct file *file) |
4231 |
+ cFYI(1, "inode = 0x%p file flags are 0x%x for %s", |
4232 |
+ inode, file->f_flags, full_path); |
4233 |
+ |
4234 |
+- if (enable_oplocks) |
4235 |
++ if (tcon->ses->server->oplocks) |
4236 |
+ oplock = REQ_OPLOCK; |
4237 |
+ else |
4238 |
+ oplock = 0; |
4239 |
+@@ -505,7 +505,7 @@ static int cifs_reopen_file(struct cifsFileInfo *pCifsFile, bool can_flush) |
4240 |
+ cFYI(1, "inode = 0x%p file flags 0x%x for %s", |
4241 |
+ inode, pCifsFile->f_flags, full_path); |
4242 |
+ |
4243 |
+- if (enable_oplocks) |
4244 |
++ if (tcon->ses->server->oplocks) |
4245 |
+ oplock = REQ_OPLOCK; |
4246 |
+ else |
4247 |
+ oplock = 0; |
4248 |
+@@ -960,9 +960,9 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile) |
4249 |
+ INIT_LIST_HEAD(&locks_to_send); |
4250 |
+ |
4251 |
+ /* |
4252 |
+- * Allocating count locks is enough because no locks can be added to |
4253 |
+- * the list while we are holding cinode->lock_mutex that protects |
4254 |
+- * locking operations of this inode. |
4255 |
++ * Allocating count locks is enough because no FL_POSIX locks can be |
4256 |
++ * added to the list while we are holding cinode->lock_mutex that |
4257 |
++ * protects locking operations of this inode. |
4258 |
+ */ |
4259 |
+ for (; i < count; i++) { |
4260 |
+ lck = kmalloc(sizeof(struct lock_to_push), GFP_KERNEL); |
4261 |
+@@ -973,18 +973,20 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile) |
4262 |
+ list_add_tail(&lck->llist, &locks_to_send); |
4263 |
+ } |
4264 |
+ |
4265 |
+- i = 0; |
4266 |
+ el = locks_to_send.next; |
4267 |
+ lock_flocks(); |
4268 |
+ cifs_for_each_lock(cfile->dentry->d_inode, before) { |
4269 |
++ flock = *before; |
4270 |
++ if ((flock->fl_flags & FL_POSIX) == 0) |
4271 |
++ continue; |
4272 |
+ if (el == &locks_to_send) { |
4273 |
+- /* something is really wrong */ |
4274 |
++ /* |
4275 |
++ * The list ended. We don't have enough allocated |
4276 |
++ * structures - something is really wrong. |
4277 |
++ */ |
4278 |
+ cERROR(1, "Can't push all brlocks!"); |
4279 |
+ break; |
4280 |
+ } |
4281 |
+- flock = *before; |
4282 |
+- if ((flock->fl_flags & FL_POSIX) == 0) |
4283 |
+- continue; |
4284 |
+ length = 1 + flock->fl_end - flock->fl_start; |
4285 |
+ if (flock->fl_type == F_RDLCK || flock->fl_type == F_SHLCK) |
4286 |
+ type = CIFS_RDLCK; |
4287 |
+@@ -996,7 +998,6 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile) |
4288 |
+ lck->length = length; |
4289 |
+ lck->type = type; |
4290 |
+ lck->offset = flock->fl_start; |
4291 |
+- i++; |
4292 |
+ el = el->next; |
4293 |
+ } |
4294 |
+ unlock_flocks(); |
4295 |
+diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c |
4296 |
+index 0cc9584..99a27cf 100644 |
4297 |
+--- a/fs/cifs/transport.c |
4298 |
++++ b/fs/cifs/transport.c |
4299 |
+@@ -265,12 +265,12 @@ static int wait_for_free_request(struct TCP_Server_Info *server, |
4300 |
+ |
4301 |
+ spin_lock(&GlobalMid_Lock); |
4302 |
+ while (1) { |
4303 |
+- if (atomic_read(&server->inFlight) >= cifs_max_pending) { |
4304 |
++ if (atomic_read(&server->inFlight) >= server->maxReq) { |
4305 |
+ spin_unlock(&GlobalMid_Lock); |
4306 |
+ cifs_num_waiters_inc(server); |
4307 |
+ wait_event(server->request_q, |
4308 |
+ atomic_read(&server->inFlight) |
4309 |
+- < cifs_max_pending); |
4310 |
++ < server->maxReq); |
4311 |
+ cifs_num_waiters_dec(server); |
4312 |
+ spin_lock(&GlobalMid_Lock); |
4313 |
+ } else { |
4314 |
+diff --git a/fs/dcache.c b/fs/dcache.c |
4315 |
+index f7908ae..eb723d3 100644 |
4316 |
+--- a/fs/dcache.c |
4317 |
++++ b/fs/dcache.c |
4318 |
+@@ -2357,6 +2357,7 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode) |
4319 |
+ if (d_ancestor(alias, dentry)) { |
4320 |
+ /* Check for loops */ |
4321 |
+ actual = ERR_PTR(-ELOOP); |
4322 |
++ spin_unlock(&inode->i_lock); |
4323 |
+ } else if (IS_ROOT(alias)) { |
4324 |
+ /* Is this an anonymous mountpoint that we |
4325 |
+ * could splice into our tree? */ |
4326 |
+@@ -2366,7 +2367,7 @@ struct dentry *d_materialise_unique(struct dentry *dentry, struct inode *inode) |
4327 |
+ goto found; |
4328 |
+ } else { |
4329 |
+ /* Nope, but we must(!) avoid directory |
4330 |
+- * aliasing */ |
4331 |
++ * aliasing. This drops inode->i_lock */ |
4332 |
+ actual = __d_unalias(inode, dentry, alias); |
4333 |
+ } |
4334 |
+ write_sequnlock(&rename_lock); |
4335 |
+diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h |
4336 |
+index 5b0e26a..dbae4d9 100644 |
4337 |
+--- a/fs/ext4/ext4.h |
4338 |
++++ b/fs/ext4/ext4.h |
4339 |
+@@ -184,6 +184,8 @@ struct mpage_da_data { |
4340 |
+ #define EXT4_IO_END_UNWRITTEN 0x0001 |
4341 |
+ #define EXT4_IO_END_ERROR 0x0002 |
4342 |
+ #define EXT4_IO_END_QUEUED 0x0004 |
4343 |
++#define EXT4_IO_END_DIRECT 0x0008 |
4344 |
++#define EXT4_IO_END_IN_FSYNC 0x0010 |
4345 |
+ |
4346 |
+ struct ext4_io_page { |
4347 |
+ struct page *p_page; |
4348 |
+diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h |
4349 |
+index 5802fa1..95af6f8 100644 |
4350 |
+--- a/fs/ext4/ext4_jbd2.h |
4351 |
++++ b/fs/ext4/ext4_jbd2.h |
4352 |
+@@ -261,43 +261,45 @@ static inline void ext4_update_inode_fsync_trans(handle_t *handle, |
4353 |
+ /* super.c */ |
4354 |
+ int ext4_force_commit(struct super_block *sb); |
4355 |
+ |
4356 |
+-static inline int ext4_should_journal_data(struct inode *inode) |
4357 |
++/* |
4358 |
++ * Ext4 inode journal modes |
4359 |
++ */ |
4360 |
++#define EXT4_INODE_JOURNAL_DATA_MODE 0x01 /* journal data mode */ |
4361 |
++#define EXT4_INODE_ORDERED_DATA_MODE 0x02 /* ordered data mode */ |
4362 |
++#define EXT4_INODE_WRITEBACK_DATA_MODE 0x04 /* writeback data mode */ |
4363 |
++ |
4364 |
++static inline int ext4_inode_journal_mode(struct inode *inode) |
4365 |
+ { |
4366 |
+ if (EXT4_JOURNAL(inode) == NULL) |
4367 |
+- return 0; |
4368 |
+- if (!S_ISREG(inode->i_mode)) |
4369 |
+- return 1; |
4370 |
+- if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) |
4371 |
+- return 1; |
4372 |
+- if (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA)) |
4373 |
+- return 1; |
4374 |
+- return 0; |
4375 |
++ return EXT4_INODE_WRITEBACK_DATA_MODE; /* writeback */ |
4376 |
++ /* We do not support data journalling with delayed allocation */ |
4377 |
++ if (!S_ISREG(inode->i_mode) || |
4378 |
++ test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) |
4379 |
++ return EXT4_INODE_JOURNAL_DATA_MODE; /* journal data */ |
4380 |
++ if (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA) && |
4381 |
++ !test_opt(inode->i_sb, DELALLOC)) |
4382 |
++ return EXT4_INODE_JOURNAL_DATA_MODE; /* journal data */ |
4383 |
++ if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA) |
4384 |
++ return EXT4_INODE_ORDERED_DATA_MODE; /* ordered */ |
4385 |
++ if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA) |
4386 |
++ return EXT4_INODE_WRITEBACK_DATA_MODE; /* writeback */ |
4387 |
++ else |
4388 |
++ BUG(); |
4389 |
++} |
4390 |
++ |
4391 |
++static inline int ext4_should_journal_data(struct inode *inode) |
4392 |
++{ |
4393 |
++ return ext4_inode_journal_mode(inode) & EXT4_INODE_JOURNAL_DATA_MODE; |
4394 |
+ } |
4395 |
+ |
4396 |
+ static inline int ext4_should_order_data(struct inode *inode) |
4397 |
+ { |
4398 |
+- if (EXT4_JOURNAL(inode) == NULL) |
4399 |
+- return 0; |
4400 |
+- if (!S_ISREG(inode->i_mode)) |
4401 |
+- return 0; |
4402 |
+- if (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA)) |
4403 |
+- return 0; |
4404 |
+- if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA) |
4405 |
+- return 1; |
4406 |
+- return 0; |
4407 |
++ return ext4_inode_journal_mode(inode) & EXT4_INODE_ORDERED_DATA_MODE; |
4408 |
+ } |
4409 |
+ |
4410 |
+ static inline int ext4_should_writeback_data(struct inode *inode) |
4411 |
+ { |
4412 |
+- if (EXT4_JOURNAL(inode) == NULL) |
4413 |
+- return 1; |
4414 |
+- if (!S_ISREG(inode->i_mode)) |
4415 |
+- return 0; |
4416 |
+- if (ext4_test_inode_flag(inode, EXT4_INODE_JOURNAL_DATA)) |
4417 |
+- return 0; |
4418 |
+- if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA) |
4419 |
+- return 1; |
4420 |
+- return 0; |
4421 |
++ return ext4_inode_journal_mode(inode) & EXT4_INODE_WRITEBACK_DATA_MODE; |
4422 |
+ } |
4423 |
+ |
4424 |
+ /* |
4425 |
+diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c |
4426 |
+index 607b155..7507036 100644 |
4427 |
+--- a/fs/ext4/extents.c |
4428 |
++++ b/fs/ext4/extents.c |
4429 |
+@@ -301,6 +301,8 @@ static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext) |
4430 |
+ ext4_fsblk_t block = ext4_ext_pblock(ext); |
4431 |
+ int len = ext4_ext_get_actual_len(ext); |
4432 |
+ |
4433 |
++ if (len == 0) |
4434 |
++ return 0; |
4435 |
+ return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len); |
4436 |
+ } |
4437 |
+ |
4438 |
+diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c |
4439 |
+index 00a2cb7..bb6c7d8 100644 |
4440 |
+--- a/fs/ext4/fsync.c |
4441 |
++++ b/fs/ext4/fsync.c |
4442 |
+@@ -89,6 +89,7 @@ int ext4_flush_completed_IO(struct inode *inode) |
4443 |
+ io = list_entry(ei->i_completed_io_list.next, |
4444 |
+ ext4_io_end_t, list); |
4445 |
+ list_del_init(&io->list); |
4446 |
++ io->flag |= EXT4_IO_END_IN_FSYNC; |
4447 |
+ /* |
4448 |
+ * Calling ext4_end_io_nolock() to convert completed |
4449 |
+ * IO to written. |
4450 |
+@@ -108,6 +109,7 @@ int ext4_flush_completed_IO(struct inode *inode) |
4451 |
+ if (ret < 0) |
4452 |
+ ret2 = ret; |
4453 |
+ spin_lock_irqsave(&ei->i_completed_io_lock, flags); |
4454 |
++ io->flag &= ~EXT4_IO_END_IN_FSYNC; |
4455 |
+ } |
4456 |
+ spin_unlock_irqrestore(&ei->i_completed_io_lock, flags); |
4457 |
+ return (ret2 < 0) ? ret2 : 0; |
4458 |
+diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c |
4459 |
+index 92655fd..3ce7613 100644 |
4460 |
+--- a/fs/ext4/inode.c |
4461 |
++++ b/fs/ext4/inode.c |
4462 |
+@@ -2480,13 +2480,14 @@ static int ext4_da_write_end(struct file *file, |
4463 |
+ int write_mode = (int)(unsigned long)fsdata; |
4464 |
+ |
4465 |
+ if (write_mode == FALL_BACK_TO_NONDELALLOC) { |
4466 |
+- if (ext4_should_order_data(inode)) { |
4467 |
++ switch (ext4_inode_journal_mode(inode)) { |
4468 |
++ case EXT4_INODE_ORDERED_DATA_MODE: |
4469 |
+ return ext4_ordered_write_end(file, mapping, pos, |
4470 |
+ len, copied, page, fsdata); |
4471 |
+- } else if (ext4_should_writeback_data(inode)) { |
4472 |
++ case EXT4_INODE_WRITEBACK_DATA_MODE: |
4473 |
+ return ext4_writeback_write_end(file, mapping, pos, |
4474 |
+ len, copied, page, fsdata); |
4475 |
+- } else { |
4476 |
++ default: |
4477 |
+ BUG(); |
4478 |
+ } |
4479 |
+ } |
4480 |
+@@ -2793,9 +2794,6 @@ out: |
4481 |
+ |
4482 |
+ /* queue the work to convert unwritten extents to written */ |
4483 |
+ queue_work(wq, &io_end->work); |
4484 |
+- |
4485 |
+- /* XXX: probably should move into the real I/O completion handler */ |
4486 |
+- inode_dio_done(inode); |
4487 |
+ } |
4488 |
+ |
4489 |
+ static void ext4_end_io_buffer_write(struct buffer_head *bh, int uptodate) |
4490 |
+@@ -2919,9 +2917,12 @@ static ssize_t ext4_ext_direct_IO(int rw, struct kiocb *iocb, |
4491 |
+ iocb->private = NULL; |
4492 |
+ EXT4_I(inode)->cur_aio_dio = NULL; |
4493 |
+ if (!is_sync_kiocb(iocb)) { |
4494 |
+- iocb->private = ext4_init_io_end(inode, GFP_NOFS); |
4495 |
+- if (!iocb->private) |
4496 |
++ ext4_io_end_t *io_end = |
4497 |
++ ext4_init_io_end(inode, GFP_NOFS); |
4498 |
++ if (!io_end) |
4499 |
+ return -ENOMEM; |
4500 |
++ io_end->flag |= EXT4_IO_END_DIRECT; |
4501 |
++ iocb->private = io_end; |
4502 |
+ /* |
4503 |
+ * we save the io structure for current async |
4504 |
+ * direct IO, so that later ext4_map_blocks() |
4505 |
+@@ -3084,18 +3085,25 @@ static const struct address_space_operations ext4_da_aops = { |
4506 |
+ |
4507 |
+ void ext4_set_aops(struct inode *inode) |
4508 |
+ { |
4509 |
+- if (ext4_should_order_data(inode) && |
4510 |
+- test_opt(inode->i_sb, DELALLOC)) |
4511 |
+- inode->i_mapping->a_ops = &ext4_da_aops; |
4512 |
+- else if (ext4_should_order_data(inode)) |
4513 |
+- inode->i_mapping->a_ops = &ext4_ordered_aops; |
4514 |
+- else if (ext4_should_writeback_data(inode) && |
4515 |
+- test_opt(inode->i_sb, DELALLOC)) |
4516 |
+- inode->i_mapping->a_ops = &ext4_da_aops; |
4517 |
+- else if (ext4_should_writeback_data(inode)) |
4518 |
+- inode->i_mapping->a_ops = &ext4_writeback_aops; |
4519 |
+- else |
4520 |
++ switch (ext4_inode_journal_mode(inode)) { |
4521 |
++ case EXT4_INODE_ORDERED_DATA_MODE: |
4522 |
++ if (test_opt(inode->i_sb, DELALLOC)) |
4523 |
++ inode->i_mapping->a_ops = &ext4_da_aops; |
4524 |
++ else |
4525 |
++ inode->i_mapping->a_ops = &ext4_ordered_aops; |
4526 |
++ break; |
4527 |
++ case EXT4_INODE_WRITEBACK_DATA_MODE: |
4528 |
++ if (test_opt(inode->i_sb, DELALLOC)) |
4529 |
++ inode->i_mapping->a_ops = &ext4_da_aops; |
4530 |
++ else |
4531 |
++ inode->i_mapping->a_ops = &ext4_writeback_aops; |
4532 |
++ break; |
4533 |
++ case EXT4_INODE_JOURNAL_DATA_MODE: |
4534 |
+ inode->i_mapping->a_ops = &ext4_journalled_aops; |
4535 |
++ break; |
4536 |
++ default: |
4537 |
++ BUG(); |
4538 |
++ } |
4539 |
+ } |
4540 |
+ |
4541 |
+ |
4542 |
+diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c |
4543 |
+index 7e106c8..24feb1c 100644 |
4544 |
+--- a/fs/ext4/page-io.c |
4545 |
++++ b/fs/ext4/page-io.c |
4546 |
+@@ -111,6 +111,8 @@ int ext4_end_io_nolock(ext4_io_end_t *io) |
4547 |
+ if (io->iocb) |
4548 |
+ aio_complete(io->iocb, io->result, 0); |
4549 |
+ |
4550 |
++ if (io->flag & EXT4_IO_END_DIRECT) |
4551 |
++ inode_dio_done(inode); |
4552 |
+ /* Wake up anyone waiting on unwritten extent conversion */ |
4553 |
+ if (atomic_dec_and_test(&EXT4_I(inode)->i_aiodio_unwritten)) |
4554 |
+ wake_up_all(ext4_ioend_wq(io->inode)); |
4555 |
+@@ -128,12 +130,18 @@ static void ext4_end_io_work(struct work_struct *work) |
4556 |
+ unsigned long flags; |
4557 |
+ |
4558 |
+ spin_lock_irqsave(&ei->i_completed_io_lock, flags); |
4559 |
++ if (io->flag & EXT4_IO_END_IN_FSYNC) |
4560 |
++ goto requeue; |
4561 |
+ if (list_empty(&io->list)) { |
4562 |
+ spin_unlock_irqrestore(&ei->i_completed_io_lock, flags); |
4563 |
+ goto free; |
4564 |
+ } |
4565 |
+ |
4566 |
+ if (!mutex_trylock(&inode->i_mutex)) { |
4567 |
++ bool was_queued; |
4568 |
++requeue: |
4569 |
++ was_queued = !!(io->flag & EXT4_IO_END_QUEUED); |
4570 |
++ io->flag |= EXT4_IO_END_QUEUED; |
4571 |
+ spin_unlock_irqrestore(&ei->i_completed_io_lock, flags); |
4572 |
+ /* |
4573 |
+ * Requeue the work instead of waiting so that the work |
4574 |
+@@ -146,9 +154,8 @@ static void ext4_end_io_work(struct work_struct *work) |
4575 |
+ * yield the cpu if it sees an end_io request that has already |
4576 |
+ * been requeued. |
4577 |
+ */ |
4578 |
+- if (io->flag & EXT4_IO_END_QUEUED) |
4579 |
++ if (was_queued) |
4580 |
+ yield(); |
4581 |
+- io->flag |= EXT4_IO_END_QUEUED; |
4582 |
+ return; |
4583 |
+ } |
4584 |
+ list_del_init(&io->list); |
4585 |
+diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c |
4586 |
+index 0be5a78..2d0ca24 100644 |
4587 |
+--- a/fs/hugetlbfs/inode.c |
4588 |
++++ b/fs/hugetlbfs/inode.c |
4589 |
+@@ -238,17 +238,10 @@ static ssize_t hugetlbfs_read(struct file *filp, char __user *buf, |
4590 |
+ loff_t isize; |
4591 |
+ ssize_t retval = 0; |
4592 |
+ |
4593 |
+- mutex_lock(&inode->i_mutex); |
4594 |
+- |
4595 |
+ /* validate length */ |
4596 |
+ if (len == 0) |
4597 |
+ goto out; |
4598 |
+ |
4599 |
+- isize = i_size_read(inode); |
4600 |
+- if (!isize) |
4601 |
+- goto out; |
4602 |
+- |
4603 |
+- end_index = (isize - 1) >> huge_page_shift(h); |
4604 |
+ for (;;) { |
4605 |
+ struct page *page; |
4606 |
+ unsigned long nr, ret; |
4607 |
+@@ -256,18 +249,21 @@ static ssize_t hugetlbfs_read(struct file *filp, char __user *buf, |
4608 |
+ |
4609 |
+ /* nr is the maximum number of bytes to copy from this page */ |
4610 |
+ nr = huge_page_size(h); |
4611 |
++ isize = i_size_read(inode); |
4612 |
++ if (!isize) |
4613 |
++ goto out; |
4614 |
++ end_index = (isize - 1) >> huge_page_shift(h); |
4615 |
+ if (index >= end_index) { |
4616 |
+ if (index > end_index) |
4617 |
+ goto out; |
4618 |
+ nr = ((isize - 1) & ~huge_page_mask(h)) + 1; |
4619 |
+- if (nr <= offset) { |
4620 |
++ if (nr <= offset) |
4621 |
+ goto out; |
4622 |
+- } |
4623 |
+ } |
4624 |
+ nr = nr - offset; |
4625 |
+ |
4626 |
+ /* Find the page */ |
4627 |
+- page = find_get_page(mapping, index); |
4628 |
++ page = find_lock_page(mapping, index); |
4629 |
+ if (unlikely(page == NULL)) { |
4630 |
+ /* |
4631 |
+ * We have a HOLE, zero out the user-buffer for the |
4632 |
+@@ -279,17 +275,18 @@ static ssize_t hugetlbfs_read(struct file *filp, char __user *buf, |
4633 |
+ else |
4634 |
+ ra = 0; |
4635 |
+ } else { |
4636 |
++ unlock_page(page); |
4637 |
++ |
4638 |
+ /* |
4639 |
+ * We have the page, copy it to user space buffer. |
4640 |
+ */ |
4641 |
+ ra = hugetlbfs_read_actor(page, offset, buf, len, nr); |
4642 |
+ ret = ra; |
4643 |
++ page_cache_release(page); |
4644 |
+ } |
4645 |
+ if (ra < 0) { |
4646 |
+ if (retval == 0) |
4647 |
+ retval = ra; |
4648 |
+- if (page) |
4649 |
+- page_cache_release(page); |
4650 |
+ goto out; |
4651 |
+ } |
4652 |
+ |
4653 |
+@@ -299,16 +296,12 @@ static ssize_t hugetlbfs_read(struct file *filp, char __user *buf, |
4654 |
+ index += offset >> huge_page_shift(h); |
4655 |
+ offset &= ~huge_page_mask(h); |
4656 |
+ |
4657 |
+- if (page) |
4658 |
+- page_cache_release(page); |
4659 |
+- |
4660 |
+ /* short read or no more work */ |
4661 |
+ if ((ret != nr) || (len == 0)) |
4662 |
+ break; |
4663 |
+ } |
4664 |
+ out: |
4665 |
+ *ppos = ((loff_t)index << huge_page_shift(h)) + offset; |
4666 |
+- mutex_unlock(&inode->i_mutex); |
4667 |
+ return retval; |
4668 |
+ } |
4669 |
+ |
4670 |
+diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c |
4671 |
+index a0e41a4..8267de5 100644 |
4672 |
+--- a/fs/jbd2/transaction.c |
4673 |
++++ b/fs/jbd2/transaction.c |
4674 |
+@@ -1948,6 +1948,8 @@ zap_buffer_unlocked: |
4675 |
+ clear_buffer_mapped(bh); |
4676 |
+ clear_buffer_req(bh); |
4677 |
+ clear_buffer_new(bh); |
4678 |
++ clear_buffer_delay(bh); |
4679 |
++ clear_buffer_unwritten(bh); |
4680 |
+ bh->b_bdev = NULL; |
4681 |
+ return may_free; |
4682 |
+ } |
4683 |
+diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c |
4684 |
+index c061b9a..2444780 100644 |
4685 |
+--- a/fs/lockd/svc.c |
4686 |
++++ b/fs/lockd/svc.c |
4687 |
+@@ -440,7 +440,7 @@ static int param_set_##name(const char *val, struct kernel_param *kp) \ |
4688 |
+ __typeof__(type) num = which_strtol(val, &endp, 0); \ |
4689 |
+ if (endp == val || *endp || num < (min) || num > (max)) \ |
4690 |
+ return -EINVAL; \ |
4691 |
+- *((int *) kp->arg) = num; \ |
4692 |
++ *((type *) kp->arg) = num; \ |
4693 |
+ return 0; \ |
4694 |
+ } |
4695 |
+ |
4696 |
+diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c |
4697 |
+index 726e59a..168cb93 100644 |
4698 |
+--- a/fs/nfs/callback_xdr.c |
4699 |
++++ b/fs/nfs/callback_xdr.c |
4700 |
+@@ -9,6 +9,8 @@ |
4701 |
+ #include <linux/sunrpc/svc.h> |
4702 |
+ #include <linux/nfs4.h> |
4703 |
+ #include <linux/nfs_fs.h> |
4704 |
++#include <linux/ratelimit.h> |
4705 |
++#include <linux/printk.h> |
4706 |
+ #include <linux/slab.h> |
4707 |
+ #include <linux/sunrpc/bc_xprt.h> |
4708 |
+ #include "nfs4_fs.h" |
4709 |
+@@ -167,7 +169,7 @@ static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound |
4710 |
+ if (hdr->minorversion <= 1) { |
4711 |
+ hdr->cb_ident = ntohl(*p++); /* ignored by v4.1 */ |
4712 |
+ } else { |
4713 |
+- printk(KERN_WARNING "%s: NFSv4 server callback with " |
4714 |
++ pr_warn_ratelimited("NFS: %s: NFSv4 server callback with " |
4715 |
+ "illegal minor version %u!\n", |
4716 |
+ __func__, hdr->minorversion); |
4717 |
+ return htonl(NFS4ERR_MINOR_VERS_MISMATCH); |
4718 |
+diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c |
4719 |
+index 7f26540..ac889af 100644 |
4720 |
+--- a/fs/nfs/delegation.c |
4721 |
++++ b/fs/nfs/delegation.c |
4722 |
+@@ -466,6 +466,17 @@ static void nfs_delegation_run_state_manager(struct nfs_client *clp) |
4723 |
+ nfs4_schedule_state_manager(clp); |
4724 |
+ } |
4725 |
+ |
4726 |
++void nfs_remove_bad_delegation(struct inode *inode) |
4727 |
++{ |
4728 |
++ struct nfs_delegation *delegation; |
4729 |
++ |
4730 |
++ delegation = nfs_detach_delegation(NFS_I(inode), NFS_SERVER(inode)); |
4731 |
++ if (delegation) { |
4732 |
++ nfs_inode_find_state_and_recover(inode, &delegation->stateid); |
4733 |
++ nfs_free_delegation(delegation); |
4734 |
++ } |
4735 |
++} |
4736 |
++ |
4737 |
+ /** |
4738 |
+ * nfs_expire_all_delegation_types |
4739 |
+ * @clp: client to process |
4740 |
+diff --git a/fs/nfs/delegation.h b/fs/nfs/delegation.h |
4741 |
+index d9322e4..691a796 100644 |
4742 |
+--- a/fs/nfs/delegation.h |
4743 |
++++ b/fs/nfs/delegation.h |
4744 |
+@@ -45,6 +45,7 @@ void nfs_expire_unreferenced_delegations(struct nfs_client *clp); |
4745 |
+ void nfs_handle_cb_pathdown(struct nfs_client *clp); |
4746 |
+ int nfs_client_return_marked_delegations(struct nfs_client *clp); |
4747 |
+ int nfs_delegations_present(struct nfs_client *clp); |
4748 |
++void nfs_remove_bad_delegation(struct inode *inode); |
4749 |
+ |
4750 |
+ void nfs_delegation_mark_reclaim(struct nfs_client *clp); |
4751 |
+ void nfs_delegation_reap_unclaimed(struct nfs_client *clp); |
4752 |
+diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h |
4753 |
+index 693ae22..0983b25 100644 |
4754 |
+--- a/fs/nfs/nfs4_fs.h |
4755 |
++++ b/fs/nfs/nfs4_fs.h |
4756 |
+@@ -191,6 +191,7 @@ struct nfs4_exception { |
4757 |
+ long timeout; |
4758 |
+ int retry; |
4759 |
+ struct nfs4_state *state; |
4760 |
++ struct inode *inode; |
4761 |
+ }; |
4762 |
+ |
4763 |
+ struct nfs4_state_recovery_ops { |
4764 |
+@@ -324,6 +325,8 @@ extern void nfs4_put_open_state(struct nfs4_state *); |
4765 |
+ extern void nfs4_close_state(struct nfs4_state *, fmode_t); |
4766 |
+ extern void nfs4_close_sync(struct nfs4_state *, fmode_t); |
4767 |
+ extern void nfs4_state_set_mode_locked(struct nfs4_state *, fmode_t); |
4768 |
++extern void nfs_inode_find_state_and_recover(struct inode *inode, |
4769 |
++ const nfs4_stateid *stateid); |
4770 |
+ extern void nfs4_schedule_lease_recovery(struct nfs_client *); |
4771 |
+ extern void nfs4_schedule_state_manager(struct nfs_client *); |
4772 |
+ extern void nfs4_schedule_path_down_recovery(struct nfs_client *clp); |
4773 |
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
4774 |
+index e527030..d945700 100644 |
4775 |
+--- a/fs/nfs/nfs4proc.c |
4776 |
++++ b/fs/nfs/nfs4proc.c |
4777 |
+@@ -257,15 +257,28 @@ static int nfs4_handle_exception(struct nfs_server *server, int errorcode, struc |
4778 |
+ { |
4779 |
+ struct nfs_client *clp = server->nfs_client; |
4780 |
+ struct nfs4_state *state = exception->state; |
4781 |
++ struct inode *inode = exception->inode; |
4782 |
+ int ret = errorcode; |
4783 |
+ |
4784 |
+ exception->retry = 0; |
4785 |
+ switch(errorcode) { |
4786 |
+ case 0: |
4787 |
+ return 0; |
4788 |
++ case -NFS4ERR_OPENMODE: |
4789 |
++ if (nfs_have_delegation(inode, FMODE_READ)) { |
4790 |
++ nfs_inode_return_delegation(inode); |
4791 |
++ exception->retry = 1; |
4792 |
++ return 0; |
4793 |
++ } |
4794 |
++ if (state == NULL) |
4795 |
++ break; |
4796 |
++ nfs4_schedule_stateid_recovery(server, state); |
4797 |
++ goto wait_on_recovery; |
4798 |
++ case -NFS4ERR_DELEG_REVOKED: |
4799 |
+ case -NFS4ERR_ADMIN_REVOKED: |
4800 |
+ case -NFS4ERR_BAD_STATEID: |
4801 |
+- case -NFS4ERR_OPENMODE: |
4802 |
++ if (state != NULL) |
4803 |
++ nfs_remove_bad_delegation(state->inode); |
4804 |
+ if (state == NULL) |
4805 |
+ break; |
4806 |
+ nfs4_schedule_stateid_recovery(server, state); |
4807 |
+@@ -1316,8 +1329,11 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state |
4808 |
+ * The show must go on: exit, but mark the |
4809 |
+ * stateid as needing recovery. |
4810 |
+ */ |
4811 |
++ case -NFS4ERR_DELEG_REVOKED: |
4812 |
+ case -NFS4ERR_ADMIN_REVOKED: |
4813 |
+ case -NFS4ERR_BAD_STATEID: |
4814 |
++ nfs_inode_find_state_and_recover(state->inode, |
4815 |
++ stateid); |
4816 |
+ nfs4_schedule_stateid_recovery(server, state); |
4817 |
+ case -EKEYEXPIRED: |
4818 |
+ /* |
4819 |
+@@ -1822,7 +1838,7 @@ static struct nfs4_state *nfs4_do_open(struct inode *dir, struct dentry *dentry, |
4820 |
+ * the user though... |
4821 |
+ */ |
4822 |
+ if (status == -NFS4ERR_BAD_SEQID) { |
4823 |
+- printk(KERN_WARNING "NFS: v4 server %s " |
4824 |
++ pr_warn_ratelimited("NFS: v4 server %s " |
4825 |
+ " returned a bad sequence-id error!\n", |
4826 |
+ NFS_SERVER(dir)->nfs_client->cl_hostname); |
4827 |
+ exception.retry = 1; |
4828 |
+@@ -1893,7 +1909,10 @@ static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, |
4829 |
+ struct nfs4_state *state) |
4830 |
+ { |
4831 |
+ struct nfs_server *server = NFS_SERVER(inode); |
4832 |
+- struct nfs4_exception exception = { }; |
4833 |
++ struct nfs4_exception exception = { |
4834 |
++ .state = state, |
4835 |
++ .inode = inode, |
4836 |
++ }; |
4837 |
+ int err; |
4838 |
+ do { |
4839 |
+ err = nfs4_handle_exception(server, |
4840 |
+@@ -2223,11 +2242,12 @@ static int nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fhandle, |
4841 |
+ switch (err) { |
4842 |
+ case 0: |
4843 |
+ case -NFS4ERR_WRONGSEC: |
4844 |
+- break; |
4845 |
++ goto out; |
4846 |
+ default: |
4847 |
+ err = nfs4_handle_exception(server, err, &exception); |
4848 |
+ } |
4849 |
+ } while (exception.retry); |
4850 |
++out: |
4851 |
+ return err; |
4852 |
+ } |
4853 |
+ |
4854 |
+@@ -3707,8 +3727,11 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, |
4855 |
+ if (task->tk_status >= 0) |
4856 |
+ return 0; |
4857 |
+ switch(task->tk_status) { |
4858 |
++ case -NFS4ERR_DELEG_REVOKED: |
4859 |
+ case -NFS4ERR_ADMIN_REVOKED: |
4860 |
+ case -NFS4ERR_BAD_STATEID: |
4861 |
++ if (state != NULL) |
4862 |
++ nfs_remove_bad_delegation(state->inode); |
4863 |
+ case -NFS4ERR_OPENMODE: |
4864 |
+ if (state == NULL) |
4865 |
+ break; |
4866 |
+@@ -4526,7 +4549,9 @@ out: |
4867 |
+ |
4868 |
+ static int nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request) |
4869 |
+ { |
4870 |
+- struct nfs4_exception exception = { }; |
4871 |
++ struct nfs4_exception exception = { |
4872 |
++ .state = state, |
4873 |
++ }; |
4874 |
+ int err; |
4875 |
+ |
4876 |
+ do { |
4877 |
+@@ -4619,6 +4644,7 @@ int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl) |
4878 |
+ * The show must go on: exit, but mark the |
4879 |
+ * stateid as needing recovery. |
4880 |
+ */ |
4881 |
++ case -NFS4ERR_DELEG_REVOKED: |
4882 |
+ case -NFS4ERR_ADMIN_REVOKED: |
4883 |
+ case -NFS4ERR_BAD_STATEID: |
4884 |
+ case -NFS4ERR_OPENMODE: |
4885 |
+@@ -5957,21 +5983,22 @@ nfs4_layoutcommit_done(struct rpc_task *task, void *calldata) |
4886 |
+ return; |
4887 |
+ |
4888 |
+ switch (task->tk_status) { /* Just ignore these failures */ |
4889 |
+- case NFS4ERR_DELEG_REVOKED: /* layout was recalled */ |
4890 |
+- case NFS4ERR_BADIOMODE: /* no IOMODE_RW layout for range */ |
4891 |
+- case NFS4ERR_BADLAYOUT: /* no layout */ |
4892 |
+- case NFS4ERR_GRACE: /* loca_recalim always false */ |
4893 |
++ case -NFS4ERR_DELEG_REVOKED: /* layout was recalled */ |
4894 |
++ case -NFS4ERR_BADIOMODE: /* no IOMODE_RW layout for range */ |
4895 |
++ case -NFS4ERR_BADLAYOUT: /* no layout */ |
4896 |
++ case -NFS4ERR_GRACE: /* loca_recalim always false */ |
4897 |
+ task->tk_status = 0; |
4898 |
+- } |
4899 |
+- |
4900 |
+- if (nfs4_async_handle_error(task, server, NULL) == -EAGAIN) { |
4901 |
+- rpc_restart_call_prepare(task); |
4902 |
+- return; |
4903 |
+- } |
4904 |
+- |
4905 |
+- if (task->tk_status == 0) |
4906 |
++ break; |
4907 |
++ case 0: |
4908 |
+ nfs_post_op_update_inode_force_wcc(data->args.inode, |
4909 |
+ data->res.fattr); |
4910 |
++ break; |
4911 |
++ default: |
4912 |
++ if (nfs4_async_handle_error(task, server, NULL) == -EAGAIN) { |
4913 |
++ rpc_restart_call_prepare(task); |
4914 |
++ return; |
4915 |
++ } |
4916 |
++ } |
4917 |
+ } |
4918 |
+ |
4919 |
+ static void nfs4_layoutcommit_release(void *calldata) |
4920 |
+@@ -6074,11 +6101,12 @@ nfs41_proc_secinfo_no_name(struct nfs_server *server, struct nfs_fh *fhandle, |
4921 |
+ case 0: |
4922 |
+ case -NFS4ERR_WRONGSEC: |
4923 |
+ case -NFS4ERR_NOTSUPP: |
4924 |
+- break; |
4925 |
++ goto out; |
4926 |
+ default: |
4927 |
+ err = nfs4_handle_exception(server, err, &exception); |
4928 |
+ } |
4929 |
+ } while (exception.retry); |
4930 |
++out: |
4931 |
+ return err; |
4932 |
+ } |
4933 |
+ |
4934 |
+diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c |
4935 |
+index a58eed7..66020ac 100644 |
4936 |
+--- a/fs/nfs/nfs4state.c |
4937 |
++++ b/fs/nfs/nfs4state.c |
4938 |
+@@ -935,7 +935,7 @@ static void nfs_increment_seqid(int status, struct nfs_seqid *seqid) |
4939 |
+ case -NFS4ERR_BAD_SEQID: |
4940 |
+ if (seqid->sequence->flags & NFS_SEQID_CONFIRMED) |
4941 |
+ return; |
4942 |
+- printk(KERN_WARNING "NFS: v4 server returned a bad" |
4943 |
++ pr_warn_ratelimited("NFS: v4 server returned a bad" |
4944 |
+ " sequence-id error on an" |
4945 |
+ " unconfirmed sequence %p!\n", |
4946 |
+ seqid->sequence); |
4947 |
+@@ -1071,12 +1071,37 @@ void nfs4_schedule_stateid_recovery(const struct nfs_server *server, struct nfs4 |
4948 |
+ { |
4949 |
+ struct nfs_client *clp = server->nfs_client; |
4950 |
+ |
4951 |
+- if (test_and_clear_bit(NFS_DELEGATED_STATE, &state->flags)) |
4952 |
+- nfs_async_inode_return_delegation(state->inode, &state->stateid); |
4953 |
+ nfs4_state_mark_reclaim_nograce(clp, state); |
4954 |
+ nfs4_schedule_state_manager(clp); |
4955 |
+ } |
4956 |
+ |
4957 |
++void nfs_inode_find_state_and_recover(struct inode *inode, |
4958 |
++ const nfs4_stateid *stateid) |
4959 |
++{ |
4960 |
++ struct nfs_client *clp = NFS_SERVER(inode)->nfs_client; |
4961 |
++ struct nfs_inode *nfsi = NFS_I(inode); |
4962 |
++ struct nfs_open_context *ctx; |
4963 |
++ struct nfs4_state *state; |
4964 |
++ bool found = false; |
4965 |
++ |
4966 |
++ spin_lock(&inode->i_lock); |
4967 |
++ list_for_each_entry(ctx, &nfsi->open_files, list) { |
4968 |
++ state = ctx->state; |
4969 |
++ if (state == NULL) |
4970 |
++ continue; |
4971 |
++ if (!test_bit(NFS_DELEGATED_STATE, &state->flags)) |
4972 |
++ continue; |
4973 |
++ if (memcmp(state->stateid.data, stateid->data, sizeof(state->stateid.data)) != 0) |
4974 |
++ continue; |
4975 |
++ nfs4_state_mark_reclaim_nograce(clp, state); |
4976 |
++ found = true; |
4977 |
++ } |
4978 |
++ spin_unlock(&inode->i_lock); |
4979 |
++ if (found) |
4980 |
++ nfs4_schedule_state_manager(clp); |
4981 |
++} |
4982 |
++ |
4983 |
++ |
4984 |
+ static int nfs4_reclaim_locks(struct nfs4_state *state, const struct nfs4_state_recovery_ops *ops) |
4985 |
+ { |
4986 |
+ struct inode *inode = state->inode; |
4987 |
+@@ -1739,7 +1764,7 @@ static void nfs4_state_manager(struct nfs_client *clp) |
4988 |
+ } while (atomic_read(&clp->cl_count) > 1); |
4989 |
+ return; |
4990 |
+ out_error: |
4991 |
+- printk(KERN_WARNING "Error: state manager failed on NFSv4 server %s" |
4992 |
++ pr_warn_ratelimited("NFS: state manager failed on NFSv4 server %s" |
4993 |
+ " with error %d\n", clp->cl_hostname, -status); |
4994 |
+ nfs4_end_drain_session(clp); |
4995 |
+ nfs4_clear_state_manager_bit(clp); |
4996 |
+diff --git a/fs/proc/namespaces.c b/fs/proc/namespaces.c |
4997 |
+index be177f7..d6c078e 100644 |
4998 |
+--- a/fs/proc/namespaces.c |
4999 |
++++ b/fs/proc/namespaces.c |
5000 |
+@@ -54,7 +54,7 @@ static struct dentry *proc_ns_instantiate(struct inode *dir, |
5001 |
+ ei->ns_ops = ns_ops; |
5002 |
+ ei->ns = ns; |
5003 |
+ |
5004 |
+- dentry->d_op = &pid_dentry_operations; |
5005 |
++ d_set_d_op(dentry, &pid_dentry_operations); |
5006 |
+ d_add(dentry, inode); |
5007 |
+ /* Close the race of the process dying before we return the dentry */ |
5008 |
+ if (pid_revalidate(dentry, NULL)) |
5009 |
+diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c |
5010 |
+index a6b6217..53c3bce 100644 |
5011 |
+--- a/fs/proc/proc_sysctl.c |
5012 |
++++ b/fs/proc/proc_sysctl.c |
5013 |
+@@ -188,20 +188,32 @@ static ssize_t proc_sys_write(struct file *filp, const char __user *buf, |
5014 |
+ |
5015 |
+ static int proc_sys_open(struct inode *inode, struct file *filp) |
5016 |
+ { |
5017 |
++ struct ctl_table_header *head = grab_header(inode); |
5018 |
+ struct ctl_table *table = PROC_I(inode)->sysctl_entry; |
5019 |
+ |
5020 |
++ /* sysctl was unregistered */ |
5021 |
++ if (IS_ERR(head)) |
5022 |
++ return PTR_ERR(head); |
5023 |
++ |
5024 |
+ if (table->poll) |
5025 |
+ filp->private_data = proc_sys_poll_event(table->poll); |
5026 |
+ |
5027 |
++ sysctl_head_finish(head); |
5028 |
++ |
5029 |
+ return 0; |
5030 |
+ } |
5031 |
+ |
5032 |
+ static unsigned int proc_sys_poll(struct file *filp, poll_table *wait) |
5033 |
+ { |
5034 |
+ struct inode *inode = filp->f_path.dentry->d_inode; |
5035 |
++ struct ctl_table_header *head = grab_header(inode); |
5036 |
+ struct ctl_table *table = PROC_I(inode)->sysctl_entry; |
5037 |
+- unsigned long event = (unsigned long)filp->private_data; |
5038 |
+ unsigned int ret = DEFAULT_POLLMASK; |
5039 |
++ unsigned long event; |
5040 |
++ |
5041 |
++ /* sysctl was unregistered */ |
5042 |
++ if (IS_ERR(head)) |
5043 |
++ return POLLERR | POLLHUP; |
5044 |
+ |
5045 |
+ if (!table->proc_handler) |
5046 |
+ goto out; |
5047 |
+@@ -209,6 +221,7 @@ static unsigned int proc_sys_poll(struct file *filp, poll_table *wait) |
5048 |
+ if (!table->poll) |
5049 |
+ goto out; |
5050 |
+ |
5051 |
++ event = (unsigned long)filp->private_data; |
5052 |
+ poll_wait(filp, &table->poll->wait, wait); |
5053 |
+ |
5054 |
+ if (event != atomic_read(&table->poll->event)) { |
5055 |
+@@ -217,6 +230,8 @@ static unsigned int proc_sys_poll(struct file *filp, poll_table *wait) |
5056 |
+ } |
5057 |
+ |
5058 |
+ out: |
5059 |
++ sysctl_head_finish(head); |
5060 |
++ |
5061 |
+ return ret; |
5062 |
+ } |
5063 |
+ |
5064 |
+diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c |
5065 |
+index 7dcd2a2..3efa725 100644 |
5066 |
+--- a/fs/proc/task_mmu.c |
5067 |
++++ b/fs/proc/task_mmu.c |
5068 |
+@@ -409,6 +409,9 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, |
5069 |
+ } else { |
5070 |
+ spin_unlock(&walk->mm->page_table_lock); |
5071 |
+ } |
5072 |
++ |
5073 |
++ if (pmd_trans_unstable(pmd)) |
5074 |
++ return 0; |
5075 |
+ /* |
5076 |
+ * The mmap_sem held all the way back in m_start() is what |
5077 |
+ * keeps khugepaged out of here and from collapsing things |
5078 |
+@@ -507,6 +510,8 @@ static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr, |
5079 |
+ struct page *page; |
5080 |
+ |
5081 |
+ split_huge_page_pmd(walk->mm, pmd); |
5082 |
++ if (pmd_trans_unstable(pmd)) |
5083 |
++ return 0; |
5084 |
+ |
5085 |
+ pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); |
5086 |
+ for (; addr != end; pte++, addr += PAGE_SIZE) { |
5087 |
+@@ -670,6 +675,8 @@ static int pagemap_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, |
5088 |
+ int err = 0; |
5089 |
+ |
5090 |
+ split_huge_page_pmd(walk->mm, pmd); |
5091 |
++ if (pmd_trans_unstable(pmd)) |
5092 |
++ return 0; |
5093 |
+ |
5094 |
+ /* find the first VMA at or above 'addr' */ |
5095 |
+ vma = find_vma(walk->mm, addr); |
5096 |
+@@ -961,6 +968,8 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr, |
5097 |
+ spin_unlock(&walk->mm->page_table_lock); |
5098 |
+ } |
5099 |
+ |
5100 |
++ if (pmd_trans_unstable(pmd)) |
5101 |
++ return 0; |
5102 |
+ orig_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl); |
5103 |
+ do { |
5104 |
+ struct page *page = can_gather_numa_stats(*pte, md->vma, addr); |
5105 |
+diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c |
5106 |
+index deb804b..9db61a4 100644 |
5107 |
+--- a/fs/sysfs/inode.c |
5108 |
++++ b/fs/sysfs/inode.c |
5109 |
+@@ -136,12 +136,13 @@ static int sysfs_sd_setsecdata(struct sysfs_dirent *sd, void **secdata, u32 *sec |
5110 |
+ void *old_secdata; |
5111 |
+ size_t old_secdata_len; |
5112 |
+ |
5113 |
+- iattrs = sd->s_iattr; |
5114 |
+- if (!iattrs) |
5115 |
+- iattrs = sysfs_init_inode_attrs(sd); |
5116 |
+- if (!iattrs) |
5117 |
+- return -ENOMEM; |
5118 |
++ if (!sd->s_iattr) { |
5119 |
++ sd->s_iattr = sysfs_init_inode_attrs(sd); |
5120 |
++ if (!sd->s_iattr) |
5121 |
++ return -ENOMEM; |
5122 |
++ } |
5123 |
+ |
5124 |
++ iattrs = sd->s_iattr; |
5125 |
+ old_secdata = iattrs->ia_secdata; |
5126 |
+ old_secdata_len = iattrs->ia_secdata_len; |
5127 |
+ |
5128 |
+diff --git a/fs/udf/file.c b/fs/udf/file.c |
5129 |
+index dca0c38..d567b84 100644 |
5130 |
+--- a/fs/udf/file.c |
5131 |
++++ b/fs/udf/file.c |
5132 |
+@@ -201,12 +201,10 @@ out: |
5133 |
+ static int udf_release_file(struct inode *inode, struct file *filp) |
5134 |
+ { |
5135 |
+ if (filp->f_mode & FMODE_WRITE) { |
5136 |
+- mutex_lock(&inode->i_mutex); |
5137 |
+ down_write(&UDF_I(inode)->i_data_sem); |
5138 |
+ udf_discard_prealloc(inode); |
5139 |
+ udf_truncate_tail_extent(inode); |
5140 |
+ up_write(&UDF_I(inode)->i_data_sem); |
5141 |
+- mutex_unlock(&inode->i_mutex); |
5142 |
+ } |
5143 |
+ return 0; |
5144 |
+ } |
5145 |
+diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c |
5146 |
+index 0fa98b1..cfc4277 100644 |
5147 |
+--- a/fs/xfs/xfs_iget.c |
5148 |
++++ b/fs/xfs/xfs_iget.c |
5149 |
+@@ -353,9 +353,20 @@ xfs_iget_cache_miss( |
5150 |
+ BUG(); |
5151 |
+ } |
5152 |
+ |
5153 |
+- spin_lock(&pag->pag_ici_lock); |
5154 |
++ /* |
5155 |
++ * These values must be set before inserting the inode into the radix |
5156 |
++ * tree as the moment it is inserted a concurrent lookup (allowed by the |
5157 |
++ * RCU locking mechanism) can find it and that lookup must see that this |
5158 |
++ * is an inode currently under construction (i.e. that XFS_INEW is set). |
5159 |
++ * The ip->i_flags_lock that protects the XFS_INEW flag forms the |
5160 |
++ * memory barrier that ensures this detection works correctly at lookup |
5161 |
++ * time. |
5162 |
++ */ |
5163 |
++ ip->i_udquot = ip->i_gdquot = NULL; |
5164 |
++ xfs_iflags_set(ip, XFS_INEW); |
5165 |
+ |
5166 |
+ /* insert the new inode */ |
5167 |
++ spin_lock(&pag->pag_ici_lock); |
5168 |
+ error = radix_tree_insert(&pag->pag_ici_root, agino, ip); |
5169 |
+ if (unlikely(error)) { |
5170 |
+ WARN_ON(error != -EEXIST); |
5171 |
+@@ -363,11 +374,6 @@ xfs_iget_cache_miss( |
5172 |
+ error = EAGAIN; |
5173 |
+ goto out_preload_end; |
5174 |
+ } |
5175 |
+- |
5176 |
+- /* These values _must_ be set before releasing the radix tree lock! */ |
5177 |
+- ip->i_udquot = ip->i_gdquot = NULL; |
5178 |
+- xfs_iflags_set(ip, XFS_INEW); |
5179 |
+- |
5180 |
+ spin_unlock(&pag->pag_ici_lock); |
5181 |
+ radix_tree_preload_end(); |
5182 |
+ |
5183 |
+diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c |
5184 |
+index 541a508..4f5d0ce 100644 |
5185 |
+--- a/fs/xfs/xfs_log_recover.c |
5186 |
++++ b/fs/xfs/xfs_log_recover.c |
5187 |
+@@ -3161,37 +3161,26 @@ xlog_recover_process_iunlinks( |
5188 |
+ */ |
5189 |
+ continue; |
5190 |
+ } |
5191 |
++ /* |
5192 |
++ * Unlock the buffer so that it can be acquired in the normal |
5193 |
++ * course of the transaction to truncate and free each inode. |
5194 |
++ * Because we are not racing with anyone else here for the AGI |
5195 |
++ * buffer, we don't even need to hold it locked to read the |
5196 |
++ * initial unlinked bucket entries out of the buffer. We keep |
5197 |
++ * buffer reference though, so that it stays pinned in memory |
5198 |
++ * while we need the buffer. |
5199 |
++ */ |
5200 |
+ agi = XFS_BUF_TO_AGI(agibp); |
5201 |
++ xfs_buf_unlock(agibp); |
5202 |
+ |
5203 |
+ for (bucket = 0; bucket < XFS_AGI_UNLINKED_BUCKETS; bucket++) { |
5204 |
+ agino = be32_to_cpu(agi->agi_unlinked[bucket]); |
5205 |
+ while (agino != NULLAGINO) { |
5206 |
+- /* |
5207 |
+- * Release the agi buffer so that it can |
5208 |
+- * be acquired in the normal course of the |
5209 |
+- * transaction to truncate and free the inode. |
5210 |
+- */ |
5211 |
+- xfs_buf_relse(agibp); |
5212 |
+- |
5213 |
+ agino = xlog_recover_process_one_iunlink(mp, |
5214 |
+ agno, agino, bucket); |
5215 |
+- |
5216 |
+- /* |
5217 |
+- * Reacquire the agibuffer and continue around |
5218 |
+- * the loop. This should never fail as we know |
5219 |
+- * the buffer was good earlier on. |
5220 |
+- */ |
5221 |
+- error = xfs_read_agi(mp, NULL, agno, &agibp); |
5222 |
+- ASSERT(error == 0); |
5223 |
+- agi = XFS_BUF_TO_AGI(agibp); |
5224 |
+ } |
5225 |
+ } |
5226 |
+- |
5227 |
+- /* |
5228 |
+- * Release the buffer for the current agi so we can |
5229 |
+- * go on to the next one. |
5230 |
+- */ |
5231 |
+- xfs_buf_relse(agibp); |
5232 |
++ xfs_buf_rele(agibp); |
5233 |
+ } |
5234 |
+ |
5235 |
+ mp->m_dmevmask = mp_dmevmask; |
5236 |
+diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h |
5237 |
+index 76bff2b..a03c098 100644 |
5238 |
+--- a/include/asm-generic/pgtable.h |
5239 |
++++ b/include/asm-generic/pgtable.h |
5240 |
+@@ -425,6 +425,8 @@ extern void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn, |
5241 |
+ unsigned long size); |
5242 |
+ #endif |
5243 |
+ |
5244 |
++#ifdef CONFIG_MMU |
5245 |
++ |
5246 |
+ #ifndef CONFIG_TRANSPARENT_HUGEPAGE |
5247 |
+ static inline int pmd_trans_huge(pmd_t pmd) |
5248 |
+ { |
5249 |
+@@ -441,7 +443,66 @@ static inline int pmd_write(pmd_t pmd) |
5250 |
+ return 0; |
5251 |
+ } |
5252 |
+ #endif /* __HAVE_ARCH_PMD_WRITE */ |
5253 |
++#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ |
5254 |
++ |
5255 |
++/* |
5256 |
++ * This function is meant to be used by sites walking pagetables with |
5257 |
++ * the mmap_sem hold in read mode to protect against MADV_DONTNEED and |
5258 |
++ * transhuge page faults. MADV_DONTNEED can convert a transhuge pmd |
5259 |
++ * into a null pmd and the transhuge page fault can convert a null pmd |
5260 |
++ * into an hugepmd or into a regular pmd (if the hugepage allocation |
5261 |
++ * fails). While holding the mmap_sem in read mode the pmd becomes |
5262 |
++ * stable and stops changing under us only if it's not null and not a |
5263 |
++ * transhuge pmd. When those races occurs and this function makes a |
5264 |
++ * difference vs the standard pmd_none_or_clear_bad, the result is |
5265 |
++ * undefined so behaving like if the pmd was none is safe (because it |
5266 |
++ * can return none anyway). The compiler level barrier() is critically |
5267 |
++ * important to compute the two checks atomically on the same pmdval. |
5268 |
++ */ |
5269 |
++static inline int pmd_none_or_trans_huge_or_clear_bad(pmd_t *pmd) |
5270 |
++{ |
5271 |
++ /* depend on compiler for an atomic pmd read */ |
5272 |
++ pmd_t pmdval = *pmd; |
5273 |
++ /* |
5274 |
++ * The barrier will stabilize the pmdval in a register or on |
5275 |
++ * the stack so that it will stop changing under the code. |
5276 |
++ */ |
5277 |
++#ifdef CONFIG_TRANSPARENT_HUGEPAGE |
5278 |
++ barrier(); |
5279 |
++#endif |
5280 |
++ if (pmd_none(pmdval)) |
5281 |
++ return 1; |
5282 |
++ if (unlikely(pmd_bad(pmdval))) { |
5283 |
++ if (!pmd_trans_huge(pmdval)) |
5284 |
++ pmd_clear_bad(pmd); |
5285 |
++ return 1; |
5286 |
++ } |
5287 |
++ return 0; |
5288 |
++} |
5289 |
++ |
5290 |
++/* |
5291 |
++ * This is a noop if Transparent Hugepage Support is not built into |
5292 |
++ * the kernel. Otherwise it is equivalent to |
5293 |
++ * pmd_none_or_trans_huge_or_clear_bad(), and shall only be called in |
5294 |
++ * places that already verified the pmd is not none and they want to |
5295 |
++ * walk ptes while holding the mmap sem in read mode (write mode don't |
5296 |
++ * need this). If THP is not enabled, the pmd can't go away under the |
5297 |
++ * code even if MADV_DONTNEED runs, but if THP is enabled we need to |
5298 |
++ * run a pmd_trans_unstable before walking the ptes after |
5299 |
++ * split_huge_page_pmd returns (because it may have run when the pmd |
5300 |
++ * become null, but then a page fault can map in a THP and not a |
5301 |
++ * regular page). |
5302 |
++ */ |
5303 |
++static inline int pmd_trans_unstable(pmd_t *pmd) |
5304 |
++{ |
5305 |
++#ifdef CONFIG_TRANSPARENT_HUGEPAGE |
5306 |
++ return pmd_none_or_trans_huge_or_clear_bad(pmd); |
5307 |
++#else |
5308 |
++ return 0; |
5309 |
+ #endif |
5310 |
++} |
5311 |
++ |
5312 |
++#endif /* CONFIG_MMU */ |
5313 |
+ |
5314 |
+ #endif /* !__ASSEMBLY__ */ |
5315 |
+ |
5316 |
+diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h |
5317 |
+index 2292d1a..991ef01 100644 |
5318 |
+--- a/include/asm-generic/unistd.h |
5319 |
++++ b/include/asm-generic/unistd.h |
5320 |
+@@ -218,7 +218,7 @@ __SC_COMP(__NR_pwritev, sys_pwritev, compat_sys_pwritev) |
5321 |
+ |
5322 |
+ /* fs/sendfile.c */ |
5323 |
+ #define __NR3264_sendfile 71 |
5324 |
+-__SC_3264(__NR3264_sendfile, sys_sendfile64, sys_sendfile) |
5325 |
++__SYSCALL(__NR3264_sendfile, sys_sendfile64) |
5326 |
+ |
5327 |
+ /* fs/select.c */ |
5328 |
+ #define __NR_pselect6 72 |
5329 |
+diff --git a/include/linux/fb.h b/include/linux/fb.h |
5330 |
+index 1d6836c..73845ce 100644 |
5331 |
+--- a/include/linux/fb.h |
5332 |
++++ b/include/linux/fb.h |
5333 |
+@@ -997,6 +997,7 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf, |
5334 |
+ /* drivers/video/fbmem.c */ |
5335 |
+ extern int register_framebuffer(struct fb_info *fb_info); |
5336 |
+ extern int unregister_framebuffer(struct fb_info *fb_info); |
5337 |
++extern int unlink_framebuffer(struct fb_info *fb_info); |
5338 |
+ extern void remove_conflicting_framebuffers(struct apertures_struct *a, |
5339 |
+ const char *name, bool primary); |
5340 |
+ extern int fb_prepare_logo(struct fb_info *fb_info, int rotate); |
5341 |
+diff --git a/include/linux/math64.h b/include/linux/math64.h |
5342 |
+index 23fcdfc..b8ba855 100644 |
5343 |
+--- a/include/linux/math64.h |
5344 |
++++ b/include/linux/math64.h |
5345 |
+@@ -6,6 +6,8 @@ |
5346 |
+ |
5347 |
+ #if BITS_PER_LONG == 64 |
5348 |
+ |
5349 |
++#define div64_long(x,y) div64_s64((x),(y)) |
5350 |
++ |
5351 |
+ /** |
5352 |
+ * div_u64_rem - unsigned 64bit divide with 32bit divisor with remainder |
5353 |
+ * |
5354 |
+@@ -45,6 +47,8 @@ static inline s64 div64_s64(s64 dividend, s64 divisor) |
5355 |
+ |
5356 |
+ #elif BITS_PER_LONG == 32 |
5357 |
+ |
5358 |
++#define div64_long(x,y) div_s64((x),(y)) |
5359 |
++ |
5360 |
+ #ifndef div_u64_rem |
5361 |
+ static inline u64 div_u64_rem(u64 dividend, u32 divisor, u32 *remainder) |
5362 |
+ { |
5363 |
+diff --git a/include/linux/rtc.h b/include/linux/rtc.h |
5364 |
+index 93f4d03..fcabfb4 100644 |
5365 |
+--- a/include/linux/rtc.h |
5366 |
++++ b/include/linux/rtc.h |
5367 |
+@@ -202,7 +202,8 @@ struct rtc_device |
5368 |
+ struct hrtimer pie_timer; /* sub second exp, so needs hrtimer */ |
5369 |
+ int pie_enabled; |
5370 |
+ struct work_struct irqwork; |
5371 |
+- |
5372 |
++ /* Some hardware can't support UIE mode */ |
5373 |
++ int uie_unsupported; |
5374 |
+ |
5375 |
+ #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL |
5376 |
+ struct work_struct uie_task; |
5377 |
+diff --git a/kernel/futex.c b/kernel/futex.c |
5378 |
+index 1614be2..0677023 100644 |
5379 |
+--- a/kernel/futex.c |
5380 |
++++ b/kernel/futex.c |
5381 |
+@@ -2641,6 +2641,16 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout, |
5382 |
+ } |
5383 |
+ |
5384 |
+ switch (cmd) { |
5385 |
++ case FUTEX_LOCK_PI: |
5386 |
++ case FUTEX_UNLOCK_PI: |
5387 |
++ case FUTEX_TRYLOCK_PI: |
5388 |
++ case FUTEX_WAIT_REQUEUE_PI: |
5389 |
++ case FUTEX_CMP_REQUEUE_PI: |
5390 |
++ if (!futex_cmpxchg_enabled) |
5391 |
++ return -ENOSYS; |
5392 |
++ } |
5393 |
++ |
5394 |
++ switch (cmd) { |
5395 |
+ case FUTEX_WAIT: |
5396 |
+ val3 = FUTEX_BITSET_MATCH_ANY; |
5397 |
+ case FUTEX_WAIT_BITSET: |
5398 |
+@@ -2661,16 +2671,13 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout, |
5399 |
+ ret = futex_wake_op(uaddr, flags, uaddr2, val, val2, val3); |
5400 |
+ break; |
5401 |
+ case FUTEX_LOCK_PI: |
5402 |
+- if (futex_cmpxchg_enabled) |
5403 |
+- ret = futex_lock_pi(uaddr, flags, val, timeout, 0); |
5404 |
++ ret = futex_lock_pi(uaddr, flags, val, timeout, 0); |
5405 |
+ break; |
5406 |
+ case FUTEX_UNLOCK_PI: |
5407 |
+- if (futex_cmpxchg_enabled) |
5408 |
+- ret = futex_unlock_pi(uaddr, flags); |
5409 |
++ ret = futex_unlock_pi(uaddr, flags); |
5410 |
+ break; |
5411 |
+ case FUTEX_TRYLOCK_PI: |
5412 |
+- if (futex_cmpxchg_enabled) |
5413 |
+- ret = futex_lock_pi(uaddr, flags, 0, timeout, 1); |
5414 |
++ ret = futex_lock_pi(uaddr, flags, 0, timeout, 1); |
5415 |
+ break; |
5416 |
+ case FUTEX_WAIT_REQUEUE_PI: |
5417 |
+ val3 = FUTEX_BITSET_MATCH_ANY; |
5418 |
+diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c |
5419 |
+index fb7db75..25784d6 100644 |
5420 |
+--- a/kernel/irq/chip.c |
5421 |
++++ b/kernel/irq/chip.c |
5422 |
+@@ -61,8 +61,7 @@ int irq_set_irq_type(unsigned int irq, unsigned int type) |
5423 |
+ return -EINVAL; |
5424 |
+ |
5425 |
+ type &= IRQ_TYPE_SENSE_MASK; |
5426 |
+- if (type != IRQ_TYPE_NONE) |
5427 |
+- ret = __irq_set_trigger(desc, irq, type); |
5428 |
++ ret = __irq_set_trigger(desc, irq, type); |
5429 |
+ irq_put_desc_busunlock(desc, flags); |
5430 |
+ return ret; |
5431 |
+ } |
5432 |
+diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c |
5433 |
+index ae95cd2..7600092 100644 |
5434 |
+--- a/kernel/irq/manage.c |
5435 |
++++ b/kernel/irq/manage.c |
5436 |
+@@ -773,7 +773,7 @@ static int irq_thread(void *data) |
5437 |
+ struct irqaction *action); |
5438 |
+ int wake; |
5439 |
+ |
5440 |
+- if (force_irqthreads & test_bit(IRQTF_FORCED_THREAD, |
5441 |
++ if (force_irqthreads && test_bit(IRQTF_FORCED_THREAD, |
5442 |
+ &action->thread_flags)) |
5443 |
+ handler_fn = irq_forced_thread_fn; |
5444 |
+ else |
5445 |
+diff --git a/kernel/module.c b/kernel/module.c |
5446 |
+index 178333c..6969ef0 100644 |
5447 |
+--- a/kernel/module.c |
5448 |
++++ b/kernel/module.c |
5449 |
+@@ -2341,8 +2341,7 @@ static int copy_and_check(struct load_info *info, |
5450 |
+ return -ENOEXEC; |
5451 |
+ |
5452 |
+ /* Suck in entire file: we'll want most of it. */ |
5453 |
+- /* vmalloc barfs on "unusual" numbers. Check here */ |
5454 |
+- if (len > 64 * 1024 * 1024 || (hdr = vmalloc(len)) == NULL) |
5455 |
++ if ((hdr = vmalloc(len)) == NULL) |
5456 |
+ return -ENOMEM; |
5457 |
+ |
5458 |
+ if (copy_from_user(hdr, umod, len) != 0) { |
5459 |
+diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c |
5460 |
+index 624538a..7c0d578 100644 |
5461 |
+--- a/kernel/power/hibernate.c |
5462 |
++++ b/kernel/power/hibernate.c |
5463 |
+@@ -648,7 +648,7 @@ int hibernate(void) |
5464 |
+ /* Allocate memory management structures */ |
5465 |
+ error = create_basic_memory_bitmaps(); |
5466 |
+ if (error) |
5467 |
+- goto Exit; |
5468 |
++ goto Enable_umh; |
5469 |
+ |
5470 |
+ printk(KERN_INFO "PM: Syncing filesystems ... "); |
5471 |
+ sys_sync(); |
5472 |
+@@ -656,7 +656,7 @@ int hibernate(void) |
5473 |
+ |
5474 |
+ error = prepare_processes(); |
5475 |
+ if (error) |
5476 |
+- goto Finish; |
5477 |
++ goto Free_bitmaps; |
5478 |
+ |
5479 |
+ error = hibernation_snapshot(hibernation_mode == HIBERNATION_PLATFORM); |
5480 |
+ if (error) |
5481 |
+@@ -689,8 +689,9 @@ int hibernate(void) |
5482 |
+ |
5483 |
+ Thaw: |
5484 |
+ thaw_processes(); |
5485 |
+- Finish: |
5486 |
++ Free_bitmaps: |
5487 |
+ free_basic_memory_bitmaps(); |
5488 |
++ Enable_umh: |
5489 |
+ usermodehelper_enable(); |
5490 |
+ Exit: |
5491 |
+ pm_notifier_call_chain(PM_POST_HIBERNATION); |
5492 |
+diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c |
5493 |
+index f6117a4..4b85a7a 100644 |
5494 |
+--- a/kernel/time/ntp.c |
5495 |
++++ b/kernel/time/ntp.c |
5496 |
+@@ -275,7 +275,7 @@ static inline s64 ntp_update_offset_fll(s64 offset64, long secs) |
5497 |
+ |
5498 |
+ time_status |= STA_MODE; |
5499 |
+ |
5500 |
+- return div_s64(offset64 << (NTP_SCALE_SHIFT - SHIFT_FLL), secs); |
5501 |
++ return div64_long(offset64 << (NTP_SCALE_SHIFT - SHIFT_FLL), secs); |
5502 |
+ } |
5503 |
+ |
5504 |
+ static void ntp_update_offset(long offset) |
5505 |
+diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c |
5506 |
+index ad72a03..6d40244 100644 |
5507 |
+--- a/lib/kobject_uevent.c |
5508 |
++++ b/lib/kobject_uevent.c |
5509 |
+@@ -29,16 +29,17 @@ |
5510 |
+ |
5511 |
+ u64 uevent_seqnum; |
5512 |
+ char uevent_helper[UEVENT_HELPER_PATH_LEN] = CONFIG_UEVENT_HELPER_PATH; |
5513 |
+-static DEFINE_SPINLOCK(sequence_lock); |
5514 |
+ #ifdef CONFIG_NET |
5515 |
+ struct uevent_sock { |
5516 |
+ struct list_head list; |
5517 |
+ struct sock *sk; |
5518 |
+ }; |
5519 |
+ static LIST_HEAD(uevent_sock_list); |
5520 |
+-static DEFINE_MUTEX(uevent_sock_mutex); |
5521 |
+ #endif |
5522 |
+ |
5523 |
++/* This lock protects uevent_seqnum and uevent_sock_list */ |
5524 |
++static DEFINE_MUTEX(uevent_sock_mutex); |
5525 |
++ |
5526 |
+ /* the strings here must match the enum in include/linux/kobject.h */ |
5527 |
+ static const char *kobject_actions[] = { |
5528 |
+ [KOBJ_ADD] = "add", |
5529 |
+@@ -136,7 +137,6 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, |
5530 |
+ struct kobject *top_kobj; |
5531 |
+ struct kset *kset; |
5532 |
+ const struct kset_uevent_ops *uevent_ops; |
5533 |
+- u64 seq; |
5534 |
+ int i = 0; |
5535 |
+ int retval = 0; |
5536 |
+ #ifdef CONFIG_NET |
5537 |
+@@ -243,17 +243,16 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, |
5538 |
+ else if (action == KOBJ_REMOVE) |
5539 |
+ kobj->state_remove_uevent_sent = 1; |
5540 |
+ |
5541 |
++ mutex_lock(&uevent_sock_mutex); |
5542 |
+ /* we will send an event, so request a new sequence number */ |
5543 |
+- spin_lock(&sequence_lock); |
5544 |
+- seq = ++uevent_seqnum; |
5545 |
+- spin_unlock(&sequence_lock); |
5546 |
+- retval = add_uevent_var(env, "SEQNUM=%llu", (unsigned long long)seq); |
5547 |
+- if (retval) |
5548 |
++ retval = add_uevent_var(env, "SEQNUM=%llu", (unsigned long long)++uevent_seqnum); |
5549 |
++ if (retval) { |
5550 |
++ mutex_unlock(&uevent_sock_mutex); |
5551 |
+ goto exit; |
5552 |
++ } |
5553 |
+ |
5554 |
+ #if defined(CONFIG_NET) |
5555 |
+ /* send netlink message */ |
5556 |
+- mutex_lock(&uevent_sock_mutex); |
5557 |
+ list_for_each_entry(ue_sk, &uevent_sock_list, list) { |
5558 |
+ struct sock *uevent_sock = ue_sk->sk; |
5559 |
+ struct sk_buff *skb; |
5560 |
+@@ -287,8 +286,8 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action, |
5561 |
+ } else |
5562 |
+ retval = -ENOMEM; |
5563 |
+ } |
5564 |
+- mutex_unlock(&uevent_sock_mutex); |
5565 |
+ #endif |
5566 |
++ mutex_unlock(&uevent_sock_mutex); |
5567 |
+ |
5568 |
+ /* call uevent_helper, usually only enabled during early boot */ |
5569 |
+ if (uevent_helper[0] && !kobj_usermode_filter(kobj)) { |
5570 |
+diff --git a/mm/bootmem.c b/mm/bootmem.c |
5571 |
+index 1a77012..b863822 100644 |
5572 |
+--- a/mm/bootmem.c |
5573 |
++++ b/mm/bootmem.c |
5574 |
+@@ -768,14 +768,13 @@ void * __init alloc_bootmem_section(unsigned long size, |
5575 |
+ unsigned long section_nr) |
5576 |
+ { |
5577 |
+ bootmem_data_t *bdata; |
5578 |
+- unsigned long pfn, goal, limit; |
5579 |
++ unsigned long pfn, goal; |
5580 |
+ |
5581 |
+ pfn = section_nr_to_pfn(section_nr); |
5582 |
+ goal = pfn << PAGE_SHIFT; |
5583 |
+- limit = section_nr_to_pfn(section_nr + 1) << PAGE_SHIFT; |
5584 |
+ bdata = &bootmem_node_data[early_pfn_to_nid(pfn)]; |
5585 |
+ |
5586 |
+- return alloc_bootmem_core(bdata, size, SMP_CACHE_BYTES, goal, limit); |
5587 |
++ return alloc_bootmem_core(bdata, size, SMP_CACHE_BYTES, goal, 0); |
5588 |
+ } |
5589 |
+ #endif |
5590 |
+ |
5591 |
+diff --git a/mm/memcontrol.c b/mm/memcontrol.c |
5592 |
+index de67e91..778554f 100644 |
5593 |
+--- a/mm/memcontrol.c |
5594 |
++++ b/mm/memcontrol.c |
5595 |
+@@ -5237,6 +5237,8 @@ static int mem_cgroup_count_precharge_pte_range(pmd_t *pmd, |
5596 |
+ spinlock_t *ptl; |
5597 |
+ |
5598 |
+ split_huge_page_pmd(walk->mm, pmd); |
5599 |
++ if (pmd_trans_unstable(pmd)) |
5600 |
++ return 0; |
5601 |
+ |
5602 |
+ pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); |
5603 |
+ for (; addr != end; pte++, addr += PAGE_SIZE) |
5604 |
+@@ -5398,6 +5400,8 @@ static int mem_cgroup_move_charge_pte_range(pmd_t *pmd, |
5605 |
+ spinlock_t *ptl; |
5606 |
+ |
5607 |
+ split_huge_page_pmd(walk->mm, pmd); |
5608 |
++ if (pmd_trans_unstable(pmd)) |
5609 |
++ return 0; |
5610 |
+ retry: |
5611 |
+ pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl); |
5612 |
+ for (; addr != end; addr += PAGE_SIZE) { |
5613 |
+diff --git a/mm/memory.c b/mm/memory.c |
5614 |
+index 829d437..1b1ca17 100644 |
5615 |
+--- a/mm/memory.c |
5616 |
++++ b/mm/memory.c |
5617 |
+@@ -1228,16 +1228,24 @@ static inline unsigned long zap_pmd_range(struct mmu_gather *tlb, |
5618 |
+ do { |
5619 |
+ next = pmd_addr_end(addr, end); |
5620 |
+ if (pmd_trans_huge(*pmd)) { |
5621 |
+- if (next-addr != HPAGE_PMD_SIZE) { |
5622 |
++ if (next - addr != HPAGE_PMD_SIZE) { |
5623 |
+ VM_BUG_ON(!rwsem_is_locked(&tlb->mm->mmap_sem)); |
5624 |
+ split_huge_page_pmd(vma->vm_mm, pmd); |
5625 |
+ } else if (zap_huge_pmd(tlb, vma, pmd)) |
5626 |
+- continue; |
5627 |
++ goto next; |
5628 |
+ /* fall through */ |
5629 |
+ } |
5630 |
+- if (pmd_none_or_clear_bad(pmd)) |
5631 |
+- continue; |
5632 |
++ /* |
5633 |
++ * Here there can be other concurrent MADV_DONTNEED or |
5634 |
++ * trans huge page faults running, and if the pmd is |
5635 |
++ * none or trans huge it can change under us. This is |
5636 |
++ * because MADV_DONTNEED holds the mmap_sem in read |
5637 |
++ * mode. |
5638 |
++ */ |
5639 |
++ if (pmd_none_or_trans_huge_or_clear_bad(pmd)) |
5640 |
++ goto next; |
5641 |
+ next = zap_pte_range(tlb, vma, pmd, addr, next, details); |
5642 |
++next: |
5643 |
+ cond_resched(); |
5644 |
+ } while (pmd++, addr = next, addr != end); |
5645 |
+ |
5646 |
+diff --git a/mm/mempolicy.c b/mm/mempolicy.c |
5647 |
+index c3fdbcb..b26aae2 100644 |
5648 |
+--- a/mm/mempolicy.c |
5649 |
++++ b/mm/mempolicy.c |
5650 |
+@@ -512,7 +512,7 @@ static inline int check_pmd_range(struct vm_area_struct *vma, pud_t *pud, |
5651 |
+ do { |
5652 |
+ next = pmd_addr_end(addr, end); |
5653 |
+ split_huge_page_pmd(vma->vm_mm, pmd); |
5654 |
+- if (pmd_none_or_clear_bad(pmd)) |
5655 |
++ if (pmd_none_or_trans_huge_or_clear_bad(pmd)) |
5656 |
+ continue; |
5657 |
+ if (check_pte_range(vma, pmd, addr, next, nodes, |
5658 |
+ flags, private)) |
5659 |
+diff --git a/mm/mincore.c b/mm/mincore.c |
5660 |
+index 636a868..936b4ce 100644 |
5661 |
+--- a/mm/mincore.c |
5662 |
++++ b/mm/mincore.c |
5663 |
+@@ -164,7 +164,7 @@ static void mincore_pmd_range(struct vm_area_struct *vma, pud_t *pud, |
5664 |
+ } |
5665 |
+ /* fall through */ |
5666 |
+ } |
5667 |
+- if (pmd_none_or_clear_bad(pmd)) |
5668 |
++ if (pmd_none_or_trans_huge_or_clear_bad(pmd)) |
5669 |
+ mincore_unmapped_range(vma, addr, next, vec); |
5670 |
+ else |
5671 |
+ mincore_pte_range(vma, pmd, addr, next, vec); |
5672 |
+diff --git a/mm/pagewalk.c b/mm/pagewalk.c |
5673 |
+index 2f5cf10..aa9701e 100644 |
5674 |
+--- a/mm/pagewalk.c |
5675 |
++++ b/mm/pagewalk.c |
5676 |
+@@ -59,7 +59,7 @@ again: |
5677 |
+ continue; |
5678 |
+ |
5679 |
+ split_huge_page_pmd(walk->mm, pmd); |
5680 |
+- if (pmd_none_or_clear_bad(pmd)) |
5681 |
++ if (pmd_none_or_trans_huge_or_clear_bad(pmd)) |
5682 |
+ goto again; |
5683 |
+ err = walk_pte_range(pmd, addr, next, walk); |
5684 |
+ if (err) |
5685 |
+diff --git a/mm/slub.c b/mm/slub.c |
5686 |
+index 1a919f0..a99c785 100644 |
5687 |
+--- a/mm/slub.c |
5688 |
++++ b/mm/slub.c |
5689 |
+@@ -3911,13 +3911,14 @@ struct kmem_cache *kmem_cache_create(const char *name, size_t size, |
5690 |
+ if (kmem_cache_open(s, n, |
5691 |
+ size, align, flags, ctor)) { |
5692 |
+ list_add(&s->list, &slab_caches); |
5693 |
++ up_write(&slub_lock); |
5694 |
+ if (sysfs_slab_add(s)) { |
5695 |
++ down_write(&slub_lock); |
5696 |
+ list_del(&s->list); |
5697 |
+ kfree(n); |
5698 |
+ kfree(s); |
5699 |
+ goto err; |
5700 |
+ } |
5701 |
+- up_write(&slub_lock); |
5702 |
+ return s; |
5703 |
+ } |
5704 |
+ kfree(n); |
5705 |
+diff --git a/mm/sparse.c b/mm/sparse.c |
5706 |
+index 61d7cde..a8bc7d3 100644 |
5707 |
+--- a/mm/sparse.c |
5708 |
++++ b/mm/sparse.c |
5709 |
+@@ -353,29 +353,21 @@ static void __init sparse_early_usemaps_alloc_node(unsigned long**usemap_map, |
5710 |
+ |
5711 |
+ usemap = sparse_early_usemaps_alloc_pgdat_section(NODE_DATA(nodeid), |
5712 |
+ usemap_count); |
5713 |
+- if (usemap) { |
5714 |
+- for (pnum = pnum_begin; pnum < pnum_end; pnum++) { |
5715 |
+- if (!present_section_nr(pnum)) |
5716 |
+- continue; |
5717 |
+- usemap_map[pnum] = usemap; |
5718 |
+- usemap += size; |
5719 |
++ if (!usemap) { |
5720 |
++ usemap = alloc_bootmem_node(NODE_DATA(nodeid), size * usemap_count); |
5721 |
++ if (!usemap) { |
5722 |
++ printk(KERN_WARNING "%s: allocation failed\n", __func__); |
5723 |
++ return; |
5724 |
+ } |
5725 |
+- return; |
5726 |
+ } |
5727 |
+ |
5728 |
+- usemap = alloc_bootmem_node(NODE_DATA(nodeid), size * usemap_count); |
5729 |
+- if (usemap) { |
5730 |
+- for (pnum = pnum_begin; pnum < pnum_end; pnum++) { |
5731 |
+- if (!present_section_nr(pnum)) |
5732 |
+- continue; |
5733 |
+- usemap_map[pnum] = usemap; |
5734 |
+- usemap += size; |
5735 |
+- check_usemap_section_nr(nodeid, usemap_map[pnum]); |
5736 |
+- } |
5737 |
+- return; |
5738 |
++ for (pnum = pnum_begin; pnum < pnum_end; pnum++) { |
5739 |
++ if (!present_section_nr(pnum)) |
5740 |
++ continue; |
5741 |
++ usemap_map[pnum] = usemap; |
5742 |
++ usemap += size; |
5743 |
++ check_usemap_section_nr(nodeid, usemap_map[pnum]); |
5744 |
+ } |
5745 |
+- |
5746 |
+- printk(KERN_WARNING "%s: allocation failed\n", __func__); |
5747 |
+ } |
5748 |
+ |
5749 |
+ #ifndef CONFIG_SPARSEMEM_VMEMMAP |
5750 |
+diff --git a/mm/swapfile.c b/mm/swapfile.c |
5751 |
+index b1cd120..2015a1e 100644 |
5752 |
+--- a/mm/swapfile.c |
5753 |
++++ b/mm/swapfile.c |
5754 |
+@@ -931,9 +931,7 @@ static inline int unuse_pmd_range(struct vm_area_struct *vma, pud_t *pud, |
5755 |
+ pmd = pmd_offset(pud, addr); |
5756 |
+ do { |
5757 |
+ next = pmd_addr_end(addr, end); |
5758 |
+- if (unlikely(pmd_trans_huge(*pmd))) |
5759 |
+- continue; |
5760 |
+- if (pmd_none_or_clear_bad(pmd)) |
5761 |
++ if (pmd_none_or_trans_huge_or_clear_bad(pmd)) |
5762 |
+ continue; |
5763 |
+ ret = unuse_pte_range(vma, pmd, addr, next, entry, page); |
5764 |
+ if (ret) |
5765 |
+diff --git a/net/core/dev.c b/net/core/dev.c |
5766 |
+index c56cacf..55cd370 100644 |
5767 |
+--- a/net/core/dev.c |
5768 |
++++ b/net/core/dev.c |
5769 |
+@@ -3634,7 +3634,8 @@ EXPORT_SYMBOL(napi_gro_receive); |
5770 |
+ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) |
5771 |
+ { |
5772 |
+ __skb_pull(skb, skb_headlen(skb)); |
5773 |
+- skb_reserve(skb, NET_IP_ALIGN - skb_headroom(skb)); |
5774 |
++ /* restore the reserve we had after netdev_alloc_skb_ip_align() */ |
5775 |
++ skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN - skb_headroom(skb)); |
5776 |
+ skb->vlan_tci = 0; |
5777 |
+ skb->dev = napi->dev; |
5778 |
+ skb->skb_iif = 0; |
5779 |
+diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c |
5780 |
+index 9083e82..2ef859a 100644 |
5781 |
+--- a/net/core/rtnetlink.c |
5782 |
++++ b/net/core/rtnetlink.c |
5783 |
+@@ -1116,6 +1116,8 @@ static const struct nla_policy ifla_vf_policy[IFLA_VF_MAX+1] = { |
5784 |
+ .len = sizeof(struct ifla_vf_vlan) }, |
5785 |
+ [IFLA_VF_TX_RATE] = { .type = NLA_BINARY, |
5786 |
+ .len = sizeof(struct ifla_vf_tx_rate) }, |
5787 |
++ [IFLA_VF_SPOOFCHK] = { .type = NLA_BINARY, |
5788 |
++ .len = sizeof(struct ifla_vf_spoofchk) }, |
5789 |
+ }; |
5790 |
+ |
5791 |
+ static const struct nla_policy ifla_port_policy[IFLA_PORT_MAX+1] = { |
5792 |
+diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c |
5793 |
+index ec56271..f7f07e2 100644 |
5794 |
+--- a/net/ipv6/ip6_output.c |
5795 |
++++ b/net/ipv6/ip6_output.c |
5796 |
+@@ -1411,8 +1411,9 @@ alloc_new_skb: |
5797 |
+ */ |
5798 |
+ skb->ip_summed = csummode; |
5799 |
+ skb->csum = 0; |
5800 |
+- /* reserve for fragmentation */ |
5801 |
+- skb_reserve(skb, hh_len+sizeof(struct frag_hdr)); |
5802 |
++ /* reserve for fragmentation and ipsec header */ |
5803 |
++ skb_reserve(skb, hh_len + sizeof(struct frag_hdr) + |
5804 |
++ dst_exthdrlen); |
5805 |
+ |
5806 |
+ if (sk->sk_type == SOCK_DGRAM) |
5807 |
+ skb_shinfo(skb)->tx_flags = tx_flags; |
5808 |
+@@ -1420,9 +1421,9 @@ alloc_new_skb: |
5809 |
+ /* |
5810 |
+ * Find where to start putting bytes |
5811 |
+ */ |
5812 |
+- data = skb_put(skb, fraglen + dst_exthdrlen); |
5813 |
+- skb_set_network_header(skb, exthdrlen + dst_exthdrlen); |
5814 |
+- data += fragheaderlen + dst_exthdrlen; |
5815 |
++ data = skb_put(skb, fraglen); |
5816 |
++ skb_set_network_header(skb, exthdrlen); |
5817 |
++ data += fragheaderlen; |
5818 |
+ skb->transport_header = (skb->network_header + |
5819 |
+ fragheaderlen); |
5820 |
+ if (fraggap) { |
5821 |
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c |
5822 |
+index b582a0a..059b9d9 100644 |
5823 |
+--- a/net/ipv6/route.c |
5824 |
++++ b/net/ipv6/route.c |
5825 |
+@@ -2446,8 +2446,12 @@ static int rt6_fill_node(struct net *net, |
5826 |
+ |
5827 |
+ rcu_read_lock(); |
5828 |
+ n = dst_get_neighbour(&rt->dst); |
5829 |
+- if (n) |
5830 |
+- NLA_PUT(skb, RTA_GATEWAY, 16, &n->primary_key); |
5831 |
++ if (n) { |
5832 |
++ if (nla_put(skb, RTA_GATEWAY, 16, &n->primary_key) < 0) { |
5833 |
++ rcu_read_unlock(); |
5834 |
++ goto nla_put_failure; |
5835 |
++ } |
5836 |
++ } |
5837 |
+ rcu_read_unlock(); |
5838 |
+ |
5839 |
+ if (rt->dst.dev) |
5840 |
+diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c |
5841 |
+index 8a90d75..b1bd16f 100644 |
5842 |
+--- a/net/l2tp/l2tp_ppp.c |
5843 |
++++ b/net/l2tp/l2tp_ppp.c |
5844 |
+@@ -915,7 +915,7 @@ static int pppol2tp_getname(struct socket *sock, struct sockaddr *uaddr, |
5845 |
+ goto end_put_sess; |
5846 |
+ } |
5847 |
+ |
5848 |
+- inet = inet_sk(sk); |
5849 |
++ inet = inet_sk(tunnel->sock); |
5850 |
+ if (tunnel->version == 2) { |
5851 |
+ struct sockaddr_pppol2tp sp; |
5852 |
+ len = sizeof(sp); |
5853 |
+diff --git a/net/rds/send.c b/net/rds/send.c |
5854 |
+index e2d63c5..96531d4 100644 |
5855 |
+--- a/net/rds/send.c |
5856 |
++++ b/net/rds/send.c |
5857 |
+@@ -935,7 +935,6 @@ int rds_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, |
5858 |
+ /* Mirror Linux UDP mirror of BSD error message compatibility */ |
5859 |
+ /* XXX: Perhaps MSG_MORE someday */ |
5860 |
+ if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_CMSG_COMPAT)) { |
5861 |
+- printk(KERN_INFO "msg_flags 0x%08X\n", msg->msg_flags); |
5862 |
+ ret = -EOPNOTSUPP; |
5863 |
+ goto out; |
5864 |
+ } |
5865 |
+diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c |
5866 |
+index 72ad836..4530a91 100644 |
5867 |
+--- a/net/sunrpc/cache.c |
5868 |
++++ b/net/sunrpc/cache.c |
5869 |
+@@ -828,6 +828,8 @@ static ssize_t cache_do_downcall(char *kaddr, const char __user *buf, |
5870 |
+ { |
5871 |
+ ssize_t ret; |
5872 |
+ |
5873 |
++ if (count == 0) |
5874 |
++ return -EINVAL; |
5875 |
+ if (copy_from_user(kaddr, buf, count)) |
5876 |
+ return -EFAULT; |
5877 |
+ kaddr[count] = '\0'; |
5878 |
+diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c |
5879 |
+index 00a1a2a..4e2b3b4 100644 |
5880 |
+--- a/net/sunrpc/sched.c |
5881 |
++++ b/net/sunrpc/sched.c |
5882 |
+@@ -500,14 +500,18 @@ EXPORT_SYMBOL_GPL(rpc_wake_up_next); |
5883 |
+ */ |
5884 |
+ void rpc_wake_up(struct rpc_wait_queue *queue) |
5885 |
+ { |
5886 |
+- struct rpc_task *task, *next; |
5887 |
+ struct list_head *head; |
5888 |
+ |
5889 |
+ spin_lock_bh(&queue->lock); |
5890 |
+ head = &queue->tasks[queue->maxpriority]; |
5891 |
+ for (;;) { |
5892 |
+- list_for_each_entry_safe(task, next, head, u.tk_wait.list) |
5893 |
++ while (!list_empty(head)) { |
5894 |
++ struct rpc_task *task; |
5895 |
++ task = list_first_entry(head, |
5896 |
++ struct rpc_task, |
5897 |
++ u.tk_wait.list); |
5898 |
+ rpc_wake_up_task_queue_locked(queue, task); |
5899 |
++ } |
5900 |
+ if (head == &queue->tasks[0]) |
5901 |
+ break; |
5902 |
+ head--; |
5903 |
+@@ -525,13 +529,16 @@ EXPORT_SYMBOL_GPL(rpc_wake_up); |
5904 |
+ */ |
5905 |
+ void rpc_wake_up_status(struct rpc_wait_queue *queue, int status) |
5906 |
+ { |
5907 |
+- struct rpc_task *task, *next; |
5908 |
+ struct list_head *head; |
5909 |
+ |
5910 |
+ spin_lock_bh(&queue->lock); |
5911 |
+ head = &queue->tasks[queue->maxpriority]; |
5912 |
+ for (;;) { |
5913 |
+- list_for_each_entry_safe(task, next, head, u.tk_wait.list) { |
5914 |
++ while (!list_empty(head)) { |
5915 |
++ struct rpc_task *task; |
5916 |
++ task = list_first_entry(head, |
5917 |
++ struct rpc_task, |
5918 |
++ u.tk_wait.list); |
5919 |
+ task->tk_status = status; |
5920 |
+ rpc_wake_up_task_queue_locked(queue, task); |
5921 |
+ } |
5922 |
+diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c |
5923 |
+index 39e02c5..2f6d11d 100644 |
5924 |
+--- a/net/xfrm/xfrm_replay.c |
5925 |
++++ b/net/xfrm/xfrm_replay.c |
5926 |
+@@ -167,7 +167,7 @@ static void xfrm_replay_advance(struct xfrm_state *x, __be32 net_seq) |
5927 |
+ } |
5928 |
+ |
5929 |
+ if (xfrm_aevent_is_on(xs_net(x))) |
5930 |
+- xfrm_replay_notify(x, XFRM_REPLAY_UPDATE); |
5931 |
++ x->repl->notify(x, XFRM_REPLAY_UPDATE); |
5932 |
+ } |
5933 |
+ |
5934 |
+ static int xfrm_replay_overflow_bmp(struct xfrm_state *x, struct sk_buff *skb) |
5935 |
+@@ -279,7 +279,7 @@ static void xfrm_replay_advance_bmp(struct xfrm_state *x, __be32 net_seq) |
5936 |
+ replay_esn->bmp[nr] |= (1U << bitnr); |
5937 |
+ |
5938 |
+ if (xfrm_aevent_is_on(xs_net(x))) |
5939 |
+- xfrm_replay_notify(x, XFRM_REPLAY_UPDATE); |
5940 |
++ x->repl->notify(x, XFRM_REPLAY_UPDATE); |
5941 |
+ } |
5942 |
+ |
5943 |
+ static void xfrm_replay_notify_bmp(struct xfrm_state *x, int event) |
5944 |
+@@ -473,7 +473,7 @@ static void xfrm_replay_advance_esn(struct xfrm_state *x, __be32 net_seq) |
5945 |
+ replay_esn->bmp[nr] |= (1U << bitnr); |
5946 |
+ |
5947 |
+ if (xfrm_aevent_is_on(xs_net(x))) |
5948 |
+- xfrm_replay_notify(x, XFRM_REPLAY_UPDATE); |
5949 |
++ x->repl->notify(x, XFRM_REPLAY_UPDATE); |
5950 |
+ } |
5951 |
+ |
5952 |
+ static struct xfrm_replay xfrm_replay_legacy = { |
5953 |
+diff --git a/security/integrity/ima/Kconfig b/security/integrity/ima/Kconfig |
5954 |
+index 4f554f2..063298a 100644 |
5955 |
+--- a/security/integrity/ima/Kconfig |
5956 |
++++ b/security/integrity/ima/Kconfig |
5957 |
+@@ -9,7 +9,7 @@ config IMA |
5958 |
+ select CRYPTO_HMAC |
5959 |
+ select CRYPTO_MD5 |
5960 |
+ select CRYPTO_SHA1 |
5961 |
+- select TCG_TPM if !S390 && !UML |
5962 |
++ select TCG_TPM if HAS_IOMEM && !UML |
5963 |
+ select TCG_TIS if TCG_TPM |
5964 |
+ help |
5965 |
+ The Trusted Computing Group(TCG) runtime Integrity |
5966 |
+diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c |
5967 |
+index c1da422..b58b4b1 100644 |
5968 |
+--- a/sound/pci/hda/hda_eld.c |
5969 |
++++ b/sound/pci/hda/hda_eld.c |
5970 |
+@@ -385,8 +385,8 @@ error: |
5971 |
+ static void hdmi_print_pcm_rates(int pcm, char *buf, int buflen) |
5972 |
+ { |
5973 |
+ static unsigned int alsa_rates[] = { |
5974 |
+- 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, |
5975 |
+- 96000, 176400, 192000, 384000 |
5976 |
++ 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, |
5977 |
++ 88200, 96000, 176400, 192000, 384000 |
5978 |
+ }; |
5979 |
+ int i, j; |
5980 |
+ |
5981 |
+diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c |
5982 |
+index 2c064a9..075677c 100644 |
5983 |
+--- a/sound/soc/fsl/p1022_ds.c |
5984 |
++++ b/sound/soc/fsl/p1022_ds.c |
5985 |
+@@ -392,7 +392,8 @@ static int p1022_ds_probe(struct platform_device *pdev) |
5986 |
+ } |
5987 |
+ |
5988 |
+ if (strcasecmp(sprop, "i2s-slave") == 0) { |
5989 |
+- mdata->dai_format = SND_SOC_DAIFMT_I2S; |
5990 |
++ mdata->dai_format = SND_SOC_DAIFMT_NB_NF | |
5991 |
++ SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM; |
5992 |
+ mdata->codec_clk_direction = SND_SOC_CLOCK_OUT; |
5993 |
+ mdata->cpu_clk_direction = SND_SOC_CLOCK_IN; |
5994 |
+ |
5995 |
+@@ -409,31 +410,38 @@ static int p1022_ds_probe(struct platform_device *pdev) |
5996 |
+ } |
5997 |
+ mdata->clk_frequency = be32_to_cpup(iprop); |
5998 |
+ } else if (strcasecmp(sprop, "i2s-master") == 0) { |
5999 |
+- mdata->dai_format = SND_SOC_DAIFMT_I2S; |
6000 |
++ mdata->dai_format = SND_SOC_DAIFMT_NB_NF | |
6001 |
++ SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS; |
6002 |
+ mdata->codec_clk_direction = SND_SOC_CLOCK_IN; |
6003 |
+ mdata->cpu_clk_direction = SND_SOC_CLOCK_OUT; |
6004 |
+ } else if (strcasecmp(sprop, "lj-slave") == 0) { |
6005 |
+- mdata->dai_format = SND_SOC_DAIFMT_LEFT_J; |
6006 |
++ mdata->dai_format = SND_SOC_DAIFMT_NB_NF | |
6007 |
++ SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM; |
6008 |
+ mdata->codec_clk_direction = SND_SOC_CLOCK_OUT; |
6009 |
+ mdata->cpu_clk_direction = SND_SOC_CLOCK_IN; |
6010 |
+ } else if (strcasecmp(sprop, "lj-master") == 0) { |
6011 |
+- mdata->dai_format = SND_SOC_DAIFMT_LEFT_J; |
6012 |
++ mdata->dai_format = SND_SOC_DAIFMT_NB_NF | |
6013 |
++ SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBS_CFS; |
6014 |
+ mdata->codec_clk_direction = SND_SOC_CLOCK_IN; |
6015 |
+ mdata->cpu_clk_direction = SND_SOC_CLOCK_OUT; |
6016 |
+ } else if (strcasecmp(sprop, "rj-slave") == 0) { |
6017 |
+- mdata->dai_format = SND_SOC_DAIFMT_RIGHT_J; |
6018 |
++ mdata->dai_format = SND_SOC_DAIFMT_NB_NF | |
6019 |
++ SND_SOC_DAIFMT_RIGHT_J | SND_SOC_DAIFMT_CBM_CFM; |
6020 |
+ mdata->codec_clk_direction = SND_SOC_CLOCK_OUT; |
6021 |
+ mdata->cpu_clk_direction = SND_SOC_CLOCK_IN; |
6022 |
+ } else if (strcasecmp(sprop, "rj-master") == 0) { |
6023 |
+- mdata->dai_format = SND_SOC_DAIFMT_RIGHT_J; |
6024 |
++ mdata->dai_format = SND_SOC_DAIFMT_NB_NF | |
6025 |
++ SND_SOC_DAIFMT_RIGHT_J | SND_SOC_DAIFMT_CBS_CFS; |
6026 |
+ mdata->codec_clk_direction = SND_SOC_CLOCK_IN; |
6027 |
+ mdata->cpu_clk_direction = SND_SOC_CLOCK_OUT; |
6028 |
+ } else if (strcasecmp(sprop, "ac97-slave") == 0) { |
6029 |
+- mdata->dai_format = SND_SOC_DAIFMT_AC97; |
6030 |
++ mdata->dai_format = SND_SOC_DAIFMT_NB_NF | |
6031 |
++ SND_SOC_DAIFMT_AC97 | SND_SOC_DAIFMT_CBM_CFM; |
6032 |
+ mdata->codec_clk_direction = SND_SOC_CLOCK_OUT; |
6033 |
+ mdata->cpu_clk_direction = SND_SOC_CLOCK_IN; |
6034 |
+ } else if (strcasecmp(sprop, "ac97-master") == 0) { |
6035 |
+- mdata->dai_format = SND_SOC_DAIFMT_AC97; |
6036 |
++ mdata->dai_format = SND_SOC_DAIFMT_NB_NF | |
6037 |
++ SND_SOC_DAIFMT_AC97 | SND_SOC_DAIFMT_CBS_CFS; |
6038 |
+ mdata->codec_clk_direction = SND_SOC_CLOCK_IN; |
6039 |
+ mdata->cpu_clk_direction = SND_SOC_CLOCK_OUT; |
6040 |
+ } else { |
6041 |
+diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c |
6042 |
+index 8ad93ee..b583e60 100644 |
6043 |
+--- a/sound/soc/pxa/pxa-ssp.c |
6044 |
++++ b/sound/soc/pxa/pxa-ssp.c |
6045 |
+@@ -668,6 +668,38 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream, |
6046 |
+ return 0; |
6047 |
+ } |
6048 |
+ |
6049 |
++static void pxa_ssp_set_running_bit(struct snd_pcm_substream *substream, |
6050 |
++ struct ssp_device *ssp, int value) |
6051 |
++{ |
6052 |
++ uint32_t sscr0 = pxa_ssp_read_reg(ssp, SSCR0); |
6053 |
++ uint32_t sscr1 = pxa_ssp_read_reg(ssp, SSCR1); |
6054 |
++ uint32_t sspsp = pxa_ssp_read_reg(ssp, SSPSP); |
6055 |
++ uint32_t sssr = pxa_ssp_read_reg(ssp, SSSR); |
6056 |
++ |
6057 |
++ if (value && (sscr0 & SSCR0_SSE)) |
6058 |
++ pxa_ssp_write_reg(ssp, SSCR0, sscr0 & ~SSCR0_SSE); |
6059 |
++ |
6060 |
++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
6061 |
++ if (value) |
6062 |
++ sscr1 |= SSCR1_TSRE; |
6063 |
++ else |
6064 |
++ sscr1 &= ~SSCR1_TSRE; |
6065 |
++ } else { |
6066 |
++ if (value) |
6067 |
++ sscr1 |= SSCR1_RSRE; |
6068 |
++ else |
6069 |
++ sscr1 &= ~SSCR1_RSRE; |
6070 |
++ } |
6071 |
++ |
6072 |
++ pxa_ssp_write_reg(ssp, SSCR1, sscr1); |
6073 |
++ |
6074 |
++ if (value) { |
6075 |
++ pxa_ssp_write_reg(ssp, SSSR, sssr); |
6076 |
++ pxa_ssp_write_reg(ssp, SSPSP, sspsp); |
6077 |
++ pxa_ssp_write_reg(ssp, SSCR0, sscr0 | SSCR0_SSE); |
6078 |
++ } |
6079 |
++} |
6080 |
++ |
6081 |
+ static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd, |
6082 |
+ struct snd_soc_dai *cpu_dai) |
6083 |
+ { |
6084 |
+@@ -681,42 +713,21 @@ static int pxa_ssp_trigger(struct snd_pcm_substream *substream, int cmd, |
6085 |
+ pxa_ssp_enable(ssp); |
6086 |
+ break; |
6087 |
+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
6088 |
+- val = pxa_ssp_read_reg(ssp, SSCR1); |
6089 |
+- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
6090 |
+- val |= SSCR1_TSRE; |
6091 |
+- else |
6092 |
+- val |= SSCR1_RSRE; |
6093 |
+- pxa_ssp_write_reg(ssp, SSCR1, val); |
6094 |
++ pxa_ssp_set_running_bit(substream, ssp, 1); |
6095 |
+ val = pxa_ssp_read_reg(ssp, SSSR); |
6096 |
+ pxa_ssp_write_reg(ssp, SSSR, val); |
6097 |
+ break; |
6098 |
+ case SNDRV_PCM_TRIGGER_START: |
6099 |
+- val = pxa_ssp_read_reg(ssp, SSCR1); |
6100 |
+- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
6101 |
+- val |= SSCR1_TSRE; |
6102 |
+- else |
6103 |
+- val |= SSCR1_RSRE; |
6104 |
+- pxa_ssp_write_reg(ssp, SSCR1, val); |
6105 |
+- pxa_ssp_enable(ssp); |
6106 |
++ pxa_ssp_set_running_bit(substream, ssp, 1); |
6107 |
+ break; |
6108 |
+ case SNDRV_PCM_TRIGGER_STOP: |
6109 |
+- val = pxa_ssp_read_reg(ssp, SSCR1); |
6110 |
+- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
6111 |
+- val &= ~SSCR1_TSRE; |
6112 |
+- else |
6113 |
+- val &= ~SSCR1_RSRE; |
6114 |
+- pxa_ssp_write_reg(ssp, SSCR1, val); |
6115 |
++ pxa_ssp_set_running_bit(substream, ssp, 0); |
6116 |
+ break; |
6117 |
+ case SNDRV_PCM_TRIGGER_SUSPEND: |
6118 |
+ pxa_ssp_disable(ssp); |
6119 |
+ break; |
6120 |
+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
6121 |
+- val = pxa_ssp_read_reg(ssp, SSCR1); |
6122 |
+- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
6123 |
+- val &= ~SSCR1_TSRE; |
6124 |
+- else |
6125 |
+- val &= ~SSCR1_RSRE; |
6126 |
+- pxa_ssp_write_reg(ssp, SSCR1, val); |
6127 |
++ pxa_ssp_set_running_bit(substream, ssp, 0); |
6128 |
+ break; |
6129 |
+ |
6130 |
+ default: |