Contents of /trunk/kernel26-mcore/patches-2.6.36-r4/0101-2.6.36.2-all-fixes.patch
Parent Directory | Revision Log
Revision 1239 -
(show annotations)
(download)
Thu Dec 16 19:45:12 2010 UTC (13 years, 9 months ago) by niro
File size: 354024 byte(s)
Thu Dec 16 19:45:12 2010 UTC (13 years, 9 months ago) by niro
File size: 354024 byte(s)
rev bump to 2.6.36-mcore-r4; really use linux-2.6.36.2 patch
1 | diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h |
2 | index 6e8f05c..d757555 100644 |
3 | --- a/arch/arm/include/asm/assembler.h |
4 | +++ b/arch/arm/include/asm/assembler.h |
5 | @@ -215,7 +215,7 @@ |
6 | @ Slightly optimised to avoid incrementing the pointer twice |
7 | usraccoff \instr, \reg, \ptr, \inc, 0, \cond, \abort |
8 | .if \rept == 2 |
9 | - usraccoff \instr, \reg, \ptr, \inc, 4, \cond, \abort |
10 | + usraccoff \instr, \reg, \ptr, \inc, \inc, \cond, \abort |
11 | .endif |
12 | |
13 | add\cond \ptr, #\rept * \inc |
14 | diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S |
15 | index 1e4cbd4..64f6bc1 100644 |
16 | --- a/arch/arm/lib/findbit.S |
17 | +++ b/arch/arm/lib/findbit.S |
18 | @@ -174,8 +174,8 @@ ENDPROC(_find_next_bit_be) |
19 | */ |
20 | .L_found: |
21 | #if __LINUX_ARM_ARCH__ >= 5 |
22 | - rsb r1, r3, #0 |
23 | - and r3, r3, r1 |
24 | + rsb r0, r3, #0 |
25 | + and r3, r3, r0 |
26 | clz r3, r3 |
27 | rsb r3, r3, #31 |
28 | add r0, r2, r3 |
29 | @@ -190,5 +190,7 @@ ENDPROC(_find_next_bit_be) |
30 | addeq r2, r2, #1 |
31 | mov r0, r2 |
32 | #endif |
33 | + cmp r1, r0 @ Clamp to maxbit |
34 | + movlo r0, r1 |
35 | mov pc, lr |
36 | |
37 | diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c |
38 | index 38088c3..78defd7 100644 |
39 | --- a/arch/arm/mach-cns3xxx/pcie.c |
40 | +++ b/arch/arm/mach-cns3xxx/pcie.c |
41 | @@ -369,7 +369,7 @@ static int __init cns3xxx_pcie_init(void) |
42 | { |
43 | int i; |
44 | |
45 | - hook_fault_code(16 + 6, cns3xxx_pcie_abort_handler, SIGBUS, |
46 | + hook_fault_code(16 + 6, cns3xxx_pcie_abort_handler, SIGBUS, 0, |
47 | "imprecise external abort"); |
48 | |
49 | for (i = 0; i < ARRAY_SIZE(cns3xxx_pcie); i++) { |
50 | diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c |
51 | index 9b906de..56036ff 100644 |
52 | --- a/arch/arm/mm/fault-armv.c |
53 | +++ b/arch/arm/mm/fault-armv.c |
54 | @@ -65,6 +65,30 @@ static int do_adjust_pte(struct vm_area_struct *vma, unsigned long address, |
55 | return ret; |
56 | } |
57 | |
58 | +#if USE_SPLIT_PTLOCKS |
59 | +/* |
60 | + * If we are using split PTE locks, then we need to take the page |
61 | + * lock here. Otherwise we are using shared mm->page_table_lock |
62 | + * which is already locked, thus cannot take it. |
63 | + */ |
64 | +static inline void do_pte_lock(spinlock_t *ptl) |
65 | +{ |
66 | + /* |
67 | + * Use nested version here to indicate that we are already |
68 | + * holding one similar spinlock. |
69 | + */ |
70 | + spin_lock_nested(ptl, SINGLE_DEPTH_NESTING); |
71 | +} |
72 | + |
73 | +static inline void do_pte_unlock(spinlock_t *ptl) |
74 | +{ |
75 | + spin_unlock(ptl); |
76 | +} |
77 | +#else /* !USE_SPLIT_PTLOCKS */ |
78 | +static inline void do_pte_lock(spinlock_t *ptl) {} |
79 | +static inline void do_pte_unlock(spinlock_t *ptl) {} |
80 | +#endif /* USE_SPLIT_PTLOCKS */ |
81 | + |
82 | static int adjust_pte(struct vm_area_struct *vma, unsigned long address, |
83 | unsigned long pfn) |
84 | { |
85 | @@ -89,11 +113,11 @@ static int adjust_pte(struct vm_area_struct *vma, unsigned long address, |
86 | */ |
87 | ptl = pte_lockptr(vma->vm_mm, pmd); |
88 | pte = pte_offset_map_nested(pmd, address); |
89 | - spin_lock(ptl); |
90 | + do_pte_lock(ptl); |
91 | |
92 | ret = do_adjust_pte(vma, address, pfn, pte); |
93 | |
94 | - spin_unlock(ptl); |
95 | + do_pte_unlock(ptl); |
96 | pte_unmap_nested(pte); |
97 | |
98 | return ret; |
99 | diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c |
100 | index ec7eddf..f5c5b8d 100644 |
101 | --- a/arch/arm/plat-omap/dma.c |
102 | +++ b/arch/arm/plat-omap/dma.c |
103 | @@ -30,6 +30,7 @@ |
104 | #include <linux/irq.h> |
105 | #include <linux/io.h> |
106 | #include <linux/slab.h> |
107 | +#include <linux/delay.h> |
108 | |
109 | #include <asm/system.h> |
110 | #include <mach/hardware.h> |
111 | @@ -996,11 +997,17 @@ void omap_start_dma(int lch) |
112 | l = dma_read(CCR(lch)); |
113 | |
114 | /* |
115 | - * Errata: On ES2.0 BUFFERING disable must be set. |
116 | - * This will always fail on ES1.0 |
117 | + * Errata: Inter Frame DMA buffering issue (All OMAP2420 and |
118 | + * OMAP2430ES1.0): DMA will wrongly buffer elements if packing and |
119 | + * bursting is enabled. This might result in data gets stalled in |
120 | + * FIFO at the end of the block. |
121 | + * Workaround: DMA channels must have BUFFERING_DISABLED bit set to |
122 | + * guarantee no data will stay in the DMA FIFO in case inter frame |
123 | + * buffering occurs. |
124 | */ |
125 | - if (cpu_is_omap24xx()) |
126 | - l |= OMAP_DMA_CCR_EN; |
127 | + if (cpu_is_omap2420() || |
128 | + (cpu_is_omap2430() && (omap_type() == OMAP2430_REV_ES1_0))) |
129 | + l |= OMAP_DMA_CCR_BUFFERING_DISABLE; |
130 | |
131 | l |= OMAP_DMA_CCR_EN; |
132 | dma_write(l, CCR(lch)); |
133 | @@ -1018,8 +1025,39 @@ void omap_stop_dma(int lch) |
134 | dma_write(0, CICR(lch)); |
135 | |
136 | l = dma_read(CCR(lch)); |
137 | - l &= ~OMAP_DMA_CCR_EN; |
138 | - dma_write(l, CCR(lch)); |
139 | + /* OMAP3 Errata i541: sDMA FIFO draining does not finish */ |
140 | + if (cpu_is_omap34xx() && (l & OMAP_DMA_CCR_SEL_SRC_DST_SYNC)) { |
141 | + int i = 0; |
142 | + u32 sys_cf; |
143 | + |
144 | + /* Configure No-Standby */ |
145 | + l = dma_read(OCP_SYSCONFIG); |
146 | + sys_cf = l; |
147 | + l &= ~DMA_SYSCONFIG_MIDLEMODE_MASK; |
148 | + l |= DMA_SYSCONFIG_MIDLEMODE(DMA_IDLEMODE_NO_IDLE); |
149 | + dma_write(l , OCP_SYSCONFIG); |
150 | + |
151 | + l = dma_read(CCR(lch)); |
152 | + l &= ~OMAP_DMA_CCR_EN; |
153 | + dma_write(l, CCR(lch)); |
154 | + |
155 | + /* Wait for sDMA FIFO drain */ |
156 | + l = dma_read(CCR(lch)); |
157 | + while (i < 100 && (l & (OMAP_DMA_CCR_RD_ACTIVE | |
158 | + OMAP_DMA_CCR_WR_ACTIVE))) { |
159 | + udelay(5); |
160 | + i++; |
161 | + l = dma_read(CCR(lch)); |
162 | + } |
163 | + if (i >= 100) |
164 | + printk(KERN_ERR "DMA drain did not complete on " |
165 | + "lch %d\n", lch); |
166 | + /* Restore OCP_SYSCONFIG */ |
167 | + dma_write(sys_cf, OCP_SYSCONFIG); |
168 | + } else { |
169 | + l &= ~OMAP_DMA_CCR_EN; |
170 | + dma_write(l, CCR(lch)); |
171 | + } |
172 | |
173 | if (!omap_dma_in_1510_mode() && dma_chan[lch].next_lch != -1) { |
174 | int next_lch, cur_lch = lch; |
175 | diff --git a/arch/arm/plat-omap/include/plat/dma.h b/arch/arm/plat-omap/include/plat/dma.h |
176 | index af3a039..cf66f85 100644 |
177 | --- a/arch/arm/plat-omap/include/plat/dma.h |
178 | +++ b/arch/arm/plat-omap/include/plat/dma.h |
179 | @@ -335,6 +335,10 @@ |
180 | #define OMAP2_DMA_MISALIGNED_ERR_IRQ (1 << 11) |
181 | |
182 | #define OMAP_DMA_CCR_EN (1 << 7) |
183 | +#define OMAP_DMA_CCR_RD_ACTIVE (1 << 9) |
184 | +#define OMAP_DMA_CCR_WR_ACTIVE (1 << 10) |
185 | +#define OMAP_DMA_CCR_SEL_SRC_DST_SYNC (1 << 24) |
186 | +#define OMAP_DMA_CCR_BUFFERING_DISABLE (1 << 25) |
187 | |
188 | #define OMAP_DMA_DATA_TYPE_S8 0x00 |
189 | #define OMAP_DMA_DATA_TYPE_S16 0x01 |
190 | diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile |
191 | index 592c707..b07d990 100644 |
192 | --- a/arch/microblaze/Makefile |
193 | +++ b/arch/microblaze/Makefile |
194 | @@ -72,12 +72,16 @@ export MMU DTB |
195 | |
196 | all: linux.bin |
197 | |
198 | -BOOT_TARGETS = linux.bin linux.bin.gz simpleImage.% |
199 | +# With make 3.82 we cannot mix normal and wildcard targets |
200 | +BOOT_TARGETS1 = linux.bin linux.bin.gz |
201 | +BOOT_TARGETS2 = simpleImage.% |
202 | |
203 | archclean: |
204 | $(Q)$(MAKE) $(clean)=$(boot) |
205 | |
206 | -$(BOOT_TARGETS): vmlinux |
207 | +$(BOOT_TARGETS1): vmlinux |
208 | + $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ |
209 | +$(BOOT_TARGETS2): vmlinux |
210 | $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ |
211 | |
212 | define archhelp |
213 | diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c |
214 | index 09dffe6..1eb64ba 100644 |
215 | --- a/arch/powerpc/mm/hash_utils_64.c |
216 | +++ b/arch/powerpc/mm/hash_utils_64.c |
217 | @@ -1122,7 +1122,7 @@ void hash_preload(struct mm_struct *mm, unsigned long ea, |
218 | else |
219 | #endif /* CONFIG_PPC_HAS_HASH_64K */ |
220 | rc = __hash_page_4K(ea, access, vsid, ptep, trap, local, ssize, |
221 | - subpage_protection(pgdir, ea)); |
222 | + subpage_protection(mm, ea)); |
223 | |
224 | /* Dump some info in case of hash insertion failure, they should |
225 | * never happen so it is really useful to know if/when they do |
226 | diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c |
227 | index ac15139..1995c17 100644 |
228 | --- a/arch/s390/kernel/nmi.c |
229 | +++ b/arch/s390/kernel/nmi.c |
230 | @@ -95,7 +95,6 @@ EXPORT_SYMBOL_GPL(s390_handle_mcck); |
231 | static int notrace s390_revalidate_registers(struct mci *mci) |
232 | { |
233 | int kill_task; |
234 | - u64 tmpclock; |
235 | u64 zero; |
236 | void *fpt_save_area, *fpt_creg_save_area; |
237 | |
238 | @@ -214,11 +213,10 @@ static int notrace s390_revalidate_registers(struct mci *mci) |
239 | : "0", "cc"); |
240 | #endif |
241 | /* Revalidate clock comparator register */ |
242 | - asm volatile( |
243 | - " stck 0(%1)\n" |
244 | - " sckc 0(%1)" |
245 | - : "=m" (tmpclock) : "a" (&(tmpclock)) : "cc", "memory"); |
246 | - |
247 | + if (S390_lowcore.clock_comparator == -1) |
248 | + set_clock_comparator(S390_lowcore.mcck_clock); |
249 | + else |
250 | + set_clock_comparator(S390_lowcore.clock_comparator); |
251 | /* Check if old PSW is valid */ |
252 | if (!mci->wp) |
253 | /* |
254 | diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c |
255 | index 3479f1b..c1e326c 100644 |
256 | --- a/arch/s390/kernel/vtime.c |
257 | +++ b/arch/s390/kernel/vtime.c |
258 | @@ -19,6 +19,7 @@ |
259 | #include <linux/kernel_stat.h> |
260 | #include <linux/rcupdate.h> |
261 | #include <linux/posix-timers.h> |
262 | +#include <linux/cpu.h> |
263 | |
264 | #include <asm/s390_ext.h> |
265 | #include <asm/timer.h> |
266 | @@ -565,6 +566,23 @@ void init_cpu_vtimer(void) |
267 | __ctl_set_bit(0,10); |
268 | } |
269 | |
270 | +static int __cpuinit s390_nohz_notify(struct notifier_block *self, |
271 | + unsigned long action, void *hcpu) |
272 | +{ |
273 | + struct s390_idle_data *idle; |
274 | + long cpu = (long) hcpu; |
275 | + |
276 | + idle = &per_cpu(s390_idle, cpu); |
277 | + switch (action) { |
278 | + case CPU_DYING: |
279 | + case CPU_DYING_FROZEN: |
280 | + idle->nohz_delay = 0; |
281 | + default: |
282 | + break; |
283 | + } |
284 | + return NOTIFY_OK; |
285 | +} |
286 | + |
287 | void __init vtime_init(void) |
288 | { |
289 | /* request the cpu timer external interrupt */ |
290 | @@ -573,5 +591,6 @@ void __init vtime_init(void) |
291 | |
292 | /* Enable cpu timer interrupts on the boot cpu. */ |
293 | init_cpu_vtimer(); |
294 | + cpu_notifier(s390_nohz_notify, 0); |
295 | } |
296 | |
297 | diff --git a/arch/s390/lib/delay.c b/arch/s390/lib/delay.c |
298 | index 752b362..7c37ec3 100644 |
299 | --- a/arch/s390/lib/delay.c |
300 | +++ b/arch/s390/lib/delay.c |
301 | @@ -29,17 +29,21 @@ static void __udelay_disabled(unsigned long long usecs) |
302 | { |
303 | unsigned long mask, cr0, cr0_saved; |
304 | u64 clock_saved; |
305 | + u64 end; |
306 | |
307 | + mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT; |
308 | + end = get_clock() + (usecs << 12); |
309 | clock_saved = local_tick_disable(); |
310 | - set_clock_comparator(get_clock() + (usecs << 12)); |
311 | __ctl_store(cr0_saved, 0, 0); |
312 | cr0 = (cr0_saved & 0xffff00e0) | 0x00000800; |
313 | __ctl_load(cr0 , 0, 0); |
314 | - mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT; |
315 | lockdep_off(); |
316 | - trace_hardirqs_on(); |
317 | - __load_psw_mask(mask); |
318 | - local_irq_disable(); |
319 | + do { |
320 | + set_clock_comparator(end); |
321 | + trace_hardirqs_on(); |
322 | + __load_psw_mask(mask); |
323 | + local_irq_disable(); |
324 | + } while (get_clock() < end); |
325 | lockdep_on(); |
326 | __ctl_load(cr0_saved, 0, 0); |
327 | local_tick_enable(clock_saved); |
328 | diff --git a/arch/sh/include/asm/syscalls_32.h b/arch/sh/include/asm/syscalls_32.h |
329 | index be201fd..ae717e3 100644 |
330 | --- a/arch/sh/include/asm/syscalls_32.h |
331 | +++ b/arch/sh/include/asm/syscalls_32.h |
332 | @@ -19,9 +19,10 @@ asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, |
333 | asmlinkage int sys_vfork(unsigned long r4, unsigned long r5, |
334 | unsigned long r6, unsigned long r7, |
335 | struct pt_regs __regs); |
336 | -asmlinkage int sys_execve(const char __user *ufilename, char __user * __user *uargv, |
337 | - char __user * __user *uenvp, unsigned long r7, |
338 | - struct pt_regs __regs); |
339 | +asmlinkage int sys_execve(const char __user *ufilename, |
340 | + const char __user *const __user *uargv, |
341 | + const char __user *const __user *uenvp, |
342 | + unsigned long r7, struct pt_regs __regs); |
343 | asmlinkage int sys_sigsuspend(old_sigset_t mask, unsigned long r5, |
344 | unsigned long r6, unsigned long r7, |
345 | struct pt_regs __regs); |
346 | diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c |
347 | index 7f7338c..1664cce 100644 |
348 | --- a/arch/um/drivers/line.c |
349 | +++ b/arch/um/drivers/line.c |
350 | @@ -727,6 +727,9 @@ struct winch { |
351 | |
352 | static void free_winch(struct winch *winch, int free_irq_ok) |
353 | { |
354 | + if (free_irq_ok) |
355 | + free_irq(WINCH_IRQ, winch); |
356 | + |
357 | list_del(&winch->list); |
358 | |
359 | if (winch->pid != -1) |
360 | @@ -735,8 +738,6 @@ static void free_winch(struct winch *winch, int free_irq_ok) |
361 | os_close_file(winch->fd); |
362 | if (winch->stack != 0) |
363 | free_stack(winch->stack, 0); |
364 | - if (free_irq_ok) |
365 | - free_irq(WINCH_IRQ, winch); |
366 | kfree(winch); |
367 | } |
368 | |
369 | diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S |
370 | index ec63785..9a873d7 100644 |
371 | --- a/arch/um/kernel/uml.lds.S |
372 | +++ b/arch/um/kernel/uml.lds.S |
373 | @@ -22,7 +22,7 @@ SECTIONS |
374 | _text = .; |
375 | _stext = .; |
376 | __init_begin = .; |
377 | - INIT_TEXT_SECTION(PAGE_SIZE) |
378 | + INIT_TEXT_SECTION(0) |
379 | . = ALIGN(PAGE_SIZE); |
380 | |
381 | .text : |
382 | diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c |
383 | index dec5678..6e3359d 100644 |
384 | --- a/arch/um/os-Linux/time.c |
385 | +++ b/arch/um/os-Linux/time.c |
386 | @@ -60,7 +60,7 @@ static inline long long timeval_to_ns(const struct timeval *tv) |
387 | long long disable_timer(void) |
388 | { |
389 | struct itimerval time = ((struct itimerval) { { 0, 0 }, { 0, 0 } }); |
390 | - int remain, max = UM_NSEC_PER_SEC / UM_HZ; |
391 | + long long remain, max = UM_NSEC_PER_SEC / UM_HZ; |
392 | |
393 | if (setitimer(ITIMER_VIRTUAL, &time, &time) < 0) |
394 | printk(UM_KERN_ERR "disable_timer - setitimer failed, " |
395 | diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c |
396 | index cd8da24..a2baafb 100644 |
397 | --- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c |
398 | +++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c |
399 | @@ -701,6 +701,7 @@ static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy) |
400 | per_cpu(acfreq_data, policy->cpu) = NULL; |
401 | acpi_processor_unregister_performance(data->acpi_data, |
402 | policy->cpu); |
403 | + kfree(data->freq_table); |
404 | kfree(data); |
405 | } |
406 | |
407 | diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c |
408 | index ff15c9d..42c5942 100644 |
409 | --- a/arch/x86/kernel/hw_breakpoint.c |
410 | +++ b/arch/x86/kernel/hw_breakpoint.c |
411 | @@ -433,6 +433,10 @@ static int __kprobes hw_breakpoint_handler(struct die_args *args) |
412 | dr6_p = (unsigned long *)ERR_PTR(args->err); |
413 | dr6 = *dr6_p; |
414 | |
415 | + /* If it's a single step, TRAP bits are random */ |
416 | + if (dr6 & DR_STEP) |
417 | + return NOTIFY_DONE; |
418 | + |
419 | /* Do an early return if no trap bits are set in DR6 */ |
420 | if ((dr6 & DR_TRAP_BITS) == 0) |
421 | return NOTIFY_DONE; |
422 | diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c |
423 | index 2a02a65..89055e0 100644 |
424 | --- a/arch/x86/kvm/svm.c |
425 | +++ b/arch/x86/kvm/svm.c |
426 | @@ -3281,6 +3281,7 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) |
427 | vcpu->arch.regs[VCPU_REGS_RIP] = svm->vmcb->save.rip; |
428 | |
429 | load_host_msrs(vcpu); |
430 | + kvm_load_ldt(ldt_selector); |
431 | loadsegment(fs, fs_selector); |
432 | #ifdef CONFIG_X86_64 |
433 | load_gs_index(gs_selector); |
434 | @@ -3288,7 +3289,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu) |
435 | #else |
436 | loadsegment(gs, gs_selector); |
437 | #endif |
438 | - kvm_load_ldt(ldt_selector); |
439 | |
440 | reload_tss(vcpu); |
441 | |
442 | diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c |
443 | index 7bddfab..f23f725 100644 |
444 | --- a/arch/x86/kvm/vmx.c |
445 | +++ b/arch/x86/kvm/vmx.c |
446 | @@ -828,10 +828,9 @@ static void vmx_save_host_state(struct kvm_vcpu *vcpu) |
447 | #endif |
448 | |
449 | #ifdef CONFIG_X86_64 |
450 | - if (is_long_mode(&vmx->vcpu)) { |
451 | - rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base); |
452 | + rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base); |
453 | + if (is_long_mode(&vmx->vcpu)) |
454 | wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base); |
455 | - } |
456 | #endif |
457 | for (i = 0; i < vmx->save_nmsrs; ++i) |
458 | kvm_set_shared_msr(vmx->guest_msrs[i].index, |
459 | @@ -846,23 +845,23 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx) |
460 | |
461 | ++vmx->vcpu.stat.host_state_reload; |
462 | vmx->host_state.loaded = 0; |
463 | - if (vmx->host_state.fs_reload_needed) |
464 | - loadsegment(fs, vmx->host_state.fs_sel); |
465 | +#ifdef CONFIG_X86_64 |
466 | + if (is_long_mode(&vmx->vcpu)) |
467 | + rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base); |
468 | +#endif |
469 | if (vmx->host_state.gs_ldt_reload_needed) { |
470 | kvm_load_ldt(vmx->host_state.ldt_sel); |
471 | #ifdef CONFIG_X86_64 |
472 | load_gs_index(vmx->host_state.gs_sel); |
473 | - wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs); |
474 | #else |
475 | loadsegment(gs, vmx->host_state.gs_sel); |
476 | #endif |
477 | } |
478 | + if (vmx->host_state.fs_reload_needed) |
479 | + loadsegment(fs, vmx->host_state.fs_sel); |
480 | reload_tss(); |
481 | #ifdef CONFIG_X86_64 |
482 | - if (is_long_mode(&vmx->vcpu)) { |
483 | - rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base); |
484 | - wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base); |
485 | - } |
486 | + wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base); |
487 | #endif |
488 | if (current_thread_info()->status & TS_USEDFPU) |
489 | clts(); |
490 | diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c |
491 | index a4a427b..3f2d2b3 100644 |
492 | --- a/arch/x86/kvm/x86.c |
493 | +++ b/arch/x86/kvm/x86.c |
494 | @@ -2305,6 +2305,7 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu, |
495 | !kvm_exception_is_soft(vcpu->arch.exception.nr); |
496 | events->exception.nr = vcpu->arch.exception.nr; |
497 | events->exception.has_error_code = vcpu->arch.exception.has_error_code; |
498 | + events->exception.pad = 0; |
499 | events->exception.error_code = vcpu->arch.exception.error_code; |
500 | |
501 | events->interrupt.injected = |
502 | @@ -2318,12 +2319,14 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu, |
503 | events->nmi.injected = vcpu->arch.nmi_injected; |
504 | events->nmi.pending = vcpu->arch.nmi_pending; |
505 | events->nmi.masked = kvm_x86_ops->get_nmi_mask(vcpu); |
506 | + events->nmi.pad = 0; |
507 | |
508 | events->sipi_vector = vcpu->arch.sipi_vector; |
509 | |
510 | events->flags = (KVM_VCPUEVENT_VALID_NMI_PENDING |
511 | | KVM_VCPUEVENT_VALID_SIPI_VECTOR |
512 | | KVM_VCPUEVENT_VALID_SHADOW); |
513 | + memset(&events->reserved, 0, sizeof(events->reserved)); |
514 | } |
515 | |
516 | static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, |
517 | @@ -2366,6 +2369,7 @@ static void kvm_vcpu_ioctl_x86_get_debugregs(struct kvm_vcpu *vcpu, |
518 | dbgregs->dr6 = vcpu->arch.dr6; |
519 | dbgregs->dr7 = vcpu->arch.dr7; |
520 | dbgregs->flags = 0; |
521 | + memset(&dbgregs->reserved, 0, sizeof(dbgregs->reserved)); |
522 | } |
523 | |
524 | static int kvm_vcpu_ioctl_x86_set_debugregs(struct kvm_vcpu *vcpu, |
525 | @@ -2849,6 +2853,7 @@ static int kvm_vm_ioctl_get_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps) |
526 | sizeof(ps->channels)); |
527 | ps->flags = kvm->arch.vpit->pit_state.flags; |
528 | mutex_unlock(&kvm->arch.vpit->pit_state.lock); |
529 | + memset(&ps->reserved, 0, sizeof(ps->reserved)); |
530 | return r; |
531 | } |
532 | |
533 | @@ -2912,10 +2917,6 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, |
534 | struct kvm_memslots *slots, *old_slots; |
535 | unsigned long *dirty_bitmap; |
536 | |
537 | - spin_lock(&kvm->mmu_lock); |
538 | - kvm_mmu_slot_remove_write_access(kvm, log->slot); |
539 | - spin_unlock(&kvm->mmu_lock); |
540 | - |
541 | r = -ENOMEM; |
542 | dirty_bitmap = vmalloc(n); |
543 | if (!dirty_bitmap) |
544 | @@ -2937,6 +2938,10 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, |
545 | dirty_bitmap = old_slots->memslots[log->slot].dirty_bitmap; |
546 | kfree(old_slots); |
547 | |
548 | + spin_lock(&kvm->mmu_lock); |
549 | + kvm_mmu_slot_remove_write_access(kvm, log->slot); |
550 | + spin_unlock(&kvm->mmu_lock); |
551 | + |
552 | r = -EFAULT; |
553 | if (copy_to_user(log->dirty_bitmap, dirty_bitmap, n)) { |
554 | vfree(dirty_bitmap); |
555 | @@ -3229,6 +3234,7 @@ long kvm_arch_vm_ioctl(struct file *filp, |
556 | now_ns = timespec_to_ns(&now); |
557 | user_ns.clock = kvm->arch.kvmclock_offset + now_ns; |
558 | user_ns.flags = 0; |
559 | + memset(&user_ns.pad, 0, sizeof(user_ns.pad)); |
560 | |
561 | r = -EFAULT; |
562 | if (copy_to_user(argp, &user_ns, sizeof(user_ns))) |
563 | diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c |
564 | index 44f8086..0f6cd14 100644 |
565 | --- a/arch/x86/xen/enlighten.c |
566 | +++ b/arch/x86/xen/enlighten.c |
567 | @@ -1017,10 +1017,6 @@ static void xen_reboot(int reason) |
568 | { |
569 | struct sched_shutdown r = { .reason = reason }; |
570 | |
571 | -#ifdef CONFIG_SMP |
572 | - stop_other_cpus(); |
573 | -#endif |
574 | - |
575 | if (HYPERVISOR_sched_op(SCHEDOP_shutdown, &r)) |
576 | BUG(); |
577 | } |
578 | diff --git a/block/blk-map.c b/block/blk-map.c |
579 | index ade0a08..267a57b 100644 |
580 | --- a/block/blk-map.c |
581 | +++ b/block/blk-map.c |
582 | @@ -205,6 +205,8 @@ int blk_rq_map_user_iov(struct request_queue *q, struct request *rq, |
583 | unaligned = 1; |
584 | break; |
585 | } |
586 | + if (!iov[i].iov_len) |
587 | + return -EINVAL; |
588 | } |
589 | |
590 | if (unaligned || (q->dma_pad_mask & len) || map_data) |
591 | diff --git a/block/blk-settings.c b/block/blk-settings.c |
592 | index a234f4b..450577d 100644 |
593 | --- a/block/blk-settings.c |
594 | +++ b/block/blk-settings.c |
595 | @@ -343,7 +343,7 @@ EXPORT_SYMBOL(blk_queue_logical_block_size); |
596 | * hardware can operate on without reverting to read-modify-write |
597 | * operations. |
598 | */ |
599 | -void blk_queue_physical_block_size(struct request_queue *q, unsigned short size) |
600 | +void blk_queue_physical_block_size(struct request_queue *q, unsigned int size) |
601 | { |
602 | q->limits.physical_block_size = size; |
603 | |
604 | diff --git a/block/genhd.c b/block/genhd.c |
605 | index 59a2db6..315afd2 100644 |
606 | --- a/block/genhd.c |
607 | +++ b/block/genhd.c |
608 | @@ -541,13 +541,15 @@ void add_disk(struct gendisk *disk) |
609 | disk->major = MAJOR(devt); |
610 | disk->first_minor = MINOR(devt); |
611 | |
612 | + /* Register BDI before referencing it from bdev */ |
613 | + bdi = &disk->queue->backing_dev_info; |
614 | + bdi_register_dev(bdi, disk_devt(disk)); |
615 | + |
616 | blk_register_region(disk_devt(disk), disk->minors, NULL, |
617 | exact_match, exact_lock, disk); |
618 | register_disk(disk); |
619 | blk_register_queue(disk); |
620 | |
621 | - bdi = &disk->queue->backing_dev_info; |
622 | - bdi_register_dev(bdi, disk_devt(disk)); |
623 | retval = sysfs_create_link(&disk_to_dev(disk)->kobj, &bdi->dev->kobj, |
624 | "bdi"); |
625 | WARN_ON(retval); |
626 | diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c |
627 | index a8b5a10..4f4230b 100644 |
628 | --- a/block/scsi_ioctl.c |
629 | +++ b/block/scsi_ioctl.c |
630 | @@ -321,33 +321,47 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk, |
631 | if (hdr->iovec_count) { |
632 | const int size = sizeof(struct sg_iovec) * hdr->iovec_count; |
633 | size_t iov_data_len; |
634 | - struct sg_iovec *iov; |
635 | + struct sg_iovec *sg_iov; |
636 | + struct iovec *iov; |
637 | + int i; |
638 | |
639 | - iov = kmalloc(size, GFP_KERNEL); |
640 | - if (!iov) { |
641 | + sg_iov = kmalloc(size, GFP_KERNEL); |
642 | + if (!sg_iov) { |
643 | ret = -ENOMEM; |
644 | goto out; |
645 | } |
646 | |
647 | - if (copy_from_user(iov, hdr->dxferp, size)) { |
648 | - kfree(iov); |
649 | + if (copy_from_user(sg_iov, hdr->dxferp, size)) { |
650 | + kfree(sg_iov); |
651 | ret = -EFAULT; |
652 | goto out; |
653 | } |
654 | |
655 | + /* |
656 | + * Sum up the vecs, making sure they don't overflow |
657 | + */ |
658 | + iov = (struct iovec *) sg_iov; |
659 | + iov_data_len = 0; |
660 | + for (i = 0; i < hdr->iovec_count; i++) { |
661 | + if (iov_data_len + iov[i].iov_len < iov_data_len) { |
662 | + kfree(sg_iov); |
663 | + ret = -EINVAL; |
664 | + goto out; |
665 | + } |
666 | + iov_data_len += iov[i].iov_len; |
667 | + } |
668 | + |
669 | /* SG_IO howto says that the shorter of the two wins */ |
670 | - iov_data_len = iov_length((struct iovec *)iov, |
671 | - hdr->iovec_count); |
672 | if (hdr->dxfer_len < iov_data_len) { |
673 | - hdr->iovec_count = iov_shorten((struct iovec *)iov, |
674 | + hdr->iovec_count = iov_shorten(iov, |
675 | hdr->iovec_count, |
676 | hdr->dxfer_len); |
677 | iov_data_len = hdr->dxfer_len; |
678 | } |
679 | |
680 | - ret = blk_rq_map_user_iov(q, rq, NULL, iov, hdr->iovec_count, |
681 | + ret = blk_rq_map_user_iov(q, rq, NULL, sg_iov, hdr->iovec_count, |
682 | iov_data_len, GFP_KERNEL); |
683 | - kfree(iov); |
684 | + kfree(sg_iov); |
685 | } else if (hdr->dxfer_len) |
686 | ret = blk_rq_map_user(q, rq, NULL, hdr->dxferp, hdr->dxfer_len, |
687 | GFP_KERNEL); |
688 | diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c |
689 | index 9841720..4c0a0a3 100644 |
690 | --- a/drivers/acpi/battery.c |
691 | +++ b/drivers/acpi/battery.c |
692 | @@ -98,6 +98,7 @@ enum { |
693 | * due to bad math. |
694 | */ |
695 | ACPI_BATTERY_QUIRK_SIGNED16_CURRENT, |
696 | + ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, |
697 | }; |
698 | |
699 | struct acpi_battery { |
700 | @@ -412,6 +413,8 @@ static int acpi_battery_get_info(struct acpi_battery *battery) |
701 | result = extract_package(battery, buffer.pointer, |
702 | info_offsets, ARRAY_SIZE(info_offsets)); |
703 | kfree(buffer.pointer); |
704 | + if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags)) |
705 | + battery->full_charge_capacity = battery->design_capacity; |
706 | return result; |
707 | } |
708 | |
709 | @@ -448,6 +451,10 @@ static int acpi_battery_get_state(struct acpi_battery *battery) |
710 | battery->rate_now != -1) |
711 | battery->rate_now = abs((s16)battery->rate_now); |
712 | |
713 | + if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags) |
714 | + && battery->capacity_now >= 0 && battery->capacity_now <= 100) |
715 | + battery->capacity_now = (battery->capacity_now * |
716 | + battery->full_charge_capacity) / 100; |
717 | return result; |
718 | } |
719 | |
720 | @@ -561,6 +568,33 @@ static void acpi_battery_quirks(struct acpi_battery *battery) |
721 | } |
722 | } |
723 | |
724 | +/* |
725 | + * According to the ACPI spec, some kinds of primary batteries can |
726 | + * report percentage battery remaining capacity directly to OS. |
727 | + * In this case, it reports the Last Full Charged Capacity == 100 |
728 | + * and BatteryPresentRate == 0xFFFFFFFF. |
729 | + * |
730 | + * Now we found some battery reports percentage remaining capacity |
731 | + * even if it's rechargeable. |
732 | + * https://bugzilla.kernel.org/show_bug.cgi?id=15979 |
733 | + * |
734 | + * Handle this correctly so that they won't break userspace. |
735 | + */ |
736 | +static void acpi_battery_quirks2(struct acpi_battery *battery) |
737 | +{ |
738 | + if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags)) |
739 | + return ; |
740 | + |
741 | + if (battery->full_charge_capacity == 100 && |
742 | + battery->rate_now == ACPI_BATTERY_VALUE_UNKNOWN && |
743 | + battery->capacity_now >=0 && battery->capacity_now <= 100) { |
744 | + set_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags); |
745 | + battery->full_charge_capacity = battery->design_capacity; |
746 | + battery->capacity_now = (battery->capacity_now * |
747 | + battery->full_charge_capacity) / 100; |
748 | + } |
749 | +} |
750 | + |
751 | static int acpi_battery_update(struct acpi_battery *battery) |
752 | { |
753 | int result, old_present = acpi_battery_present(battery); |
754 | @@ -586,7 +620,9 @@ static int acpi_battery_update(struct acpi_battery *battery) |
755 | if (!battery->bat.dev) |
756 | sysfs_add_battery(battery); |
757 | #endif |
758 | - return acpi_battery_get_state(battery); |
759 | + result = acpi_battery_get_state(battery); |
760 | + acpi_battery_quirks2(battery); |
761 | + return result; |
762 | } |
763 | |
764 | /* -------------------------------------------------------------------------- |
765 | diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c |
766 | index 310e3b9..d68bd61 100644 |
767 | --- a/drivers/acpi/bus.c |
768 | +++ b/drivers/acpi/bus.c |
769 | @@ -935,6 +935,12 @@ static int __init acpi_bus_init(void) |
770 | goto error1; |
771 | } |
772 | |
773 | + /* |
774 | + * _PDC control method may load dynamic SSDT tables, |
775 | + * and we need to install the table handler before that. |
776 | + */ |
777 | + acpi_sysfs_init(); |
778 | + |
779 | acpi_early_processor_set_pdc(); |
780 | |
781 | /* |
782 | @@ -1026,7 +1032,6 @@ static int __init acpi_init(void) |
783 | acpi_scan_init(); |
784 | acpi_ec_init(); |
785 | acpi_power_init(); |
786 | - acpi_sysfs_init(); |
787 | acpi_debugfs_init(); |
788 | acpi_sleep_proc_init(); |
789 | acpi_wakeup_device_init(); |
790 | diff --git a/drivers/acpi/debugfs.c b/drivers/acpi/debugfs.c |
791 | index 7de27d4..74c4a39 100644 |
792 | --- a/drivers/acpi/debugfs.c |
793 | +++ b/drivers/acpi/debugfs.c |
794 | @@ -79,7 +79,7 @@ int __init acpi_debugfs_init(void) |
795 | if (!acpi_dir) |
796 | goto err; |
797 | |
798 | - cm_dentry = debugfs_create_file("custom_method", S_IWUGO, |
799 | + cm_dentry = debugfs_create_file("custom_method", S_IWUSR, |
800 | acpi_dir, NULL, &cm_fops); |
801 | if (!cm_dentry) |
802 | goto err; |
803 | diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c |
804 | index a89172c..7bb6787 100644 |
805 | --- a/drivers/ata/libata-scsi.c |
806 | +++ b/drivers/ata/libata-scsi.c |
807 | @@ -2577,8 +2577,11 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) |
808 | * |
809 | * If door lock fails, always clear sdev->locked to |
810 | * avoid this infinite loop. |
811 | + * |
812 | + * This may happen before SCSI scan is complete. Make |
813 | + * sure qc->dev->sdev isn't NULL before dereferencing. |
814 | */ |
815 | - if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL) |
816 | + if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL && qc->dev->sdev) |
817 | qc->dev->sdev->locked = 0; |
818 | |
819 | qc->scsicmd->result = SAM_STAT_CHECK_CONDITION; |
820 | diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c |
821 | index 4730c42..c51b8d2 100644 |
822 | --- a/drivers/ata/sata_via.c |
823 | +++ b/drivers/ata/sata_via.c |
824 | @@ -538,7 +538,7 @@ static int vt8251_prepare_host(struct pci_dev *pdev, struct ata_host **r_host) |
825 | return 0; |
826 | } |
827 | |
828 | -static void svia_configure(struct pci_dev *pdev) |
829 | +static void svia_configure(struct pci_dev *pdev, int board_id) |
830 | { |
831 | u8 tmp8; |
832 | |
833 | @@ -577,7 +577,7 @@ static void svia_configure(struct pci_dev *pdev) |
834 | } |
835 | |
836 | /* |
837 | - * vt6421 has problems talking to some drives. The following |
838 | + * vt6420/1 has problems talking to some drives. The following |
839 | * is the fix from Joseph Chan <JosephChan@via.com.tw>. |
840 | * |
841 | * When host issues HOLD, device may send up to 20DW of data |
842 | @@ -596,8 +596,9 @@ static void svia_configure(struct pci_dev *pdev) |
843 | * |
844 | * https://bugzilla.kernel.org/show_bug.cgi?id=15173 |
845 | * http://article.gmane.org/gmane.linux.ide/46352 |
846 | + * http://thread.gmane.org/gmane.linux.kernel/1062139 |
847 | */ |
848 | - if (pdev->device == 0x3249) { |
849 | + if (board_id == vt6420 || board_id == vt6421) { |
850 | pci_read_config_byte(pdev, 0x52, &tmp8); |
851 | tmp8 |= 1 << 2; |
852 | pci_write_config_byte(pdev, 0x52, tmp8); |
853 | @@ -652,7 +653,7 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
854 | if (rc) |
855 | return rc; |
856 | |
857 | - svia_configure(pdev); |
858 | + svia_configure(pdev, board_id); |
859 | |
860 | pci_set_master(pdev); |
861 | return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, |
862 | diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c |
863 | index cd18493..47350de 100644 |
864 | --- a/drivers/char/agp/intel-agp.c |
865 | +++ b/drivers/char/agp/intel-agp.c |
866 | @@ -1049,6 +1049,7 @@ static struct pci_device_id agp_intel_pci_table[] = { |
867 | ID(PCI_DEVICE_ID_INTEL_G45_HB), |
868 | ID(PCI_DEVICE_ID_INTEL_G41_HB), |
869 | ID(PCI_DEVICE_ID_INTEL_B43_HB), |
870 | + ID(PCI_DEVICE_ID_INTEL_B43_1_HB), |
871 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB), |
872 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB), |
873 | ID(PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB), |
874 | diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c |
875 | index 75e0a34..6ea3bf6 100644 |
876 | --- a/drivers/char/agp/intel-gtt.c |
877 | +++ b/drivers/char/agp/intel-gtt.c |
878 | @@ -534,7 +534,7 @@ static void intel_i830_init_gtt_entries(void) |
879 | |
880 | pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl); |
881 | |
882 | - if (IS_I965) { |
883 | + if (IS_G33 || IS_I965) { |
884 | u32 pgetbl_ctl; |
885 | pgetbl_ctl = readl(intel_private.registers+I810_PGETBL_CTL); |
886 | |
887 | @@ -567,22 +567,6 @@ static void intel_i830_init_gtt_entries(void) |
888 | size = 512; |
889 | } |
890 | size += 4; /* add in BIOS popup space */ |
891 | - } else if (IS_G33 && !IS_PINEVIEW) { |
892 | - /* G33's GTT size defined in gmch_ctrl */ |
893 | - switch (gmch_ctrl & G33_PGETBL_SIZE_MASK) { |
894 | - case G33_PGETBL_SIZE_1M: |
895 | - size = 1024; |
896 | - break; |
897 | - case G33_PGETBL_SIZE_2M: |
898 | - size = 2048; |
899 | - break; |
900 | - default: |
901 | - dev_info(&agp_bridge->dev->dev, |
902 | - "unknown page table size 0x%x, assuming 512KB\n", |
903 | - (gmch_ctrl & G33_PGETBL_SIZE_MASK)); |
904 | - size = 512; |
905 | - } |
906 | - size += 4; |
907 | } else if (IS_G4X || IS_PINEVIEW) { |
908 | /* On 4 series hardware, GTT stolen is separate from graphics |
909 | * stolen, ignore it in stolen gtt entries counting. However, |
910 | @@ -1257,24 +1241,31 @@ static int intel_i915_get_gtt_size(void) |
911 | int size; |
912 | |
913 | if (IS_G33) { |
914 | - u16 gmch_ctrl; |
915 | + u32 pgetbl_ctl; |
916 | + pgetbl_ctl = readl(intel_private.registers+I810_PGETBL_CTL); |
917 | |
918 | - /* G33's GTT size defined in gmch_ctrl */ |
919 | - pci_read_config_word(agp_bridge->dev, I830_GMCH_CTRL, &gmch_ctrl); |
920 | - switch (gmch_ctrl & I830_GMCH_GMS_MASK) { |
921 | - case I830_GMCH_GMS_STOLEN_512: |
922 | + switch (pgetbl_ctl & I965_PGETBL_SIZE_MASK) { |
923 | + case I965_PGETBL_SIZE_128KB: |
924 | + size = 128; |
925 | + break; |
926 | + case I965_PGETBL_SIZE_256KB: |
927 | + size = 256; |
928 | + break; |
929 | + case I965_PGETBL_SIZE_512KB: |
930 | size = 512; |
931 | break; |
932 | - case I830_GMCH_GMS_STOLEN_1024: |
933 | + case I965_PGETBL_SIZE_1MB: |
934 | size = 1024; |
935 | break; |
936 | - case I830_GMCH_GMS_STOLEN_8192: |
937 | - size = 8*1024; |
938 | + case I965_PGETBL_SIZE_2MB: |
939 | + size = 2048; |
940 | + break; |
941 | + case I965_PGETBL_SIZE_1_5MB: |
942 | + size = 1024 + 512; |
943 | break; |
944 | default: |
945 | - dev_info(&agp_bridge->dev->dev, |
946 | - "unknown page table size 0x%x, assuming 512KB\n", |
947 | - (gmch_ctrl & I830_GMCH_GMS_MASK)); |
948 | + dev_info(&intel_private.pcidev->dev, |
949 | + "unknown page table size, assuming 512KB\n"); |
950 | size = 512; |
951 | } |
952 | } else { |
953 | @@ -1306,14 +1297,6 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge) |
954 | pci_read_config_dword(intel_private.pcidev, I915_MMADDR, &temp); |
955 | pci_read_config_dword(intel_private.pcidev, I915_PTEADDR, &temp2); |
956 | |
957 | - gtt_map_size = intel_i915_get_gtt_size(); |
958 | - |
959 | - intel_private.gtt = ioremap(temp2, gtt_map_size); |
960 | - if (!intel_private.gtt) |
961 | - return -ENOMEM; |
962 | - |
963 | - intel_private.gtt_total_size = gtt_map_size / 4; |
964 | - |
965 | temp &= 0xfff80000; |
966 | |
967 | intel_private.registers = ioremap(temp, 128 * 4096); |
968 | @@ -1322,6 +1305,14 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge) |
969 | return -ENOMEM; |
970 | } |
971 | |
972 | + gtt_map_size = intel_i915_get_gtt_size(); |
973 | + |
974 | + intel_private.gtt = ioremap(temp2, gtt_map_size); |
975 | + if (!intel_private.gtt) |
976 | + return -ENOMEM; |
977 | + |
978 | + intel_private.gtt_total_size = gtt_map_size / 4; |
979 | + |
980 | temp = readl(intel_private.registers+I810_PGETBL_CTL) & 0xfffff000; |
981 | global_cache_flush(); /* FIXME: ? */ |
982 | |
983 | diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c |
984 | index a0a1829..f8e7d89 100644 |
985 | --- a/drivers/char/hpet.c |
986 | +++ b/drivers/char/hpet.c |
987 | @@ -479,6 +479,21 @@ static int hpet_ioctl_ieon(struct hpet_dev *devp) |
988 | if (irq) { |
989 | unsigned long irq_flags; |
990 | |
991 | + if (devp->hd_flags & HPET_SHARED_IRQ) { |
992 | + /* |
993 | + * To prevent the interrupt handler from seeing an |
994 | + * unwanted interrupt status bit, program the timer |
995 | + * so that it will not fire in the near future ... |
996 | + */ |
997 | + writel(readl(&timer->hpet_config) & ~Tn_TYPE_CNF_MASK, |
998 | + &timer->hpet_config); |
999 | + write_counter(read_counter(&hpet->hpet_mc), |
1000 | + &timer->hpet_compare); |
1001 | + /* ... and clear any left-over status. */ |
1002 | + isr = 1 << (devp - devp->hd_hpets->hp_dev); |
1003 | + writel(isr, &hpet->hpet_isr); |
1004 | + } |
1005 | + |
1006 | sprintf(devp->hd_name, "hpet%d", (int)(devp - hpetp->hp_dev)); |
1007 | irq_flags = devp->hd_flags & HPET_SHARED_IRQ |
1008 | ? IRQF_SHARED : IRQF_DISABLED; |
1009 | @@ -970,6 +985,8 @@ static int hpet_acpi_add(struct acpi_device *device) |
1010 | return -ENODEV; |
1011 | |
1012 | if (!data.hd_address || !data.hd_nirqs) { |
1013 | + if (data.hd_address) |
1014 | + iounmap(data.hd_address); |
1015 | printk("%s: no address or irqs in _CRS\n", __func__); |
1016 | return -ENODEV; |
1017 | } |
1018 | diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c |
1019 | index 7bd7c45..501f115 100644 |
1020 | --- a/drivers/char/ipmi/ipmi_si_intf.c |
1021 | +++ b/drivers/char/ipmi/ipmi_si_intf.c |
1022 | @@ -1665,6 +1665,17 @@ static int check_hotmod_int_op(const char *curr, const char *option, |
1023 | return 0; |
1024 | } |
1025 | |
1026 | +static struct smi_info *smi_info_alloc(void) |
1027 | +{ |
1028 | + struct smi_info *info = kzalloc(sizeof(*info), GFP_KERNEL); |
1029 | + |
1030 | + if (info) { |
1031 | + spin_lock_init(&info->si_lock); |
1032 | + spin_lock_init(&info->msg_lock); |
1033 | + } |
1034 | + return info; |
1035 | +} |
1036 | + |
1037 | static int hotmod_handler(const char *val, struct kernel_param *kp) |
1038 | { |
1039 | char *str = kstrdup(val, GFP_KERNEL); |
1040 | @@ -1779,7 +1790,7 @@ static int hotmod_handler(const char *val, struct kernel_param *kp) |
1041 | } |
1042 | |
1043 | if (op == HM_ADD) { |
1044 | - info = kzalloc(sizeof(*info), GFP_KERNEL); |
1045 | + info = smi_info_alloc(); |
1046 | if (!info) { |
1047 | rv = -ENOMEM; |
1048 | goto out; |
1049 | @@ -1844,7 +1855,7 @@ static __devinit void hardcode_find_bmc(void) |
1050 | if (!ports[i] && !addrs[i]) |
1051 | continue; |
1052 | |
1053 | - info = kzalloc(sizeof(*info), GFP_KERNEL); |
1054 | + info = smi_info_alloc(); |
1055 | if (!info) |
1056 | return; |
1057 | |
1058 | @@ -2028,7 +2039,7 @@ static __devinit int try_init_spmi(struct SPMITable *spmi) |
1059 | return -ENODEV; |
1060 | } |
1061 | |
1062 | - info = kzalloc(sizeof(*info), GFP_KERNEL); |
1063 | + info = smi_info_alloc(); |
1064 | if (!info) { |
1065 | printk(KERN_ERR PFX "Could not allocate SI data (3)\n"); |
1066 | return -ENOMEM; |
1067 | @@ -2138,7 +2149,7 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev, |
1068 | if (!acpi_dev) |
1069 | return -ENODEV; |
1070 | |
1071 | - info = kzalloc(sizeof(*info), GFP_KERNEL); |
1072 | + info = smi_info_alloc(); |
1073 | if (!info) |
1074 | return -ENOMEM; |
1075 | |
1076 | @@ -2319,7 +2330,7 @@ static __devinit void try_init_dmi(struct dmi_ipmi_data *ipmi_data) |
1077 | { |
1078 | struct smi_info *info; |
1079 | |
1080 | - info = kzalloc(sizeof(*info), GFP_KERNEL); |
1081 | + info = smi_info_alloc(); |
1082 | if (!info) { |
1083 | printk(KERN_ERR PFX "Could not allocate SI data\n"); |
1084 | return; |
1085 | @@ -2426,7 +2437,7 @@ static int __devinit ipmi_pci_probe(struct pci_dev *pdev, |
1086 | int class_type = pdev->class & PCI_ERMC_CLASSCODE_TYPE_MASK; |
1087 | struct smi_info *info; |
1088 | |
1089 | - info = kzalloc(sizeof(*info), GFP_KERNEL); |
1090 | + info = smi_info_alloc(); |
1091 | if (!info) |
1092 | return -ENOMEM; |
1093 | |
1094 | @@ -2567,7 +2578,7 @@ static int __devinit ipmi_of_probe(struct platform_device *dev, |
1095 | return -EINVAL; |
1096 | } |
1097 | |
1098 | - info = kzalloc(sizeof(*info), GFP_KERNEL); |
1099 | + info = smi_info_alloc(); |
1100 | |
1101 | if (!info) { |
1102 | dev_err(&dev->dev, |
1103 | @@ -3014,7 +3025,7 @@ static __devinit void default_find_bmc(void) |
1104 | if (check_legacy_ioport(ipmi_defaults[i].port)) |
1105 | continue; |
1106 | #endif |
1107 | - info = kzalloc(sizeof(*info), GFP_KERNEL); |
1108 | + info = smi_info_alloc(); |
1109 | if (!info) |
1110 | return; |
1111 | |
1112 | @@ -3139,9 +3150,6 @@ static int try_smi_init(struct smi_info *new_smi) |
1113 | goto out_err; |
1114 | } |
1115 | |
1116 | - spin_lock_init(&(new_smi->si_lock)); |
1117 | - spin_lock_init(&(new_smi->msg_lock)); |
1118 | - |
1119 | /* Do low-level detection first. */ |
1120 | if (new_smi->handlers->detect(new_smi->si_sm)) { |
1121 | if (new_smi->addr_source) |
1122 | diff --git a/drivers/char/tty_buffer.c b/drivers/char/tty_buffer.c |
1123 | index cc1e985..d8210ca 100644 |
1124 | --- a/drivers/char/tty_buffer.c |
1125 | +++ b/drivers/char/tty_buffer.c |
1126 | @@ -413,7 +413,8 @@ static void flush_to_ldisc(struct work_struct *work) |
1127 | spin_lock_irqsave(&tty->buf.lock, flags); |
1128 | |
1129 | if (!test_and_set_bit(TTY_FLUSHING, &tty->flags)) { |
1130 | - struct tty_buffer *head; |
1131 | + struct tty_buffer *head, *tail = tty->buf.tail; |
1132 | + int seen_tail = 0; |
1133 | while ((head = tty->buf.head) != NULL) { |
1134 | int count; |
1135 | char *char_buf; |
1136 | @@ -423,6 +424,15 @@ static void flush_to_ldisc(struct work_struct *work) |
1137 | if (!count) { |
1138 | if (head->next == NULL) |
1139 | break; |
1140 | + /* |
1141 | + There's a possibility tty might get new buffer |
1142 | + added during the unlock window below. We could |
1143 | + end up spinning in here forever hogging the CPU |
1144 | + completely. To avoid this let's have a rest each |
1145 | + time we processed the tail buffer. |
1146 | + */ |
1147 | + if (tail == head) |
1148 | + seen_tail = 1; |
1149 | tty->buf.head = head->next; |
1150 | tty_buffer_free(tty, head); |
1151 | continue; |
1152 | @@ -432,7 +442,7 @@ static void flush_to_ldisc(struct work_struct *work) |
1153 | line discipline as we want to empty the queue */ |
1154 | if (test_bit(TTY_FLUSHPENDING, &tty->flags)) |
1155 | break; |
1156 | - if (!tty->receive_room) { |
1157 | + if (!tty->receive_room || seen_tail) { |
1158 | schedule_delayed_work(&tty->buf.work, 1); |
1159 | break; |
1160 | } |
1161 | diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c |
1162 | index 613c852..e0f7f4b 100644 |
1163 | --- a/drivers/char/tty_io.c |
1164 | +++ b/drivers/char/tty_io.c |
1165 | @@ -553,6 +553,9 @@ void __tty_hangup(struct tty_struct *tty) |
1166 | |
1167 | tty_lock(); |
1168 | |
1169 | + /* some functions below drop BTM, so we need this bit */ |
1170 | + set_bit(TTY_HUPPING, &tty->flags); |
1171 | + |
1172 | /* inuse_filps is protected by the single tty lock, |
1173 | this really needs to change if we want to flush the |
1174 | workqueue with the lock held */ |
1175 | @@ -572,6 +575,10 @@ void __tty_hangup(struct tty_struct *tty) |
1176 | } |
1177 | spin_unlock(&tty_files_lock); |
1178 | |
1179 | + /* |
1180 | + * it drops BTM and thus races with reopen |
1181 | + * we protect the race by TTY_HUPPING |
1182 | + */ |
1183 | tty_ldisc_hangup(tty); |
1184 | |
1185 | read_lock(&tasklist_lock); |
1186 | @@ -609,7 +616,6 @@ void __tty_hangup(struct tty_struct *tty) |
1187 | tty->session = NULL; |
1188 | tty->pgrp = NULL; |
1189 | tty->ctrl_status = 0; |
1190 | - set_bit(TTY_HUPPED, &tty->flags); |
1191 | spin_unlock_irqrestore(&tty->ctrl_lock, flags); |
1192 | |
1193 | /* Account for the p->signal references we killed */ |
1194 | @@ -635,6 +641,7 @@ void __tty_hangup(struct tty_struct *tty) |
1195 | * can't yet guarantee all that. |
1196 | */ |
1197 | set_bit(TTY_HUPPED, &tty->flags); |
1198 | + clear_bit(TTY_HUPPING, &tty->flags); |
1199 | tty_ldisc_enable(tty); |
1200 | |
1201 | tty_unlock(); |
1202 | @@ -1304,7 +1311,9 @@ static int tty_reopen(struct tty_struct *tty) |
1203 | { |
1204 | struct tty_driver *driver = tty->driver; |
1205 | |
1206 | - if (test_bit(TTY_CLOSING, &tty->flags)) |
1207 | + if (test_bit(TTY_CLOSING, &tty->flags) || |
1208 | + test_bit(TTY_HUPPING, &tty->flags) || |
1209 | + test_bit(TTY_LDISC_CHANGING, &tty->flags)) |
1210 | return -EIO; |
1211 | |
1212 | if (driver->type == TTY_DRIVER_TYPE_PTY && |
1213 | diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c |
1214 | index 412f977..4214d58 100644 |
1215 | --- a/drivers/char/tty_ldisc.c |
1216 | +++ b/drivers/char/tty_ldisc.c |
1217 | @@ -47,6 +47,7 @@ |
1218 | |
1219 | static DEFINE_SPINLOCK(tty_ldisc_lock); |
1220 | static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_wait); |
1221 | +static DECLARE_WAIT_QUEUE_HEAD(tty_ldisc_idle); |
1222 | /* Line disc dispatch table */ |
1223 | static struct tty_ldisc_ops *tty_ldiscs[NR_LDISCS]; |
1224 | |
1225 | @@ -83,6 +84,7 @@ static void put_ldisc(struct tty_ldisc *ld) |
1226 | return; |
1227 | } |
1228 | local_irq_restore(flags); |
1229 | + wake_up(&tty_ldisc_idle); |
1230 | } |
1231 | |
1232 | /** |
1233 | @@ -452,6 +454,8 @@ static int tty_ldisc_open(struct tty_struct *tty, struct tty_ldisc *ld) |
1234 | /* BTM here locks versus a hangup event */ |
1235 | WARN_ON(!tty_locked()); |
1236 | ret = ld->ops->open(tty); |
1237 | + if (ret) |
1238 | + clear_bit(TTY_LDISC_OPEN, &tty->flags); |
1239 | return ret; |
1240 | } |
1241 | return 0; |
1242 | @@ -531,6 +535,23 @@ static int tty_ldisc_halt(struct tty_struct *tty) |
1243 | } |
1244 | |
1245 | /** |
1246 | + * tty_ldisc_wait_idle - wait for the ldisc to become idle |
1247 | + * @tty: tty to wait for |
1248 | + * |
1249 | + * Wait for the line discipline to become idle. The discipline must |
1250 | + * have been halted for this to guarantee it remains idle. |
1251 | + */ |
1252 | +static int tty_ldisc_wait_idle(struct tty_struct *tty) |
1253 | +{ |
1254 | + int ret; |
1255 | + ret = wait_event_interruptible_timeout(tty_ldisc_idle, |
1256 | + atomic_read(&tty->ldisc->users) == 1, 5 * HZ); |
1257 | + if (ret < 0) |
1258 | + return ret; |
1259 | + return ret > 0 ? 0 : -EBUSY; |
1260 | +} |
1261 | + |
1262 | +/** |
1263 | * tty_set_ldisc - set line discipline |
1264 | * @tty: the terminal to set |
1265 | * @ldisc: the line discipline |
1266 | @@ -634,8 +655,17 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) |
1267 | |
1268 | flush_scheduled_work(); |
1269 | |
1270 | + retval = tty_ldisc_wait_idle(tty); |
1271 | + |
1272 | tty_lock(); |
1273 | mutex_lock(&tty->ldisc_mutex); |
1274 | + |
1275 | + /* handle wait idle failure locked */ |
1276 | + if (retval) { |
1277 | + tty_ldisc_put(new_ldisc); |
1278 | + goto enable; |
1279 | + } |
1280 | + |
1281 | if (test_bit(TTY_HUPPED, &tty->flags)) { |
1282 | /* We were raced by the hangup method. It will have stomped |
1283 | the ldisc data and closed the ldisc down */ |
1284 | @@ -669,6 +699,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) |
1285 | |
1286 | tty_ldisc_put(o_ldisc); |
1287 | |
1288 | +enable: |
1289 | /* |
1290 | * Allow ldisc referencing to occur again |
1291 | */ |
1292 | @@ -714,9 +745,12 @@ static void tty_reset_termios(struct tty_struct *tty) |
1293 | * state closed |
1294 | */ |
1295 | |
1296 | -static void tty_ldisc_reinit(struct tty_struct *tty, int ldisc) |
1297 | +static int tty_ldisc_reinit(struct tty_struct *tty, int ldisc) |
1298 | { |
1299 | - struct tty_ldisc *ld; |
1300 | + struct tty_ldisc *ld = tty_ldisc_get(ldisc); |
1301 | + |
1302 | + if (IS_ERR(ld)) |
1303 | + return -1; |
1304 | |
1305 | tty_ldisc_close(tty, tty->ldisc); |
1306 | tty_ldisc_put(tty->ldisc); |
1307 | @@ -724,10 +758,10 @@ static void tty_ldisc_reinit(struct tty_struct *tty, int ldisc) |
1308 | /* |
1309 | * Switch the line discipline back |
1310 | */ |
1311 | - ld = tty_ldisc_get(ldisc); |
1312 | - BUG_ON(IS_ERR(ld)); |
1313 | tty_ldisc_assign(tty, ld); |
1314 | tty_set_termios_ldisc(tty, ldisc); |
1315 | + |
1316 | + return 0; |
1317 | } |
1318 | |
1319 | /** |
1320 | @@ -802,13 +836,16 @@ void tty_ldisc_hangup(struct tty_struct *tty) |
1321 | a FIXME */ |
1322 | if (tty->ldisc) { /* Not yet closed */ |
1323 | if (reset == 0) { |
1324 | - tty_ldisc_reinit(tty, tty->termios->c_line); |
1325 | - err = tty_ldisc_open(tty, tty->ldisc); |
1326 | + |
1327 | + if (!tty_ldisc_reinit(tty, tty->termios->c_line)) |
1328 | + err = tty_ldisc_open(tty, tty->ldisc); |
1329 | + else |
1330 | + err = 1; |
1331 | } |
1332 | /* If the re-open fails or we reset then go to N_TTY. The |
1333 | N_TTY open cannot fail */ |
1334 | if (reset || err) { |
1335 | - tty_ldisc_reinit(tty, N_TTY); |
1336 | + BUG_ON(tty_ldisc_reinit(tty, N_TTY)); |
1337 | WARN_ON(tty_ldisc_open(tty, tty->ldisc)); |
1338 | } |
1339 | tty_ldisc_enable(tty); |
1340 | diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c |
1341 | index 38df8c1..6b68a0f 100644 |
1342 | --- a/drivers/char/vt_ioctl.c |
1343 | +++ b/drivers/char/vt_ioctl.c |
1344 | @@ -503,6 +503,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, |
1345 | struct kbd_struct * kbd; |
1346 | unsigned int console; |
1347 | unsigned char ucval; |
1348 | + unsigned int uival; |
1349 | void __user *up = (void __user *)arg; |
1350 | int i, perm; |
1351 | int ret = 0; |
1352 | @@ -657,7 +658,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, |
1353 | break; |
1354 | |
1355 | case KDGETMODE: |
1356 | - ucval = vc->vc_mode; |
1357 | + uival = vc->vc_mode; |
1358 | goto setint; |
1359 | |
1360 | case KDMAPDISP: |
1361 | @@ -695,7 +696,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, |
1362 | break; |
1363 | |
1364 | case KDGKBMODE: |
1365 | - ucval = ((kbd->kbdmode == VC_RAW) ? K_RAW : |
1366 | + uival = ((kbd->kbdmode == VC_RAW) ? K_RAW : |
1367 | (kbd->kbdmode == VC_MEDIUMRAW) ? K_MEDIUMRAW : |
1368 | (kbd->kbdmode == VC_UNICODE) ? K_UNICODE : |
1369 | K_XLATE); |
1370 | @@ -717,9 +718,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, |
1371 | break; |
1372 | |
1373 | case KDGKBMETA: |
1374 | - ucval = (vc_kbd_mode(kbd, VC_META) ? K_ESCPREFIX : K_METABIT); |
1375 | + uival = (vc_kbd_mode(kbd, VC_META) ? K_ESCPREFIX : K_METABIT); |
1376 | setint: |
1377 | - ret = put_user(ucval, (int __user *)arg); |
1378 | + ret = put_user(uival, (int __user *)arg); |
1379 | break; |
1380 | |
1381 | case KDGETKEYCODE: |
1382 | @@ -949,7 +950,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, |
1383 | for (i = 0; i < MAX_NR_CONSOLES; ++i) |
1384 | if (! VT_IS_IN_USE(i)) |
1385 | break; |
1386 | - ucval = i < MAX_NR_CONSOLES ? (i+1) : -1; |
1387 | + uival = i < MAX_NR_CONSOLES ? (i+1) : -1; |
1388 | goto setint; |
1389 | |
1390 | /* |
1391 | diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c |
1392 | index 2e992bc..8a515ba 100644 |
1393 | --- a/drivers/crypto/padlock-aes.c |
1394 | +++ b/drivers/crypto/padlock-aes.c |
1395 | @@ -286,7 +286,7 @@ static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key, |
1396 | if (initial) |
1397 | asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */ |
1398 | : "+S" (input), "+D" (output), "+a" (iv) |
1399 | - : "d" (control_word), "b" (key), "c" (count)); |
1400 | + : "d" (control_word), "b" (key), "c" (initial)); |
1401 | |
1402 | asm volatile (".byte 0xf3,0x0f,0xa7,0xd0" /* rep xcryptcbc */ |
1403 | : "+S" (input), "+D" (output), "+a" (iv) |
1404 | diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c |
1405 | index 9dcb17d..7570b71 100644 |
1406 | --- a/drivers/firewire/ohci.c |
1407 | +++ b/drivers/firewire/ohci.c |
1408 | @@ -739,7 +739,7 @@ static void ar_context_tasklet(unsigned long data) |
1409 | d = &ab->descriptor; |
1410 | |
1411 | if (d->res_count == 0) { |
1412 | - size_t size, rest, offset; |
1413 | + size_t size, size2, rest, pktsize, size3, offset; |
1414 | dma_addr_t start_bus; |
1415 | void *start; |
1416 | |
1417 | @@ -750,25 +750,61 @@ static void ar_context_tasklet(unsigned long data) |
1418 | */ |
1419 | |
1420 | offset = offsetof(struct ar_buffer, data); |
1421 | - start = buffer = ab; |
1422 | + start = ab; |
1423 | start_bus = le32_to_cpu(ab->descriptor.data_address) - offset; |
1424 | + buffer = ab->data; |
1425 | |
1426 | ab = ab->next; |
1427 | d = &ab->descriptor; |
1428 | - size = buffer + PAGE_SIZE - ctx->pointer; |
1429 | + size = start + PAGE_SIZE - ctx->pointer; |
1430 | + /* valid buffer data in the next page */ |
1431 | rest = le16_to_cpu(d->req_count) - le16_to_cpu(d->res_count); |
1432 | + /* what actually fits in this page */ |
1433 | + size2 = min(rest, (size_t)PAGE_SIZE - offset - size); |
1434 | memmove(buffer, ctx->pointer, size); |
1435 | - memcpy(buffer + size, ab->data, rest); |
1436 | - ctx->current_buffer = ab; |
1437 | - ctx->pointer = (void *) ab->data + rest; |
1438 | - end = buffer + size + rest; |
1439 | + memcpy(buffer + size, ab->data, size2); |
1440 | + |
1441 | + while (size > 0) { |
1442 | + void *next = handle_ar_packet(ctx, buffer); |
1443 | + pktsize = next - buffer; |
1444 | + if (pktsize >= size) { |
1445 | + /* |
1446 | + * We have handled all the data that was |
1447 | + * originally in this page, so we can now |
1448 | + * continue in the next page. |
1449 | + */ |
1450 | + buffer = next; |
1451 | + break; |
1452 | + } |
1453 | + /* move the next packet to the start of the buffer */ |
1454 | + memmove(buffer, next, size + size2 - pktsize); |
1455 | + size -= pktsize; |
1456 | + /* fill up this page again */ |
1457 | + size3 = min(rest - size2, |
1458 | + (size_t)PAGE_SIZE - offset - size - size2); |
1459 | + memcpy(buffer + size + size2, |
1460 | + (void *) ab->data + size2, size3); |
1461 | + size2 += size3; |
1462 | + } |
1463 | |
1464 | - while (buffer < end) |
1465 | - buffer = handle_ar_packet(ctx, buffer); |
1466 | + if (rest > 0) { |
1467 | + /* handle the packets that are fully in the next page */ |
1468 | + buffer = (void *) ab->data + |
1469 | + (buffer - (start + offset + size)); |
1470 | + end = (void *) ab->data + rest; |
1471 | + |
1472 | + while (buffer < end) |
1473 | + buffer = handle_ar_packet(ctx, buffer); |
1474 | |
1475 | - dma_free_coherent(ohci->card.device, PAGE_SIZE, |
1476 | - start, start_bus); |
1477 | - ar_context_add_page(ctx); |
1478 | + ctx->current_buffer = ab; |
1479 | + ctx->pointer = end; |
1480 | + |
1481 | + dma_free_coherent(ohci->card.device, PAGE_SIZE, |
1482 | + start, start_bus); |
1483 | + ar_context_add_page(ctx); |
1484 | + } else { |
1485 | + ctx->pointer = start + PAGE_SIZE; |
1486 | + } |
1487 | } else { |
1488 | buffer = ctx->pointer; |
1489 | ctx->pointer = end = |
1490 | diff --git a/drivers/gpio/cs5535-gpio.c b/drivers/gpio/cs5535-gpio.c |
1491 | index e23c068..599f6c9 100644 |
1492 | --- a/drivers/gpio/cs5535-gpio.c |
1493 | +++ b/drivers/gpio/cs5535-gpio.c |
1494 | @@ -56,6 +56,18 @@ static struct cs5535_gpio_chip { |
1495 | * registers, see include/linux/cs5535.h. |
1496 | */ |
1497 | |
1498 | +static void errata_outl(u32 val, unsigned long addr) |
1499 | +{ |
1500 | + /* |
1501 | + * According to the CS5536 errata (#36), after suspend |
1502 | + * a write to the high bank GPIO register will clear all |
1503 | + * non-selected bits; the recommended workaround is a |
1504 | + * read-modify-write operation. |
1505 | + */ |
1506 | + val |= inl(addr); |
1507 | + outl(val, addr); |
1508 | +} |
1509 | + |
1510 | static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, |
1511 | unsigned int reg) |
1512 | { |
1513 | @@ -64,7 +76,7 @@ static void __cs5535_gpio_set(struct cs5535_gpio_chip *chip, unsigned offset, |
1514 | outl(1 << offset, chip->base + reg); |
1515 | else |
1516 | /* high bank register */ |
1517 | - outl(1 << (offset - 16), chip->base + 0x80 + reg); |
1518 | + errata_outl(1 << (offset - 16), chip->base + 0x80 + reg); |
1519 | } |
1520 | |
1521 | void cs5535_gpio_set(unsigned offset, unsigned int reg) |
1522 | @@ -86,7 +98,7 @@ static void __cs5535_gpio_clear(struct cs5535_gpio_chip *chip, unsigned offset, |
1523 | outl(1 << (offset + 16), chip->base + reg); |
1524 | else |
1525 | /* high bank register */ |
1526 | - outl(1 << offset, chip->base + 0x80 + reg); |
1527 | + errata_outl(1 << offset, chip->base + 0x80 + reg); |
1528 | } |
1529 | |
1530 | void cs5535_gpio_clear(unsigned offset, unsigned int reg) |
1531 | diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c |
1532 | index 2dd2c93..71c69b8 100644 |
1533 | --- a/drivers/gpu/drm/i915/i915_dma.c |
1534 | +++ b/drivers/gpu/drm/i915/i915_dma.c |
1535 | @@ -2306,6 +2306,9 @@ int i915_driver_unload(struct drm_device *dev) |
1536 | i915_gem_lastclose(dev); |
1537 | |
1538 | intel_cleanup_overlay(dev); |
1539 | + |
1540 | + if (!I915_NEED_GFX_HWS(dev)) |
1541 | + i915_free_hws(dev); |
1542 | } |
1543 | |
1544 | intel_teardown_mchbar(dev); |
1545 | diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c |
1546 | index 744225e..477e4ac 100644 |
1547 | --- a/drivers/gpu/drm/i915/i915_irq.c |
1548 | +++ b/drivers/gpu/drm/i915/i915_irq.c |
1549 | @@ -310,6 +310,7 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev) |
1550 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
1551 | int ret = IRQ_NONE; |
1552 | u32 de_iir, gt_iir, de_ier, pch_iir; |
1553 | + u32 hotplug_mask; |
1554 | struct drm_i915_master_private *master_priv; |
1555 | struct intel_ring_buffer *render_ring = &dev_priv->render_ring; |
1556 | |
1557 | @@ -325,6 +326,11 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev) |
1558 | if (de_iir == 0 && gt_iir == 0 && pch_iir == 0) |
1559 | goto done; |
1560 | |
1561 | + if (HAS_PCH_CPT(dev)) |
1562 | + hotplug_mask = SDE_HOTPLUG_MASK_CPT; |
1563 | + else |
1564 | + hotplug_mask = SDE_HOTPLUG_MASK; |
1565 | + |
1566 | ret = IRQ_HANDLED; |
1567 | |
1568 | if (dev->primary->master) { |
1569 | @@ -366,10 +372,8 @@ irqreturn_t ironlake_irq_handler(struct drm_device *dev) |
1570 | drm_handle_vblank(dev, 1); |
1571 | |
1572 | /* check event from PCH */ |
1573 | - if ((de_iir & DE_PCH_EVENT) && |
1574 | - (pch_iir & SDE_HOTPLUG_MASK)) { |
1575 | + if ((de_iir & DE_PCH_EVENT) && (pch_iir & hotplug_mask)) |
1576 | queue_work(dev_priv->wq, &dev_priv->hotplug_work); |
1577 | - } |
1578 | |
1579 | if (de_iir & DE_PCU_EVENT) { |
1580 | I915_WRITE16(MEMINTRSTS, I915_READ(MEMINTRSTS)); |
1581 | @@ -1424,8 +1428,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev) |
1582 | u32 display_mask = DE_MASTER_IRQ_CONTROL | DE_GSE | DE_PCH_EVENT | |
1583 | DE_PLANEA_FLIP_DONE | DE_PLANEB_FLIP_DONE; |
1584 | u32 render_mask = GT_PIPE_NOTIFY | GT_BSD_USER_INTERRUPT; |
1585 | - u32 hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG | |
1586 | - SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG; |
1587 | + u32 hotplug_mask; |
1588 | |
1589 | dev_priv->irq_mask_reg = ~display_mask; |
1590 | dev_priv->de_irq_enable_reg = display_mask | DE_PIPEA_VBLANK | DE_PIPEB_VBLANK; |
1591 | @@ -1450,6 +1453,14 @@ static int ironlake_irq_postinstall(struct drm_device *dev) |
1592 | I915_WRITE(GTIER, dev_priv->gt_irq_enable_reg); |
1593 | (void) I915_READ(GTIER); |
1594 | |
1595 | + if (HAS_PCH_CPT(dev)) { |
1596 | + hotplug_mask = SDE_CRT_HOTPLUG_CPT | SDE_PORTB_HOTPLUG_CPT | |
1597 | + SDE_PORTC_HOTPLUG_CPT | SDE_PORTD_HOTPLUG_CPT ; |
1598 | + } else { |
1599 | + hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG | |
1600 | + SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG; |
1601 | + } |
1602 | + |
1603 | dev_priv->pch_irq_mask_reg = ~hotplug_mask; |
1604 | dev_priv->pch_irq_enable_reg = hotplug_mask; |
1605 | |
1606 | diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h |
1607 | index 4f5e155..249addb 100644 |
1608 | --- a/drivers/gpu/drm/i915/i915_reg.h |
1609 | +++ b/drivers/gpu/drm/i915/i915_reg.h |
1610 | @@ -2551,6 +2551,10 @@ |
1611 | #define SDE_PORTD_HOTPLUG_CPT (1 << 23) |
1612 | #define SDE_PORTC_HOTPLUG_CPT (1 << 22) |
1613 | #define SDE_PORTB_HOTPLUG_CPT (1 << 21) |
1614 | +#define SDE_HOTPLUG_MASK_CPT (SDE_CRT_HOTPLUG_CPT | \ |
1615 | + SDE_PORTD_HOTPLUG_CPT | \ |
1616 | + SDE_PORTC_HOTPLUG_CPT | \ |
1617 | + SDE_PORTB_HOTPLUG_CPT) |
1618 | |
1619 | #define SDEISR 0xc4000 |
1620 | #define SDEIMR 0xc4004 |
1621 | @@ -2722,6 +2726,9 @@ |
1622 | #define FDI_RXB_CHICKEN 0xc2010 |
1623 | #define FDI_RX_PHASE_SYNC_POINTER_ENABLE (1) |
1624 | |
1625 | +#define SOUTH_DSPCLK_GATE_D 0xc2020 |
1626 | +#define PCH_DPLSUNIT_CLOCK_GATE_DISABLE (1<<29) |
1627 | + |
1628 | /* CPU: FDI_TX */ |
1629 | #define FDI_TXA_CTL 0x60100 |
1630 | #define FDI_TXB_CTL 0x61100 |
1631 | diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c |
1632 | index 31f0858..2df5b9a 100644 |
1633 | --- a/drivers/gpu/drm/i915/i915_suspend.c |
1634 | +++ b/drivers/gpu/drm/i915/i915_suspend.c |
1635 | @@ -862,8 +862,10 @@ int i915_restore_state(struct drm_device *dev) |
1636 | /* Clock gating state */ |
1637 | intel_init_clock_gating(dev); |
1638 | |
1639 | - if (HAS_PCH_SPLIT(dev)) |
1640 | + if (HAS_PCH_SPLIT(dev)) { |
1641 | ironlake_enable_drps(dev); |
1642 | + intel_init_emon(dev); |
1643 | + } |
1644 | |
1645 | /* Cache mode state */ |
1646 | I915_WRITE (CACHE_MODE_0, dev_priv->saveCACHE_MODE_0 | 0xffff0000); |
1647 | diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c |
1648 | index 197d4f3..0f950e7 100644 |
1649 | --- a/drivers/gpu/drm/i915/intel_crt.c |
1650 | +++ b/drivers/gpu/drm/i915/intel_crt.c |
1651 | @@ -191,7 +191,8 @@ static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector) |
1652 | DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER"); |
1653 | |
1654 | if (turn_off_dac) { |
1655 | - I915_WRITE(PCH_ADPA, temp); |
1656 | + /* Make sure hotplug is enabled */ |
1657 | + I915_WRITE(PCH_ADPA, temp | ADPA_CRT_HOTPLUG_ENABLE); |
1658 | (void)I915_READ(PCH_ADPA); |
1659 | } |
1660 | |
1661 | diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c |
1662 | index 9792285..e92ba16 100644 |
1663 | --- a/drivers/gpu/drm/i915/intel_display.c |
1664 | +++ b/drivers/gpu/drm/i915/intel_display.c |
1665 | @@ -5674,6 +5674,13 @@ void intel_init_clock_gating(struct drm_device *dev) |
1666 | I915_WRITE(PCH_DSPCLK_GATE_D, dspclk_gate); |
1667 | |
1668 | /* |
1669 | + * On Ibex Peak and Cougar Point, we need to disable clock |
1670 | + * gating for the panel power sequencer or it will fail to |
1671 | + * start up when no ports are active. |
1672 | + */ |
1673 | + I915_WRITE(SOUTH_DSPCLK_GATE_D, PCH_DPLSUNIT_CLOCK_GATE_DISABLE); |
1674 | + |
1675 | + /* |
1676 | * According to the spec the following bits should be set in |
1677 | * order to enable memory self-refresh |
1678 | * The bit 22/21 of 0x42004 |
1679 | diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h |
1680 | index 8828b3a..2b16137 100644 |
1681 | --- a/drivers/gpu/drm/i915/intel_drv.h |
1682 | +++ b/drivers/gpu/drm/i915/intel_drv.h |
1683 | @@ -250,6 +250,7 @@ extern void intel_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, |
1684 | extern void intel_init_clock_gating(struct drm_device *dev); |
1685 | extern void ironlake_enable_drps(struct drm_device *dev); |
1686 | extern void ironlake_disable_drps(struct drm_device *dev); |
1687 | +extern void intel_init_emon(struct drm_device *dev); |
1688 | |
1689 | extern int intel_pin_and_fence_fb_obj(struct drm_device *dev, |
1690 | struct drm_gem_object *obj); |
1691 | diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c |
1692 | index 1d306a4..7436641 100644 |
1693 | --- a/drivers/gpu/drm/i915/intel_overlay.c |
1694 | +++ b/drivers/gpu/drm/i915/intel_overlay.c |
1695 | @@ -1367,6 +1367,12 @@ void intel_setup_overlay(struct drm_device *dev) |
1696 | goto out_free_bo; |
1697 | } |
1698 | overlay->flip_addr = overlay->reg_bo->gtt_offset; |
1699 | + |
1700 | + ret = i915_gem_object_set_to_gtt_domain(reg_bo, true); |
1701 | + if (ret) { |
1702 | + DRM_ERROR("failed to move overlay register bo into the GTT\n"); |
1703 | + goto out_unpin_bo; |
1704 | + } |
1705 | } else { |
1706 | ret = i915_gem_attach_phys_object(dev, reg_bo, |
1707 | I915_GEM_PHYS_OVERLAY_REGS, |
1708 | @@ -1399,6 +1405,8 @@ void intel_setup_overlay(struct drm_device *dev) |
1709 | DRM_INFO("initialized overlay support\n"); |
1710 | return; |
1711 | |
1712 | +out_unpin_bo: |
1713 | + i915_gem_object_unpin(reg_bo); |
1714 | out_free_bo: |
1715 | drm_gem_object_unreference(reg_bo); |
1716 | out_free: |
1717 | diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c |
1718 | index ee73e42..b60652b 100644 |
1719 | --- a/drivers/gpu/drm/i915/intel_sdvo.c |
1720 | +++ b/drivers/gpu/drm/i915/intel_sdvo.c |
1721 | @@ -1498,10 +1498,12 @@ intel_sdvo_detect(struct drm_connector *connector, bool force) |
1722 | if (!intel_sdvo_write_cmd(intel_sdvo, |
1723 | SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0)) |
1724 | return connector_status_unknown; |
1725 | - if (intel_sdvo->is_tv) { |
1726 | - /* add 30ms delay when the output type is SDVO-TV */ |
1727 | + |
1728 | + /* add 30ms delay when the output type might be TV */ |
1729 | + if (intel_sdvo->caps.output_flags & |
1730 | + (SDVO_OUTPUT_SVID0 | SDVO_OUTPUT_CVBS0)) |
1731 | mdelay(30); |
1732 | - } |
1733 | + |
1734 | if (!intel_sdvo_read_response(intel_sdvo, &response, 2)) |
1735 | return connector_status_unknown; |
1736 | |
1737 | diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c |
1738 | index 8e421f6..05efb5b 100644 |
1739 | --- a/drivers/gpu/drm/radeon/atom.c |
1740 | +++ b/drivers/gpu/drm/radeon/atom.c |
1741 | @@ -112,6 +112,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base, |
1742 | base += 3; |
1743 | break; |
1744 | case ATOM_IIO_WRITE: |
1745 | + (void)ctx->card->ioreg_read(ctx->card, CU16(base + 1)); |
1746 | ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp); |
1747 | base += 3; |
1748 | break; |
1749 | diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c |
1750 | index e594223..0ba4163 100644 |
1751 | --- a/drivers/gpu/drm/radeon/r100.c |
1752 | +++ b/drivers/gpu/drm/radeon/r100.c |
1753 | @@ -2318,6 +2318,9 @@ void r100_vram_init_sizes(struct radeon_device *rdev) |
1754 | /* Fix for RN50, M6, M7 with 8/16/32(??) MBs of VRAM - |
1755 | * Novell bug 204882 + along with lots of ubuntu ones |
1756 | */ |
1757 | + if (rdev->mc.aper_size > config_aper_size) |
1758 | + config_aper_size = rdev->mc.aper_size; |
1759 | + |
1760 | if (config_aper_size > rdev->mc.real_vram_size) |
1761 | rdev->mc.mc_vram_size = config_aper_size; |
1762 | else |
1763 | @@ -3225,6 +3228,8 @@ static int r100_cs_track_texture_check(struct radeon_device *rdev, |
1764 | for (u = 0; u < track->num_texture; u++) { |
1765 | if (!track->textures[u].enabled) |
1766 | continue; |
1767 | + if (track->textures[u].lookup_disable) |
1768 | + continue; |
1769 | robj = track->textures[u].robj; |
1770 | if (robj == NULL) { |
1771 | DRM_ERROR("No texture bound to unit %u\n", u); |
1772 | @@ -3459,6 +3464,7 @@ void r100_cs_track_clear(struct radeon_device *rdev, struct r100_cs_track *track |
1773 | track->textures[i].robj = NULL; |
1774 | /* CS IB emission code makes sure texture unit are disabled */ |
1775 | track->textures[i].enabled = false; |
1776 | + track->textures[i].lookup_disable = false; |
1777 | track->textures[i].roundup_w = true; |
1778 | track->textures[i].roundup_h = true; |
1779 | if (track->separate_cube) |
1780 | diff --git a/drivers/gpu/drm/radeon/r100_track.h b/drivers/gpu/drm/radeon/r100_track.h |
1781 | index f47cdca..af65600 100644 |
1782 | --- a/drivers/gpu/drm/radeon/r100_track.h |
1783 | +++ b/drivers/gpu/drm/radeon/r100_track.h |
1784 | @@ -46,6 +46,7 @@ struct r100_cs_track_texture { |
1785 | unsigned height_11; |
1786 | bool use_pitch; |
1787 | bool enabled; |
1788 | + bool lookup_disable; |
1789 | bool roundup_w; |
1790 | bool roundup_h; |
1791 | unsigned compress_format; |
1792 | diff --git a/drivers/gpu/drm/radeon/r200.c b/drivers/gpu/drm/radeon/r200.c |
1793 | index 0266d72..d2408c3 100644 |
1794 | --- a/drivers/gpu/drm/radeon/r200.c |
1795 | +++ b/drivers/gpu/drm/radeon/r200.c |
1796 | @@ -447,6 +447,8 @@ int r200_packet0_check(struct radeon_cs_parser *p, |
1797 | track->textures[i].width = 1 << ((idx_value >> RADEON_TXFORMAT_WIDTH_SHIFT) & RADEON_TXFORMAT_WIDTH_MASK); |
1798 | track->textures[i].height = 1 << ((idx_value >> RADEON_TXFORMAT_HEIGHT_SHIFT) & RADEON_TXFORMAT_HEIGHT_MASK); |
1799 | } |
1800 | + if (idx_value & R200_TXFORMAT_LOOKUP_DISABLE) |
1801 | + track->textures[i].lookup_disable = true; |
1802 | switch ((idx_value & RADEON_TXFORMAT_FORMAT_MASK)) { |
1803 | case R200_TXFORMAT_I8: |
1804 | case R200_TXFORMAT_RGB332: |
1805 | diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c |
1806 | index 7b65e4e..d4503df 100644 |
1807 | --- a/drivers/gpu/drm/radeon/r600.c |
1808 | +++ b/drivers/gpu/drm/radeon/r600.c |
1809 | @@ -97,14 +97,8 @@ u32 rv6xx_get_temp(struct radeon_device *rdev) |
1810 | { |
1811 | u32 temp = (RREG32(CG_THERMAL_STATUS) & ASIC_T_MASK) >> |
1812 | ASIC_T_SHIFT; |
1813 | - u32 actual_temp = 0; |
1814 | |
1815 | - if ((temp >> 7) & 1) |
1816 | - actual_temp = 0; |
1817 | - else |
1818 | - actual_temp = (temp >> 1) & 0xff; |
1819 | - |
1820 | - return actual_temp * 1000; |
1821 | + return temp * 1000; |
1822 | } |
1823 | |
1824 | void r600_pm_get_dynpm_state(struct radeon_device *rdev) |
1825 | @@ -1608,8 +1602,11 @@ void r600_gpu_init(struct radeon_device *rdev) |
1826 | rdev->config.r600.tiling_npipes = rdev->config.r600.max_tile_pipes; |
1827 | rdev->config.r600.tiling_nbanks = 4 << ((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); |
1828 | tiling_config |= BANK_TILING((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); |
1829 | - tiling_config |= GROUP_SIZE(0); |
1830 | - rdev->config.r600.tiling_group_size = 256; |
1831 | + tiling_config |= GROUP_SIZE((ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT); |
1832 | + if ((ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT) |
1833 | + rdev->config.r600.tiling_group_size = 512; |
1834 | + else |
1835 | + rdev->config.r600.tiling_group_size = 256; |
1836 | tmp = (ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT; |
1837 | if (tmp > 3) { |
1838 | tiling_config |= ROW_TILING(3); |
1839 | diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c |
1840 | index 3473c00..e5d4928 100644 |
1841 | --- a/drivers/gpu/drm/radeon/r600_blit_kms.c |
1842 | +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c |
1843 | @@ -650,8 +650,8 @@ void r600_kms_blit_copy(struct radeon_device *rdev, |
1844 | int src_x = src_gpu_addr & 255; |
1845 | int dst_x = dst_gpu_addr & 255; |
1846 | int h = 1; |
1847 | - src_gpu_addr = src_gpu_addr & ~255; |
1848 | - dst_gpu_addr = dst_gpu_addr & ~255; |
1849 | + src_gpu_addr = src_gpu_addr & ~255ULL; |
1850 | + dst_gpu_addr = dst_gpu_addr & ~255ULL; |
1851 | |
1852 | if (!src_x && !dst_x) { |
1853 | h = (cur_size / max_bytes); |
1854 | @@ -744,8 +744,8 @@ void r600_kms_blit_copy(struct radeon_device *rdev, |
1855 | int src_x = (src_gpu_addr & 255); |
1856 | int dst_x = (dst_gpu_addr & 255); |
1857 | int h = 1; |
1858 | - src_gpu_addr = src_gpu_addr & ~255; |
1859 | - dst_gpu_addr = dst_gpu_addr & ~255; |
1860 | + src_gpu_addr = src_gpu_addr & ~255ULL; |
1861 | + dst_gpu_addr = dst_gpu_addr & ~255ULL; |
1862 | |
1863 | if (!src_x && !dst_x) { |
1864 | h = (cur_size / max_bytes); |
1865 | diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c |
1866 | index 250a3a9..478fddf 100644 |
1867 | --- a/drivers/gpu/drm/radeon/r600_cs.c |
1868 | +++ b/drivers/gpu/drm/radeon/r600_cs.c |
1869 | @@ -228,7 +228,7 @@ static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i) |
1870 | __func__, __LINE__, pitch); |
1871 | return -EINVAL; |
1872 | } |
1873 | - if (!IS_ALIGNED((height / 8), track->nbanks)) { |
1874 | + if (!IS_ALIGNED((height / 8), track->npipes)) { |
1875 | dev_warn(p->dev, "%s:%d cb height (%d) invalid\n", |
1876 | __func__, __LINE__, height); |
1877 | return -EINVAL; |
1878 | @@ -367,7 +367,7 @@ static int r600_cs_track_check(struct radeon_cs_parser *p) |
1879 | __func__, __LINE__, pitch); |
1880 | return -EINVAL; |
1881 | } |
1882 | - if ((height / 8) & (track->nbanks - 1)) { |
1883 | + if (!IS_ALIGNED((height / 8), track->npipes)) { |
1884 | dev_warn(p->dev, "%s:%d db height (%d) invalid\n", |
1885 | __func__, __LINE__, height); |
1886 | return -EINVAL; |
1887 | diff --git a/drivers/gpu/drm/radeon/r600_reg.h b/drivers/gpu/drm/radeon/r600_reg.h |
1888 | index d84612a..33cda01 100644 |
1889 | --- a/drivers/gpu/drm/radeon/r600_reg.h |
1890 | +++ b/drivers/gpu/drm/radeon/r600_reg.h |
1891 | @@ -86,6 +86,7 @@ |
1892 | #define R600_HDP_NONSURFACE_BASE 0x2c04 |
1893 | |
1894 | #define R600_BUS_CNTL 0x5420 |
1895 | +# define R600_BIOS_ROM_DIS (1 << 1) |
1896 | #define R600_CONFIG_CNTL 0x5424 |
1897 | #define R600_CONFIG_MEMSIZE 0x5428 |
1898 | #define R600_CONFIG_F0_BASE 0x542C |
1899 | diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c |
1900 | index 8e43dda..3779265 100644 |
1901 | --- a/drivers/gpu/drm/radeon/radeon_atombios.c |
1902 | +++ b/drivers/gpu/drm/radeon/radeon_atombios.c |
1903 | @@ -98,6 +98,14 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev |
1904 | } |
1905 | } |
1906 | |
1907 | + /* some DCE3 boards have bad data for this entry */ |
1908 | + if (ASIC_IS_DCE3(rdev)) { |
1909 | + if ((i == 4) && |
1910 | + (gpio->usClkMaskRegisterIndex == 0x1fda) && |
1911 | + (gpio->sucI2cId.ucAccess == 0x94)) |
1912 | + gpio->sucI2cId.ucAccess = 0x14; |
1913 | + } |
1914 | + |
1915 | if (gpio->sucI2cId.ucAccess == id) { |
1916 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; |
1917 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; |
1918 | @@ -174,6 +182,14 @@ void radeon_atombios_i2c_init(struct radeon_device *rdev) |
1919 | } |
1920 | } |
1921 | |
1922 | + /* some DCE3 boards have bad data for this entry */ |
1923 | + if (ASIC_IS_DCE3(rdev)) { |
1924 | + if ((i == 4) && |
1925 | + (gpio->usClkMaskRegisterIndex == 0x1fda) && |
1926 | + (gpio->sucI2cId.ucAccess == 0x94)) |
1927 | + gpio->sucI2cId.ucAccess = 0x14; |
1928 | + } |
1929 | + |
1930 | i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; |
1931 | i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; |
1932 | i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; |
1933 | diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c |
1934 | index 654787e..8f2c7b5 100644 |
1935 | --- a/drivers/gpu/drm/radeon/radeon_bios.c |
1936 | +++ b/drivers/gpu/drm/radeon/radeon_bios.c |
1937 | @@ -130,6 +130,7 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev) |
1938 | } |
1939 | return true; |
1940 | } |
1941 | + |
1942 | static bool r700_read_disabled_bios(struct radeon_device *rdev) |
1943 | { |
1944 | uint32_t viph_control; |
1945 | @@ -143,7 +144,7 @@ static bool r700_read_disabled_bios(struct radeon_device *rdev) |
1946 | bool r; |
1947 | |
1948 | viph_control = RREG32(RADEON_VIPH_CONTROL); |
1949 | - bus_cntl = RREG32(RADEON_BUS_CNTL); |
1950 | + bus_cntl = RREG32(R600_BUS_CNTL); |
1951 | d1vga_control = RREG32(AVIVO_D1VGA_CONTROL); |
1952 | d2vga_control = RREG32(AVIVO_D2VGA_CONTROL); |
1953 | vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL); |
1954 | @@ -152,7 +153,7 @@ static bool r700_read_disabled_bios(struct radeon_device *rdev) |
1955 | /* disable VIP */ |
1956 | WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); |
1957 | /* enable the rom */ |
1958 | - WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM)); |
1959 | + WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS)); |
1960 | /* Disable VGA mode */ |
1961 | WREG32(AVIVO_D1VGA_CONTROL, |
1962 | (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | |
1963 | @@ -191,7 +192,7 @@ static bool r700_read_disabled_bios(struct radeon_device *rdev) |
1964 | cg_spll_status = RREG32(R600_CG_SPLL_STATUS); |
1965 | } |
1966 | WREG32(RADEON_VIPH_CONTROL, viph_control); |
1967 | - WREG32(RADEON_BUS_CNTL, bus_cntl); |
1968 | + WREG32(R600_BUS_CNTL, bus_cntl); |
1969 | WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); |
1970 | WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); |
1971 | WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); |
1972 | @@ -216,7 +217,7 @@ static bool r600_read_disabled_bios(struct radeon_device *rdev) |
1973 | bool r; |
1974 | |
1975 | viph_control = RREG32(RADEON_VIPH_CONTROL); |
1976 | - bus_cntl = RREG32(RADEON_BUS_CNTL); |
1977 | + bus_cntl = RREG32(R600_BUS_CNTL); |
1978 | d1vga_control = RREG32(AVIVO_D1VGA_CONTROL); |
1979 | d2vga_control = RREG32(AVIVO_D2VGA_CONTROL); |
1980 | vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL); |
1981 | @@ -231,7 +232,7 @@ static bool r600_read_disabled_bios(struct radeon_device *rdev) |
1982 | /* disable VIP */ |
1983 | WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); |
1984 | /* enable the rom */ |
1985 | - WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM)); |
1986 | + WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS)); |
1987 | /* Disable VGA mode */ |
1988 | WREG32(AVIVO_D1VGA_CONTROL, |
1989 | (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | |
1990 | @@ -262,7 +263,7 @@ static bool r600_read_disabled_bios(struct radeon_device *rdev) |
1991 | |
1992 | /* restore regs */ |
1993 | WREG32(RADEON_VIPH_CONTROL, viph_control); |
1994 | - WREG32(RADEON_BUS_CNTL, bus_cntl); |
1995 | + WREG32(R600_BUS_CNTL, bus_cntl); |
1996 | WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); |
1997 | WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); |
1998 | WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); |
1999 | diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c |
2000 | index 7b7ea26..137b807 100644 |
2001 | --- a/drivers/gpu/drm/radeon/radeon_combios.c |
2002 | +++ b/drivers/gpu/drm/radeon/radeon_combios.c |
2003 | @@ -571,6 +571,7 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde |
2004 | } |
2005 | |
2006 | if (clk_mask && data_mask) { |
2007 | + /* system specific masks */ |
2008 | i2c.mask_clk_mask = clk_mask; |
2009 | i2c.mask_data_mask = data_mask; |
2010 | i2c.a_clk_mask = clk_mask; |
2011 | @@ -579,7 +580,19 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde |
2012 | i2c.en_data_mask = data_mask; |
2013 | i2c.y_clk_mask = clk_mask; |
2014 | i2c.y_data_mask = data_mask; |
2015 | + } else if ((ddc_line == RADEON_GPIOPAD_MASK) || |
2016 | + (ddc_line == RADEON_MDGPIO_MASK)) { |
2017 | + /* default gpiopad masks */ |
2018 | + i2c.mask_clk_mask = (0x20 << 8); |
2019 | + i2c.mask_data_mask = 0x80; |
2020 | + i2c.a_clk_mask = (0x20 << 8); |
2021 | + i2c.a_data_mask = 0x80; |
2022 | + i2c.en_clk_mask = (0x20 << 8); |
2023 | + i2c.en_data_mask = 0x80; |
2024 | + i2c.y_clk_mask = (0x20 << 8); |
2025 | + i2c.y_data_mask = 0x80; |
2026 | } else { |
2027 | + /* default masks for ddc pads */ |
2028 | i2c.mask_clk_mask = RADEON_GPIO_EN_1; |
2029 | i2c.mask_data_mask = RADEON_GPIO_EN_0; |
2030 | i2c.a_clk_mask = RADEON_GPIO_A_1; |
2031 | @@ -716,7 +729,7 @@ void radeon_combios_i2c_init(struct radeon_device *rdev) |
2032 | clk = RBIOS8(offset + 3 + (i * 5) + 3); |
2033 | data = RBIOS8(offset + 3 + (i * 5) + 4); |
2034 | i2c = combios_setup_i2c_bus(rdev, DDC_MONID, |
2035 | - clk, data); |
2036 | + (1 << clk), (1 << data)); |
2037 | rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "GPIOPAD_MASK"); |
2038 | break; |
2039 | } |
2040 | diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c |
2041 | index ecc1a8f..5e222c9 100644 |
2042 | --- a/drivers/gpu/drm/radeon/radeon_connectors.c |
2043 | +++ b/drivers/gpu/drm/radeon/radeon_connectors.c |
2044 | @@ -1119,6 +1119,8 @@ radeon_add_atom_connector(struct drm_device *dev, |
2045 | /* no HPD on analog connectors */ |
2046 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
2047 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; |
2048 | + connector->interlace_allowed = true; |
2049 | + connector->doublescan_allowed = true; |
2050 | break; |
2051 | case DRM_MODE_CONNECTOR_DVIA: |
2052 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
2053 | @@ -1134,6 +1136,8 @@ radeon_add_atom_connector(struct drm_device *dev, |
2054 | 1); |
2055 | /* no HPD on analog connectors */ |
2056 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
2057 | + connector->interlace_allowed = true; |
2058 | + connector->doublescan_allowed = true; |
2059 | break; |
2060 | case DRM_MODE_CONNECTOR_DVII: |
2061 | case DRM_MODE_CONNECTOR_DVID: |
2062 | @@ -1163,6 +1167,11 @@ radeon_add_atom_connector(struct drm_device *dev, |
2063 | rdev->mode_info.load_detect_property, |
2064 | 1); |
2065 | } |
2066 | + connector->interlace_allowed = true; |
2067 | + if (connector_type == DRM_MODE_CONNECTOR_DVII) |
2068 | + connector->doublescan_allowed = true; |
2069 | + else |
2070 | + connector->doublescan_allowed = false; |
2071 | break; |
2072 | case DRM_MODE_CONNECTOR_HDMIA: |
2073 | case DRM_MODE_CONNECTOR_HDMIB: |
2074 | @@ -1186,6 +1195,11 @@ radeon_add_atom_connector(struct drm_device *dev, |
2075 | rdev->mode_info.underscan_property, |
2076 | UNDERSCAN_AUTO); |
2077 | subpixel_order = SubPixelHorizontalRGB; |
2078 | + connector->interlace_allowed = true; |
2079 | + if (connector_type == DRM_MODE_CONNECTOR_HDMIB) |
2080 | + connector->doublescan_allowed = true; |
2081 | + else |
2082 | + connector->doublescan_allowed = false; |
2083 | break; |
2084 | case DRM_MODE_CONNECTOR_DisplayPort: |
2085 | case DRM_MODE_CONNECTOR_eDP: |
2086 | @@ -1216,6 +1230,9 @@ radeon_add_atom_connector(struct drm_device *dev, |
2087 | drm_connector_attach_property(&radeon_connector->base, |
2088 | rdev->mode_info.underscan_property, |
2089 | UNDERSCAN_AUTO); |
2090 | + connector->interlace_allowed = true; |
2091 | + /* in theory with a DP to VGA converter... */ |
2092 | + connector->doublescan_allowed = false; |
2093 | break; |
2094 | case DRM_MODE_CONNECTOR_SVIDEO: |
2095 | case DRM_MODE_CONNECTOR_Composite: |
2096 | @@ -1231,6 +1248,8 @@ radeon_add_atom_connector(struct drm_device *dev, |
2097 | radeon_atombios_get_tv_info(rdev)); |
2098 | /* no HPD on analog connectors */ |
2099 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
2100 | + connector->interlace_allowed = false; |
2101 | + connector->doublescan_allowed = false; |
2102 | break; |
2103 | case DRM_MODE_CONNECTOR_LVDS: |
2104 | radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); |
2105 | @@ -1249,6 +1268,8 @@ radeon_add_atom_connector(struct drm_device *dev, |
2106 | dev->mode_config.scaling_mode_property, |
2107 | DRM_MODE_SCALE_FULLSCREEN); |
2108 | subpixel_order = SubPixelHorizontalRGB; |
2109 | + connector->interlace_allowed = false; |
2110 | + connector->doublescan_allowed = false; |
2111 | break; |
2112 | } |
2113 | |
2114 | @@ -1326,6 +1347,8 @@ radeon_add_legacy_connector(struct drm_device *dev, |
2115 | /* no HPD on analog connectors */ |
2116 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
2117 | connector->polled = DRM_CONNECTOR_POLL_CONNECT; |
2118 | + connector->interlace_allowed = true; |
2119 | + connector->doublescan_allowed = true; |
2120 | break; |
2121 | case DRM_MODE_CONNECTOR_DVIA: |
2122 | drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); |
2123 | @@ -1341,6 +1364,8 @@ radeon_add_legacy_connector(struct drm_device *dev, |
2124 | 1); |
2125 | /* no HPD on analog connectors */ |
2126 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
2127 | + connector->interlace_allowed = true; |
2128 | + connector->doublescan_allowed = true; |
2129 | break; |
2130 | case DRM_MODE_CONNECTOR_DVII: |
2131 | case DRM_MODE_CONNECTOR_DVID: |
2132 | @@ -1358,6 +1383,11 @@ radeon_add_legacy_connector(struct drm_device *dev, |
2133 | 1); |
2134 | } |
2135 | subpixel_order = SubPixelHorizontalRGB; |
2136 | + connector->interlace_allowed = true; |
2137 | + if (connector_type == DRM_MODE_CONNECTOR_DVII) |
2138 | + connector->doublescan_allowed = true; |
2139 | + else |
2140 | + connector->doublescan_allowed = false; |
2141 | break; |
2142 | case DRM_MODE_CONNECTOR_SVIDEO: |
2143 | case DRM_MODE_CONNECTOR_Composite: |
2144 | @@ -1380,6 +1410,8 @@ radeon_add_legacy_connector(struct drm_device *dev, |
2145 | radeon_combios_get_tv_info(rdev)); |
2146 | /* no HPD on analog connectors */ |
2147 | radeon_connector->hpd.hpd = RADEON_HPD_NONE; |
2148 | + connector->interlace_allowed = false; |
2149 | + connector->doublescan_allowed = false; |
2150 | break; |
2151 | case DRM_MODE_CONNECTOR_LVDS: |
2152 | drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); |
2153 | @@ -1393,6 +1425,8 @@ radeon_add_legacy_connector(struct drm_device *dev, |
2154 | dev->mode_config.scaling_mode_property, |
2155 | DRM_MODE_SCALE_FULLSCREEN); |
2156 | subpixel_order = SubPixelHorizontalRGB; |
2157 | + connector->interlace_allowed = false; |
2158 | + connector->doublescan_allowed = false; |
2159 | break; |
2160 | } |
2161 | |
2162 | diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c |
2163 | index 2c293e8..b82015e 100644 |
2164 | --- a/drivers/gpu/drm/radeon/radeon_encoders.c |
2165 | +++ b/drivers/gpu/drm/radeon/radeon_encoders.c |
2166 | @@ -595,6 +595,7 @@ atombios_digital_setup(struct drm_encoder *encoder, int action) |
2167 | int |
2168 | atombios_get_encoder_mode(struct drm_encoder *encoder) |
2169 | { |
2170 | + struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
2171 | struct drm_device *dev = encoder->dev; |
2172 | struct radeon_device *rdev = dev->dev_private; |
2173 | struct drm_connector *connector; |
2174 | @@ -602,9 +603,20 @@ atombios_get_encoder_mode(struct drm_encoder *encoder) |
2175 | struct radeon_connector_atom_dig *dig_connector; |
2176 | |
2177 | connector = radeon_get_connector_for_encoder(encoder); |
2178 | - if (!connector) |
2179 | - return 0; |
2180 | - |
2181 | + if (!connector) { |
2182 | + switch (radeon_encoder->encoder_id) { |
2183 | + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY: |
2184 | + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1: |
2185 | + case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2: |
2186 | + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA: |
2187 | + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: |
2188 | + return ATOM_ENCODER_MODE_DVI; |
2189 | + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: |
2190 | + case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: |
2191 | + default: |
2192 | + return ATOM_ENCODER_MODE_CRT; |
2193 | + } |
2194 | + } |
2195 | radeon_connector = to_radeon_connector(connector); |
2196 | |
2197 | switch (connector->connector_type) { |
2198 | @@ -1547,6 +1559,23 @@ static void radeon_atom_encoder_disable(struct drm_encoder *encoder) |
2199 | struct radeon_device *rdev = dev->dev_private; |
2200 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
2201 | struct radeon_encoder_atom_dig *dig; |
2202 | + |
2203 | + /* check for pre-DCE3 cards with shared encoders; |
2204 | + * can't really use the links individually, so don't disable |
2205 | + * the encoder if it's in use by another connector |
2206 | + */ |
2207 | + if (!ASIC_IS_DCE3(rdev)) { |
2208 | + struct drm_encoder *other_encoder; |
2209 | + struct radeon_encoder *other_radeon_encoder; |
2210 | + |
2211 | + list_for_each_entry(other_encoder, &dev->mode_config.encoder_list, head) { |
2212 | + other_radeon_encoder = to_radeon_encoder(other_encoder); |
2213 | + if ((radeon_encoder->encoder_id == other_radeon_encoder->encoder_id) && |
2214 | + drm_helper_encoder_in_use(other_encoder)) |
2215 | + goto disable_done; |
2216 | + } |
2217 | + } |
2218 | + |
2219 | radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); |
2220 | |
2221 | switch (radeon_encoder->encoder_id) { |
2222 | @@ -1586,6 +1615,7 @@ static void radeon_atom_encoder_disable(struct drm_encoder *encoder) |
2223 | break; |
2224 | } |
2225 | |
2226 | +disable_done: |
2227 | if (radeon_encoder_is_digital(encoder)) { |
2228 | if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) |
2229 | r600_hdmi_disable(encoder); |
2230 | diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c |
2231 | index 6a13ee3..acae80e 100644 |
2232 | --- a/drivers/gpu/drm/radeon/radeon_i2c.c |
2233 | +++ b/drivers/gpu/drm/radeon/radeon_i2c.c |
2234 | @@ -946,6 +946,7 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev, |
2235 | i2c->rec = *rec; |
2236 | i2c->adapter.owner = THIS_MODULE; |
2237 | i2c->dev = dev; |
2238 | + sprintf(i2c->adapter.name, "Radeon aux bus %s", name); |
2239 | i2c_set_adapdata(&i2c->adapter, i2c); |
2240 | i2c->adapter.algo_data = &i2c->algo.dp; |
2241 | i2c->algo.dp.aux_ch = radeon_dp_i2c_aux_ch; |
2242 | diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c |
2243 | index b3b5306..25d345e 100644 |
2244 | --- a/drivers/gpu/drm/radeon/radeon_object.c |
2245 | +++ b/drivers/gpu/drm/radeon/radeon_object.c |
2246 | @@ -102,6 +102,8 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj, |
2247 | type = ttm_bo_type_device; |
2248 | } |
2249 | *bo_ptr = NULL; |
2250 | + |
2251 | +retry: |
2252 | bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL); |
2253 | if (bo == NULL) |
2254 | return -ENOMEM; |
2255 | @@ -109,8 +111,6 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj, |
2256 | bo->gobj = gobj; |
2257 | bo->surface_reg = -1; |
2258 | INIT_LIST_HEAD(&bo->list); |
2259 | - |
2260 | -retry: |
2261 | radeon_ttm_placement_from_domain(bo, domain); |
2262 | /* Kernel allocation are uninterruptible */ |
2263 | mutex_lock(&rdev->vram_mutex); |
2264 | diff --git a/drivers/gpu/drm/radeon/radeon_reg.h b/drivers/gpu/drm/radeon/radeon_reg.h |
2265 | index c332f46..6492881 100644 |
2266 | --- a/drivers/gpu/drm/radeon/radeon_reg.h |
2267 | +++ b/drivers/gpu/drm/radeon/radeon_reg.h |
2268 | @@ -2836,6 +2836,7 @@ |
2269 | # define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24) |
2270 | # define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24) |
2271 | # define R200_TXFORMAT_ST_ROUTE_SHIFT 24 |
2272 | +# define R200_TXFORMAT_LOOKUP_DISABLE (1 << 27) |
2273 | # define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28) |
2274 | # define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29) |
2275 | # define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30) |
2276 | diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c |
2277 | index 9490da7..b88353d 100644 |
2278 | --- a/drivers/gpu/drm/radeon/rv770.c |
2279 | +++ b/drivers/gpu/drm/radeon/rv770.c |
2280 | @@ -643,10 +643,11 @@ static void rv770_gpu_init(struct radeon_device *rdev) |
2281 | else |
2282 | gb_tiling_config |= BANK_TILING((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); |
2283 | rdev->config.rv770.tiling_nbanks = 4 << ((gb_tiling_config >> 4) & 0x3); |
2284 | - |
2285 | - gb_tiling_config |= GROUP_SIZE(0); |
2286 | - rdev->config.rv770.tiling_group_size = 256; |
2287 | - |
2288 | + gb_tiling_config |= GROUP_SIZE((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT); |
2289 | + if ((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT) |
2290 | + rdev->config.rv770.tiling_group_size = 512; |
2291 | + else |
2292 | + rdev->config.rv770.tiling_group_size = 256; |
2293 | if (((mc_arb_ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT) > 3) { |
2294 | gb_tiling_config |= ROW_TILING(3); |
2295 | gb_tiling_config |= SAMPLE_SPLIT(3); |
2296 | diff --git a/drivers/hid/hid-egalax.c b/drivers/hid/hid-egalax.c |
2297 | index 8ca7f65..54b017a 100644 |
2298 | --- a/drivers/hid/hid-egalax.c |
2299 | +++ b/drivers/hid/hid-egalax.c |
2300 | @@ -31,7 +31,7 @@ struct egalax_data { |
2301 | bool first; /* is this the first finger in the frame? */ |
2302 | bool valid; /* valid finger data, or just placeholder? */ |
2303 | bool activity; /* at least one active finger previously? */ |
2304 | - __u16 lastx, lasty; /* latest valid (x, y) in the frame */ |
2305 | + __u16 lastx, lasty, lastz; /* latest valid (x, y, z) in the frame */ |
2306 | }; |
2307 | |
2308 | static int egalax_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
2309 | @@ -79,6 +79,10 @@ static int egalax_input_mapping(struct hid_device *hdev, struct hid_input *hi, |
2310 | case HID_DG_TIPPRESSURE: |
2311 | hid_map_usage(hi, usage, bit, max, |
2312 | EV_ABS, ABS_MT_PRESSURE); |
2313 | + /* touchscreen emulation */ |
2314 | + input_set_abs_params(hi->input, ABS_PRESSURE, |
2315 | + field->logical_minimum, |
2316 | + field->logical_maximum, 0, 0); |
2317 | return 1; |
2318 | } |
2319 | return 0; |
2320 | @@ -109,8 +113,8 @@ static void egalax_filter_event(struct egalax_data *td, struct input_dev *input) |
2321 | if (td->valid) { |
2322 | /* emit multitouch events */ |
2323 | input_event(input, EV_ABS, ABS_MT_TRACKING_ID, td->id); |
2324 | - input_event(input, EV_ABS, ABS_MT_POSITION_X, td->x); |
2325 | - input_event(input, EV_ABS, ABS_MT_POSITION_Y, td->y); |
2326 | + input_event(input, EV_ABS, ABS_MT_POSITION_X, td->x >> 3); |
2327 | + input_event(input, EV_ABS, ABS_MT_POSITION_Y, td->y >> 3); |
2328 | input_event(input, EV_ABS, ABS_MT_PRESSURE, td->z); |
2329 | |
2330 | input_mt_sync(input); |
2331 | @@ -121,6 +125,7 @@ static void egalax_filter_event(struct egalax_data *td, struct input_dev *input) |
2332 | */ |
2333 | td->lastx = td->x; |
2334 | td->lasty = td->y; |
2335 | + td->lastz = td->z; |
2336 | } |
2337 | |
2338 | /* |
2339 | @@ -129,8 +134,9 @@ static void egalax_filter_event(struct egalax_data *td, struct input_dev *input) |
2340 | * the oldest on the panel, the one we want for single touch |
2341 | */ |
2342 | if (!td->first && td->activity) { |
2343 | - input_event(input, EV_ABS, ABS_X, td->lastx); |
2344 | - input_event(input, EV_ABS, ABS_Y, td->lasty); |
2345 | + input_event(input, EV_ABS, ABS_X, td->lastx >> 3); |
2346 | + input_event(input, EV_ABS, ABS_Y, td->lasty >> 3); |
2347 | + input_event(input, EV_ABS, ABS_PRESSURE, td->lastz); |
2348 | } |
2349 | |
2350 | if (!td->valid) { |
2351 | diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c |
2352 | index f0260c6..859ee7e 100644 |
2353 | --- a/drivers/hid/usbhid/hid-quirks.c |
2354 | +++ b/drivers/hid/usbhid/hid-quirks.c |
2355 | @@ -34,7 +34,6 @@ static const struct hid_blacklist { |
2356 | { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, |
2357 | { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, |
2358 | { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER, HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET }, |
2359 | - { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH, HID_QUIRK_MULTI_INPUT }, |
2360 | { USB_VENDOR_ID_MOJO, USB_DEVICE_ID_RETRO_ADAPTER, HID_QUIRK_MULTI_INPUT }, |
2361 | { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART, HID_QUIRK_MULTI_INPUT }, |
2362 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
2363 | diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c |
2364 | index b3841a6..2e8f0c9 100644 |
2365 | --- a/drivers/hwmon/lm85.c |
2366 | +++ b/drivers/hwmon/lm85.c |
2367 | @@ -1259,6 +1259,7 @@ static int lm85_probe(struct i2c_client *client, |
2368 | switch (data->type) { |
2369 | case adm1027: |
2370 | case adt7463: |
2371 | + case adt7468: |
2372 | case emc6d100: |
2373 | case emc6d102: |
2374 | data->freq_map = adm1027_freq_map; |
2375 | diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c |
2376 | index 5f6d7f8..ace6799 100644 |
2377 | --- a/drivers/i2c/busses/i2c-pca-platform.c |
2378 | +++ b/drivers/i2c/busses/i2c-pca-platform.c |
2379 | @@ -224,7 +224,7 @@ static int __devinit i2c_pca_pf_probe(struct platform_device *pdev) |
2380 | |
2381 | if (irq) { |
2382 | ret = request_irq(irq, i2c_pca_pf_handler, |
2383 | - IRQF_TRIGGER_FALLING, i2c->adap.name, i2c); |
2384 | + IRQF_TRIGGER_FALLING, pdev->name, i2c); |
2385 | if (ret) |
2386 | goto e_reqirq; |
2387 | } |
2388 | diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h |
2389 | index ed7ad74..8c53926 100644 |
2390 | --- a/drivers/input/serio/i8042-x86ia64io.h |
2391 | +++ b/drivers/input/serio/i8042-x86ia64io.h |
2392 | @@ -333,6 +333,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = { |
2393 | }, |
2394 | }, |
2395 | { |
2396 | + /* Sony Vaio VPCZ122GX */ |
2397 | + .matches = { |
2398 | + DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), |
2399 | + DMI_MATCH(DMI_PRODUCT_NAME, "VPCZ122GX"), |
2400 | + }, |
2401 | + }, |
2402 | + { |
2403 | /* Sony Vaio FS-115b */ |
2404 | .matches = { |
2405 | DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), |
2406 | diff --git a/drivers/isdn/gigaset/bas-gigaset.c b/drivers/isdn/gigaset/bas-gigaset.c |
2407 | index 707d9c9..131976d 100644 |
2408 | --- a/drivers/isdn/gigaset/bas-gigaset.c |
2409 | +++ b/drivers/isdn/gigaset/bas-gigaset.c |
2410 | @@ -438,23 +438,27 @@ static void cmd_in_timeout(unsigned long data) |
2411 | return; |
2412 | } |
2413 | |
2414 | - if (ucs->retry_cmd_in++ < BAS_RETRY) { |
2415 | - dev_notice(cs->dev, "control read: timeout, retry %d\n", |
2416 | - ucs->retry_cmd_in); |
2417 | - rc = atread_submit(cs, BAS_TIMEOUT); |
2418 | - if (rc >= 0 || rc == -ENODEV) |
2419 | - /* resubmitted or disconnected */ |
2420 | - /* - bypass regular exit block */ |
2421 | - return; |
2422 | - } else { |
2423 | + if (ucs->retry_cmd_in++ >= BAS_RETRY) { |
2424 | dev_err(cs->dev, |
2425 | "control read: timeout, giving up after %d tries\n", |
2426 | ucs->retry_cmd_in); |
2427 | + kfree(ucs->rcvbuf); |
2428 | + ucs->rcvbuf = NULL; |
2429 | + ucs->rcvbuf_size = 0; |
2430 | + error_reset(cs); |
2431 | + return; |
2432 | + } |
2433 | + |
2434 | + gig_dbg(DEBUG_USBREQ, "%s: timeout, retry %d", |
2435 | + __func__, ucs->retry_cmd_in); |
2436 | + rc = atread_submit(cs, BAS_TIMEOUT); |
2437 | + if (rc < 0) { |
2438 | + kfree(ucs->rcvbuf); |
2439 | + ucs->rcvbuf = NULL; |
2440 | + ucs->rcvbuf_size = 0; |
2441 | + if (rc != -ENODEV) |
2442 | + error_reset(cs); |
2443 | } |
2444 | - kfree(ucs->rcvbuf); |
2445 | - ucs->rcvbuf = NULL; |
2446 | - ucs->rcvbuf_size = 0; |
2447 | - error_reset(cs); |
2448 | } |
2449 | |
2450 | /* read_ctrl_callback |
2451 | @@ -470,18 +474,11 @@ static void read_ctrl_callback(struct urb *urb) |
2452 | struct cardstate *cs = inbuf->cs; |
2453 | struct bas_cardstate *ucs = cs->hw.bas; |
2454 | int status = urb->status; |
2455 | - int have_data = 0; |
2456 | unsigned numbytes; |
2457 | int rc; |
2458 | |
2459 | update_basstate(ucs, 0, BS_ATRDPEND); |
2460 | wake_up(&ucs->waitqueue); |
2461 | - |
2462 | - if (!ucs->rcvbuf_size) { |
2463 | - dev_warn(cs->dev, "%s: no receive in progress\n", __func__); |
2464 | - return; |
2465 | - } |
2466 | - |
2467 | del_timer(&ucs->timer_cmd_in); |
2468 | |
2469 | switch (status) { |
2470 | @@ -495,19 +492,10 @@ static void read_ctrl_callback(struct urb *urb) |
2471 | numbytes = ucs->rcvbuf_size; |
2472 | } |
2473 | |
2474 | - /* copy received bytes to inbuf */ |
2475 | - have_data = gigaset_fill_inbuf(inbuf, ucs->rcvbuf, numbytes); |
2476 | - |
2477 | - if (unlikely(numbytes < ucs->rcvbuf_size)) { |
2478 | - /* incomplete - resubmit for remaining bytes */ |
2479 | - ucs->rcvbuf_size -= numbytes; |
2480 | - ucs->retry_cmd_in = 0; |
2481 | - rc = atread_submit(cs, BAS_TIMEOUT); |
2482 | - if (rc >= 0 || rc == -ENODEV) |
2483 | - /* resubmitted or disconnected */ |
2484 | - /* - bypass regular exit block */ |
2485 | - return; |
2486 | - error_reset(cs); |
2487 | + /* copy received bytes to inbuf, notify event layer */ |
2488 | + if (gigaset_fill_inbuf(inbuf, ucs->rcvbuf, numbytes)) { |
2489 | + gig_dbg(DEBUG_INTR, "%s-->BH", __func__); |
2490 | + gigaset_schedule_event(cs); |
2491 | } |
2492 | break; |
2493 | |
2494 | @@ -516,37 +504,32 @@ static void read_ctrl_callback(struct urb *urb) |
2495 | case -EINPROGRESS: /* pending */ |
2496 | case -ENODEV: /* device removed */ |
2497 | case -ESHUTDOWN: /* device shut down */ |
2498 | - /* no action necessary */ |
2499 | + /* no further action necessary */ |
2500 | gig_dbg(DEBUG_USBREQ, "%s: %s", |
2501 | __func__, get_usb_statmsg(status)); |
2502 | break; |
2503 | |
2504 | - default: /* severe trouble */ |
2505 | - dev_warn(cs->dev, "control read: %s\n", |
2506 | - get_usb_statmsg(status)); |
2507 | + default: /* other errors: retry */ |
2508 | if (ucs->retry_cmd_in++ < BAS_RETRY) { |
2509 | - dev_notice(cs->dev, "control read: retry %d\n", |
2510 | - ucs->retry_cmd_in); |
2511 | + gig_dbg(DEBUG_USBREQ, "%s: %s, retry %d", __func__, |
2512 | + get_usb_statmsg(status), ucs->retry_cmd_in); |
2513 | rc = atread_submit(cs, BAS_TIMEOUT); |
2514 | - if (rc >= 0 || rc == -ENODEV) |
2515 | - /* resubmitted or disconnected */ |
2516 | - /* - bypass regular exit block */ |
2517 | + if (rc >= 0) |
2518 | + /* successfully resubmitted, skip freeing */ |
2519 | return; |
2520 | - } else { |
2521 | - dev_err(cs->dev, |
2522 | - "control read: giving up after %d tries\n", |
2523 | - ucs->retry_cmd_in); |
2524 | + if (rc == -ENODEV) |
2525 | + /* disconnect, no further action necessary */ |
2526 | + break; |
2527 | } |
2528 | + dev_err(cs->dev, "control read: %s, giving up after %d tries\n", |
2529 | + get_usb_statmsg(status), ucs->retry_cmd_in); |
2530 | error_reset(cs); |
2531 | } |
2532 | |
2533 | + /* read finished, free buffer */ |
2534 | kfree(ucs->rcvbuf); |
2535 | ucs->rcvbuf = NULL; |
2536 | ucs->rcvbuf_size = 0; |
2537 | - if (have_data) { |
2538 | - gig_dbg(DEBUG_INTR, "%s-->BH", __func__); |
2539 | - gigaset_schedule_event(cs); |
2540 | - } |
2541 | } |
2542 | |
2543 | /* atread_submit |
2544 | @@ -1598,13 +1581,13 @@ static int gigaset_init_bchannel(struct bc_state *bcs) |
2545 | |
2546 | ret = starturbs(bcs); |
2547 | if (ret < 0) { |
2548 | + spin_unlock_irqrestore(&cs->lock, flags); |
2549 | dev_err(cs->dev, |
2550 | "could not start isochronous I/O for channel B%d: %s\n", |
2551 | bcs->channel + 1, |
2552 | ret == -EFAULT ? "null URB" : get_usb_rcmsg(ret)); |
2553 | if (ret != -ENODEV) |
2554 | error_hangup(bcs); |
2555 | - spin_unlock_irqrestore(&cs->lock, flags); |
2556 | return ret; |
2557 | } |
2558 | |
2559 | @@ -1614,11 +1597,11 @@ static int gigaset_init_bchannel(struct bc_state *bcs) |
2560 | dev_err(cs->dev, "could not open channel B%d\n", |
2561 | bcs->channel + 1); |
2562 | stopurbs(bcs->hw.bas); |
2563 | - if (ret != -ENODEV) |
2564 | - error_hangup(bcs); |
2565 | } |
2566 | |
2567 | spin_unlock_irqrestore(&cs->lock, flags); |
2568 | + if (ret < 0 && ret != -ENODEV) |
2569 | + error_hangup(bcs); |
2570 | return ret; |
2571 | } |
2572 | |
2573 | diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c |
2574 | index 2dfd346..f39ccdf 100644 |
2575 | --- a/drivers/isdn/gigaset/isocdata.c |
2576 | +++ b/drivers/isdn/gigaset/isocdata.c |
2577 | @@ -842,13 +842,14 @@ static inline void trans_receive(unsigned char *src, unsigned count, |
2578 | |
2579 | if (unlikely(bcs->ignore)) { |
2580 | bcs->ignore--; |
2581 | - hdlc_flush(bcs); |
2582 | return; |
2583 | } |
2584 | skb = bcs->rx_skb; |
2585 | - if (skb == NULL) |
2586 | + if (skb == NULL) { |
2587 | skb = gigaset_new_rx_skb(bcs); |
2588 | - bcs->hw.bas->goodbytes += skb->len; |
2589 | + if (skb == NULL) |
2590 | + return; |
2591 | + } |
2592 | dobytes = bcs->rx_bufsize - skb->len; |
2593 | while (count > 0) { |
2594 | dst = skb_put(skb, count < dobytes ? count : dobytes); |
2595 | @@ -860,6 +861,7 @@ static inline void trans_receive(unsigned char *src, unsigned count, |
2596 | if (dobytes == 0) { |
2597 | dump_bytes(DEBUG_STREAM_DUMP, |
2598 | "rcv data", skb->data, skb->len); |
2599 | + bcs->hw.bas->goodbytes += skb->len; |
2600 | gigaset_skb_rcvd(bcs, skb); |
2601 | skb = gigaset_new_rx_skb(bcs); |
2602 | if (skb == NULL) |
2603 | diff --git a/drivers/leds/leds-ss4200.c b/drivers/leds/leds-ss4200.c |
2604 | index a688293..614ebeb 100644 |
2605 | --- a/drivers/leds/leds-ss4200.c |
2606 | +++ b/drivers/leds/leds-ss4200.c |
2607 | @@ -102,6 +102,7 @@ static struct dmi_system_id __initdata nas_led_whitelist[] = { |
2608 | DMI_MATCH(DMI_PRODUCT_VERSION, "1.00.00") |
2609 | } |
2610 | }, |
2611 | + {} |
2612 | }; |
2613 | |
2614 | /* |
2615 | diff --git a/drivers/md/md.c b/drivers/md/md.c |
2616 | index f20d13e..792574c 100644 |
2617 | --- a/drivers/md/md.c |
2618 | +++ b/drivers/md/md.c |
2619 | @@ -1329,7 +1329,7 @@ super_90_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors) |
2620 | md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, |
2621 | rdev->sb_page); |
2622 | md_super_wait(rdev->mddev); |
2623 | - return num_sectors / 2; /* kB for sysfs */ |
2624 | + return num_sectors; |
2625 | } |
2626 | |
2627 | |
2628 | @@ -1697,7 +1697,7 @@ super_1_rdev_size_change(mdk_rdev_t *rdev, sector_t num_sectors) |
2629 | md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, |
2630 | rdev->sb_page); |
2631 | md_super_wait(rdev->mddev); |
2632 | - return num_sectors / 2; /* kB for sysfs */ |
2633 | + return num_sectors; |
2634 | } |
2635 | |
2636 | static struct super_type super_types[] = { |
2637 | @@ -2172,6 +2172,8 @@ repeat: |
2638 | if (!mddev->persistent) { |
2639 | clear_bit(MD_CHANGE_CLEAN, &mddev->flags); |
2640 | clear_bit(MD_CHANGE_DEVS, &mddev->flags); |
2641 | + if (!mddev->external) |
2642 | + clear_bit(MD_CHANGE_PENDING, &mddev->flags); |
2643 | wake_up(&mddev->sb_wait); |
2644 | return; |
2645 | } |
2646 | diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c |
2647 | index 0b830bb..d8b2d7b 100644 |
2648 | --- a/drivers/md/raid1.c |
2649 | +++ b/drivers/md/raid1.c |
2650 | @@ -1210,6 +1210,7 @@ static int raid1_remove_disk(mddev_t *mddev, int number) |
2651 | * is not possible. |
2652 | */ |
2653 | if (!test_bit(Faulty, &rdev->flags) && |
2654 | + !mddev->recovery_disabled && |
2655 | mddev->degraded < conf->raid_disks) { |
2656 | err = -EBUSY; |
2657 | goto abort; |
2658 | diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c |
2659 | index f6b62e7..11c987e 100644 |
2660 | --- a/drivers/media/video/cx23885/cx23885-core.c |
2661 | +++ b/drivers/media/video/cx23885/cx23885-core.c |
2662 | @@ -815,6 +815,7 @@ static void cx23885_dev_checkrevision(struct cx23885_dev *dev) |
2663 | case 0x0e: |
2664 | /* CX23887-15Z */ |
2665 | dev->hwrevision = 0xc0; |
2666 | + break; |
2667 | case 0x0f: |
2668 | /* CX23887-14Z */ |
2669 | dev->hwrevision = 0xb1; |
2670 | diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c |
2671 | index 78abc1c..a50bf65 100644 |
2672 | --- a/drivers/media/video/gspca/gspca.c |
2673 | +++ b/drivers/media/video/gspca/gspca.c |
2674 | @@ -652,7 +652,7 @@ static struct usb_host_endpoint *get_ep(struct gspca_dev *gspca_dev) |
2675 | : USB_ENDPOINT_XFER_ISOC; |
2676 | i = gspca_dev->alt; /* previous alt setting */ |
2677 | if (gspca_dev->cam.reverse_alts) { |
2678 | - if (gspca_dev->audio) |
2679 | + if (gspca_dev->audio && i < gspca_dev->nbalt - 2) |
2680 | i++; |
2681 | while (++i < gspca_dev->nbalt) { |
2682 | ep = alt_xfer(&intf->altsetting[i], xfer); |
2683 | @@ -660,7 +660,7 @@ static struct usb_host_endpoint *get_ep(struct gspca_dev *gspca_dev) |
2684 | break; |
2685 | } |
2686 | } else { |
2687 | - if (gspca_dev->audio) |
2688 | + if (gspca_dev->audio && i > 1) |
2689 | i--; |
2690 | while (--i >= 0) { |
2691 | ep = alt_xfer(&intf->altsetting[i], xfer); |
2692 | diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c |
2693 | index 3705443..c01d75b 100644 |
2694 | --- a/drivers/media/video/gspca/sonixj.c |
2695 | +++ b/drivers/media/video/gspca/sonixj.c |
2696 | @@ -2474,8 +2474,7 @@ static int sd_start(struct gspca_dev *gspca_dev) |
2697 | reg1 = 0x44; |
2698 | reg17 = 0xa2; |
2699 | break; |
2700 | - default: |
2701 | -/* case SENSOR_SP80708: */ |
2702 | + case SENSOR_SP80708: |
2703 | init = sp80708_sensor_param1; |
2704 | if (mode) { |
2705 | /*?? reg1 = 0x04; * 320 clk 48Mhz */ |
2706 | diff --git a/drivers/media/video/hdpvr/hdpvr-video.c b/drivers/media/video/hdpvr/hdpvr-video.c |
2707 | index 4863a21..93f7959 100644 |
2708 | --- a/drivers/media/video/hdpvr/hdpvr-video.c |
2709 | +++ b/drivers/media/video/hdpvr/hdpvr-video.c |
2710 | @@ -157,6 +157,7 @@ int hdpvr_alloc_buffers(struct hdpvr_device *dev, uint count) |
2711 | mem, dev->bulk_in_size, |
2712 | hdpvr_read_bulk_callback, buf); |
2713 | |
2714 | + buf->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
2715 | buf->status = BUFSTAT_AVAILABLE; |
2716 | list_add_tail(&buf->buff_list, &dev->free_buff_list); |
2717 | } |
2718 | diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c |
2719 | index 0e41213..4897d90f 100644 |
2720 | --- a/drivers/media/video/msp3400-driver.c |
2721 | +++ b/drivers/media/video/msp3400-driver.c |
2722 | @@ -382,7 +382,12 @@ static int msp_s_ctrl(struct v4l2_ctrl *ctrl) |
2723 | |
2724 | void msp_update_volume(struct msp_state *state) |
2725 | { |
2726 | - v4l2_ctrl_s_ctrl(state->volume, v4l2_ctrl_g_ctrl(state->volume)); |
2727 | + /* Force an update of the volume/mute cluster */ |
2728 | + v4l2_ctrl_lock(state->volume); |
2729 | + state->volume->val = state->volume->cur.val; |
2730 | + state->muted->val = state->muted->cur.val; |
2731 | + msp_s_ctrl(state->volume); |
2732 | + v4l2_ctrl_unlock(state->volume); |
2733 | } |
2734 | |
2735 | /* --- v4l2 ioctls --- */ |
2736 | diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c |
2737 | index bb8d83d..7c74751 100644 |
2738 | --- a/drivers/media/video/saa7134/saa7134-cards.c |
2739 | +++ b/drivers/media/video/saa7134/saa7134-cards.c |
2740 | @@ -6661,6 +6661,18 @@ struct pci_device_id saa7134_pci_tbl[] = { |
2741 | .subdevice = 0x2804, |
2742 | .driver_data = SAA7134_BOARD_TECHNOTREND_BUDGET_T3000, |
2743 | }, { |
2744 | + .vendor = PCI_VENDOR_ID_PHILIPS, |
2745 | + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
2746 | + .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ |
2747 | + .subdevice = 0x7190, |
2748 | + .driver_data = SAA7134_BOARD_BEHOLD_H7, |
2749 | + }, { |
2750 | + .vendor = PCI_VENDOR_ID_PHILIPS, |
2751 | + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
2752 | + .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ |
2753 | + .subdevice = 0x7090, |
2754 | + .driver_data = SAA7134_BOARD_BEHOLD_A7, |
2755 | + }, { |
2756 | /* --- boards without eeprom + subsystem ID --- */ |
2757 | .vendor = PCI_VENDOR_ID_PHILIPS, |
2758 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
2759 | @@ -6698,18 +6710,6 @@ struct pci_device_id saa7134_pci_tbl[] = { |
2760 | .subvendor = PCI_ANY_ID, |
2761 | .subdevice = PCI_ANY_ID, |
2762 | .driver_data = SAA7134_BOARD_UNKNOWN, |
2763 | - }, { |
2764 | - .vendor = PCI_VENDOR_ID_PHILIPS, |
2765 | - .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
2766 | - .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ |
2767 | - .subdevice = 0x7190, |
2768 | - .driver_data = SAA7134_BOARD_BEHOLD_H7, |
2769 | - }, { |
2770 | - .vendor = PCI_VENDOR_ID_PHILIPS, |
2771 | - .device = PCI_DEVICE_ID_PHILIPS_SAA7133, |
2772 | - .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ |
2773 | - .subdevice = 0x7090, |
2774 | - .driver_data = SAA7134_BOARD_BEHOLD_A7, |
2775 | },{ |
2776 | /* --- end of list --- */ |
2777 | } |
2778 | diff --git a/drivers/misc/ad525x_dpot-spi.c b/drivers/misc/ad525x_dpot-spi.c |
2779 | index b8c6df9..6cfcb63 100644 |
2780 | --- a/drivers/misc/ad525x_dpot-spi.c |
2781 | +++ b/drivers/misc/ad525x_dpot-spi.c |
2782 | @@ -53,13 +53,13 @@ static int write8(void *client, u8 val) |
2783 | static int write16(void *client, u8 reg, u8 val) |
2784 | { |
2785 | u8 data[2] = {reg, val}; |
2786 | - return spi_write(client, data, 1); |
2787 | + return spi_write(client, data, 2); |
2788 | } |
2789 | |
2790 | static int write24(void *client, u8 reg, u16 val) |
2791 | { |
2792 | u8 data[3] = {reg, val >> 8, val}; |
2793 | - return spi_write(client, data, 1); |
2794 | + return spi_write(client, data, 3); |
2795 | } |
2796 | |
2797 | static int read8(void *client) |
2798 | diff --git a/drivers/misc/sgi-xp/xpc_partition.c b/drivers/misc/sgi-xp/xpc_partition.c |
2799 | index d551f09..6956f7e 100644 |
2800 | --- a/drivers/misc/sgi-xp/xpc_partition.c |
2801 | +++ b/drivers/misc/sgi-xp/xpc_partition.c |
2802 | @@ -439,18 +439,23 @@ xpc_discovery(void) |
2803 | * nodes that can comprise an access protection grouping. The access |
2804 | * protection is in regards to memory, IOI and IPI. |
2805 | */ |
2806 | - max_regions = 64; |
2807 | region_size = xp_region_size; |
2808 | |
2809 | - switch (region_size) { |
2810 | - case 128: |
2811 | - max_regions *= 2; |
2812 | - case 64: |
2813 | - max_regions *= 2; |
2814 | - case 32: |
2815 | - max_regions *= 2; |
2816 | - region_size = 16; |
2817 | - DBUG_ON(!is_shub2()); |
2818 | + if (is_uv()) |
2819 | + max_regions = 256; |
2820 | + else { |
2821 | + max_regions = 64; |
2822 | + |
2823 | + switch (region_size) { |
2824 | + case 128: |
2825 | + max_regions *= 2; |
2826 | + case 64: |
2827 | + max_regions *= 2; |
2828 | + case 32: |
2829 | + max_regions *= 2; |
2830 | + region_size = 16; |
2831 | + DBUG_ON(!is_shub2()); |
2832 | + } |
2833 | } |
2834 | |
2835 | for (region = 0; region < max_regions; region++) { |
2836 | diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c |
2837 | index 09eee6d..9ca553b 100644 |
2838 | --- a/drivers/mmc/core/core.c |
2839 | +++ b/drivers/mmc/core/core.c |
2840 | @@ -1514,7 +1514,7 @@ void mmc_stop_host(struct mmc_host *host) |
2841 | |
2842 | if (host->caps & MMC_CAP_DISABLE) |
2843 | cancel_delayed_work(&host->disable); |
2844 | - cancel_delayed_work(&host->detect); |
2845 | + cancel_delayed_work_sync(&host->detect); |
2846 | mmc_flush_scheduled_work(); |
2847 | |
2848 | /* clear pm flags now and let card drivers set them as needed */ |
2849 | diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c |
2850 | index 5cc39ed..7132428 100644 |
2851 | --- a/drivers/net/e1000/e1000_main.c |
2852 | +++ b/drivers/net/e1000/e1000_main.c |
2853 | @@ -31,7 +31,7 @@ |
2854 | |
2855 | char e1000_driver_name[] = "e1000"; |
2856 | static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; |
2857 | -#define DRV_VERSION "7.3.21-k6-NAPI" |
2858 | +#define DRV_VERSION "7.3.21-k8-NAPI" |
2859 | const char e1000_driver_version[] = DRV_VERSION; |
2860 | static const char e1000_copyright[] = "Copyright (c) 1999-2006 Intel Corporation."; |
2861 | |
2862 | @@ -483,9 +483,6 @@ void e1000_down(struct e1000_adapter *adapter) |
2863 | struct net_device *netdev = adapter->netdev; |
2864 | u32 rctl, tctl; |
2865 | |
2866 | - /* signal that we're down so the interrupt handler does not |
2867 | - * reschedule our watchdog timer */ |
2868 | - set_bit(__E1000_DOWN, &adapter->flags); |
2869 | |
2870 | /* disable receives in the hardware */ |
2871 | rctl = er32(RCTL); |
2872 | @@ -506,6 +503,13 @@ void e1000_down(struct e1000_adapter *adapter) |
2873 | |
2874 | e1000_irq_disable(adapter); |
2875 | |
2876 | + /* |
2877 | + * Setting DOWN must be after irq_disable to prevent |
2878 | + * a screaming interrupt. Setting DOWN also prevents |
2879 | + * timers and tasks from rescheduling. |
2880 | + */ |
2881 | + set_bit(__E1000_DOWN, &adapter->flags); |
2882 | + |
2883 | del_timer_sync(&adapter->tx_fifo_stall_timer); |
2884 | del_timer_sync(&adapter->watchdog_timer); |
2885 | del_timer_sync(&adapter->phy_info_timer); |
2886 | diff --git a/drivers/net/jme.c b/drivers/net/jme.c |
2887 | index 99f24f5..f0643ac 100644 |
2888 | --- a/drivers/net/jme.c |
2889 | +++ b/drivers/net/jme.c |
2890 | @@ -1575,6 +1575,16 @@ jme_free_irq(struct jme_adapter *jme) |
2891 | } |
2892 | } |
2893 | |
2894 | +static inline void |
2895 | +jme_phy_on(struct jme_adapter *jme) |
2896 | +{ |
2897 | + u32 bmcr; |
2898 | + |
2899 | + bmcr = jme_mdio_read(jme->dev, jme->mii_if.phy_id, MII_BMCR); |
2900 | + bmcr &= ~BMCR_PDOWN; |
2901 | + jme_mdio_write(jme->dev, jme->mii_if.phy_id, MII_BMCR, bmcr); |
2902 | +} |
2903 | + |
2904 | static int |
2905 | jme_open(struct net_device *netdev) |
2906 | { |
2907 | @@ -1595,10 +1605,12 @@ jme_open(struct net_device *netdev) |
2908 | |
2909 | jme_start_irq(jme); |
2910 | |
2911 | - if (test_bit(JME_FLAG_SSET, &jme->flags)) |
2912 | + if (test_bit(JME_FLAG_SSET, &jme->flags)) { |
2913 | + jme_phy_on(jme); |
2914 | jme_set_settings(netdev, &jme->old_ecmd); |
2915 | - else |
2916 | + } else { |
2917 | jme_reset_phy_processor(jme); |
2918 | + } |
2919 | |
2920 | jme_reset_link(jme); |
2921 | |
2922 | @@ -3006,10 +3018,12 @@ jme_resume(struct pci_dev *pdev) |
2923 | jme_clear_pm(jme); |
2924 | pci_restore_state(pdev); |
2925 | |
2926 | - if (test_bit(JME_FLAG_SSET, &jme->flags)) |
2927 | + if (test_bit(JME_FLAG_SSET, &jme->flags)) { |
2928 | + jme_phy_on(jme); |
2929 | jme_set_settings(netdev, &jme->old_ecmd); |
2930 | - else |
2931 | + } else { |
2932 | jme_reset_phy_processor(jme); |
2933 | + } |
2934 | |
2935 | jme_start_irq(jme); |
2936 | netif_device_attach(netdev); |
2937 | diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c |
2938 | index f9b509a..b12553b 100644 |
2939 | --- a/drivers/net/pcmcia/pcnet_cs.c |
2940 | +++ b/drivers/net/pcmcia/pcnet_cs.c |
2941 | @@ -1622,6 +1622,7 @@ static struct pcmcia_device_id pcnet_ids[] = { |
2942 | PCMCIA_DEVICE_PROD_ID12("COMPU-SHACK", "FASTline PCMCIA 10/100 Fast-Ethernet", 0xfa2e424d, 0x3953d9b9), |
2943 | PCMCIA_DEVICE_PROD_ID12("CONTEC", "C-NET(PC)C-10L", 0x21cab552, 0xf6f90722), |
2944 | PCMCIA_DEVICE_PROD_ID12("corega", "FEther PCC-TXF", 0x0a21501a, 0xa51564a2), |
2945 | + PCMCIA_DEVICE_PROD_ID12("corega", "Ether CF-TD", 0x0a21501a, 0x6589340a), |
2946 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-T", 0x5261440f, 0xfa9d85bd), |
2947 | PCMCIA_DEVICE_PROD_ID12("corega K.K.", "corega EtherII PCC-TD", 0x5261440f, 0xc49bd73d), |
2948 | PCMCIA_DEVICE_PROD_ID12("Corega K.K.", "corega EtherII PCC-TD", 0xd4fdcbd8, 0xc49bd73d), |
2949 | diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c |
2950 | index 0101f2b..c1ba49b 100644 |
2951 | --- a/drivers/net/phy/marvell.c |
2952 | +++ b/drivers/net/phy/marvell.c |
2953 | @@ -196,20 +196,27 @@ static int m88e1121_config_aneg(struct phy_device *phydev) |
2954 | MII_88E1121_PHY_MSCR_PAGE); |
2955 | if (err < 0) |
2956 | return err; |
2957 | - mscr = phy_read(phydev, MII_88E1121_PHY_MSCR_REG) & |
2958 | - MII_88E1121_PHY_MSCR_DELAY_MASK; |
2959 | |
2960 | - if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) |
2961 | - mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY | |
2962 | - MII_88E1121_PHY_MSCR_TX_DELAY); |
2963 | - else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) |
2964 | - mscr |= MII_88E1121_PHY_MSCR_RX_DELAY; |
2965 | - else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) |
2966 | - mscr |= MII_88E1121_PHY_MSCR_TX_DELAY; |
2967 | + if ((phydev->interface == PHY_INTERFACE_MODE_RGMII) || |
2968 | + (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) || |
2969 | + (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) || |
2970 | + (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID)) { |
2971 | |
2972 | - err = phy_write(phydev, MII_88E1121_PHY_MSCR_REG, mscr); |
2973 | - if (err < 0) |
2974 | - return err; |
2975 | + mscr = phy_read(phydev, MII_88E1121_PHY_MSCR_REG) & |
2976 | + MII_88E1121_PHY_MSCR_DELAY_MASK; |
2977 | + |
2978 | + if (phydev->interface == PHY_INTERFACE_MODE_RGMII_ID) |
2979 | + mscr |= (MII_88E1121_PHY_MSCR_RX_DELAY | |
2980 | + MII_88E1121_PHY_MSCR_TX_DELAY); |
2981 | + else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_RXID) |
2982 | + mscr |= MII_88E1121_PHY_MSCR_RX_DELAY; |
2983 | + else if (phydev->interface == PHY_INTERFACE_MODE_RGMII_TXID) |
2984 | + mscr |= MII_88E1121_PHY_MSCR_TX_DELAY; |
2985 | + |
2986 | + err = phy_write(phydev, MII_88E1121_PHY_MSCR_REG, mscr); |
2987 | + if (err < 0) |
2988 | + return err; |
2989 | + } |
2990 | |
2991 | phy_write(phydev, MII_88E1121_PHY_PAGE, oldpage); |
2992 | |
2993 | diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c |
2994 | index 142c381..80666f0 100644 |
2995 | --- a/drivers/net/r6040.c |
2996 | +++ b/drivers/net/r6040.c |
2997 | @@ -893,16 +893,18 @@ static void r6040_multicast_list(struct net_device *dev) |
2998 | /* Multicast Address 1~4 case */ |
2999 | i = 0; |
3000 | netdev_for_each_mc_addr(ha, dev) { |
3001 | - if (i < MCAST_MAX) { |
3002 | - adrp = (u16 *) ha->addr; |
3003 | - iowrite16(adrp[0], ioaddr + MID_1L + 8 * i); |
3004 | - iowrite16(adrp[1], ioaddr + MID_1M + 8 * i); |
3005 | - iowrite16(adrp[2], ioaddr + MID_1H + 8 * i); |
3006 | - } else { |
3007 | - iowrite16(0xffff, ioaddr + MID_1L + 8 * i); |
3008 | - iowrite16(0xffff, ioaddr + MID_1M + 8 * i); |
3009 | - iowrite16(0xffff, ioaddr + MID_1H + 8 * i); |
3010 | - } |
3011 | + if (i >= MCAST_MAX) |
3012 | + break; |
3013 | + adrp = (u16 *) ha->addr; |
3014 | + iowrite16(adrp[0], ioaddr + MID_1L + 8 * i); |
3015 | + iowrite16(adrp[1], ioaddr + MID_1M + 8 * i); |
3016 | + iowrite16(adrp[2], ioaddr + MID_1H + 8 * i); |
3017 | + i++; |
3018 | + } |
3019 | + while (i < MCAST_MAX) { |
3020 | + iowrite16(0xffff, ioaddr + MID_1L + 8 * i); |
3021 | + iowrite16(0xffff, ioaddr + MID_1M + 8 * i); |
3022 | + iowrite16(0xffff, ioaddr + MID_1H + 8 * i); |
3023 | i++; |
3024 | } |
3025 | } |
3026 | diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c |
3027 | index 992db2f..6fedc89 100644 |
3028 | --- a/drivers/net/r8169.c |
3029 | +++ b/drivers/net/r8169.c |
3030 | @@ -2936,7 +2936,7 @@ static const struct rtl_cfg_info { |
3031 | .hw_start = rtl_hw_start_8168, |
3032 | .region = 2, |
3033 | .align = 8, |
3034 | - .intr_event = SYSErr | RxFIFOOver | LinkChg | RxOverflow | |
3035 | + .intr_event = SYSErr | LinkChg | RxOverflow | |
3036 | TxErr | TxOK | RxOK | RxErr, |
3037 | .napi_event = TxErr | TxOK | RxOK | RxOverflow, |
3038 | .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI, |
3039 | @@ -4455,14 +4455,12 @@ static inline int rtl8169_fragmented_frame(u32 status) |
3040 | return (status & (FirstFrag | LastFrag)) != (FirstFrag | LastFrag); |
3041 | } |
3042 | |
3043 | -static inline void rtl8169_rx_csum(struct sk_buff *skb, struct RxDesc *desc) |
3044 | +static inline void rtl8169_rx_csum(struct sk_buff *skb, u32 opts1) |
3045 | { |
3046 | - u32 opts1 = le32_to_cpu(desc->opts1); |
3047 | u32 status = opts1 & RxProtoMask; |
3048 | |
3049 | if (((status == RxProtoTCP) && !(opts1 & TCPFail)) || |
3050 | - ((status == RxProtoUDP) && !(opts1 & UDPFail)) || |
3051 | - ((status == RxProtoIP) && !(opts1 & IPFail))) |
3052 | + ((status == RxProtoUDP) && !(opts1 & UDPFail))) |
3053 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
3054 | else |
3055 | skb->ip_summed = CHECKSUM_NONE; |
3056 | @@ -4551,8 +4549,6 @@ static int rtl8169_rx_interrupt(struct net_device *dev, |
3057 | continue; |
3058 | } |
3059 | |
3060 | - rtl8169_rx_csum(skb, desc); |
3061 | - |
3062 | if (rtl8169_try_rx_copy(&skb, tp, pkt_size, addr)) { |
3063 | dma_sync_single_for_device(&pdev->dev, addr, |
3064 | pkt_size, PCI_DMA_FROMDEVICE); |
3065 | @@ -4563,6 +4559,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev, |
3066 | tp->Rx_skbuff[entry] = NULL; |
3067 | } |
3068 | |
3069 | + rtl8169_rx_csum(skb, status); |
3070 | skb_put(skb, pkt_size); |
3071 | skb->protocol = eth_type_trans(skb, dev); |
3072 | |
3073 | @@ -4630,7 +4627,8 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) |
3074 | } |
3075 | |
3076 | /* Work around for rx fifo overflow */ |
3077 | - if (unlikely(status & RxFIFOOver)) { |
3078 | + if (unlikely(status & RxFIFOOver) && |
3079 | + (tp->mac_version == RTL_GIGA_MAC_VER_11)) { |
3080 | netif_stop_queue(dev); |
3081 | rtl8169_tx_timeout(dev); |
3082 | break; |
3083 | @@ -4891,6 +4889,9 @@ static int rtl8169_resume(struct device *device) |
3084 | { |
3085 | struct pci_dev *pdev = to_pci_dev(device); |
3086 | struct net_device *dev = pci_get_drvdata(pdev); |
3087 | + struct rtl8169_private *tp = netdev_priv(dev); |
3088 | + |
3089 | + rtl8169_init_phy(dev, tp); |
3090 | |
3091 | if (netif_running(dev)) |
3092 | __rtl8169_resume(dev); |
3093 | @@ -4931,6 +4932,8 @@ static int rtl8169_runtime_resume(struct device *device) |
3094 | tp->saved_wolopts = 0; |
3095 | spin_unlock_irq(&tp->lock); |
3096 | |
3097 | + rtl8169_init_phy(dev, tp); |
3098 | + |
3099 | __rtl8169_resume(dev); |
3100 | |
3101 | return 0; |
3102 | diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c |
3103 | index ca7fc9d..c04d49e 100644 |
3104 | --- a/drivers/net/usb/usbnet.c |
3105 | +++ b/drivers/net/usb/usbnet.c |
3106 | @@ -45,6 +45,7 @@ |
3107 | #include <linux/usb/usbnet.h> |
3108 | #include <linux/slab.h> |
3109 | #include <linux/kernel.h> |
3110 | +#include <linux/pm_runtime.h> |
3111 | |
3112 | #define DRIVER_VERSION "22-Aug-2005" |
3113 | |
3114 | @@ -1273,6 +1274,16 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod) |
3115 | struct usb_device *xdev; |
3116 | int status; |
3117 | const char *name; |
3118 | + struct usb_driver *driver = to_usb_driver(udev->dev.driver); |
3119 | + |
3120 | + /* usbnet already took usb runtime pm, so have to enable the feature |
3121 | + * for usb interface, otherwise usb_autopm_get_interface may return |
3122 | + * failure if USB_SUSPEND(RUNTIME_PM) is enabled. |
3123 | + */ |
3124 | + if (!driver->supports_autosuspend) { |
3125 | + driver->supports_autosuspend = 1; |
3126 | + pm_runtime_enable(&udev->dev); |
3127 | + } |
3128 | |
3129 | name = udev->dev.driver->name; |
3130 | info = (struct driver_info *) prod->driver_info; |
3131 | diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h |
3132 | index d32f282..a706202 100644 |
3133 | --- a/drivers/net/wireless/ath/ath.h |
3134 | +++ b/drivers/net/wireless/ath/ath.h |
3135 | @@ -119,6 +119,7 @@ struct ath_common { |
3136 | |
3137 | u32 keymax; |
3138 | DECLARE_BITMAP(keymap, ATH_KEYMAX); |
3139 | + DECLARE_BITMAP(tkip_keymap, ATH_KEYMAX); |
3140 | u8 splitmic; |
3141 | |
3142 | struct ath_regulatory regulatory; |
3143 | diff --git a/drivers/net/wireless/ath/ath9k/ar9002_hw.c b/drivers/net/wireless/ath/ath9k/ar9002_hw.c |
3144 | index 303c63d..cb90aa8 100644 |
3145 | --- a/drivers/net/wireless/ath/ath9k/ar9002_hw.c |
3146 | +++ b/drivers/net/wireless/ath/ath9k/ar9002_hw.c |
3147 | @@ -411,6 +411,9 @@ static void ar9002_hw_configpcipowersave(struct ath_hw *ah, |
3148 | val &= ~(AR_WA_BIT6 | AR_WA_BIT7); |
3149 | } |
3150 | |
3151 | + if (AR_SREV_9280(ah)) |
3152 | + val |= AR_WA_BIT22; |
3153 | + |
3154 | if (AR_SREV_9285E_20(ah)) |
3155 | val |= AR_WA_BIT23; |
3156 | |
3157 | diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h |
3158 | index ec98ab5..a14a5e4 100644 |
3159 | --- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h |
3160 | +++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h |
3161 | @@ -34,6 +34,10 @@ static const u32 ar9300_2p2_radio_postamble[][5] = { |
3162 | |
3163 | static const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p2[][5] = { |
3164 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
3165 | + {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800}, |
3166 | + {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000}, |
3167 | + {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000}, |
3168 | + {0x0000a2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3169 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, |
3170 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3171 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, |
3172 | @@ -99,6 +103,30 @@ static const u32 ar9300Modes_lowest_ob_db_tx_gain_table_2p2[][5] = { |
3173 | {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, |
3174 | {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, |
3175 | {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, |
3176 | + {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3177 | + {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3178 | + {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3179 | + {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3180 | + {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3181 | + {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, |
3182 | + {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, |
3183 | + {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501}, |
3184 | + {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03}, |
3185 | + {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, |
3186 | + {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04}, |
3187 | + {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005}, |
3188 | + {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, |
3189 | + {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, |
3190 | + {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, |
3191 | + {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, |
3192 | + {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800}, |
3193 | + {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000}, |
3194 | + {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000}, |
3195 | + {0x0000b2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3196 | + {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800}, |
3197 | + {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000}, |
3198 | + {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000}, |
3199 | + {0x0000c2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3200 | {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, |
3201 | {0x00016048, 0x62480001, 0x62480001, 0x62480001, 0x62480001}, |
3202 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
3203 | @@ -118,7 +146,7 @@ static const u32 ar9300Modes_fast_clock_2p2[][3] = { |
3204 | {0x00008014, 0x044c044c, 0x08980898}, |
3205 | {0x0000801c, 0x148ec02b, 0x148ec057}, |
3206 | {0x00008318, 0x000044c0, 0x00008980}, |
3207 | - {0x00009e00, 0x03721821, 0x03721821}, |
3208 | + {0x00009e00, 0x0372131c, 0x0372131c}, |
3209 | {0x0000a230, 0x0000000b, 0x00000016}, |
3210 | {0x0000a254, 0x00000898, 0x00001130}, |
3211 | }; |
3212 | @@ -595,15 +623,16 @@ static const u32 ar9300_2p2_baseband_postamble[][5] = { |
3213 | {0x0000982c, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4, 0x05eea6d4}, |
3214 | {0x00009830, 0x0000059c, 0x0000059c, 0x0000119c, 0x0000119c}, |
3215 | {0x00009c00, 0x000000c4, 0x000000c4, 0x000000c4, 0x000000c4}, |
3216 | - {0x00009e00, 0x0372161e, 0x0372161e, 0x037216a0, 0x037216a0}, |
3217 | - {0x00009e04, 0x00802020, 0x00802020, 0x00802020, 0x00802020}, |
3218 | + {0x00009e00, 0x0372111a, 0x0372111a, 0x037216a0, 0x037216a0}, |
3219 | + {0x00009e04, 0x001c2020, 0x001c2020, 0x001c2020, 0x001c2020}, |
3220 | {0x00009e0c, 0x6c4000e2, 0x6d4000e2, 0x6d4000e2, 0x6c4000e2}, |
3221 | {0x00009e10, 0x7ec88d2e, 0x7ec88d2e, 0x7ec84d2e, 0x7ec84d2e}, |
3222 | - {0x00009e14, 0x31395d5e, 0x3139605e, 0x3139605e, 0x31395d5e}, |
3223 | + {0x00009e14, 0x37b95d5e, 0x37b9605e, 0x3379605e, 0x33795d5e}, |
3224 | {0x00009e18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3225 | {0x00009e1c, 0x0001cf9c, 0x0001cf9c, 0x00021f9c, 0x00021f9c}, |
3226 | {0x00009e20, 0x000003b5, 0x000003b5, 0x000003ce, 0x000003ce}, |
3227 | {0x00009e2c, 0x0000001c, 0x0000001c, 0x00000021, 0x00000021}, |
3228 | + {0x00009e3c, 0xcf946220, 0xcf946220, 0xcf946222, 0xcf946222}, |
3229 | {0x00009e44, 0x02321e27, 0x02321e27, 0x02291e27, 0x02291e27}, |
3230 | {0x00009e48, 0x5030201a, 0x5030201a, 0x50302012, 0x50302012}, |
3231 | {0x00009fc8, 0x0003f000, 0x0003f000, 0x0001a000, 0x0001a000}, |
3232 | @@ -624,16 +653,16 @@ static const u32 ar9300_2p2_baseband_postamble[][5] = { |
3233 | {0x0000a28c, 0x00022222, 0x00022222, 0x00022222, 0x00022222}, |
3234 | {0x0000a2c4, 0x00158d18, 0x00158d18, 0x00158d18, 0x00158d18}, |
3235 | {0x0000a2d0, 0x00071981, 0x00071981, 0x00071981, 0x00071982}, |
3236 | - {0x0000a2d8, 0xf999a83a, 0xf999a83a, 0xf999a83a, 0xf999a83a}, |
3237 | + {0x0000a2d8, 0x7999a83a, 0x7999a83a, 0x7999a83a, 0x7999a83a}, |
3238 | {0x0000a358, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3239 | {0x0000a830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, |
3240 | - {0x0000ae04, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, |
3241 | + {0x0000ae04, 0x001c0000, 0x001c0000, 0x001c0000, 0x001c0000}, |
3242 | {0x0000ae18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3243 | {0x0000ae1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, |
3244 | {0x0000ae20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, |
3245 | {0x0000b284, 0x00000000, 0x00000000, 0x00000150, 0x00000150}, |
3246 | {0x0000b830, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, |
3247 | - {0x0000be04, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, |
3248 | + {0x0000be04, 0x001c0000, 0x001c0000, 0x001c0000, 0x001c0000}, |
3249 | {0x0000be18, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3250 | {0x0000be1c, 0x0000019c, 0x0000019c, 0x0000019c, 0x0000019c}, |
3251 | {0x0000be20, 0x000001b5, 0x000001b5, 0x000001ce, 0x000001ce}, |
3252 | @@ -649,13 +678,13 @@ static const u32 ar9300_2p2_baseband_core[][2] = { |
3253 | {0x00009814, 0x9280c00a}, |
3254 | {0x00009818, 0x00000000}, |
3255 | {0x0000981c, 0x00020028}, |
3256 | - {0x00009834, 0x5f3ca3de}, |
3257 | + {0x00009834, 0x6400a290}, |
3258 | {0x00009838, 0x0108ecff}, |
3259 | {0x0000983c, 0x14750600}, |
3260 | {0x00009880, 0x201fff00}, |
3261 | {0x00009884, 0x00001042}, |
3262 | {0x000098a4, 0x00200400}, |
3263 | - {0x000098b0, 0x52440bbe}, |
3264 | + {0x000098b0, 0x32840bbe}, |
3265 | {0x000098d0, 0x004b6a8e}, |
3266 | {0x000098d4, 0x00000820}, |
3267 | {0x000098dc, 0x00000000}, |
3268 | @@ -681,7 +710,6 @@ static const u32 ar9300_2p2_baseband_core[][2] = { |
3269 | {0x00009e30, 0x06336f77}, |
3270 | {0x00009e34, 0x6af6532f}, |
3271 | {0x00009e38, 0x0cc80c00}, |
3272 | - {0x00009e3c, 0xcf946222}, |
3273 | {0x00009e40, 0x0d261820}, |
3274 | {0x00009e4c, 0x00001004}, |
3275 | {0x00009e50, 0x00ff03f1}, |
3276 | @@ -694,7 +722,7 @@ static const u32 ar9300_2p2_baseband_core[][2] = { |
3277 | {0x0000a220, 0x00000000}, |
3278 | {0x0000a224, 0x00000000}, |
3279 | {0x0000a228, 0x10002310}, |
3280 | - {0x0000a22c, 0x01036a1e}, |
3281 | + {0x0000a22c, 0x01036a27}, |
3282 | {0x0000a23c, 0x00000000}, |
3283 | {0x0000a244, 0x0c000000}, |
3284 | {0x0000a2a0, 0x00000001}, |
3285 | @@ -702,10 +730,6 @@ static const u32 ar9300_2p2_baseband_core[][2] = { |
3286 | {0x0000a2c8, 0x00000000}, |
3287 | {0x0000a2cc, 0x18c43433}, |
3288 | {0x0000a2d4, 0x00000000}, |
3289 | - {0x0000a2dc, 0x00000000}, |
3290 | - {0x0000a2e0, 0x00000000}, |
3291 | - {0x0000a2e4, 0x00000000}, |
3292 | - {0x0000a2e8, 0x00000000}, |
3293 | {0x0000a2ec, 0x00000000}, |
3294 | {0x0000a2f0, 0x00000000}, |
3295 | {0x0000a2f4, 0x00000000}, |
3296 | @@ -753,33 +777,17 @@ static const u32 ar9300_2p2_baseband_core[][2] = { |
3297 | {0x0000a430, 0x1ce739ce}, |
3298 | {0x0000a434, 0x00000000}, |
3299 | {0x0000a438, 0x00001801}, |
3300 | - {0x0000a43c, 0x00000000}, |
3301 | + {0x0000a43c, 0x00100000}, |
3302 | {0x0000a440, 0x00000000}, |
3303 | {0x0000a444, 0x00000000}, |
3304 | {0x0000a448, 0x06000080}, |
3305 | {0x0000a44c, 0x00000001}, |
3306 | {0x0000a450, 0x00010000}, |
3307 | {0x0000a458, 0x00000000}, |
3308 | - {0x0000a600, 0x00000000}, |
3309 | - {0x0000a604, 0x00000000}, |
3310 | - {0x0000a608, 0x00000000}, |
3311 | - {0x0000a60c, 0x00000000}, |
3312 | - {0x0000a610, 0x00000000}, |
3313 | - {0x0000a614, 0x00000000}, |
3314 | - {0x0000a618, 0x00000000}, |
3315 | - {0x0000a61c, 0x00000000}, |
3316 | - {0x0000a620, 0x00000000}, |
3317 | - {0x0000a624, 0x00000000}, |
3318 | - {0x0000a628, 0x00000000}, |
3319 | - {0x0000a62c, 0x00000000}, |
3320 | - {0x0000a630, 0x00000000}, |
3321 | - {0x0000a634, 0x00000000}, |
3322 | - {0x0000a638, 0x00000000}, |
3323 | - {0x0000a63c, 0x00000000}, |
3324 | {0x0000a640, 0x00000000}, |
3325 | {0x0000a644, 0x3fad9d74}, |
3326 | {0x0000a648, 0x0048060a}, |
3327 | - {0x0000a64c, 0x00000637}, |
3328 | + {0x0000a64c, 0x00003c37}, |
3329 | {0x0000a670, 0x03020100}, |
3330 | {0x0000a674, 0x09080504}, |
3331 | {0x0000a678, 0x0d0c0b0a}, |
3332 | @@ -802,10 +810,6 @@ static const u32 ar9300_2p2_baseband_core[][2] = { |
3333 | {0x0000a8f4, 0x00000000}, |
3334 | {0x0000b2d0, 0x00000080}, |
3335 | {0x0000b2d4, 0x00000000}, |
3336 | - {0x0000b2dc, 0x00000000}, |
3337 | - {0x0000b2e0, 0x00000000}, |
3338 | - {0x0000b2e4, 0x00000000}, |
3339 | - {0x0000b2e8, 0x00000000}, |
3340 | {0x0000b2ec, 0x00000000}, |
3341 | {0x0000b2f0, 0x00000000}, |
3342 | {0x0000b2f4, 0x00000000}, |
3343 | @@ -820,10 +824,6 @@ static const u32 ar9300_2p2_baseband_core[][2] = { |
3344 | {0x0000b8f4, 0x00000000}, |
3345 | {0x0000c2d0, 0x00000080}, |
3346 | {0x0000c2d4, 0x00000000}, |
3347 | - {0x0000c2dc, 0x00000000}, |
3348 | - {0x0000c2e0, 0x00000000}, |
3349 | - {0x0000c2e4, 0x00000000}, |
3350 | - {0x0000c2e8, 0x00000000}, |
3351 | {0x0000c2ec, 0x00000000}, |
3352 | {0x0000c2f0, 0x00000000}, |
3353 | {0x0000c2f4, 0x00000000}, |
3354 | @@ -835,6 +835,10 @@ static const u32 ar9300_2p2_baseband_core[][2] = { |
3355 | |
3356 | static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { |
3357 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
3358 | + {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800}, |
3359 | + {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000}, |
3360 | + {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000}, |
3361 | + {0x0000a2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3362 | {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, |
3363 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, |
3364 | {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, |
3365 | @@ -855,7 +859,7 @@ static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { |
3366 | {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, |
3367 | {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, |
3368 | {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, |
3369 | - {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83}, |
3370 | + {0x0000a54c, 0x59025eb2, 0x59025eb2, 0x42001a83, 0x42001a83}, |
3371 | {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, |
3372 | {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, |
3373 | {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, |
3374 | @@ -900,6 +904,30 @@ static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { |
3375 | {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
3376 | {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
3377 | {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
3378 | + {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3379 | + {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3380 | + {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3381 | + {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3382 | + {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000}, |
3383 | + {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000}, |
3384 | + {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501}, |
3385 | + {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501}, |
3386 | + {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03}, |
3387 | + {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04}, |
3388 | + {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04}, |
3389 | + {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, |
3390 | + {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, |
3391 | + {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, |
3392 | + {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, |
3393 | + {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, |
3394 | + {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800}, |
3395 | + {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000}, |
3396 | + {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000}, |
3397 | + {0x0000b2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3398 | + {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800}, |
3399 | + {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000}, |
3400 | + {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000}, |
3401 | + {0x0000c2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3402 | {0x00016044, 0x056db2e6, 0x056db2e6, 0x056db2e6, 0x056db2e6}, |
3403 | {0x00016048, 0xae480001, 0xae480001, 0xae480001, 0xae480001}, |
3404 | {0x00016068, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c, 0x6eb6db6c}, |
3405 | @@ -913,6 +941,10 @@ static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { |
3406 | |
3407 | static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p2[][5] = { |
3408 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
3409 | + {0x0000a2dc, 0x01feee00, 0x01feee00, 0x00637800, 0x00637800}, |
3410 | + {0x0000a2e0, 0x0000f000, 0x0000f000, 0x03838000, 0x03838000}, |
3411 | + {0x0000a2e4, 0x01ff0000, 0x01ff0000, 0x03fc0000, 0x03fc0000}, |
3412 | + {0x0000a2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3413 | {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, |
3414 | {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, |
3415 | {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, |
3416 | @@ -933,7 +965,7 @@ static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p2[][5] = { |
3417 | {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, |
3418 | {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, |
3419 | {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, |
3420 | - {0x0000a54c, 0x59025eb5, 0x59025eb5, 0x42001a83, 0x42001a83}, |
3421 | + {0x0000a54c, 0x59025eb2, 0x59025eb2, 0x42001a83, 0x42001a83}, |
3422 | {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, |
3423 | {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, |
3424 | {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, |
3425 | @@ -978,6 +1010,30 @@ static const u32 ar9300Modes_high_ob_db_tx_gain_table_2p2[][5] = { |
3426 | {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
3427 | {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
3428 | {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, |
3429 | + {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3430 | + {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3431 | + {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3432 | + {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3433 | + {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000}, |
3434 | + {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000}, |
3435 | + {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501}, |
3436 | + {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501}, |
3437 | + {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03}, |
3438 | + {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04}, |
3439 | + {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04}, |
3440 | + {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, |
3441 | + {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, |
3442 | + {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, |
3443 | + {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, |
3444 | + {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, |
3445 | + {0x0000b2dc, 0x01feee00, 0x01feee00, 0x00637800, 0x00637800}, |
3446 | + {0x0000b2e0, 0x0000f000, 0x0000f000, 0x03838000, 0x03838000}, |
3447 | + {0x0000b2e4, 0x01ff0000, 0x01ff0000, 0x03fc0000, 0x03fc0000}, |
3448 | + {0x0000b2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3449 | + {0x0000c2dc, 0x01feee00, 0x01feee00, 0x00637800, 0x00637800}, |
3450 | + {0x0000c2e0, 0x0000f000, 0x0000f000, 0x03838000, 0x03838000}, |
3451 | + {0x0000c2e4, 0x01ff0000, 0x01ff0000, 0x03fc0000, 0x03fc0000}, |
3452 | + {0x0000c2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3453 | {0x00016044, 0x056db2e4, 0x056db2e4, 0x056db2e4, 0x056db2e4}, |
3454 | {0x00016048, 0x8e480001, 0x8e480001, 0x8e480001, 0x8e480001}, |
3455 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
3456 | @@ -1151,14 +1207,14 @@ static const u32 ar9300Common_rx_gain_table_2p2[][2] = { |
3457 | {0x0000b074, 0x00000000}, |
3458 | {0x0000b078, 0x00000000}, |
3459 | {0x0000b07c, 0x00000000}, |
3460 | - {0x0000b080, 0x32323232}, |
3461 | - {0x0000b084, 0x2f2f3232}, |
3462 | - {0x0000b088, 0x23282a2d}, |
3463 | - {0x0000b08c, 0x1c1e2123}, |
3464 | - {0x0000b090, 0x14171919}, |
3465 | - {0x0000b094, 0x0e0e1214}, |
3466 | - {0x0000b098, 0x03050707}, |
3467 | - {0x0000b09c, 0x00030303}, |
3468 | + {0x0000b080, 0x2a2d2f32}, |
3469 | + {0x0000b084, 0x21232328}, |
3470 | + {0x0000b088, 0x19191c1e}, |
3471 | + {0x0000b08c, 0x12141417}, |
3472 | + {0x0000b090, 0x07070e0e}, |
3473 | + {0x0000b094, 0x03030305}, |
3474 | + {0x0000b098, 0x00000003}, |
3475 | + {0x0000b09c, 0x00000000}, |
3476 | {0x0000b0a0, 0x00000000}, |
3477 | {0x0000b0a4, 0x00000000}, |
3478 | {0x0000b0a8, 0x00000000}, |
3479 | @@ -1251,6 +1307,10 @@ static const u32 ar9300Common_rx_gain_table_2p2[][2] = { |
3480 | |
3481 | static const u32 ar9300Modes_low_ob_db_tx_gain_table_2p2[][5] = { |
3482 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ |
3483 | + {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800}, |
3484 | + {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000}, |
3485 | + {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000}, |
3486 | + {0x0000a2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3487 | {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, |
3488 | {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3489 | {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, |
3490 | @@ -1316,6 +1376,30 @@ static const u32 ar9300Modes_low_ob_db_tx_gain_table_2p2[][5] = { |
3491 | {0x0000a5f4, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, |
3492 | {0x0000a5f8, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, |
3493 | {0x0000a5fc, 0x7782b08c, 0x7782b08c, 0x5d801eec, 0x5d801eec}, |
3494 | + {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3495 | + {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3496 | + {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3497 | + {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3498 | + {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3499 | + {0x0000a614, 0x01404000, 0x01404000, 0x01404000, 0x01404000}, |
3500 | + {0x0000a618, 0x01404501, 0x01404501, 0x01404501, 0x01404501}, |
3501 | + {0x0000a61c, 0x02008802, 0x02008802, 0x02008501, 0x02008501}, |
3502 | + {0x0000a620, 0x0300cc03, 0x0300cc03, 0x0280ca03, 0x0280ca03}, |
3503 | + {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, |
3504 | + {0x0000a628, 0x0300cc03, 0x0300cc03, 0x04014c04, 0x04014c04}, |
3505 | + {0x0000a62c, 0x03810c03, 0x03810c03, 0x04015005, 0x04015005}, |
3506 | + {0x0000a630, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, |
3507 | + {0x0000a634, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, |
3508 | + {0x0000a638, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, |
3509 | + {0x0000a63c, 0x03810e04, 0x03810e04, 0x04015005, 0x04015005}, |
3510 | + {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800}, |
3511 | + {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000}, |
3512 | + {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000}, |
3513 | + {0x0000b2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3514 | + {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x00637800, 0x00637800}, |
3515 | + {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03838000, 0x03838000}, |
3516 | + {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03fc0000, 0x03fc0000}, |
3517 | + {0x0000c2e8, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, |
3518 | {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, |
3519 | {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, |
3520 | {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, |
3521 | @@ -1414,15 +1498,10 @@ static const u32 ar9300_2p2_mac_core[][2] = { |
3522 | {0x00008144, 0xffffffff}, |
3523 | {0x00008168, 0x00000000}, |
3524 | {0x0000816c, 0x00000000}, |
3525 | - {0x00008170, 0x18486200}, |
3526 | - {0x00008174, 0x33332210}, |
3527 | - {0x00008178, 0x00000000}, |
3528 | - {0x0000817c, 0x00020000}, |
3529 | {0x000081c0, 0x00000000}, |
3530 | {0x000081c4, 0x33332210}, |
3531 | {0x000081c8, 0x00000000}, |
3532 | {0x000081cc, 0x00000000}, |
3533 | - {0x000081d4, 0x00000000}, |
3534 | {0x000081ec, 0x00000000}, |
3535 | {0x000081f0, 0x00000000}, |
3536 | {0x000081f4, 0x00000000}, |
3537 | diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c |
3538 | index 5b995be..1a0ab70 100644 |
3539 | --- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c |
3540 | +++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c |
3541 | @@ -616,7 +616,8 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs, |
3542 | rxs->rs_status |= ATH9K_RXERR_DECRYPT; |
3543 | } else if (rxsp->status11 & AR_MichaelErr) { |
3544 | rxs->rs_status |= ATH9K_RXERR_MIC; |
3545 | - } |
3546 | + } else if (rxsp->status11 & AR_KeyMiss) |
3547 | + rxs->rs_status |= ATH9K_RXERR_DECRYPT; |
3548 | } |
3549 | |
3550 | return 0; |
3551 | diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c |
3552 | index 7c38229..716db41 100644 |
3553 | --- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c |
3554 | +++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c |
3555 | @@ -347,6 +347,10 @@ static bool create_pa_curve(u32 *data_L, u32 *data_U, u32 *pa_table, u16 *gain) |
3556 | (((Y[6] - Y[3]) * 1 << scale_factor) + |
3557 | (x_est[6] - x_est[3])) / (x_est[6] - x_est[3]); |
3558 | |
3559 | + /* prevent division by zero */ |
3560 | + if (G_fxp == 0) |
3561 | + return false; |
3562 | + |
3563 | Y_intercept = |
3564 | (G_fxp * (x_est[0] - x_est[3]) + |
3565 | (1 << scale_factor)) / (1 << scale_factor) + Y[3]; |
3566 | @@ -356,14 +360,12 @@ static bool create_pa_curve(u32 *data_L, u32 *data_U, u32 *pa_table, u16 *gain) |
3567 | |
3568 | for (i = 0; i <= 3; i++) { |
3569 | y_est[i] = i * 32; |
3570 | - |
3571 | - /* prevent division by zero */ |
3572 | - if (G_fxp == 0) |
3573 | - return false; |
3574 | - |
3575 | x_est[i] = ((y_est[i] * 1 << scale_factor) + G_fxp) / G_fxp; |
3576 | } |
3577 | |
3578 | + if (y_est[max_index] == 0) |
3579 | + return false; |
3580 | + |
3581 | x_est_fxp1_nonlin = |
3582 | x_est[max_index] - ((1 << scale_factor) * y_est[max_index] + |
3583 | G_fxp) / G_fxp; |
3584 | @@ -457,6 +459,8 @@ static bool create_pa_curve(u32 *data_L, u32 *data_U, u32 *pa_table, u16 *gain) |
3585 | |
3586 | Q_scale_B = find_proper_scale(find_expn(abs(scale_B)), 10); |
3587 | scale_B = scale_B / (1 << Q_scale_B); |
3588 | + if (scale_B == 0) |
3589 | + return false; |
3590 | Q_beta = find_proper_scale(find_expn(abs(beta_raw)), 10); |
3591 | Q_alpha = find_proper_scale(find_expn(abs(alpha_raw)), 10); |
3592 | beta_raw = beta_raw / (1 << Q_beta); |
3593 | diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h |
3594 | index 07f26ee..e7ab702 100644 |
3595 | --- a/drivers/net/wireless/ath/ath9k/ath9k.h |
3596 | +++ b/drivers/net/wireless/ath/ath9k/ath9k.h |
3597 | @@ -312,7 +312,7 @@ struct ath_rx { |
3598 | u8 rxotherant; |
3599 | u32 *rxlink; |
3600 | unsigned int rxfilter; |
3601 | - spinlock_t rxflushlock; |
3602 | + spinlock_t pcu_lock; |
3603 | spinlock_t rxbuflock; |
3604 | struct list_head rxbuf; |
3605 | struct ath_descdma rxdma; |
3606 | @@ -346,8 +346,8 @@ void ath_tx_tasklet(struct ath_softc *sc); |
3607 | void ath_tx_edma_tasklet(struct ath_softc *sc); |
3608 | void ath_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb); |
3609 | bool ath_tx_aggr_check(struct ath_softc *sc, struct ath_node *an, u8 tidno); |
3610 | -void ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, |
3611 | - u16 tid, u16 *ssn); |
3612 | +int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, |
3613 | + u16 tid, u16 *ssn); |
3614 | void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); |
3615 | void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid); |
3616 | void ath9k_enable_ps(struct ath_softc *sc); |
3617 | @@ -516,7 +516,6 @@ void ath_deinit_leds(struct ath_softc *sc); |
3618 | #define SC_OP_RXFLUSH BIT(7) |
3619 | #define SC_OP_LED_ASSOCIATED BIT(8) |
3620 | #define SC_OP_LED_ON BIT(9) |
3621 | -#define SC_OP_SCANNING BIT(10) |
3622 | #define SC_OP_TSF_RESET BIT(11) |
3623 | #define SC_OP_BT_PRIORITY_DETECTED BIT(12) |
3624 | #define SC_OP_BT_SCAN BIT(13) |
3625 | diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c |
3626 | index 4d4b22d..20cf2d4 100644 |
3627 | --- a/drivers/net/wireless/ath/ath9k/beacon.c |
3628 | +++ b/drivers/net/wireless/ath/ath9k/beacon.c |
3629 | @@ -366,7 +366,7 @@ void ath_beacon_tasklet(unsigned long data) |
3630 | ath_print(common, ATH_DBG_BEACON, |
3631 | "beacon is officially stuck\n"); |
3632 | sc->sc_flags |= SC_OP_TSF_RESET; |
3633 | - ath_reset(sc, false); |
3634 | + ath_reset(sc, true); |
3635 | } |
3636 | |
3637 | return; |
3638 | diff --git a/drivers/net/wireless/ath/ath9k/common.c b/drivers/net/wireless/ath/ath9k/common.c |
3639 | index c86f7d3..108b433 100644 |
3640 | --- a/drivers/net/wireless/ath/ath9k/common.c |
3641 | +++ b/drivers/net/wireless/ath/ath9k/common.c |
3642 | @@ -366,9 +366,13 @@ int ath9k_cmn_key_config(struct ath_common *common, |
3643 | set_bit(idx, common->keymap); |
3644 | if (key->alg == ALG_TKIP) { |
3645 | set_bit(idx + 64, common->keymap); |
3646 | + set_bit(idx, common->tkip_keymap); |
3647 | + set_bit(idx + 64, common->tkip_keymap); |
3648 | if (common->splitmic) { |
3649 | set_bit(idx + 32, common->keymap); |
3650 | set_bit(idx + 64 + 32, common->keymap); |
3651 | + set_bit(idx + 32, common->tkip_keymap); |
3652 | + set_bit(idx + 64 + 32, common->tkip_keymap); |
3653 | } |
3654 | } |
3655 | |
3656 | @@ -393,10 +397,17 @@ void ath9k_cmn_key_delete(struct ath_common *common, |
3657 | return; |
3658 | |
3659 | clear_bit(key->hw_key_idx + 64, common->keymap); |
3660 | + |
3661 | + clear_bit(key->hw_key_idx, common->tkip_keymap); |
3662 | + clear_bit(key->hw_key_idx + 64, common->tkip_keymap); |
3663 | + |
3664 | if (common->splitmic) { |
3665 | ath9k_hw_keyreset(ah, key->hw_key_idx + 32); |
3666 | clear_bit(key->hw_key_idx + 32, common->keymap); |
3667 | clear_bit(key->hw_key_idx + 64 + 32, common->keymap); |
3668 | + |
3669 | + clear_bit(key->hw_key_idx + 32, common->tkip_keymap); |
3670 | + clear_bit(key->hw_key_idx + 64 + 32, common->tkip_keymap); |
3671 | } |
3672 | } |
3673 | EXPORT_SYMBOL(ath9k_cmn_key_delete); |
3674 | diff --git a/drivers/net/wireless/ath/ath9k/eeprom_9287.c b/drivers/net/wireless/ath/ath9k/eeprom_9287.c |
3675 | index dff2da7..7cb356e 100644 |
3676 | --- a/drivers/net/wireless/ath/ath9k/eeprom_9287.c |
3677 | +++ b/drivers/net/wireless/ath/ath9k/eeprom_9287.c |
3678 | @@ -37,7 +37,7 @@ static bool ath9k_hw_ar9287_fill_eeprom(struct ath_hw *ah) |
3679 | int addr, eep_start_loc; |
3680 | eep_data = (u16 *)eep; |
3681 | |
3682 | - if (ah->hw_version.devid == 0x7015) |
3683 | + if (AR9287_HTC_DEVID(ah)) |
3684 | eep_start_loc = AR9287_HTC_EEP_START_LOC; |
3685 | else |
3686 | eep_start_loc = AR9287_EEP_START_LOC; |
3687 | diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c |
3688 | index 17e7a9a..aba49bf 100644 |
3689 | --- a/drivers/net/wireless/ath/ath9k/hif_usb.c |
3690 | +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c |
3691 | @@ -35,8 +35,14 @@ static struct usb_device_id ath9k_hif_usb_ids[] = { |
3692 | { USB_DEVICE(0x07D1, 0x3A10) }, /* Dlink Wireless 150 */ |
3693 | { USB_DEVICE(0x13D3, 0x3327) }, /* Azurewave */ |
3694 | { USB_DEVICE(0x13D3, 0x3328) }, /* Azurewave */ |
3695 | + { USB_DEVICE(0x13D3, 0x3346) }, /* IMC Networks */ |
3696 | + { USB_DEVICE(0x13D3, 0x3348) }, /* Azurewave */ |
3697 | + { USB_DEVICE(0x13D3, 0x3349) }, /* Azurewave */ |
3698 | + { USB_DEVICE(0x13D3, 0x3350) }, /* Azurewave */ |
3699 | { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */ |
3700 | { USB_DEVICE(0x083A, 0xA704) }, /* SMC Networks */ |
3701 | + { USB_DEVICE(0x040D, 0x3801) }, /* VIA */ |
3702 | + { USB_DEVICE(0x1668, 0x1200) }, /* Verizon */ |
3703 | { }, |
3704 | }; |
3705 | |
3706 | @@ -799,10 +805,18 @@ static int ath9k_hif_usb_download_fw(struct hif_device_usb *hif_dev) |
3707 | } |
3708 | kfree(buf); |
3709 | |
3710 | - if ((hif_dev->device_id == 0x7010) || (hif_dev->device_id == 0x7015)) |
3711 | + switch (hif_dev->device_id) { |
3712 | + case 0x7010: |
3713 | + case 0x7015: |
3714 | + case 0x9018: |
3715 | + case 0xA704: |
3716 | + case 0x1200: |
3717 | firm_offset = AR7010_FIRMWARE_TEXT; |
3718 | - else |
3719 | + break; |
3720 | + default: |
3721 | firm_offset = AR9271_FIRMWARE_TEXT; |
3722 | + break; |
3723 | + } |
3724 | |
3725 | /* |
3726 | * Issue FW download complete command to firmware. |
3727 | @@ -903,6 +917,8 @@ static int ath9k_hif_usb_probe(struct usb_interface *interface, |
3728 | case 0x7010: |
3729 | case 0x7015: |
3730 | case 0x9018: |
3731 | + case 0xA704: |
3732 | + case 0x1200: |
3733 | if (le16_to_cpu(udev->descriptor.bcdDevice) == 0x0202) |
3734 | hif_dev->fw_name = FIRMWARE_AR7010_1_1; |
3735 | else |
3736 | diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c |
3737 | index 2d42791..e5a0122 100644 |
3738 | --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c |
3739 | +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c |
3740 | @@ -247,6 +247,8 @@ static int ath9k_init_htc_services(struct ath9k_htc_priv *priv, u16 devid) |
3741 | case 0x7010: |
3742 | case 0x7015: |
3743 | case 0x9018: |
3744 | + case 0xA704: |
3745 | + case 0x1200: |
3746 | priv->htc->credits = 45; |
3747 | break; |
3748 | default: |
3749 | diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |
3750 | index 2a6e45a..f06eeab 100644 |
3751 | --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |
3752 | +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |
3753 | @@ -121,7 +121,7 @@ int ath9k_htc_tx_start(struct ath9k_htc_priv *priv, struct sk_buff *skb) |
3754 | tx_hdr.data_type = ATH9K_HTC_NORMAL; |
3755 | } |
3756 | |
3757 | - if (ieee80211_is_data(fc)) { |
3758 | + if (ieee80211_is_data_qos(fc)) { |
3759 | qc = ieee80211_get_qos_ctl(hdr); |
3760 | tx_hdr.tidno = qc[0] & IEEE80211_QOS_CTL_TID_MASK; |
3761 | } |
3762 | diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c |
3763 | index 3384ca1..a5779a7 100644 |
3764 | --- a/drivers/net/wireless/ath/ath9k/hw.c |
3765 | +++ b/drivers/net/wireless/ath/ath9k/hw.c |
3766 | @@ -486,6 +486,7 @@ static int ath9k_hw_post_init(struct ath_hw *ah) |
3767 | ath_print(ath9k_hw_common(ah), ATH_DBG_FATAL, |
3768 | "Failed allocating banks for " |
3769 | "external radio\n"); |
3770 | + ath9k_hw_rf_free_ext_banks(ah); |
3771 | return ecode; |
3772 | } |
3773 | |
3774 | diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c |
3775 | index 243c177..7924123 100644 |
3776 | --- a/drivers/net/wireless/ath/ath9k/init.c |
3777 | +++ b/drivers/net/wireless/ath/ath9k/init.c |
3778 | @@ -56,7 +56,7 @@ MODULE_PARM_DESC(blink, "Enable LED blink on activity"); |
3779 | * on 5 MHz steps, we support the channels which we know |
3780 | * we have calibration data for all cards though to make |
3781 | * this static */ |
3782 | -static struct ieee80211_channel ath9k_2ghz_chantable[] = { |
3783 | +static const struct ieee80211_channel ath9k_2ghz_chantable[] = { |
3784 | CHAN2G(2412, 0), /* Channel 1 */ |
3785 | CHAN2G(2417, 1), /* Channel 2 */ |
3786 | CHAN2G(2422, 2), /* Channel 3 */ |
3787 | @@ -77,7 +77,7 @@ static struct ieee80211_channel ath9k_2ghz_chantable[] = { |
3788 | * on 5 MHz steps, we support the channels which we know |
3789 | * we have calibration data for all cards though to make |
3790 | * this static */ |
3791 | -static struct ieee80211_channel ath9k_5ghz_chantable[] = { |
3792 | +static const struct ieee80211_channel ath9k_5ghz_chantable[] = { |
3793 | /* _We_ call this UNII 1 */ |
3794 | CHAN5G(5180, 14), /* Channel 36 */ |
3795 | CHAN5G(5200, 15), /* Channel 40 */ |
3796 | @@ -477,10 +477,17 @@ err: |
3797 | return -EIO; |
3798 | } |
3799 | |
3800 | -static void ath9k_init_channels_rates(struct ath_softc *sc) |
3801 | +static int ath9k_init_channels_rates(struct ath_softc *sc) |
3802 | { |
3803 | + void *channels; |
3804 | + |
3805 | if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes)) { |
3806 | - sc->sbands[IEEE80211_BAND_2GHZ].channels = ath9k_2ghz_chantable; |
3807 | + channels = kmemdup(ath9k_2ghz_chantable, |
3808 | + sizeof(ath9k_2ghz_chantable), GFP_KERNEL); |
3809 | + if (!channels) |
3810 | + return -ENOMEM; |
3811 | + |
3812 | + sc->sbands[IEEE80211_BAND_2GHZ].channels = channels; |
3813 | sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ; |
3814 | sc->sbands[IEEE80211_BAND_2GHZ].n_channels = |
3815 | ARRAY_SIZE(ath9k_2ghz_chantable); |
3816 | @@ -490,7 +497,15 @@ static void ath9k_init_channels_rates(struct ath_softc *sc) |
3817 | } |
3818 | |
3819 | if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes)) { |
3820 | - sc->sbands[IEEE80211_BAND_5GHZ].channels = ath9k_5ghz_chantable; |
3821 | + channels = kmemdup(ath9k_5ghz_chantable, |
3822 | + sizeof(ath9k_5ghz_chantable), GFP_KERNEL); |
3823 | + if (!channels) { |
3824 | + if (sc->sbands[IEEE80211_BAND_2GHZ].channels) |
3825 | + kfree(sc->sbands[IEEE80211_BAND_2GHZ].channels); |
3826 | + return -ENOMEM; |
3827 | + } |
3828 | + |
3829 | + sc->sbands[IEEE80211_BAND_5GHZ].channels = channels; |
3830 | sc->sbands[IEEE80211_BAND_5GHZ].band = IEEE80211_BAND_5GHZ; |
3831 | sc->sbands[IEEE80211_BAND_5GHZ].n_channels = |
3832 | ARRAY_SIZE(ath9k_5ghz_chantable); |
3833 | @@ -499,6 +514,7 @@ static void ath9k_init_channels_rates(struct ath_softc *sc) |
3834 | sc->sbands[IEEE80211_BAND_5GHZ].n_bitrates = |
3835 | ARRAY_SIZE(ath9k_legacy_rates) - 4; |
3836 | } |
3837 | + return 0; |
3838 | } |
3839 | |
3840 | static void ath9k_init_misc(struct ath_softc *sc) |
3841 | @@ -593,8 +609,11 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, |
3842 | if (ret) |
3843 | goto err_btcoex; |
3844 | |
3845 | + ret = ath9k_init_channels_rates(sc); |
3846 | + if (ret) |
3847 | + goto err_btcoex; |
3848 | + |
3849 | ath9k_init_crypto(sc); |
3850 | - ath9k_init_channels_rates(sc); |
3851 | ath9k_init_misc(sc); |
3852 | |
3853 | return 0; |
3854 | @@ -641,7 +660,8 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw) |
3855 | BIT(NL80211_IFTYPE_ADHOC) | |
3856 | BIT(NL80211_IFTYPE_MESH_POINT); |
3857 | |
3858 | - hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
3859 | + if (AR_SREV_5416(sc->sc_ah)) |
3860 | + hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
3861 | |
3862 | hw->queues = 4; |
3863 | hw->max_rates = 4; |
3864 | @@ -751,6 +771,12 @@ static void ath9k_deinit_softc(struct ath_softc *sc) |
3865 | { |
3866 | int i = 0; |
3867 | |
3868 | + if (sc->sbands[IEEE80211_BAND_2GHZ].channels) |
3869 | + kfree(sc->sbands[IEEE80211_BAND_2GHZ].channels); |
3870 | + |
3871 | + if (sc->sbands[IEEE80211_BAND_5GHZ].channels) |
3872 | + kfree(sc->sbands[IEEE80211_BAND_5GHZ].channels); |
3873 | + |
3874 | if ((sc->btcoex.no_stomp_timer) && |
3875 | sc->sc_ah->btcoex_hw.scheme == ATH_BTCOEX_CFG_3WIRE) |
3876 | ath_gen_timer_free(sc->sc_ah, sc->btcoex.no_stomp_timer); |
3877 | diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c |
3878 | index e955bb9..3efda8a 100644 |
3879 | --- a/drivers/net/wireless/ath/ath9k/mac.c |
3880 | +++ b/drivers/net/wireless/ath/ath9k/mac.c |
3881 | @@ -711,8 +711,11 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds, |
3882 | rs->rs_phyerr = phyerr; |
3883 | } else if (ads.ds_rxstatus8 & AR_DecryptCRCErr) |
3884 | rs->rs_status |= ATH9K_RXERR_DECRYPT; |
3885 | - else if (ads.ds_rxstatus8 & AR_MichaelErr) |
3886 | + else if ((ads.ds_rxstatus8 & AR_MichaelErr) && |
3887 | + rs->rs_keyix != ATH9K_RXKEYIX_INVALID) |
3888 | rs->rs_status |= ATH9K_RXERR_MIC; |
3889 | + else if (ads.ds_rxstatus8 & AR_KeyMiss) |
3890 | + rs->rs_status |= ATH9K_RXERR_DECRYPT; |
3891 | } |
3892 | |
3893 | return 0; |
3894 | diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c |
3895 | index 3caa323..853919c 100644 |
3896 | --- a/drivers/net/wireless/ath/ath9k/main.c |
3897 | +++ b/drivers/net/wireless/ath/ath9k/main.c |
3898 | @@ -213,6 +213,9 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, |
3899 | */ |
3900 | ath9k_hw_set_interrupts(ah, 0); |
3901 | ath_drain_all_txq(sc, false); |
3902 | + |
3903 | + spin_lock_bh(&sc->rx.pcu_lock); |
3904 | + |
3905 | stopped = ath_stoprecv(sc); |
3906 | |
3907 | /* XXX: do not flush receive queue here. We don't want |
3908 | @@ -239,6 +242,7 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, |
3909 | "reset status %d\n", |
3910 | channel->center_freq, r); |
3911 | spin_unlock_bh(&sc->sc_resetlock); |
3912 | + spin_unlock_bh(&sc->rx.pcu_lock); |
3913 | goto ps_restore; |
3914 | } |
3915 | spin_unlock_bh(&sc->sc_resetlock); |
3916 | @@ -247,17 +251,20 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw, |
3917 | ath_print(common, ATH_DBG_FATAL, |
3918 | "Unable to restart recv logic\n"); |
3919 | r = -EIO; |
3920 | + spin_unlock_bh(&sc->rx.pcu_lock); |
3921 | goto ps_restore; |
3922 | } |
3923 | |
3924 | + spin_unlock_bh(&sc->rx.pcu_lock); |
3925 | + |
3926 | ath_cache_conf_rate(sc, &hw->conf); |
3927 | ath_update_txpow(sc); |
3928 | ath9k_hw_set_interrupts(ah, ah->imask); |
3929 | |
3930 | - if (!(sc->sc_flags & (SC_OP_OFFCHANNEL | SC_OP_SCANNING))) { |
3931 | - ath_start_ani(common); |
3932 | - ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0); |
3933 | + if (!(sc->sc_flags & (SC_OP_OFFCHANNEL))) { |
3934 | ath_beacon_config(sc, NULL); |
3935 | + ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work, 0); |
3936 | + ath_start_ani(common); |
3937 | } |
3938 | |
3939 | ps_restore: |
3940 | @@ -269,6 +276,7 @@ static void ath_paprd_activate(struct ath_softc *sc) |
3941 | { |
3942 | struct ath_hw *ah = sc->sc_ah; |
3943 | struct ath9k_hw_cal_data *caldata = ah->caldata; |
3944 | + struct ath_common *common = ath9k_hw_common(ah); |
3945 | int chain; |
3946 | |
3947 | if (!caldata || !caldata->paprd_done) |
3948 | @@ -277,7 +285,7 @@ static void ath_paprd_activate(struct ath_softc *sc) |
3949 | ath9k_ps_wakeup(sc); |
3950 | ar9003_paprd_enable(ah, false); |
3951 | for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { |
3952 | - if (!(ah->caps.tx_chainmask & BIT(chain))) |
3953 | + if (!(common->tx_chainmask & BIT(chain))) |
3954 | continue; |
3955 | |
3956 | ar9003_paprd_populate_single_table(ah, caldata, chain); |
3957 | @@ -299,6 +307,7 @@ void ath_paprd_calibrate(struct work_struct *work) |
3958 | struct ieee80211_supported_band *sband = &sc->sbands[band]; |
3959 | struct ath_tx_control txctl; |
3960 | struct ath9k_hw_cal_data *caldata = ah->caldata; |
3961 | + struct ath_common *common = ath9k_hw_common(ah); |
3962 | int qnum, ftype; |
3963 | int chain_ok = 0; |
3964 | int chain; |
3965 | @@ -332,7 +341,7 @@ void ath_paprd_calibrate(struct work_struct *work) |
3966 | ath9k_ps_wakeup(sc); |
3967 | ar9003_paprd_init_table(ah); |
3968 | for (chain = 0; chain < AR9300_MAX_CHAINS; chain++) { |
3969 | - if (!(ah->caps.tx_chainmask & BIT(chain))) |
3970 | + if (!(common->tx_chainmask & BIT(chain))) |
3971 | continue; |
3972 | |
3973 | chain_ok = 0; |
3974 | @@ -550,7 +559,7 @@ void ath_hw_check(struct work_struct *work) |
3975 | |
3976 | msleep(1); |
3977 | } |
3978 | - ath_reset(sc, false); |
3979 | + ath_reset(sc, true); |
3980 | |
3981 | out: |
3982 | ath9k_ps_restore(sc); |
3983 | @@ -568,7 +577,7 @@ void ath9k_tasklet(unsigned long data) |
3984 | ath9k_ps_wakeup(sc); |
3985 | |
3986 | if (status & ATH9K_INT_FATAL) { |
3987 | - ath_reset(sc, false); |
3988 | + ath_reset(sc, true); |
3989 | ath9k_ps_restore(sc); |
3990 | return; |
3991 | } |
3992 | @@ -583,7 +592,7 @@ void ath9k_tasklet(unsigned long data) |
3993 | rxmask = (ATH9K_INT_RX | ATH9K_INT_RXEOL | ATH9K_INT_RXORN); |
3994 | |
3995 | if (status & rxmask) { |
3996 | - spin_lock_bh(&sc->rx.rxflushlock); |
3997 | + spin_lock_bh(&sc->rx.pcu_lock); |
3998 | |
3999 | /* Check for high priority Rx first */ |
4000 | if ((ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) && |
4001 | @@ -591,7 +600,7 @@ void ath9k_tasklet(unsigned long data) |
4002 | ath_rx_tasklet(sc, 0, true); |
4003 | |
4004 | ath_rx_tasklet(sc, 0, false); |
4005 | - spin_unlock_bh(&sc->rx.rxflushlock); |
4006 | + spin_unlock_bh(&sc->rx.pcu_lock); |
4007 | } |
4008 | |
4009 | if (status & ATH9K_INT_TX) { |
4010 | @@ -838,6 +847,7 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw) |
4011 | if (!ah->curchan) |
4012 | ah->curchan = ath_get_curchannel(sc, sc->hw); |
4013 | |
4014 | + spin_lock_bh(&sc->rx.pcu_lock); |
4015 | spin_lock_bh(&sc->sc_resetlock); |
4016 | r = ath9k_hw_reset(ah, ah->curchan, ah->caldata, false); |
4017 | if (r) { |
4018 | @@ -852,8 +862,10 @@ void ath_radio_enable(struct ath_softc *sc, struct ieee80211_hw *hw) |
4019 | if (ath_startrecv(sc) != 0) { |
4020 | ath_print(common, ATH_DBG_FATAL, |
4021 | "Unable to restart recv logic\n"); |
4022 | + spin_unlock_bh(&sc->rx.pcu_lock); |
4023 | return; |
4024 | } |
4025 | + spin_unlock_bh(&sc->rx.pcu_lock); |
4026 | |
4027 | if (sc->sc_flags & SC_OP_BEACONS) |
4028 | ath_beacon_config(sc, NULL); /* restart beacons */ |
4029 | @@ -892,6 +904,9 @@ void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw) |
4030 | ath9k_hw_set_interrupts(ah, 0); |
4031 | |
4032 | ath_drain_all_txq(sc, false); /* clear pending tx frames */ |
4033 | + |
4034 | + spin_lock_bh(&sc->rx.pcu_lock); |
4035 | + |
4036 | ath_stoprecv(sc); /* turn off frame recv */ |
4037 | ath_flushrecv(sc); /* flush recv queue */ |
4038 | |
4039 | @@ -909,6 +924,9 @@ void ath_radio_disable(struct ath_softc *sc, struct ieee80211_hw *hw) |
4040 | spin_unlock_bh(&sc->sc_resetlock); |
4041 | |
4042 | ath9k_hw_phy_disable(ah); |
4043 | + |
4044 | + spin_unlock_bh(&sc->rx.pcu_lock); |
4045 | + |
4046 | ath9k_hw_configpcipowersave(ah, 1, 1); |
4047 | ath9k_ps_restore(sc); |
4048 | ath9k_setpower(sc, ATH9K_PM_FULL_SLEEP); |
4049 | @@ -928,6 +946,9 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) |
4050 | |
4051 | ath9k_hw_set_interrupts(ah, 0); |
4052 | ath_drain_all_txq(sc, retry_tx); |
4053 | + |
4054 | + spin_lock_bh(&sc->rx.pcu_lock); |
4055 | + |
4056 | ath_stoprecv(sc); |
4057 | ath_flushrecv(sc); |
4058 | |
4059 | @@ -942,6 +963,8 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) |
4060 | ath_print(common, ATH_DBG_FATAL, |
4061 | "Unable to start recv logic\n"); |
4062 | |
4063 | + spin_unlock_bh(&sc->rx.pcu_lock); |
4064 | + |
4065 | /* |
4066 | * We may be doing a reset in response to a request |
4067 | * that changes the channel so update any state that |
4068 | @@ -951,7 +974,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx) |
4069 | |
4070 | ath_update_txpow(sc); |
4071 | |
4072 | - if (sc->sc_flags & SC_OP_BEACONS) |
4073 | + if ((sc->sc_flags & SC_OP_BEACONS) || !(sc->sc_flags & (SC_OP_OFFCHANNEL))) |
4074 | ath_beacon_config(sc, NULL); /* restart beacons */ |
4075 | |
4076 | ath9k_hw_set_interrupts(ah, ah->imask); |
4077 | @@ -1106,6 +1129,7 @@ static int ath9k_start(struct ieee80211_hw *hw) |
4078 | * be followed by initialization of the appropriate bits |
4079 | * and then setup of the interrupt mask. |
4080 | */ |
4081 | + spin_lock_bh(&sc->rx.pcu_lock); |
4082 | spin_lock_bh(&sc->sc_resetlock); |
4083 | r = ath9k_hw_reset(ah, init_channel, ah->caldata, false); |
4084 | if (r) { |
4085 | @@ -1114,6 +1138,7 @@ static int ath9k_start(struct ieee80211_hw *hw) |
4086 | "(freq %u MHz)\n", r, |
4087 | curchan->center_freq); |
4088 | spin_unlock_bh(&sc->sc_resetlock); |
4089 | + spin_unlock_bh(&sc->rx.pcu_lock); |
4090 | goto mutex_unlock; |
4091 | } |
4092 | spin_unlock_bh(&sc->sc_resetlock); |
4093 | @@ -1135,8 +1160,10 @@ static int ath9k_start(struct ieee80211_hw *hw) |
4094 | ath_print(common, ATH_DBG_FATAL, |
4095 | "Unable to start recv logic\n"); |
4096 | r = -EIO; |
4097 | + spin_unlock_bh(&sc->rx.pcu_lock); |
4098 | goto mutex_unlock; |
4099 | } |
4100 | + spin_unlock_bh(&sc->rx.pcu_lock); |
4101 | |
4102 | /* Setup our intr mask. */ |
4103 | ah->imask = ATH9K_INT_TX | ATH9K_INT_RXEOL | |
4104 | @@ -1338,12 +1365,14 @@ static void ath9k_stop(struct ieee80211_hw *hw) |
4105 | * before setting the invalid flag. */ |
4106 | ath9k_hw_set_interrupts(ah, 0); |
4107 | |
4108 | + spin_lock_bh(&sc->rx.pcu_lock); |
4109 | if (!(sc->sc_flags & SC_OP_INVALID)) { |
4110 | ath_drain_all_txq(sc, false); |
4111 | ath_stoprecv(sc); |
4112 | ath9k_hw_phy_disable(ah); |
4113 | } else |
4114 | sc->rx.rxlink = NULL; |
4115 | + spin_unlock_bh(&sc->rx.pcu_lock); |
4116 | |
4117 | /* disable HAL and put h/w to sleep */ |
4118 | ath9k_hw_disable(ah); |
4119 | @@ -1556,6 +1585,8 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) |
4120 | * IEEE80211_CONF_CHANGE_PS is only passed by mac80211 for STA mode. |
4121 | */ |
4122 | if (changed & IEEE80211_CONF_CHANGE_PS) { |
4123 | + unsigned long flags; |
4124 | + spin_lock_irqsave(&sc->sc_pm_lock, flags); |
4125 | if (conf->flags & IEEE80211_CONF_PS) { |
4126 | sc->ps_flags |= PS_ENABLED; |
4127 | /* |
4128 | @@ -1570,7 +1601,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) |
4129 | sc->ps_enabled = false; |
4130 | sc->ps_flags &= ~(PS_ENABLED | |
4131 | PS_NULLFUNC_COMPLETED); |
4132 | - ath9k_setpower(sc, ATH9K_PM_AWAKE); |
4133 | + ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE); |
4134 | if (!(ah->caps.hw_caps & |
4135 | ATH9K_HW_CAP_AUTOSLEEP)) { |
4136 | ath9k_hw_setrxabort(sc->sc_ah, 0); |
4137 | @@ -1585,6 +1616,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) |
4138 | } |
4139 | } |
4140 | } |
4141 | + spin_unlock_irqrestore(&sc->sc_pm_lock, flags); |
4142 | } |
4143 | |
4144 | if (changed & IEEE80211_CONF_CHANGE_MONITOR) { |
4145 | @@ -1968,8 +2000,9 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw, |
4146 | break; |
4147 | case IEEE80211_AMPDU_TX_START: |
4148 | ath9k_ps_wakeup(sc); |
4149 | - ath_tx_aggr_start(sc, sta, tid, ssn); |
4150 | - ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
4151 | + ret = ath_tx_aggr_start(sc, sta, tid, ssn); |
4152 | + if (!ret) |
4153 | + ieee80211_start_tx_ba_cb_irqsafe(vif, sta->addr, tid); |
4154 | ath9k_ps_restore(sc); |
4155 | break; |
4156 | case IEEE80211_AMPDU_TX_STOP: |
4157 | @@ -2032,7 +2065,6 @@ static void ath9k_sw_scan_start(struct ieee80211_hw *hw) |
4158 | |
4159 | aphy->state = ATH_WIPHY_SCAN; |
4160 | ath9k_wiphy_pause_all_forced(sc, aphy); |
4161 | - sc->sc_flags |= SC_OP_SCANNING; |
4162 | mutex_unlock(&sc->mutex); |
4163 | } |
4164 | |
4165 | @@ -2047,7 +2079,6 @@ static void ath9k_sw_scan_complete(struct ieee80211_hw *hw) |
4166 | |
4167 | mutex_lock(&sc->mutex); |
4168 | aphy->state = ATH_WIPHY_ACTIVE; |
4169 | - sc->sc_flags &= ~SC_OP_SCANNING; |
4170 | mutex_unlock(&sc->mutex); |
4171 | } |
4172 | |
4173 | diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c |
4174 | index e49be73..5f825ce 100644 |
4175 | --- a/drivers/net/wireless/ath/ath9k/rc.c |
4176 | +++ b/drivers/net/wireless/ath/ath9k/rc.c |
4177 | @@ -538,7 +538,7 @@ static u8 ath_rc_setvalid_rates(struct ath_rate_priv *ath_rc_priv, |
4178 | for (i = 0; i < rateset->rs_nrates; i++) { |
4179 | for (j = 0; j < rate_table->rate_cnt; j++) { |
4180 | u32 phy = rate_table->info[j].phy; |
4181 | - u16 rate_flags = rate_table->info[i].rate_flags; |
4182 | + u16 rate_flags = rate_table->info[j].rate_flags; |
4183 | u8 rate = rateset->rs_rates[i]; |
4184 | u8 dot11rate = rate_table->info[j].dot11rate; |
4185 | |
4186 | @@ -1359,6 +1359,12 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, |
4187 | if (tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) |
4188 | return; |
4189 | |
4190 | + if (!(tx_info->flags & IEEE80211_TX_STAT_AMPDU)) { |
4191 | + tx_info->status.ampdu_ack_len = |
4192 | + (tx_info->flags & IEEE80211_TX_STAT_ACK ? 1 : 0); |
4193 | + tx_info->status.ampdu_len = 1; |
4194 | + } |
4195 | + |
4196 | /* |
4197 | * If an underrun error is seen assume it as an excessive retry only |
4198 | * if max frame trigger level has been reached (2 KB for singel stream, |
4199 | diff --git a/drivers/net/wireless/ath/ath9k/recv.c b/drivers/net/wireless/ath/ath9k/recv.c |
4200 | index a3fc987..41ebd62 100644 |
4201 | --- a/drivers/net/wireless/ath/ath9k/recv.c |
4202 | +++ b/drivers/net/wireless/ath/ath9k/recv.c |
4203 | @@ -288,19 +288,17 @@ static void ath_edma_start_recv(struct ath_softc *sc) |
4204 | ath_rx_addbuffer_edma(sc, ATH9K_RX_QUEUE_LP, |
4205 | sc->rx.rx_edma[ATH9K_RX_QUEUE_LP].rx_fifo_hwsize); |
4206 | |
4207 | - spin_unlock_bh(&sc->rx.rxbuflock); |
4208 | - |
4209 | ath_opmode_init(sc); |
4210 | |
4211 | - ath9k_hw_startpcureceive(sc->sc_ah, (sc->sc_flags & SC_OP_SCANNING)); |
4212 | + ath9k_hw_startpcureceive(sc->sc_ah, (sc->sc_flags & SC_OP_OFFCHANNEL)); |
4213 | + |
4214 | + spin_unlock_bh(&sc->rx.rxbuflock); |
4215 | } |
4216 | |
4217 | static void ath_edma_stop_recv(struct ath_softc *sc) |
4218 | { |
4219 | - spin_lock_bh(&sc->rx.rxbuflock); |
4220 | ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_HP); |
4221 | ath_rx_remove_buffer(sc, ATH9K_RX_QUEUE_LP); |
4222 | - spin_unlock_bh(&sc->rx.rxbuflock); |
4223 | } |
4224 | |
4225 | int ath_rx_init(struct ath_softc *sc, int nbufs) |
4226 | @@ -310,7 +308,7 @@ int ath_rx_init(struct ath_softc *sc, int nbufs) |
4227 | struct ath_buf *bf; |
4228 | int error = 0; |
4229 | |
4230 | - spin_lock_init(&sc->rx.rxflushlock); |
4231 | + spin_lock_init(&sc->rx.pcu_lock); |
4232 | sc->sc_flags &= ~SC_OP_RXFLUSH; |
4233 | spin_lock_init(&sc->rx.rxbuflock); |
4234 | |
4235 | @@ -496,9 +494,10 @@ int ath_startrecv(struct ath_softc *sc) |
4236 | ath9k_hw_rxena(ah); |
4237 | |
4238 | start_recv: |
4239 | - spin_unlock_bh(&sc->rx.rxbuflock); |
4240 | ath_opmode_init(sc); |
4241 | - ath9k_hw_startpcureceive(ah, (sc->sc_flags & SC_OP_SCANNING)); |
4242 | + ath9k_hw_startpcureceive(ah, (sc->sc_flags & SC_OP_OFFCHANNEL)); |
4243 | + |
4244 | + spin_unlock_bh(&sc->rx.rxbuflock); |
4245 | |
4246 | return 0; |
4247 | } |
4248 | @@ -508,7 +507,8 @@ bool ath_stoprecv(struct ath_softc *sc) |
4249 | struct ath_hw *ah = sc->sc_ah; |
4250 | bool stopped; |
4251 | |
4252 | - ath9k_hw_stoppcurecv(ah); |
4253 | + spin_lock_bh(&sc->rx.rxbuflock); |
4254 | + ath9k_hw_abortpcurecv(ah); |
4255 | ath9k_hw_setrxfilter(ah, 0); |
4256 | stopped = ath9k_hw_stopdmarecv(ah); |
4257 | |
4258 | @@ -516,19 +516,18 @@ bool ath_stoprecv(struct ath_softc *sc) |
4259 | ath_edma_stop_recv(sc); |
4260 | else |
4261 | sc->rx.rxlink = NULL; |
4262 | + spin_unlock_bh(&sc->rx.rxbuflock); |
4263 | |
4264 | return stopped; |
4265 | } |
4266 | |
4267 | void ath_flushrecv(struct ath_softc *sc) |
4268 | { |
4269 | - spin_lock_bh(&sc->rx.rxflushlock); |
4270 | sc->sc_flags |= SC_OP_RXFLUSH; |
4271 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) |
4272 | ath_rx_tasklet(sc, 1, true); |
4273 | ath_rx_tasklet(sc, 1, false); |
4274 | sc->sc_flags &= ~SC_OP_RXFLUSH; |
4275 | - spin_unlock_bh(&sc->rx.rxflushlock); |
4276 | } |
4277 | |
4278 | static bool ath_beacon_dtim_pending_cab(struct sk_buff *skb) |
4279 | @@ -631,7 +630,7 @@ static void ath_rx_ps(struct ath_softc *sc, struct sk_buff *skb) |
4280 | * No more broadcast/multicast frames to be received at this |
4281 | * point. |
4282 | */ |
4283 | - sc->ps_flags &= ~PS_WAIT_FOR_CAB; |
4284 | + sc->ps_flags &= ~(PS_WAIT_FOR_CAB | PS_WAIT_FOR_BEACON); |
4285 | ath_print(common, ATH_DBG_PS, |
4286 | "All PS CAB frames received, back to sleep\n"); |
4287 | } else if ((sc->ps_flags & PS_WAIT_FOR_PSPOLL_DATA) && |
4288 | @@ -870,15 +869,18 @@ static bool ath9k_rx_accept(struct ath_common *common, |
4289 | if (rx_stats->rs_status & ATH9K_RXERR_DECRYPT) { |
4290 | *decrypt_error = true; |
4291 | } else if (rx_stats->rs_status & ATH9K_RXERR_MIC) { |
4292 | - if (ieee80211_is_ctl(fc)) |
4293 | - /* |
4294 | - * Sometimes, we get invalid |
4295 | - * MIC failures on valid control frames. |
4296 | - * Remove these mic errors. |
4297 | - */ |
4298 | - rx_stats->rs_status &= ~ATH9K_RXERR_MIC; |
4299 | - else |
4300 | + /* |
4301 | + * The MIC error bit is only valid if the frame |
4302 | + * is not a control frame or fragment, and it was |
4303 | + * decrypted using a valid TKIP key. |
4304 | + */ |
4305 | + if (!ieee80211_is_ctl(fc) && |
4306 | + !ieee80211_has_morefrags(fc) && |
4307 | + !(le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG) && |
4308 | + test_bit(rx_stats->rs_keyix, common->tkip_keymap)) |
4309 | rxs->flag |= RX_FLAG_MMIC_ERROR; |
4310 | + else |
4311 | + rx_stats->rs_status &= ~ATH9K_RXERR_MIC; |
4312 | } |
4313 | /* |
4314 | * Reject error frames with the exception of |
4315 | @@ -1096,6 +1098,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) |
4316 | u8 rx_status_len = ah->caps.rx_status_len; |
4317 | u64 tsf = 0; |
4318 | u32 tsf_lower = 0; |
4319 | + unsigned long flags; |
4320 | |
4321 | if (edma) |
4322 | dma_type = DMA_BIDIRECTIONAL; |
4323 | @@ -1204,11 +1207,13 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp) |
4324 | sc->rx.rxotherant = 0; |
4325 | } |
4326 | |
4327 | + spin_lock_irqsave(&sc->sc_pm_lock, flags); |
4328 | if (unlikely(ath9k_check_auto_sleep(sc) || |
4329 | (sc->ps_flags & (PS_WAIT_FOR_BEACON | |
4330 | PS_WAIT_FOR_CAB | |
4331 | PS_WAIT_FOR_PSPOLL_DATA)))) |
4332 | ath_rx_ps(sc, skb); |
4333 | + spin_unlock_irqrestore(&sc->sc_pm_lock, flags); |
4334 | |
4335 | ath_rx_send_to_mac80211(hw, sc, skb, rxs); |
4336 | |
4337 | diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h |
4338 | index d01c4ad..1c24fcc 100644 |
4339 | --- a/drivers/net/wireless/ath/ath9k/reg.h |
4340 | +++ b/drivers/net/wireless/ath/ath9k/reg.h |
4341 | @@ -709,6 +709,7 @@ |
4342 | #define AR_WA_RESET_EN (1 << 18) /* Sw Control to enable PCI-Reset to POR (bit 15) */ |
4343 | #define AR_WA_ANALOG_SHIFT (1 << 20) |
4344 | #define AR_WA_POR_SHORT (1 << 21) /* PCI-E Phy reset control */ |
4345 | +#define AR_WA_BIT22 (1 << 22) |
4346 | #define AR9285_WA_DEFAULT 0x004a050b |
4347 | #define AR9280_WA_DEFAULT 0x0040073b |
4348 | #define AR_WA_DEFAULT 0x0000073f |
4349 | @@ -900,7 +901,13 @@ |
4350 | #define AR_DEVID_7010(_ah) \ |
4351 | (((_ah)->hw_version.devid == 0x7010) || \ |
4352 | ((_ah)->hw_version.devid == 0x7015) || \ |
4353 | - ((_ah)->hw_version.devid == 0x9018)) |
4354 | + ((_ah)->hw_version.devid == 0x9018) || \ |
4355 | + ((_ah)->hw_version.devid == 0xA704) || \ |
4356 | + ((_ah)->hw_version.devid == 0x1200)) |
4357 | + |
4358 | +#define AR9287_HTC_DEVID(_ah) \ |
4359 | + (((_ah)->hw_version.devid == 0x7015) || \ |
4360 | + ((_ah)->hw_version.devid == 0x1200)) |
4361 | |
4362 | #define AR_RADIO_SREV_MAJOR 0xf0 |
4363 | #define AR_RAD5133_SREV_MAJOR 0xc0 |
4364 | diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c |
4365 | index 4dda14e..a5c489c 100644 |
4366 | --- a/drivers/net/wireless/ath/ath9k/xmit.c |
4367 | +++ b/drivers/net/wireless/ath/ath9k/xmit.c |
4368 | @@ -61,6 +61,8 @@ static int ath_tx_num_badfrms(struct ath_softc *sc, struct ath_buf *bf, |
4369 | struct ath_tx_status *ts, int txok); |
4370 | static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts, |
4371 | int nbad, int txok, bool update_rc); |
4372 | +static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid, |
4373 | + int seqno); |
4374 | |
4375 | enum { |
4376 | MCS_HT20, |
4377 | @@ -143,18 +145,23 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid) |
4378 | struct ath_txq *txq = &sc->tx.txq[tid->ac->qnum]; |
4379 | struct ath_buf *bf; |
4380 | struct list_head bf_head; |
4381 | - INIT_LIST_HEAD(&bf_head); |
4382 | + struct ath_tx_status ts; |
4383 | |
4384 | - WARN_ON(!tid->paused); |
4385 | + INIT_LIST_HEAD(&bf_head); |
4386 | |
4387 | + memset(&ts, 0, sizeof(ts)); |
4388 | spin_lock_bh(&txq->axq_lock); |
4389 | - tid->paused = false; |
4390 | |
4391 | while (!list_empty(&tid->buf_q)) { |
4392 | bf = list_first_entry(&tid->buf_q, struct ath_buf, list); |
4393 | - BUG_ON(bf_isretried(bf)); |
4394 | list_move_tail(&bf->list, &bf_head); |
4395 | - ath_tx_send_ht_normal(sc, txq, tid, &bf_head); |
4396 | + |
4397 | + if (bf_isretried(bf)) { |
4398 | + ath_tx_update_baw(sc, tid, bf->bf_seqno); |
4399 | + ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0); |
4400 | + } else { |
4401 | + ath_tx_send_ht_normal(sc, txq, tid, &bf_head); |
4402 | + } |
4403 | } |
4404 | |
4405 | spin_unlock_bh(&txq->axq_lock); |
4406 | @@ -312,6 +319,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, |
4407 | int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0; |
4408 | bool rc_update = true; |
4409 | struct ieee80211_tx_rate rates[4]; |
4410 | + int nframes; |
4411 | |
4412 | skb = bf->bf_mpdu; |
4413 | hdr = (struct ieee80211_hdr *)skb->data; |
4414 | @@ -320,6 +328,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, |
4415 | hw = bf->aphy->hw; |
4416 | |
4417 | memcpy(rates, tx_info->control.rates, sizeof(rates)); |
4418 | + nframes = bf->bf_nframes; |
4419 | |
4420 | rcu_read_lock(); |
4421 | |
4422 | @@ -337,7 +346,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, |
4423 | !bf->bf_stale || bf_next != NULL) |
4424 | list_move_tail(&bf->list, &bf_head); |
4425 | |
4426 | - ath_tx_rc_status(bf, ts, 0, 0, false); |
4427 | + ath_tx_rc_status(bf, ts, 1, 0, false); |
4428 | ath_tx_complete_buf(sc, bf, txq, &bf_head, ts, |
4429 | 0, 0); |
4430 | |
4431 | @@ -431,7 +440,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, |
4432 | list_move_tail(&bf->list, &bf_head); |
4433 | } |
4434 | |
4435 | - if (!txpending) { |
4436 | + if (!txpending || (tid->state & AGGR_CLEANUP)) { |
4437 | /* |
4438 | * complete the acked-ones/xretried ones; update |
4439 | * block-ack window |
4440 | @@ -442,6 +451,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, |
4441 | |
4442 | if (rc_update && (acked_cnt == 1 || txfail_cnt == 1)) { |
4443 | memcpy(tx_info->control.rates, rates, sizeof(rates)); |
4444 | + bf->bf_nframes = nframes; |
4445 | ath_tx_rc_status(bf, ts, nbad, txok, true); |
4446 | rc_update = false; |
4447 | } else { |
4448 | @@ -510,15 +520,12 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, |
4449 | } |
4450 | |
4451 | if (tid->state & AGGR_CLEANUP) { |
4452 | + ath_tx_flush_tid(sc, tid); |
4453 | + |
4454 | if (tid->baw_head == tid->baw_tail) { |
4455 | tid->state &= ~AGGR_ADDBA_COMPLETE; |
4456 | tid->state &= ~AGGR_CLEANUP; |
4457 | - |
4458 | - /* send buffered frames as singles */ |
4459 | - ath_tx_flush_tid(sc, tid); |
4460 | } |
4461 | - rcu_read_unlock(); |
4462 | - return; |
4463 | } |
4464 | |
4465 | rcu_read_unlock(); |
4466 | @@ -785,17 +792,23 @@ static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq, |
4467 | status != ATH_AGGR_BAW_CLOSED); |
4468 | } |
4469 | |
4470 | -void ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, |
4471 | - u16 tid, u16 *ssn) |
4472 | +int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta, |
4473 | + u16 tid, u16 *ssn) |
4474 | { |
4475 | struct ath_atx_tid *txtid; |
4476 | struct ath_node *an; |
4477 | |
4478 | an = (struct ath_node *)sta->drv_priv; |
4479 | txtid = ATH_AN_2_TID(an, tid); |
4480 | + |
4481 | + if (txtid->state & (AGGR_CLEANUP | AGGR_ADDBA_COMPLETE)) |
4482 | + return -EAGAIN; |
4483 | + |
4484 | txtid->state |= AGGR_ADDBA_PROGRESS; |
4485 | txtid->paused = true; |
4486 | *ssn = txtid->seq_start; |
4487 | + |
4488 | + return 0; |
4489 | } |
4490 | |
4491 | void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) |
4492 | @@ -803,12 +816,6 @@ void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) |
4493 | struct ath_node *an = (struct ath_node *)sta->drv_priv; |
4494 | struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid); |
4495 | struct ath_txq *txq = &sc->tx.txq[txtid->ac->qnum]; |
4496 | - struct ath_tx_status ts; |
4497 | - struct ath_buf *bf; |
4498 | - struct list_head bf_head; |
4499 | - |
4500 | - memset(&ts, 0, sizeof(ts)); |
4501 | - INIT_LIST_HEAD(&bf_head); |
4502 | |
4503 | if (txtid->state & AGGR_CLEANUP) |
4504 | return; |
4505 | @@ -818,31 +825,22 @@ void ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) |
4506 | return; |
4507 | } |
4508 | |
4509 | - /* drop all software retried frames and mark this TID */ |
4510 | spin_lock_bh(&txq->axq_lock); |
4511 | txtid->paused = true; |
4512 | - while (!list_empty(&txtid->buf_q)) { |
4513 | - bf = list_first_entry(&txtid->buf_q, struct ath_buf, list); |
4514 | - if (!bf_isretried(bf)) { |
4515 | - /* |
4516 | - * NB: it's based on the assumption that |
4517 | - * software retried frame will always stay |
4518 | - * at the head of software queue. |
4519 | - */ |
4520 | - break; |
4521 | - } |
4522 | - list_move_tail(&bf->list, &bf_head); |
4523 | - ath_tx_update_baw(sc, txtid, bf->bf_seqno); |
4524 | - ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0, 0); |
4525 | - } |
4526 | - spin_unlock_bh(&txq->axq_lock); |
4527 | |
4528 | - if (txtid->baw_head != txtid->baw_tail) { |
4529 | + /* |
4530 | + * If frames are still being transmitted for this TID, they will be |
4531 | + * cleaned up during tx completion. To prevent race conditions, this |
4532 | + * TID can only be reused after all in-progress subframes have been |
4533 | + * completed. |
4534 | + */ |
4535 | + if (txtid->baw_head != txtid->baw_tail) |
4536 | txtid->state |= AGGR_CLEANUP; |
4537 | - } else { |
4538 | + else |
4539 | txtid->state &= ~AGGR_ADDBA_COMPLETE; |
4540 | - ath_tx_flush_tid(sc, txtid); |
4541 | - } |
4542 | + spin_unlock_bh(&txq->axq_lock); |
4543 | + |
4544 | + ath_tx_flush_tid(sc, txtid); |
4545 | } |
4546 | |
4547 | void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid) |
4548 | @@ -1103,15 +1101,6 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx) |
4549 | txq->axq_tx_inprogress = false; |
4550 | spin_unlock_bh(&txq->axq_lock); |
4551 | |
4552 | - /* flush any pending frames if aggregation is enabled */ |
4553 | - if (sc->sc_flags & SC_OP_TXAGGR) { |
4554 | - if (!retry_tx) { |
4555 | - spin_lock_bh(&txq->axq_lock); |
4556 | - ath_txq_drain_pending_buffers(sc, txq); |
4557 | - spin_unlock_bh(&txq->axq_lock); |
4558 | - } |
4559 | - } |
4560 | - |
4561 | if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) { |
4562 | spin_lock_bh(&txq->axq_lock); |
4563 | while (!list_empty(&txq->txq_fifo_pending)) { |
4564 | @@ -1132,6 +1121,15 @@ void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx) |
4565 | } |
4566 | spin_unlock_bh(&txq->axq_lock); |
4567 | } |
4568 | + |
4569 | + /* flush any pending frames if aggregation is enabled */ |
4570 | + if (sc->sc_flags & SC_OP_TXAGGR) { |
4571 | + if (!retry_tx) { |
4572 | + spin_lock_bh(&txq->axq_lock); |
4573 | + ath_txq_drain_pending_buffers(sc, txq); |
4574 | + spin_unlock_bh(&txq->axq_lock); |
4575 | + } |
4576 | + } |
4577 | } |
4578 | |
4579 | void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx) |
4580 | @@ -2024,9 +2022,15 @@ static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts, |
4581 | |
4582 | if (ts->ts_status & ATH9K_TXERR_FILT) |
4583 | tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED; |
4584 | - if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && update_rc) |
4585 | + if ((tx_info->flags & IEEE80211_TX_CTL_AMPDU) && update_rc) { |
4586 | tx_info->flags |= IEEE80211_TX_STAT_AMPDU; |
4587 | |
4588 | + BUG_ON(nbad > bf->bf_nframes); |
4589 | + |
4590 | + tx_info->status.ampdu_len = bf->bf_nframes; |
4591 | + tx_info->status.ampdu_ack_len = bf->bf_nframes - nbad; |
4592 | + } |
4593 | + |
4594 | if ((ts->ts_status & ATH9K_TXERR_FILT) == 0 && |
4595 | (bf->bf_flags & ATH9K_TXDESC_NOACK) == 0 && update_rc) { |
4596 | if (ieee80211_is_data(hdr->frame_control)) { |
4597 | @@ -2036,8 +2040,6 @@ static void ath_tx_rc_status(struct ath_buf *bf, struct ath_tx_status *ts, |
4598 | if ((ts->ts_status & ATH9K_TXERR_XRETRY) || |
4599 | (ts->ts_status & ATH9K_TXERR_FIFO)) |
4600 | tx_info->pad[0] |= ATH_TX_INFO_XRETRY; |
4601 | - tx_info->status.ampdu_len = bf->bf_nframes; |
4602 | - tx_info->status.ampdu_ack_len = bf->bf_nframes - nbad; |
4603 | } |
4604 | } |
4605 | |
4606 | @@ -2159,7 +2161,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) |
4607 | */ |
4608 | if (ts.ts_status & ATH9K_TXERR_XRETRY) |
4609 | bf->bf_state.bf_type |= BUF_XRETRY; |
4610 | - ath_tx_rc_status(bf, &ts, 0, txok, true); |
4611 | + ath_tx_rc_status(bf, &ts, txok ? 0 : 1, txok, true); |
4612 | } |
4613 | |
4614 | if (bf_isampdu(bf)) |
4615 | @@ -2204,7 +2206,7 @@ static void ath_tx_complete_poll_work(struct work_struct *work) |
4616 | ath_print(ath9k_hw_common(sc->sc_ah), ATH_DBG_RESET, |
4617 | "tx hung, resetting the chip\n"); |
4618 | ath9k_ps_wakeup(sc); |
4619 | - ath_reset(sc, false); |
4620 | + ath_reset(sc, true); |
4621 | ath9k_ps_restore(sc); |
4622 | } |
4623 | |
4624 | @@ -2288,7 +2290,7 @@ void ath_tx_edma_tasklet(struct ath_softc *sc) |
4625 | if (!bf_isampdu(bf)) { |
4626 | if (txs.ts_status & ATH9K_TXERR_XRETRY) |
4627 | bf->bf_state.bf_type |= BUF_XRETRY; |
4628 | - ath_tx_rc_status(bf, &txs, 0, txok, true); |
4629 | + ath_tx_rc_status(bf, &txs, txok ? 0 : 1, txok, true); |
4630 | } |
4631 | |
4632 | if (bf_isampdu(bf)) |
4633 | diff --git a/drivers/net/wireless/b43/sdio.c b/drivers/net/wireless/b43/sdio.c |
4634 | index 45933cf..09e2dfd 100644 |
4635 | --- a/drivers/net/wireless/b43/sdio.c |
4636 | +++ b/drivers/net/wireless/b43/sdio.c |
4637 | @@ -163,6 +163,7 @@ static int b43_sdio_probe(struct sdio_func *func, |
4638 | err_free_ssb: |
4639 | kfree(sdio); |
4640 | err_disable_func: |
4641 | + sdio_claim_host(func); |
4642 | sdio_disable_func(func); |
4643 | err_release_host: |
4644 | sdio_release_host(func); |
4645 | @@ -175,7 +176,9 @@ static void b43_sdio_remove(struct sdio_func *func) |
4646 | struct b43_sdio *sdio = sdio_get_drvdata(func); |
4647 | |
4648 | ssb_bus_unregister(&sdio->ssb); |
4649 | + sdio_claim_host(func); |
4650 | sdio_disable_func(func); |
4651 | + sdio_release_host(func); |
4652 | kfree(sdio); |
4653 | sdio_set_drvdata(func, NULL); |
4654 | } |
4655 | diff --git a/drivers/oprofile/timer_int.c b/drivers/oprofile/timer_int.c |
4656 | index dc0ae4d..0107251 100644 |
4657 | --- a/drivers/oprofile/timer_int.c |
4658 | +++ b/drivers/oprofile/timer_int.c |
4659 | @@ -21,6 +21,7 @@ |
4660 | #include "oprof.h" |
4661 | |
4662 | static DEFINE_PER_CPU(struct hrtimer, oprofile_hrtimer); |
4663 | +static int ctr_running; |
4664 | |
4665 | static enum hrtimer_restart oprofile_hrtimer_notify(struct hrtimer *hrtimer) |
4666 | { |
4667 | @@ -33,6 +34,9 @@ static void __oprofile_hrtimer_start(void *unused) |
4668 | { |
4669 | struct hrtimer *hrtimer = &__get_cpu_var(oprofile_hrtimer); |
4670 | |
4671 | + if (!ctr_running) |
4672 | + return; |
4673 | + |
4674 | hrtimer_init(hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
4675 | hrtimer->function = oprofile_hrtimer_notify; |
4676 | |
4677 | @@ -42,7 +46,10 @@ static void __oprofile_hrtimer_start(void *unused) |
4678 | |
4679 | static int oprofile_hrtimer_start(void) |
4680 | { |
4681 | + get_online_cpus(); |
4682 | + ctr_running = 1; |
4683 | on_each_cpu(__oprofile_hrtimer_start, NULL, 1); |
4684 | + put_online_cpus(); |
4685 | return 0; |
4686 | } |
4687 | |
4688 | @@ -50,6 +57,9 @@ static void __oprofile_hrtimer_stop(int cpu) |
4689 | { |
4690 | struct hrtimer *hrtimer = &per_cpu(oprofile_hrtimer, cpu); |
4691 | |
4692 | + if (!ctr_running) |
4693 | + return; |
4694 | + |
4695 | hrtimer_cancel(hrtimer); |
4696 | } |
4697 | |
4698 | @@ -57,8 +67,11 @@ static void oprofile_hrtimer_stop(void) |
4699 | { |
4700 | int cpu; |
4701 | |
4702 | + get_online_cpus(); |
4703 | for_each_online_cpu(cpu) |
4704 | __oprofile_hrtimer_stop(cpu); |
4705 | + ctr_running = 0; |
4706 | + put_online_cpus(); |
4707 | } |
4708 | |
4709 | static int __cpuinit oprofile_cpu_notify(struct notifier_block *self, |
4710 | diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c |
4711 | index b5a7d9b..4835a02 100644 |
4712 | --- a/drivers/pci/pci-sysfs.c |
4713 | +++ b/drivers/pci/pci-sysfs.c |
4714 | @@ -705,17 +705,21 @@ void pci_remove_legacy_files(struct pci_bus *b) |
4715 | |
4716 | #ifdef HAVE_PCI_MMAP |
4717 | |
4718 | -int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma) |
4719 | +int pci_mmap_fits(struct pci_dev *pdev, int resno, struct vm_area_struct *vma, |
4720 | + enum pci_mmap_api mmap_api) |
4721 | { |
4722 | - unsigned long nr, start, size; |
4723 | + unsigned long nr, start, size, pci_start; |
4724 | |
4725 | + if (pci_resource_len(pdev, resno) == 0) |
4726 | + return 0; |
4727 | nr = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; |
4728 | start = vma->vm_pgoff; |
4729 | size = ((pci_resource_len(pdev, resno) - 1) >> PAGE_SHIFT) + 1; |
4730 | - if (start < size && size - start >= nr) |
4731 | + pci_start = (mmap_api == PCI_MMAP_PROCFS) ? |
4732 | + pci_resource_start(pdev, resno) >> PAGE_SHIFT : 0; |
4733 | + if (start >= pci_start && start < pci_start + size && |
4734 | + start + nr <= pci_start + size) |
4735 | return 1; |
4736 | - WARN(1, "process \"%s\" tried to map 0x%08lx-0x%08lx on %s BAR %d (size 0x%08lx)\n", |
4737 | - current->comm, start, start+nr, pci_name(pdev), resno, size); |
4738 | return 0; |
4739 | } |
4740 | |
4741 | @@ -745,8 +749,14 @@ pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr, |
4742 | if (i >= PCI_ROM_RESOURCE) |
4743 | return -ENODEV; |
4744 | |
4745 | - if (!pci_mmap_fits(pdev, i, vma)) |
4746 | + if (!pci_mmap_fits(pdev, i, vma, PCI_MMAP_SYSFS)) { |
4747 | + WARN(1, "process \"%s\" tried to map 0x%08lx bytes " |
4748 | + "at page 0x%08lx on %s BAR %d (start 0x%16Lx, size 0x%16Lx)\n", |
4749 | + current->comm, vma->vm_end-vma->vm_start, vma->vm_pgoff, |
4750 | + pci_name(pdev), i, |
4751 | + pci_resource_start(pdev, i), pci_resource_len(pdev, i)); |
4752 | return -EINVAL; |
4753 | + } |
4754 | |
4755 | /* pci_mmap_page_range() expects the same kind of entry as coming |
4756 | * from /proc/bus/pci/ which is a "user visible" value. If this is |
4757 | diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h |
4758 | index 6beb11b..1001b1d 100644 |
4759 | --- a/drivers/pci/pci.h |
4760 | +++ b/drivers/pci/pci.h |
4761 | @@ -22,8 +22,13 @@ extern void pci_remove_firmware_label_files(struct pci_dev *pdev); |
4762 | #endif |
4763 | extern void pci_cleanup_rom(struct pci_dev *dev); |
4764 | #ifdef HAVE_PCI_MMAP |
4765 | +enum pci_mmap_api { |
4766 | + PCI_MMAP_SYSFS, /* mmap on /sys/bus/pci/devices/<BDF>/resource<N> */ |
4767 | + PCI_MMAP_PROCFS /* mmap on /proc/bus/pci/<BDF> */ |
4768 | +}; |
4769 | extern int pci_mmap_fits(struct pci_dev *pdev, int resno, |
4770 | - struct vm_area_struct *vma); |
4771 | + struct vm_area_struct *vmai, |
4772 | + enum pci_mmap_api mmap_api); |
4773 | #endif |
4774 | int pci_probe_reset_function(struct pci_dev *dev); |
4775 | |
4776 | diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c |
4777 | index 01f0306..4aae016 100644 |
4778 | --- a/drivers/pci/proc.c |
4779 | +++ b/drivers/pci/proc.c |
4780 | @@ -260,7 +260,7 @@ static int proc_bus_pci_mmap(struct file *file, struct vm_area_struct *vma) |
4781 | |
4782 | /* Make sure the caller is mapping a real resource for this device */ |
4783 | for (i = 0; i < PCI_ROM_RESOURCE; i++) { |
4784 | - if (pci_mmap_fits(dev, i, vma)) |
4785 | + if (pci_mmap_fits(dev, i, vma, PCI_MMAP_PROCFS)) |
4786 | break; |
4787 | } |
4788 | |
4789 | diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c |
4790 | index 6f1a86b..fd4c25a 100644 |
4791 | --- a/drivers/pcmcia/soc_common.c |
4792 | +++ b/drivers/pcmcia/soc_common.c |
4793 | @@ -65,6 +65,7 @@ void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func, |
4794 | va_end(args); |
4795 | } |
4796 | } |
4797 | +EXPORT_SYMBOL(soc_pcmcia_debug); |
4798 | |
4799 | #endif |
4800 | |
4801 | diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c |
4802 | index b2978a0..6777834 100644 |
4803 | --- a/drivers/platform/x86/wmi.c |
4804 | +++ b/drivers/platform/x86/wmi.c |
4805 | @@ -801,7 +801,7 @@ static bool guid_already_parsed(const char *guid_string) |
4806 | wblock = list_entry(p, struct wmi_block, list); |
4807 | gblock = &wblock->gblock; |
4808 | |
4809 | - if (strncmp(gblock->guid, guid_string, 16) == 0) |
4810 | + if (memcmp(gblock->guid, guid_string, 16) == 0) |
4811 | return true; |
4812 | } |
4813 | return false; |
4814 | diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c |
4815 | index dc4e32e..0d943ee 100644 |
4816 | --- a/drivers/pnp/pnpacpi/core.c |
4817 | +++ b/drivers/pnp/pnpacpi/core.c |
4818 | @@ -28,7 +28,7 @@ |
4819 | #include "../base.h" |
4820 | #include "pnpacpi.h" |
4821 | |
4822 | -static int num = 0; |
4823 | +static int num; |
4824 | |
4825 | /* We need only to blacklist devices that have already an acpi driver that |
4826 | * can't use pnp layer. We don't need to blacklist device that are directly |
4827 | @@ -180,11 +180,24 @@ struct pnp_protocol pnpacpi_protocol = { |
4828 | }; |
4829 | EXPORT_SYMBOL(pnpacpi_protocol); |
4830 | |
4831 | +static char *pnpacpi_get_id(struct acpi_device *device) |
4832 | +{ |
4833 | + struct acpi_hardware_id *id; |
4834 | + |
4835 | + list_for_each_entry(id, &device->pnp.ids, list) { |
4836 | + if (ispnpidacpi(id->id)) |
4837 | + return id->id; |
4838 | + } |
4839 | + |
4840 | + return NULL; |
4841 | +} |
4842 | + |
4843 | static int __init pnpacpi_add_device(struct acpi_device *device) |
4844 | { |
4845 | acpi_handle temp = NULL; |
4846 | acpi_status status; |
4847 | struct pnp_dev *dev; |
4848 | + char *pnpid; |
4849 | struct acpi_hardware_id *id; |
4850 | |
4851 | /* |
4852 | @@ -192,11 +205,17 @@ static int __init pnpacpi_add_device(struct acpi_device *device) |
4853 | * driver should not be loaded. |
4854 | */ |
4855 | status = acpi_get_handle(device->handle, "_CRS", &temp); |
4856 | - if (ACPI_FAILURE(status) || !ispnpidacpi(acpi_device_hid(device)) || |
4857 | - is_exclusive_device(device) || (!device->status.present)) |
4858 | + if (ACPI_FAILURE(status)) |
4859 | + return 0; |
4860 | + |
4861 | + pnpid = pnpacpi_get_id(device); |
4862 | + if (!pnpid) |
4863 | + return 0; |
4864 | + |
4865 | + if (is_exclusive_device(device) || !device->status.present) |
4866 | return 0; |
4867 | |
4868 | - dev = pnp_alloc_dev(&pnpacpi_protocol, num, acpi_device_hid(device)); |
4869 | + dev = pnp_alloc_dev(&pnpacpi_protocol, num, pnpid); |
4870 | if (!dev) |
4871 | return -ENOMEM; |
4872 | |
4873 | @@ -227,7 +246,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device) |
4874 | pnpacpi_parse_resource_option_data(dev); |
4875 | |
4876 | list_for_each_entry(id, &device->pnp.ids, list) { |
4877 | - if (!strcmp(id->id, acpi_device_hid(device))) |
4878 | + if (!strcmp(id->id, pnpid)) |
4879 | continue; |
4880 | if (!ispnpidacpi(id->id)) |
4881 | continue; |
4882 | diff --git a/drivers/power/olpc_battery.c b/drivers/power/olpc_battery.c |
4883 | index aafc1c5..5bc1dcf 100644 |
4884 | --- a/drivers/power/olpc_battery.c |
4885 | +++ b/drivers/power/olpc_battery.c |
4886 | @@ -271,14 +271,14 @@ static int olpc_bat_get_property(struct power_supply *psy, |
4887 | if (ret) |
4888 | return ret; |
4889 | |
4890 | - val->intval = (int)be16_to_cpu(ec_word) * 9760L / 32; |
4891 | + val->intval = (s16)be16_to_cpu(ec_word) * 9760L / 32; |
4892 | break; |
4893 | case POWER_SUPPLY_PROP_CURRENT_AVG: |
4894 | ret = olpc_ec_cmd(EC_BAT_CURRENT, NULL, 0, (void *)&ec_word, 2); |
4895 | if (ret) |
4896 | return ret; |
4897 | |
4898 | - val->intval = (int)be16_to_cpu(ec_word) * 15625L / 120; |
4899 | + val->intval = (s16)be16_to_cpu(ec_word) * 15625L / 120; |
4900 | break; |
4901 | case POWER_SUPPLY_PROP_CAPACITY: |
4902 | ret = olpc_ec_cmd(EC_BAT_SOC, NULL, 0, &ec_byte, 1); |
4903 | @@ -299,7 +299,7 @@ static int olpc_bat_get_property(struct power_supply *psy, |
4904 | if (ret) |
4905 | return ret; |
4906 | |
4907 | - val->intval = (int)be16_to_cpu(ec_word) * 100 / 256; |
4908 | + val->intval = (s16)be16_to_cpu(ec_word) * 100 / 256; |
4909 | break; |
4910 | case POWER_SUPPLY_PROP_TEMP_AMBIENT: |
4911 | ret = olpc_ec_cmd(EC_AMB_TEMP, NULL, 0, (void *)&ec_word, 2); |
4912 | @@ -313,7 +313,7 @@ static int olpc_bat_get_property(struct power_supply *psy, |
4913 | if (ret) |
4914 | return ret; |
4915 | |
4916 | - val->intval = (int)be16_to_cpu(ec_word) * 6250 / 15; |
4917 | + val->intval = (s16)be16_to_cpu(ec_word) * 6250 / 15; |
4918 | break; |
4919 | case POWER_SUPPLY_PROP_SERIAL_NUMBER: |
4920 | ret = olpc_ec_cmd(EC_BAT_SERIAL, NULL, 0, (void *)&ser_buf, 8); |
4921 | diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h |
4922 | index 1a1b281..16df82a 100644 |
4923 | --- a/drivers/scsi/qla2xxx/qla_gbl.h |
4924 | +++ b/drivers/scsi/qla2xxx/qla_gbl.h |
4925 | @@ -92,6 +92,7 @@ extern int ql2xshiftctondsd; |
4926 | extern int ql2xdbwr; |
4927 | extern int ql2xdontresethba; |
4928 | extern int ql2xasynctmfenable; |
4929 | +extern int ql2xgffidenable; |
4930 | extern int ql2xenabledif; |
4931 | extern int ql2xenablehba_err_chk; |
4932 | extern int ql2xtargetreset; |
4933 | diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c |
4934 | index 9c383ba..49e7b09 100644 |
4935 | --- a/drivers/scsi/qla2xxx/qla_init.c |
4936 | +++ b/drivers/scsi/qla2xxx/qla_init.c |
4937 | @@ -3258,8 +3258,9 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha, |
4938 | continue; |
4939 | |
4940 | /* Bypass ports whose FCP-4 type is not FCP_SCSI */ |
4941 | - if (new_fcport->fc4_type != FC4_TYPE_FCP_SCSI && |
4942 | - new_fcport->fc4_type != FC4_TYPE_UNKNOWN) |
4943 | + if (ql2xgffidenable && |
4944 | + (new_fcport->fc4_type != FC4_TYPE_FCP_SCSI && |
4945 | + new_fcport->fc4_type != FC4_TYPE_UNKNOWN)) |
4946 | continue; |
4947 | |
4948 | /* Locate matching device in database. */ |
4949 | diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c |
4950 | index 1e4bff6..4e29d43 100644 |
4951 | --- a/drivers/scsi/qla2xxx/qla_os.c |
4952 | +++ b/drivers/scsi/qla2xxx/qla_os.c |
4953 | @@ -160,6 +160,11 @@ MODULE_PARM_DESC(ql2xtargetreset, |
4954 | "Enable target reset." |
4955 | "Default is 1 - use hw defaults."); |
4956 | |
4957 | +int ql2xgffidenable; |
4958 | +module_param(ql2xgffidenable, int, S_IRUGO|S_IRUSR); |
4959 | +MODULE_PARM_DESC(ql2xgffidenable, |
4960 | + "Enables GFF_ID checks of port type. " |
4961 | + "Default is 0 - Do not use GFF_ID information."); |
4962 | |
4963 | int ql2xasynctmfenable; |
4964 | module_param(ql2xasynctmfenable, int, S_IRUGO|S_IRUSR); |
4965 | diff --git a/drivers/serial/mfd.c b/drivers/serial/mfd.c |
4966 | index 5dff45c..f083f7c 100644 |
4967 | --- a/drivers/serial/mfd.c |
4968 | +++ b/drivers/serial/mfd.c |
4969 | @@ -892,8 +892,7 @@ serial_hsu_set_termios(struct uart_port *port, struct ktermios *termios, |
4970 | unsigned char cval, fcr = 0; |
4971 | unsigned long flags; |
4972 | unsigned int baud, quot; |
4973 | - u32 mul = 0x3600; |
4974 | - u32 ps = 0x10; |
4975 | + u32 ps, mul; |
4976 | |
4977 | switch (termios->c_cflag & CSIZE) { |
4978 | case CS5: |
4979 | @@ -937,20 +936,19 @@ serial_hsu_set_termios(struct uart_port *port, struct ktermios *termios, |
4980 | ps = 0xC; |
4981 | quot = 1; |
4982 | break; |
4983 | - case 2500000: |
4984 | - mul = 0x2710; |
4985 | - ps = 0x10; |
4986 | - quot = 1; |
4987 | - break; |
4988 | case 18432000: |
4989 | mul = 0x2400; |
4990 | ps = 0x10; |
4991 | quot = 1; |
4992 | break; |
4993 | + case 3000000: |
4994 | + case 2500000: |
4995 | + case 2000000: |
4996 | case 1500000: |
4997 | - mul = 0x1D4C; |
4998 | - ps = 0xc; |
4999 | - quot = 1; |
5000 | + case 1000000: |
5001 | + case 500000: |
5002 | + /* mul/ps/quot = 0x9C4/0x10/0x1 will make a 500000 bps */ |
5003 | + mul = baud / 500000 * 0x9C4; |
5004 | break; |
5005 | default: |
5006 | ; |
5007 | diff --git a/drivers/ssb/b43_pci_bridge.c b/drivers/ssb/b43_pci_bridge.c |
5008 | index ef9c6a0..744d3f6 100644 |
5009 | --- a/drivers/ssb/b43_pci_bridge.c |
5010 | +++ b/drivers/ssb/b43_pci_bridge.c |
5011 | @@ -24,6 +24,7 @@ static const struct pci_device_id b43_pci_bridge_tbl[] = { |
5012 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4312) }, |
5013 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4315) }, |
5014 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4318) }, |
5015 | + { PCI_DEVICE(PCI_VENDOR_ID_BCM_GVC, 0x4318) }, |
5016 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4319) }, |
5017 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4320) }, |
5018 | { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4321) }, |
5019 | diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c |
5020 | index 5b279fb..6244555 100644 |
5021 | --- a/drivers/staging/asus_oled/asus_oled.c |
5022 | +++ b/drivers/staging/asus_oled/asus_oled.c |
5023 | @@ -620,13 +620,13 @@ static ssize_t class_set_picture(struct device *device, |
5024 | |
5025 | #define ASUS_OLED_DEVICE_ATTR(_file) dev_attr_asus_oled_##_file |
5026 | |
5027 | -static DEVICE_ATTR(asus_oled_enabled, S_IWUGO | S_IRUGO, |
5028 | +static DEVICE_ATTR(asus_oled_enabled, S_IWUSR | S_IRUGO, |
5029 | get_enabled, set_enabled); |
5030 | -static DEVICE_ATTR(asus_oled_picture, S_IWUGO , NULL, set_picture); |
5031 | +static DEVICE_ATTR(asus_oled_picture, S_IWUSR , NULL, set_picture); |
5032 | |
5033 | -static DEVICE_ATTR(enabled, S_IWUGO | S_IRUGO, |
5034 | +static DEVICE_ATTR(enabled, S_IWUSR | S_IRUGO, |
5035 | class_get_enabled, class_set_enabled); |
5036 | -static DEVICE_ATTR(picture, S_IWUGO, NULL, class_set_picture); |
5037 | +static DEVICE_ATTR(picture, S_IWUSR, NULL, class_set_picture); |
5038 | |
5039 | static int asus_oled_probe(struct usb_interface *interface, |
5040 | const struct usb_device_id *id) |
5041 | diff --git a/drivers/staging/batman-adv/soft-interface.c b/drivers/staging/batman-adv/soft-interface.c |
5042 | index 2ea97de..876be5a 100644 |
5043 | --- a/drivers/staging/batman-adv/soft-interface.c |
5044 | +++ b/drivers/staging/batman-adv/soft-interface.c |
5045 | @@ -246,6 +246,10 @@ void interface_rx(struct sk_buff *skb, int hdr_size) |
5046 | skb_pull_rcsum(skb, hdr_size); |
5047 | /* skb_set_mac_header(skb, -sizeof(struct ethhdr));*/ |
5048 | |
5049 | + if (unlikely(!pskb_may_pull(skb, ETH_HLEN))) { |
5050 | + kfree_skb(skb); |
5051 | + return; |
5052 | + } |
5053 | skb->dev = dev; |
5054 | skb->protocol = eth_type_trans(skb, dev); |
5055 | |
5056 | diff --git a/drivers/staging/frontier/tranzport.c b/drivers/staging/frontier/tranzport.c |
5057 | index eed74f0..f21a0e8 100644 |
5058 | --- a/drivers/staging/frontier/tranzport.c |
5059 | +++ b/drivers/staging/frontier/tranzport.c |
5060 | @@ -204,7 +204,7 @@ static void usb_tranzport_abort_transfers(struct usb_tranzport *dev) |
5061 | t->value = temp; \ |
5062 | return count; \ |
5063 | } \ |
5064 | - static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value); |
5065 | + static DEVICE_ATTR(value, S_IWUSR | S_IRUGO, show_##value, set_##value); |
5066 | |
5067 | show_int(enable); |
5068 | show_int(offline); |
5069 | diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c |
5070 | index bb7d765..ab2d5fa 100644 |
5071 | --- a/drivers/staging/iio/accel/adis16220_core.c |
5072 | +++ b/drivers/staging/iio/accel/adis16220_core.c |
5073 | @@ -506,7 +506,7 @@ static IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, |
5074 | adis16220_write_reset, 0); |
5075 | |
5076 | #define IIO_DEV_ATTR_CAPTURE(_store) \ |
5077 | - IIO_DEVICE_ATTR(capture, S_IWUGO, NULL, _store, 0) |
5078 | + IIO_DEVICE_ATTR(capture, S_IWUSR, NULL, _store, 0) |
5079 | |
5080 | static IIO_DEV_ATTR_CAPTURE(adis16220_write_capture); |
5081 | |
5082 | diff --git a/drivers/staging/line6/control.c b/drivers/staging/line6/control.c |
5083 | index 0b59852..e414571 100644 |
5084 | --- a/drivers/staging/line6/control.c |
5085 | +++ b/drivers/staging/line6/control.c |
5086 | @@ -268,210 +268,210 @@ VARIAX_PARAM_R(float, mix2); |
5087 | VARIAX_PARAM_R(float, mix1); |
5088 | VARIAX_PARAM_R(int, pickup_wiring); |
5089 | |
5090 | -static DEVICE_ATTR(tweak, S_IWUGO | S_IRUGO, pod_get_tweak, pod_set_tweak); |
5091 | -static DEVICE_ATTR(wah_position, S_IWUGO | S_IRUGO, pod_get_wah_position, |
5092 | +static DEVICE_ATTR(tweak, S_IWUSR | S_IRUGO, pod_get_tweak, pod_set_tweak); |
5093 | +static DEVICE_ATTR(wah_position, S_IWUSR | S_IRUGO, pod_get_wah_position, |
5094 | pod_set_wah_position); |
5095 | -static DEVICE_ATTR(compression_gain, S_IWUGO | S_IRUGO, |
5096 | +static DEVICE_ATTR(compression_gain, S_IWUSR | S_IRUGO, |
5097 | pod_get_compression_gain, pod_set_compression_gain); |
5098 | -static DEVICE_ATTR(vol_pedal_position, S_IWUGO | S_IRUGO, |
5099 | +static DEVICE_ATTR(vol_pedal_position, S_IWUSR | S_IRUGO, |
5100 | pod_get_vol_pedal_position, pod_set_vol_pedal_position); |
5101 | -static DEVICE_ATTR(compression_threshold, S_IWUGO | S_IRUGO, |
5102 | +static DEVICE_ATTR(compression_threshold, S_IWUSR | S_IRUGO, |
5103 | pod_get_compression_threshold, |
5104 | pod_set_compression_threshold); |
5105 | -static DEVICE_ATTR(pan, S_IWUGO | S_IRUGO, pod_get_pan, pod_set_pan); |
5106 | -static DEVICE_ATTR(amp_model_setup, S_IWUGO | S_IRUGO, pod_get_amp_model_setup, |
5107 | +static DEVICE_ATTR(pan, S_IWUSR | S_IRUGO, pod_get_pan, pod_set_pan); |
5108 | +static DEVICE_ATTR(amp_model_setup, S_IWUSR | S_IRUGO, pod_get_amp_model_setup, |
5109 | pod_set_amp_model_setup); |
5110 | -static DEVICE_ATTR(amp_model, S_IWUGO | S_IRUGO, pod_get_amp_model, |
5111 | +static DEVICE_ATTR(amp_model, S_IWUSR | S_IRUGO, pod_get_amp_model, |
5112 | pod_set_amp_model); |
5113 | -static DEVICE_ATTR(drive, S_IWUGO | S_IRUGO, pod_get_drive, pod_set_drive); |
5114 | -static DEVICE_ATTR(bass, S_IWUGO | S_IRUGO, pod_get_bass, pod_set_bass); |
5115 | -static DEVICE_ATTR(mid, S_IWUGO | S_IRUGO, pod_get_mid, pod_set_mid); |
5116 | -static DEVICE_ATTR(lowmid, S_IWUGO | S_IRUGO, pod_get_lowmid, pod_set_lowmid); |
5117 | -static DEVICE_ATTR(treble, S_IWUGO | S_IRUGO, pod_get_treble, pod_set_treble); |
5118 | -static DEVICE_ATTR(highmid, S_IWUGO | S_IRUGO, pod_get_highmid, |
5119 | +static DEVICE_ATTR(drive, S_IWUSR | S_IRUGO, pod_get_drive, pod_set_drive); |
5120 | +static DEVICE_ATTR(bass, S_IWUSR | S_IRUGO, pod_get_bass, pod_set_bass); |
5121 | +static DEVICE_ATTR(mid, S_IWUSR | S_IRUGO, pod_get_mid, pod_set_mid); |
5122 | +static DEVICE_ATTR(lowmid, S_IWUSR | S_IRUGO, pod_get_lowmid, pod_set_lowmid); |
5123 | +static DEVICE_ATTR(treble, S_IWUSR | S_IRUGO, pod_get_treble, pod_set_treble); |
5124 | +static DEVICE_ATTR(highmid, S_IWUSR | S_IRUGO, pod_get_highmid, |
5125 | pod_set_highmid); |
5126 | -static DEVICE_ATTR(chan_vol, S_IWUGO | S_IRUGO, pod_get_chan_vol, |
5127 | +static DEVICE_ATTR(chan_vol, S_IWUSR | S_IRUGO, pod_get_chan_vol, |
5128 | pod_set_chan_vol); |
5129 | -static DEVICE_ATTR(reverb_mix, S_IWUGO | S_IRUGO, pod_get_reverb_mix, |
5130 | +static DEVICE_ATTR(reverb_mix, S_IWUSR | S_IRUGO, pod_get_reverb_mix, |
5131 | pod_set_reverb_mix); |
5132 | -static DEVICE_ATTR(effect_setup, S_IWUGO | S_IRUGO, pod_get_effect_setup, |
5133 | +static DEVICE_ATTR(effect_setup, S_IWUSR | S_IRUGO, pod_get_effect_setup, |
5134 | pod_set_effect_setup); |
5135 | -static DEVICE_ATTR(band_1_frequency, S_IWUGO | S_IRUGO, |
5136 | +static DEVICE_ATTR(band_1_frequency, S_IWUSR | S_IRUGO, |
5137 | pod_get_band_1_frequency, pod_set_band_1_frequency); |
5138 | -static DEVICE_ATTR(presence, S_IWUGO | S_IRUGO, pod_get_presence, |
5139 | +static DEVICE_ATTR(presence, S_IWUSR | S_IRUGO, pod_get_presence, |
5140 | pod_set_presence); |
5141 | -static DEVICE_ATTR2(treble__bass, treble, S_IWUGO | S_IRUGO, |
5142 | +static DEVICE_ATTR2(treble__bass, treble, S_IWUSR | S_IRUGO, |
5143 | pod_get_treble__bass, pod_set_treble__bass); |
5144 | -static DEVICE_ATTR(noise_gate_enable, S_IWUGO | S_IRUGO, |
5145 | +static DEVICE_ATTR(noise_gate_enable, S_IWUSR | S_IRUGO, |
5146 | pod_get_noise_gate_enable, pod_set_noise_gate_enable); |
5147 | -static DEVICE_ATTR(gate_threshold, S_IWUGO | S_IRUGO, pod_get_gate_threshold, |
5148 | +static DEVICE_ATTR(gate_threshold, S_IWUSR | S_IRUGO, pod_get_gate_threshold, |
5149 | pod_set_gate_threshold); |
5150 | -static DEVICE_ATTR(gate_decay_time, S_IWUGO | S_IRUGO, pod_get_gate_decay_time, |
5151 | +static DEVICE_ATTR(gate_decay_time, S_IWUSR | S_IRUGO, pod_get_gate_decay_time, |
5152 | pod_set_gate_decay_time); |
5153 | -static DEVICE_ATTR(stomp_enable, S_IWUGO | S_IRUGO, pod_get_stomp_enable, |
5154 | +static DEVICE_ATTR(stomp_enable, S_IWUSR | S_IRUGO, pod_get_stomp_enable, |
5155 | pod_set_stomp_enable); |
5156 | -static DEVICE_ATTR(comp_enable, S_IWUGO | S_IRUGO, pod_get_comp_enable, |
5157 | +static DEVICE_ATTR(comp_enable, S_IWUSR | S_IRUGO, pod_get_comp_enable, |
5158 | pod_set_comp_enable); |
5159 | -static DEVICE_ATTR(stomp_time, S_IWUGO | S_IRUGO, pod_get_stomp_time, |
5160 | +static DEVICE_ATTR(stomp_time, S_IWUSR | S_IRUGO, pod_get_stomp_time, |
5161 | pod_set_stomp_time); |
5162 | -static DEVICE_ATTR(delay_enable, S_IWUGO | S_IRUGO, pod_get_delay_enable, |
5163 | +static DEVICE_ATTR(delay_enable, S_IWUSR | S_IRUGO, pod_get_delay_enable, |
5164 | pod_set_delay_enable); |
5165 | -static DEVICE_ATTR(mod_param_1, S_IWUGO | S_IRUGO, pod_get_mod_param_1, |
5166 | +static DEVICE_ATTR(mod_param_1, S_IWUSR | S_IRUGO, pod_get_mod_param_1, |
5167 | pod_set_mod_param_1); |
5168 | -static DEVICE_ATTR(delay_param_1, S_IWUGO | S_IRUGO, pod_get_delay_param_1, |
5169 | +static DEVICE_ATTR(delay_param_1, S_IWUSR | S_IRUGO, pod_get_delay_param_1, |
5170 | pod_set_delay_param_1); |
5171 | -static DEVICE_ATTR(delay_param_1_note_value, S_IWUGO | S_IRUGO, |
5172 | +static DEVICE_ATTR(delay_param_1_note_value, S_IWUSR | S_IRUGO, |
5173 | pod_get_delay_param_1_note_value, |
5174 | pod_set_delay_param_1_note_value); |
5175 | -static DEVICE_ATTR2(band_2_frequency__bass, band_2_frequency, S_IWUGO | S_IRUGO, |
5176 | +static DEVICE_ATTR2(band_2_frequency__bass, band_2_frequency, S_IWUSR | S_IRUGO, |
5177 | pod_get_band_2_frequency__bass, |
5178 | pod_set_band_2_frequency__bass); |
5179 | -static DEVICE_ATTR(delay_param_2, S_IWUGO | S_IRUGO, pod_get_delay_param_2, |
5180 | +static DEVICE_ATTR(delay_param_2, S_IWUSR | S_IRUGO, pod_get_delay_param_2, |
5181 | pod_set_delay_param_2); |
5182 | -static DEVICE_ATTR(delay_volume_mix, S_IWUGO | S_IRUGO, |
5183 | +static DEVICE_ATTR(delay_volume_mix, S_IWUSR | S_IRUGO, |
5184 | pod_get_delay_volume_mix, pod_set_delay_volume_mix); |
5185 | -static DEVICE_ATTR(delay_param_3, S_IWUGO | S_IRUGO, pod_get_delay_param_3, |
5186 | +static DEVICE_ATTR(delay_param_3, S_IWUSR | S_IRUGO, pod_get_delay_param_3, |
5187 | pod_set_delay_param_3); |
5188 | -static DEVICE_ATTR(reverb_enable, S_IWUGO | S_IRUGO, pod_get_reverb_enable, |
5189 | +static DEVICE_ATTR(reverb_enable, S_IWUSR | S_IRUGO, pod_get_reverb_enable, |
5190 | pod_set_reverb_enable); |
5191 | -static DEVICE_ATTR(reverb_type, S_IWUGO | S_IRUGO, pod_get_reverb_type, |
5192 | +static DEVICE_ATTR(reverb_type, S_IWUSR | S_IRUGO, pod_get_reverb_type, |
5193 | pod_set_reverb_type); |
5194 | -static DEVICE_ATTR(reverb_decay, S_IWUGO | S_IRUGO, pod_get_reverb_decay, |
5195 | +static DEVICE_ATTR(reverb_decay, S_IWUSR | S_IRUGO, pod_get_reverb_decay, |
5196 | pod_set_reverb_decay); |
5197 | -static DEVICE_ATTR(reverb_tone, S_IWUGO | S_IRUGO, pod_get_reverb_tone, |
5198 | +static DEVICE_ATTR(reverb_tone, S_IWUSR | S_IRUGO, pod_get_reverb_tone, |
5199 | pod_set_reverb_tone); |
5200 | -static DEVICE_ATTR(reverb_pre_delay, S_IWUGO | S_IRUGO, |
5201 | +static DEVICE_ATTR(reverb_pre_delay, S_IWUSR | S_IRUGO, |
5202 | pod_get_reverb_pre_delay, pod_set_reverb_pre_delay); |
5203 | -static DEVICE_ATTR(reverb_pre_post, S_IWUGO | S_IRUGO, pod_get_reverb_pre_post, |
5204 | +static DEVICE_ATTR(reverb_pre_post, S_IWUSR | S_IRUGO, pod_get_reverb_pre_post, |
5205 | pod_set_reverb_pre_post); |
5206 | -static DEVICE_ATTR(band_2_frequency, S_IWUGO | S_IRUGO, |
5207 | +static DEVICE_ATTR(band_2_frequency, S_IWUSR | S_IRUGO, |
5208 | pod_get_band_2_frequency, pod_set_band_2_frequency); |
5209 | -static DEVICE_ATTR2(band_3_frequency__bass, band_3_frequency, S_IWUGO | S_IRUGO, |
5210 | +static DEVICE_ATTR2(band_3_frequency__bass, band_3_frequency, S_IWUSR | S_IRUGO, |
5211 | pod_get_band_3_frequency__bass, |
5212 | pod_set_band_3_frequency__bass); |
5213 | -static DEVICE_ATTR(wah_enable, S_IWUGO | S_IRUGO, pod_get_wah_enable, |
5214 | +static DEVICE_ATTR(wah_enable, S_IWUSR | S_IRUGO, pod_get_wah_enable, |
5215 | pod_set_wah_enable); |
5216 | -static DEVICE_ATTR(modulation_lo_cut, S_IWUGO | S_IRUGO, |
5217 | +static DEVICE_ATTR(modulation_lo_cut, S_IWUSR | S_IRUGO, |
5218 | pod_get_modulation_lo_cut, pod_set_modulation_lo_cut); |
5219 | -static DEVICE_ATTR(delay_reverb_lo_cut, S_IWUGO | S_IRUGO, |
5220 | +static DEVICE_ATTR(delay_reverb_lo_cut, S_IWUSR | S_IRUGO, |
5221 | pod_get_delay_reverb_lo_cut, pod_set_delay_reverb_lo_cut); |
5222 | -static DEVICE_ATTR(volume_pedal_minimum, S_IWUGO | S_IRUGO, |
5223 | +static DEVICE_ATTR(volume_pedal_minimum, S_IWUSR | S_IRUGO, |
5224 | pod_get_volume_pedal_minimum, pod_set_volume_pedal_minimum); |
5225 | -static DEVICE_ATTR(eq_pre_post, S_IWUGO | S_IRUGO, pod_get_eq_pre_post, |
5226 | +static DEVICE_ATTR(eq_pre_post, S_IWUSR | S_IRUGO, pod_get_eq_pre_post, |
5227 | pod_set_eq_pre_post); |
5228 | -static DEVICE_ATTR(volume_pre_post, S_IWUGO | S_IRUGO, pod_get_volume_pre_post, |
5229 | +static DEVICE_ATTR(volume_pre_post, S_IWUSR | S_IRUGO, pod_get_volume_pre_post, |
5230 | pod_set_volume_pre_post); |
5231 | -static DEVICE_ATTR(di_model, S_IWUGO | S_IRUGO, pod_get_di_model, |
5232 | +static DEVICE_ATTR(di_model, S_IWUSR | S_IRUGO, pod_get_di_model, |
5233 | pod_set_di_model); |
5234 | -static DEVICE_ATTR(di_delay, S_IWUGO | S_IRUGO, pod_get_di_delay, |
5235 | +static DEVICE_ATTR(di_delay, S_IWUSR | S_IRUGO, pod_get_di_delay, |
5236 | pod_set_di_delay); |
5237 | -static DEVICE_ATTR(mod_enable, S_IWUGO | S_IRUGO, pod_get_mod_enable, |
5238 | +static DEVICE_ATTR(mod_enable, S_IWUSR | S_IRUGO, pod_get_mod_enable, |
5239 | pod_set_mod_enable); |
5240 | -static DEVICE_ATTR(mod_param_1_note_value, S_IWUGO | S_IRUGO, |
5241 | +static DEVICE_ATTR(mod_param_1_note_value, S_IWUSR | S_IRUGO, |
5242 | pod_get_mod_param_1_note_value, |
5243 | pod_set_mod_param_1_note_value); |
5244 | -static DEVICE_ATTR(mod_param_2, S_IWUGO | S_IRUGO, pod_get_mod_param_2, |
5245 | +static DEVICE_ATTR(mod_param_2, S_IWUSR | S_IRUGO, pod_get_mod_param_2, |
5246 | pod_set_mod_param_2); |
5247 | -static DEVICE_ATTR(mod_param_3, S_IWUGO | S_IRUGO, pod_get_mod_param_3, |
5248 | +static DEVICE_ATTR(mod_param_3, S_IWUSR | S_IRUGO, pod_get_mod_param_3, |
5249 | pod_set_mod_param_3); |
5250 | -static DEVICE_ATTR(mod_param_4, S_IWUGO | S_IRUGO, pod_get_mod_param_4, |
5251 | +static DEVICE_ATTR(mod_param_4, S_IWUSR | S_IRUGO, pod_get_mod_param_4, |
5252 | pod_set_mod_param_4); |
5253 | -static DEVICE_ATTR(mod_param_5, S_IWUGO | S_IRUGO, pod_get_mod_param_5, |
5254 | +static DEVICE_ATTR(mod_param_5, S_IWUSR | S_IRUGO, pod_get_mod_param_5, |
5255 | pod_set_mod_param_5); |
5256 | -static DEVICE_ATTR(mod_volume_mix, S_IWUGO | S_IRUGO, pod_get_mod_volume_mix, |
5257 | +static DEVICE_ATTR(mod_volume_mix, S_IWUSR | S_IRUGO, pod_get_mod_volume_mix, |
5258 | pod_set_mod_volume_mix); |
5259 | -static DEVICE_ATTR(mod_pre_post, S_IWUGO | S_IRUGO, pod_get_mod_pre_post, |
5260 | +static DEVICE_ATTR(mod_pre_post, S_IWUSR | S_IRUGO, pod_get_mod_pre_post, |
5261 | pod_set_mod_pre_post); |
5262 | -static DEVICE_ATTR(modulation_model, S_IWUGO | S_IRUGO, |
5263 | +static DEVICE_ATTR(modulation_model, S_IWUSR | S_IRUGO, |
5264 | pod_get_modulation_model, pod_set_modulation_model); |
5265 | -static DEVICE_ATTR(band_3_frequency, S_IWUGO | S_IRUGO, |
5266 | +static DEVICE_ATTR(band_3_frequency, S_IWUSR | S_IRUGO, |
5267 | pod_get_band_3_frequency, pod_set_band_3_frequency); |
5268 | -static DEVICE_ATTR2(band_4_frequency__bass, band_4_frequency, S_IWUGO | S_IRUGO, |
5269 | +static DEVICE_ATTR2(band_4_frequency__bass, band_4_frequency, S_IWUSR | S_IRUGO, |
5270 | pod_get_band_4_frequency__bass, |
5271 | pod_set_band_4_frequency__bass); |
5272 | -static DEVICE_ATTR(mod_param_1_double_precision, S_IWUGO | S_IRUGO, |
5273 | +static DEVICE_ATTR(mod_param_1_double_precision, S_IWUSR | S_IRUGO, |
5274 | pod_get_mod_param_1_double_precision, |
5275 | pod_set_mod_param_1_double_precision); |
5276 | -static DEVICE_ATTR(delay_param_1_double_precision, S_IWUGO | S_IRUGO, |
5277 | +static DEVICE_ATTR(delay_param_1_double_precision, S_IWUSR | S_IRUGO, |
5278 | pod_get_delay_param_1_double_precision, |
5279 | pod_set_delay_param_1_double_precision); |
5280 | -static DEVICE_ATTR(eq_enable, S_IWUGO | S_IRUGO, pod_get_eq_enable, |
5281 | +static DEVICE_ATTR(eq_enable, S_IWUSR | S_IRUGO, pod_get_eq_enable, |
5282 | pod_set_eq_enable); |
5283 | -static DEVICE_ATTR(tap, S_IWUGO | S_IRUGO, pod_get_tap, pod_set_tap); |
5284 | -static DEVICE_ATTR(volume_tweak_pedal_assign, S_IWUGO | S_IRUGO, |
5285 | +static DEVICE_ATTR(tap, S_IWUSR | S_IRUGO, pod_get_tap, pod_set_tap); |
5286 | +static DEVICE_ATTR(volume_tweak_pedal_assign, S_IWUSR | S_IRUGO, |
5287 | pod_get_volume_tweak_pedal_assign, |
5288 | pod_set_volume_tweak_pedal_assign); |
5289 | -static DEVICE_ATTR(band_5_frequency, S_IWUGO | S_IRUGO, |
5290 | +static DEVICE_ATTR(band_5_frequency, S_IWUSR | S_IRUGO, |
5291 | pod_get_band_5_frequency, pod_set_band_5_frequency); |
5292 | -static DEVICE_ATTR(tuner, S_IWUGO | S_IRUGO, pod_get_tuner, pod_set_tuner); |
5293 | -static DEVICE_ATTR(mic_selection, S_IWUGO | S_IRUGO, pod_get_mic_selection, |
5294 | +static DEVICE_ATTR(tuner, S_IWUSR | S_IRUGO, pod_get_tuner, pod_set_tuner); |
5295 | +static DEVICE_ATTR(mic_selection, S_IWUSR | S_IRUGO, pod_get_mic_selection, |
5296 | pod_set_mic_selection); |
5297 | -static DEVICE_ATTR(cabinet_model, S_IWUGO | S_IRUGO, pod_get_cabinet_model, |
5298 | +static DEVICE_ATTR(cabinet_model, S_IWUSR | S_IRUGO, pod_get_cabinet_model, |
5299 | pod_set_cabinet_model); |
5300 | -static DEVICE_ATTR(stomp_model, S_IWUGO | S_IRUGO, pod_get_stomp_model, |
5301 | +static DEVICE_ATTR(stomp_model, S_IWUSR | S_IRUGO, pod_get_stomp_model, |
5302 | pod_set_stomp_model); |
5303 | -static DEVICE_ATTR(roomlevel, S_IWUGO | S_IRUGO, pod_get_roomlevel, |
5304 | +static DEVICE_ATTR(roomlevel, S_IWUSR | S_IRUGO, pod_get_roomlevel, |
5305 | pod_set_roomlevel); |
5306 | -static DEVICE_ATTR(band_4_frequency, S_IWUGO | S_IRUGO, |
5307 | +static DEVICE_ATTR(band_4_frequency, S_IWUSR | S_IRUGO, |
5308 | pod_get_band_4_frequency, pod_set_band_4_frequency); |
5309 | -static DEVICE_ATTR(band_6_frequency, S_IWUGO | S_IRUGO, |
5310 | +static DEVICE_ATTR(band_6_frequency, S_IWUSR | S_IRUGO, |
5311 | pod_get_band_6_frequency, pod_set_band_6_frequency); |
5312 | -static DEVICE_ATTR(stomp_param_1_note_value, S_IWUGO | S_IRUGO, |
5313 | +static DEVICE_ATTR(stomp_param_1_note_value, S_IWUSR | S_IRUGO, |
5314 | pod_get_stomp_param_1_note_value, |
5315 | pod_set_stomp_param_1_note_value); |
5316 | -static DEVICE_ATTR(stomp_param_2, S_IWUGO | S_IRUGO, pod_get_stomp_param_2, |
5317 | +static DEVICE_ATTR(stomp_param_2, S_IWUSR | S_IRUGO, pod_get_stomp_param_2, |
5318 | pod_set_stomp_param_2); |
5319 | -static DEVICE_ATTR(stomp_param_3, S_IWUGO | S_IRUGO, pod_get_stomp_param_3, |
5320 | +static DEVICE_ATTR(stomp_param_3, S_IWUSR | S_IRUGO, pod_get_stomp_param_3, |
5321 | pod_set_stomp_param_3); |
5322 | -static DEVICE_ATTR(stomp_param_4, S_IWUGO | S_IRUGO, pod_get_stomp_param_4, |
5323 | +static DEVICE_ATTR(stomp_param_4, S_IWUSR | S_IRUGO, pod_get_stomp_param_4, |
5324 | pod_set_stomp_param_4); |
5325 | -static DEVICE_ATTR(stomp_param_5, S_IWUGO | S_IRUGO, pod_get_stomp_param_5, |
5326 | +static DEVICE_ATTR(stomp_param_5, S_IWUSR | S_IRUGO, pod_get_stomp_param_5, |
5327 | pod_set_stomp_param_5); |
5328 | -static DEVICE_ATTR(stomp_param_6, S_IWUGO | S_IRUGO, pod_get_stomp_param_6, |
5329 | +static DEVICE_ATTR(stomp_param_6, S_IWUSR | S_IRUGO, pod_get_stomp_param_6, |
5330 | pod_set_stomp_param_6); |
5331 | -static DEVICE_ATTR(amp_switch_select, S_IWUGO | S_IRUGO, |
5332 | +static DEVICE_ATTR(amp_switch_select, S_IWUSR | S_IRUGO, |
5333 | pod_get_amp_switch_select, pod_set_amp_switch_select); |
5334 | -static DEVICE_ATTR(delay_param_4, S_IWUGO | S_IRUGO, pod_get_delay_param_4, |
5335 | +static DEVICE_ATTR(delay_param_4, S_IWUSR | S_IRUGO, pod_get_delay_param_4, |
5336 | pod_set_delay_param_4); |
5337 | -static DEVICE_ATTR(delay_param_5, S_IWUGO | S_IRUGO, pod_get_delay_param_5, |
5338 | +static DEVICE_ATTR(delay_param_5, S_IWUSR | S_IRUGO, pod_get_delay_param_5, |
5339 | pod_set_delay_param_5); |
5340 | -static DEVICE_ATTR(delay_pre_post, S_IWUGO | S_IRUGO, pod_get_delay_pre_post, |
5341 | +static DEVICE_ATTR(delay_pre_post, S_IWUSR | S_IRUGO, pod_get_delay_pre_post, |
5342 | pod_set_delay_pre_post); |
5343 | -static DEVICE_ATTR(delay_model, S_IWUGO | S_IRUGO, pod_get_delay_model, |
5344 | +static DEVICE_ATTR(delay_model, S_IWUSR | S_IRUGO, pod_get_delay_model, |
5345 | pod_set_delay_model); |
5346 | -static DEVICE_ATTR(delay_verb_model, S_IWUGO | S_IRUGO, |
5347 | +static DEVICE_ATTR(delay_verb_model, S_IWUSR | S_IRUGO, |
5348 | pod_get_delay_verb_model, pod_set_delay_verb_model); |
5349 | -static DEVICE_ATTR(tempo_msb, S_IWUGO | S_IRUGO, pod_get_tempo_msb, |
5350 | +static DEVICE_ATTR(tempo_msb, S_IWUSR | S_IRUGO, pod_get_tempo_msb, |
5351 | pod_set_tempo_msb); |
5352 | -static DEVICE_ATTR(tempo_lsb, S_IWUGO | S_IRUGO, pod_get_tempo_lsb, |
5353 | +static DEVICE_ATTR(tempo_lsb, S_IWUSR | S_IRUGO, pod_get_tempo_lsb, |
5354 | pod_set_tempo_lsb); |
5355 | -static DEVICE_ATTR(wah_model, S_IWUGO | S_IRUGO, pod_get_wah_model, |
5356 | +static DEVICE_ATTR(wah_model, S_IWUSR | S_IRUGO, pod_get_wah_model, |
5357 | pod_set_wah_model); |
5358 | -static DEVICE_ATTR(bypass_volume, S_IWUGO | S_IRUGO, pod_get_bypass_volume, |
5359 | +static DEVICE_ATTR(bypass_volume, S_IWUSR | S_IRUGO, pod_get_bypass_volume, |
5360 | pod_set_bypass_volume); |
5361 | -static DEVICE_ATTR(fx_loop_on_off, S_IWUGO | S_IRUGO, pod_get_fx_loop_on_off, |
5362 | +static DEVICE_ATTR(fx_loop_on_off, S_IWUSR | S_IRUGO, pod_get_fx_loop_on_off, |
5363 | pod_set_fx_loop_on_off); |
5364 | -static DEVICE_ATTR(tweak_param_select, S_IWUGO | S_IRUGO, |
5365 | +static DEVICE_ATTR(tweak_param_select, S_IWUSR | S_IRUGO, |
5366 | pod_get_tweak_param_select, pod_set_tweak_param_select); |
5367 | -static DEVICE_ATTR(amp1_engage, S_IWUGO | S_IRUGO, pod_get_amp1_engage, |
5368 | +static DEVICE_ATTR(amp1_engage, S_IWUSR | S_IRUGO, pod_get_amp1_engage, |
5369 | pod_set_amp1_engage); |
5370 | -static DEVICE_ATTR(band_1_gain, S_IWUGO | S_IRUGO, pod_get_band_1_gain, |
5371 | +static DEVICE_ATTR(band_1_gain, S_IWUSR | S_IRUGO, pod_get_band_1_gain, |
5372 | pod_set_band_1_gain); |
5373 | -static DEVICE_ATTR2(band_2_gain__bass, band_2_gain, S_IWUGO | S_IRUGO, |
5374 | +static DEVICE_ATTR2(band_2_gain__bass, band_2_gain, S_IWUSR | S_IRUGO, |
5375 | pod_get_band_2_gain__bass, pod_set_band_2_gain__bass); |
5376 | -static DEVICE_ATTR(band_2_gain, S_IWUGO | S_IRUGO, pod_get_band_2_gain, |
5377 | +static DEVICE_ATTR(band_2_gain, S_IWUSR | S_IRUGO, pod_get_band_2_gain, |
5378 | pod_set_band_2_gain); |
5379 | -static DEVICE_ATTR2(band_3_gain__bass, band_3_gain, S_IWUGO | S_IRUGO, |
5380 | +static DEVICE_ATTR2(band_3_gain__bass, band_3_gain, S_IWUSR | S_IRUGO, |
5381 | pod_get_band_3_gain__bass, pod_set_band_3_gain__bass); |
5382 | -static DEVICE_ATTR(band_3_gain, S_IWUGO | S_IRUGO, pod_get_band_3_gain, |
5383 | +static DEVICE_ATTR(band_3_gain, S_IWUSR | S_IRUGO, pod_get_band_3_gain, |
5384 | pod_set_band_3_gain); |
5385 | -static DEVICE_ATTR2(band_4_gain__bass, band_4_gain, S_IWUGO | S_IRUGO, |
5386 | +static DEVICE_ATTR2(band_4_gain__bass, band_4_gain, S_IWUSR | S_IRUGO, |
5387 | pod_get_band_4_gain__bass, pod_set_band_4_gain__bass); |
5388 | -static DEVICE_ATTR2(band_5_gain__bass, band_5_gain, S_IWUGO | S_IRUGO, |
5389 | +static DEVICE_ATTR2(band_5_gain__bass, band_5_gain, S_IWUSR | S_IRUGO, |
5390 | pod_get_band_5_gain__bass, pod_set_band_5_gain__bass); |
5391 | -static DEVICE_ATTR(band_4_gain, S_IWUGO | S_IRUGO, pod_get_band_4_gain, |
5392 | +static DEVICE_ATTR(band_4_gain, S_IWUSR | S_IRUGO, pod_get_band_4_gain, |
5393 | pod_set_band_4_gain); |
5394 | -static DEVICE_ATTR2(band_6_gain__bass, band_6_gain, S_IWUGO | S_IRUGO, |
5395 | +static DEVICE_ATTR2(band_6_gain__bass, band_6_gain, S_IWUSR | S_IRUGO, |
5396 | pod_get_band_6_gain__bass, pod_set_band_6_gain__bass); |
5397 | static DEVICE_ATTR(body, S_IRUGO, variax_get_body, line6_nop_write); |
5398 | static DEVICE_ATTR(pickup1_enable, S_IRUGO, variax_get_pickup1_enable, |
5399 | diff --git a/drivers/staging/line6/midi.c b/drivers/staging/line6/midi.c |
5400 | index 32b6ca7..9b42e34 100644 |
5401 | --- a/drivers/staging/line6/midi.c |
5402 | +++ b/drivers/staging/line6/midi.c |
5403 | @@ -362,8 +362,8 @@ static ssize_t midi_set_midi_mask_receive(struct device *dev, |
5404 | return count; |
5405 | } |
5406 | |
5407 | -static DEVICE_ATTR(midi_mask_transmit, S_IWUGO | S_IRUGO, midi_get_midi_mask_transmit, midi_set_midi_mask_transmit); |
5408 | -static DEVICE_ATTR(midi_mask_receive, S_IWUGO | S_IRUGO, midi_get_midi_mask_receive, midi_set_midi_mask_receive); |
5409 | +static DEVICE_ATTR(midi_mask_transmit, S_IWUSR | S_IRUGO, midi_get_midi_mask_transmit, midi_set_midi_mask_transmit); |
5410 | +static DEVICE_ATTR(midi_mask_receive, S_IWUSR | S_IRUGO, midi_get_midi_mask_receive, midi_set_midi_mask_receive); |
5411 | |
5412 | /* MIDI device destructor */ |
5413 | static int snd_line6_midi_free(struct snd_device *device) |
5414 | diff --git a/drivers/staging/line6/pod.c b/drivers/staging/line6/pod.c |
5415 | index 28f5146..63318d7 100644 |
5416 | --- a/drivers/staging/line6/pod.c |
5417 | +++ b/drivers/staging/line6/pod.c |
5418 | @@ -952,33 +952,33 @@ POD_GET_SYSTEM_PARAM(tuner_pitch, 1, 1); |
5419 | #undef GET_SYSTEM_PARAM |
5420 | |
5421 | /* POD special files: */ |
5422 | -static DEVICE_ATTR(channel, S_IWUGO | S_IRUGO, pod_get_channel, pod_set_channel); |
5423 | +static DEVICE_ATTR(channel, S_IWUSR | S_IRUGO, pod_get_channel, pod_set_channel); |
5424 | static DEVICE_ATTR(clip, S_IRUGO, pod_wait_for_clip, line6_nop_write); |
5425 | static DEVICE_ATTR(device_id, S_IRUGO, pod_get_device_id, line6_nop_write); |
5426 | static DEVICE_ATTR(dirty, S_IRUGO, pod_get_dirty, line6_nop_write); |
5427 | -static DEVICE_ATTR(dump, S_IWUGO | S_IRUGO, pod_get_dump, pod_set_dump); |
5428 | -static DEVICE_ATTR(dump_buf, S_IWUGO | S_IRUGO, pod_get_dump_buf, pod_set_dump_buf); |
5429 | -static DEVICE_ATTR(finish, S_IWUGO, line6_nop_read, pod_set_finish); |
5430 | +static DEVICE_ATTR(dump, S_IWUSR | S_IRUGO, pod_get_dump, pod_set_dump); |
5431 | +static DEVICE_ATTR(dump_buf, S_IWUSR | S_IRUGO, pod_get_dump_buf, pod_set_dump_buf); |
5432 | +static DEVICE_ATTR(finish, S_IWUSR, line6_nop_read, pod_set_finish); |
5433 | static DEVICE_ATTR(firmware_version, S_IRUGO, pod_get_firmware_version, line6_nop_write); |
5434 | -static DEVICE_ATTR(midi_postprocess, S_IWUGO | S_IRUGO, pod_get_midi_postprocess, pod_set_midi_postprocess); |
5435 | -static DEVICE_ATTR(monitor_level, S_IWUGO | S_IRUGO, pod_get_monitor_level, pod_set_monitor_level); |
5436 | +static DEVICE_ATTR(midi_postprocess, S_IWUSR | S_IRUGO, pod_get_midi_postprocess, pod_set_midi_postprocess); |
5437 | +static DEVICE_ATTR(monitor_level, S_IWUSR | S_IRUGO, pod_get_monitor_level, pod_set_monitor_level); |
5438 | static DEVICE_ATTR(name, S_IRUGO, pod_get_name, line6_nop_write); |
5439 | static DEVICE_ATTR(name_buf, S_IRUGO, pod_get_name_buf, line6_nop_write); |
5440 | -static DEVICE_ATTR(retrieve_amp_setup, S_IWUGO, line6_nop_read, pod_set_retrieve_amp_setup); |
5441 | -static DEVICE_ATTR(retrieve_channel, S_IWUGO, line6_nop_read, pod_set_retrieve_channel); |
5442 | -static DEVICE_ATTR(retrieve_effects_setup, S_IWUGO, line6_nop_read, pod_set_retrieve_effects_setup); |
5443 | -static DEVICE_ATTR(routing, S_IWUGO | S_IRUGO, pod_get_routing, pod_set_routing); |
5444 | +static DEVICE_ATTR(retrieve_amp_setup, S_IWUSR, line6_nop_read, pod_set_retrieve_amp_setup); |
5445 | +static DEVICE_ATTR(retrieve_channel, S_IWUSR, line6_nop_read, pod_set_retrieve_channel); |
5446 | +static DEVICE_ATTR(retrieve_effects_setup, S_IWUSR, line6_nop_read, pod_set_retrieve_effects_setup); |
5447 | +static DEVICE_ATTR(routing, S_IWUSR | S_IRUGO, pod_get_routing, pod_set_routing); |
5448 | static DEVICE_ATTR(serial_number, S_IRUGO, pod_get_serial_number, line6_nop_write); |
5449 | -static DEVICE_ATTR(store_amp_setup, S_IWUGO, line6_nop_read, pod_set_store_amp_setup); |
5450 | -static DEVICE_ATTR(store_channel, S_IWUGO, line6_nop_read, pod_set_store_channel); |
5451 | -static DEVICE_ATTR(store_effects_setup, S_IWUGO, line6_nop_read, pod_set_store_effects_setup); |
5452 | -static DEVICE_ATTR(tuner_freq, S_IWUGO | S_IRUGO, pod_get_tuner_freq, pod_set_tuner_freq); |
5453 | -static DEVICE_ATTR(tuner_mute, S_IWUGO | S_IRUGO, pod_get_tuner_mute, pod_set_tuner_mute); |
5454 | +static DEVICE_ATTR(store_amp_setup, S_IWUSR, line6_nop_read, pod_set_store_amp_setup); |
5455 | +static DEVICE_ATTR(store_channel, S_IWUSR, line6_nop_read, pod_set_store_channel); |
5456 | +static DEVICE_ATTR(store_effects_setup, S_IWUSR, line6_nop_read, pod_set_store_effects_setup); |
5457 | +static DEVICE_ATTR(tuner_freq, S_IWUSR | S_IRUGO, pod_get_tuner_freq, pod_set_tuner_freq); |
5458 | +static DEVICE_ATTR(tuner_mute, S_IWUSR | S_IRUGO, pod_get_tuner_mute, pod_set_tuner_mute); |
5459 | static DEVICE_ATTR(tuner_note, S_IRUGO, pod_get_tuner_note, line6_nop_write); |
5460 | static DEVICE_ATTR(tuner_pitch, S_IRUGO, pod_get_tuner_pitch, line6_nop_write); |
5461 | |
5462 | #if CREATE_RAW_FILE |
5463 | -static DEVICE_ATTR(raw, S_IWUGO, line6_nop_read, line6_set_raw); |
5464 | +static DEVICE_ATTR(raw, S_IWUSR, line6_nop_read, line6_set_raw); |
5465 | #endif |
5466 | |
5467 | /* |
5468 | diff --git a/drivers/staging/line6/toneport.c b/drivers/staging/line6/toneport.c |
5469 | index e6770ea..db42178 100644 |
5470 | --- a/drivers/staging/line6/toneport.c |
5471 | +++ b/drivers/staging/line6/toneport.c |
5472 | @@ -124,9 +124,9 @@ static ssize_t toneport_set_led_green(struct device *dev, |
5473 | return count; |
5474 | } |
5475 | |
5476 | -static DEVICE_ATTR(led_red, S_IWUGO | S_IRUGO, line6_nop_read, |
5477 | +static DEVICE_ATTR(led_red, S_IWUSR | S_IRUGO, line6_nop_read, |
5478 | toneport_set_led_red); |
5479 | -static DEVICE_ATTR(led_green, S_IWUGO | S_IRUGO, line6_nop_read, |
5480 | +static DEVICE_ATTR(led_green, S_IWUSR | S_IRUGO, line6_nop_read, |
5481 | toneport_set_led_green); |
5482 | |
5483 | static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2) |
5484 | diff --git a/drivers/staging/line6/variax.c b/drivers/staging/line6/variax.c |
5485 | index 58ddbe6..b2fc09b 100644 |
5486 | --- a/drivers/staging/line6/variax.c |
5487 | +++ b/drivers/staging/line6/variax.c |
5488 | @@ -389,17 +389,17 @@ static ssize_t variax_set_raw2(struct device *dev, |
5489 | #endif |
5490 | |
5491 | /* Variax workbench special files: */ |
5492 | -static DEVICE_ATTR(model, S_IWUGO | S_IRUGO, variax_get_model, variax_set_model); |
5493 | -static DEVICE_ATTR(volume, S_IWUGO | S_IRUGO, variax_get_volume, variax_set_volume); |
5494 | -static DEVICE_ATTR(tone, S_IWUGO | S_IRUGO, variax_get_tone, variax_set_tone); |
5495 | +static DEVICE_ATTR(model, S_IWUSR | S_IRUGO, variax_get_model, variax_set_model); |
5496 | +static DEVICE_ATTR(volume, S_IWUSR | S_IRUGO, variax_get_volume, variax_set_volume); |
5497 | +static DEVICE_ATTR(tone, S_IWUSR | S_IRUGO, variax_get_tone, variax_set_tone); |
5498 | static DEVICE_ATTR(name, S_IRUGO, variax_get_name, line6_nop_write); |
5499 | static DEVICE_ATTR(bank, S_IRUGO, variax_get_bank, line6_nop_write); |
5500 | static DEVICE_ATTR(dump, S_IRUGO, variax_get_dump, line6_nop_write); |
5501 | -static DEVICE_ATTR(active, S_IWUGO | S_IRUGO, variax_get_active, variax_set_active); |
5502 | +static DEVICE_ATTR(active, S_IWUSR | S_IRUGO, variax_get_active, variax_set_active); |
5503 | |
5504 | #if CREATE_RAW_FILE |
5505 | -static DEVICE_ATTR(raw, S_IWUGO, line6_nop_read, line6_set_raw); |
5506 | -static DEVICE_ATTR(raw2, S_IWUGO, line6_nop_read, variax_set_raw2); |
5507 | +static DEVICE_ATTR(raw, S_IWUSR, line6_nop_read, line6_set_raw); |
5508 | +static DEVICE_ATTR(raw2, S_IWUSR, line6_nop_read, variax_set_raw2); |
5509 | #endif |
5510 | |
5511 | |
5512 | diff --git a/drivers/staging/rt2860/usb_main_dev.c b/drivers/staging/rt2860/usb_main_dev.c |
5513 | index ebf9074..cd15daa 100644 |
5514 | --- a/drivers/staging/rt2860/usb_main_dev.c |
5515 | +++ b/drivers/staging/rt2860/usb_main_dev.c |
5516 | @@ -65,6 +65,7 @@ struct usb_device_id rtusb_usb_id[] = { |
5517 | {USB_DEVICE(0x14B2, 0x3C07)}, /* AL */ |
5518 | {USB_DEVICE(0x050D, 0x8053)}, /* Belkin */ |
5519 | {USB_DEVICE(0x050D, 0x825B)}, /* Belkin */ |
5520 | + {USB_DEVICE(0x050D, 0x935A)}, /* Belkin F6D4050 v1 */ |
5521 | {USB_DEVICE(0x050D, 0x935B)}, /* Belkin F6D4050 v2 */ |
5522 | {USB_DEVICE(0x14B2, 0x3C23)}, /* Airlink */ |
5523 | {USB_DEVICE(0x14B2, 0x3C27)}, /* Airlink */ |
5524 | @@ -181,6 +182,7 @@ struct usb_device_id rtusb_usb_id[] = { |
5525 | {USB_DEVICE(0x2001, 0x3C09)}, /* D-Link */ |
5526 | {USB_DEVICE(0x2001, 0x3C0A)}, /* D-Link 3072 */ |
5527 | {USB_DEVICE(0x2019, 0xED14)}, /* Planex Communications, Inc. */ |
5528 | + {USB_DEVICE(0x0411, 0x015D)}, /* Buffalo Airstation WLI-UC-GN */ |
5529 | {} /* Terminating entry */ |
5530 | }; |
5531 | |
5532 | diff --git a/drivers/staging/rtl8187se/r8185b_init.c b/drivers/staging/rtl8187se/r8185b_init.c |
5533 | index a0ece1f..e7e8745 100644 |
5534 | --- a/drivers/staging/rtl8187se/r8185b_init.c |
5535 | +++ b/drivers/staging/rtl8187se/r8185b_init.c |
5536 | @@ -268,8 +268,12 @@ HwHSSIThreeWire( |
5537 | } |
5538 | udelay(10); |
5539 | } |
5540 | - if (TryCnt == TC_3W_POLL_MAX_TRY_CNT) |
5541 | - panic("HwThreeWire(): CmdReg: %#X RE|WE bits are not clear!!\n", u1bTmp); |
5542 | + if (TryCnt == TC_3W_POLL_MAX_TRY_CNT) { |
5543 | + printk(KERN_ERR "rtl8187se: HwThreeWire(): CmdReg:" |
5544 | + " %#X RE|WE bits are not clear!!\n", u1bTmp); |
5545 | + dump_stack(); |
5546 | + return 0; |
5547 | + } |
5548 | |
5549 | // RTL8187S HSSI Read/Write Function |
5550 | u1bTmp = read_nic_byte(dev, RF_SW_CONFIG); |
5551 | @@ -309,13 +313,23 @@ HwHSSIThreeWire( |
5552 | int idx; |
5553 | int ByteCnt = nDataBufBitCnt / 8; |
5554 | //printk("%d\n",nDataBufBitCnt); |
5555 | - if ((nDataBufBitCnt % 8) != 0) |
5556 | - panic("HwThreeWire(): nDataBufBitCnt(%d) should be multiple of 8!!!\n", |
5557 | - nDataBufBitCnt); |
5558 | + if ((nDataBufBitCnt % 8) != 0) { |
5559 | + printk(KERN_ERR "rtl8187se: " |
5560 | + "HwThreeWire(): nDataBufBitCnt(%d)" |
5561 | + " should be multiple of 8!!!\n", |
5562 | + nDataBufBitCnt); |
5563 | + dump_stack(); |
5564 | + nDataBufBitCnt += 8; |
5565 | + nDataBufBitCnt &= ~7; |
5566 | + } |
5567 | |
5568 | - if (nDataBufBitCnt > 64) |
5569 | - panic("HwThreeWire(): nDataBufBitCnt(%d) should <= 64!!!\n", |
5570 | - nDataBufBitCnt); |
5571 | + if (nDataBufBitCnt > 64) { |
5572 | + printk(KERN_ERR "rtl8187se: HwThreeWire():" |
5573 | + " nDataBufBitCnt(%d) should <= 64!!!\n", |
5574 | + nDataBufBitCnt); |
5575 | + dump_stack(); |
5576 | + nDataBufBitCnt = 64; |
5577 | + } |
5578 | |
5579 | for(idx = 0; idx < ByteCnt; idx++) |
5580 | { |
5581 | diff --git a/drivers/staging/samsung-laptop/samsung-laptop.c b/drivers/staging/samsung-laptop/samsung-laptop.c |
5582 | index eb44b60..ac2bf11 100644 |
5583 | --- a/drivers/staging/samsung-laptop/samsung-laptop.c |
5584 | +++ b/drivers/staging/samsung-laptop/samsung-laptop.c |
5585 | @@ -356,7 +356,7 @@ static ssize_t set_silent_state(struct device *dev, |
5586 | } |
5587 | return count; |
5588 | } |
5589 | -static DEVICE_ATTR(silent, S_IWUGO | S_IRUGO, |
5590 | +static DEVICE_ATTR(silent, S_IWUSR | S_IRUGO, |
5591 | get_silent_state, set_silent_state); |
5592 | |
5593 | |
5594 | diff --git a/drivers/staging/udlfb/udlfb.c b/drivers/staging/udlfb/udlfb.c |
5595 | index c7e061e..456cd5c 100644 |
5596 | --- a/drivers/staging/udlfb/udlfb.c |
5597 | +++ b/drivers/staging/udlfb/udlfb.c |
5598 | @@ -1143,7 +1143,7 @@ static struct device_attribute fb_device_attrs[] = { |
5599 | __ATTR_RO(metrics_bytes_sent), |
5600 | __ATTR_RO(metrics_cpu_kcycles_used), |
5601 | __ATTR_RO(metrics_misc), |
5602 | - __ATTR(metrics_reset, S_IWUGO, NULL, metrics_reset_store), |
5603 | + __ATTR(metrics_reset, S_IWUSR, NULL, metrics_reset_store), |
5604 | __ATTR_RW(use_defio), |
5605 | }; |
5606 | |
5607 | diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c |
5608 | index ea071a5..44447f5 100644 |
5609 | --- a/drivers/usb/atm/ueagle-atm.c |
5610 | +++ b/drivers/usb/atm/ueagle-atm.c |
5611 | @@ -2301,7 +2301,7 @@ out: |
5612 | return ret; |
5613 | } |
5614 | |
5615 | -static DEVICE_ATTR(stat_status, S_IWUGO | S_IRUGO, read_status, reboot); |
5616 | +static DEVICE_ATTR(stat_status, S_IWUSR | S_IRUGO, read_status, reboot); |
5617 | |
5618 | static ssize_t read_human_status(struct device *dev, |
5619 | struct device_attribute *attr, char *buf) |
5620 | @@ -2364,8 +2364,7 @@ out: |
5621 | return ret; |
5622 | } |
5623 | |
5624 | -static DEVICE_ATTR(stat_human_status, S_IWUGO | S_IRUGO, |
5625 | - read_human_status, NULL); |
5626 | +static DEVICE_ATTR(stat_human_status, S_IRUGO, read_human_status, NULL); |
5627 | |
5628 | static ssize_t read_delin(struct device *dev, struct device_attribute *attr, |
5629 | char *buf) |
5630 | @@ -2397,7 +2396,7 @@ out: |
5631 | return ret; |
5632 | } |
5633 | |
5634 | -static DEVICE_ATTR(stat_delin, S_IWUGO | S_IRUGO, read_delin, NULL); |
5635 | +static DEVICE_ATTR(stat_delin, S_IRUGO, read_delin, NULL); |
5636 | |
5637 | #define UEA_ATTR(name, reset) \ |
5638 | \ |
5639 | diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c |
5640 | index f1aaff6..045bb4b 100644 |
5641 | --- a/drivers/usb/core/devio.c |
5642 | +++ b/drivers/usb/core/devio.c |
5643 | @@ -965,10 +965,11 @@ static int proc_getdriver(struct dev_state *ps, void __user *arg) |
5644 | |
5645 | static int proc_connectinfo(struct dev_state *ps, void __user *arg) |
5646 | { |
5647 | - struct usbdevfs_connectinfo ci; |
5648 | + struct usbdevfs_connectinfo ci = { |
5649 | + .devnum = ps->dev->devnum, |
5650 | + .slow = ps->dev->speed == USB_SPEED_LOW |
5651 | + }; |
5652 | |
5653 | - ci.devnum = ps->dev->devnum; |
5654 | - ci.slow = ps->dev->speed == USB_SPEED_LOW; |
5655 | if (copy_to_user(arg, &ci, sizeof(ci))) |
5656 | return -EFAULT; |
5657 | return 0; |
5658 | diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c |
5659 | index 959f062..2d19d88 100644 |
5660 | --- a/drivers/usb/gadget/atmel_usba_udc.c |
5661 | +++ b/drivers/usb/gadget/atmel_usba_udc.c |
5662 | @@ -2016,7 +2016,7 @@ static int __init usba_udc_probe(struct platform_device *pdev) |
5663 | } |
5664 | } else { |
5665 | /* gpio_request fail so use -EINVAL for gpio_is_valid */ |
5666 | - ubc->vbus_pin = -EINVAL; |
5667 | + udc->vbus_pin = -EINVAL; |
5668 | } |
5669 | } |
5670 | |
5671 | diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c |
5672 | index 76b7fd2..b349021 100644 |
5673 | --- a/drivers/usb/host/ehci-dbg.c |
5674 | +++ b/drivers/usb/host/ehci-dbg.c |
5675 | @@ -1063,7 +1063,7 @@ static inline void create_debug_files (struct ehci_hcd *ehci) |
5676 | &debug_registers_fops)) |
5677 | goto file_error; |
5678 | |
5679 | - if (!debugfs_create_file("lpm", S_IRUGO|S_IWUGO, ehci->debug_dir, bus, |
5680 | + if (!debugfs_create_file("lpm", S_IRUGO|S_IWUSR, ehci->debug_dir, bus, |
5681 | &debug_lpm_fops)) |
5682 | goto file_error; |
5683 | |
5684 | diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c |
5685 | index 34a928d..df7b194 100644 |
5686 | --- a/drivers/usb/host/ehci-hcd.c |
5687 | +++ b/drivers/usb/host/ehci-hcd.c |
5688 | @@ -1048,10 +1048,11 @@ rescan: |
5689 | tmp && tmp != qh; |
5690 | tmp = tmp->qh_next.qh) |
5691 | continue; |
5692 | - /* periodic qh self-unlinks on empty */ |
5693 | - if (!tmp) |
5694 | - goto nogood; |
5695 | - unlink_async (ehci, qh); |
5696 | + /* periodic qh self-unlinks on empty, and a COMPLETING qh |
5697 | + * may already be unlinked. |
5698 | + */ |
5699 | + if (tmp) |
5700 | + unlink_async(ehci, qh); |
5701 | /* FALL THROUGH */ |
5702 | case QH_STATE_UNLINK: /* wait for hw to finish? */ |
5703 | case QH_STATE_UNLINK_WAIT: |
5704 | @@ -1068,7 +1069,6 @@ idle_timeout: |
5705 | } |
5706 | /* else FALL THROUGH */ |
5707 | default: |
5708 | -nogood: |
5709 | /* caller was supposed to have unlinked any requests; |
5710 | * that's not our job. just leak this memory. |
5711 | */ |
5712 | diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c |
5713 | index a1e8d27..8d24d1c 100644 |
5714 | --- a/drivers/usb/host/ehci-pci.c |
5715 | +++ b/drivers/usb/host/ehci-pci.c |
5716 | @@ -148,6 +148,18 @@ static int ehci_pci_setup(struct usb_hcd *hcd) |
5717 | if (pdev->revision < 0xa4) |
5718 | ehci->no_selective_suspend = 1; |
5719 | break; |
5720 | + |
5721 | + /* MCP89 chips on the MacBookAir3,1 give EPROTO when |
5722 | + * fetching device descriptors unless LPM is disabled. |
5723 | + * There are also intermittent problems enumerating |
5724 | + * devices with PPCD enabled. |
5725 | + */ |
5726 | + case 0x0d9d: |
5727 | + ehci_info(ehci, "disable lpm/ppcd for nvidia mcp89"); |
5728 | + ehci->has_lpm = 0; |
5729 | + ehci->has_ppcd = 0; |
5730 | + ehci->command &= ~CMD_PPCEE; |
5731 | + break; |
5732 | } |
5733 | break; |
5734 | case PCI_VENDOR_ID_VIA: |
5735 | diff --git a/drivers/usb/host/ohci-jz4740.c b/drivers/usb/host/ohci-jz4740.c |
5736 | index 10e1872..931d588 100644 |
5737 | --- a/drivers/usb/host/ohci-jz4740.c |
5738 | +++ b/drivers/usb/host/ohci-jz4740.c |
5739 | @@ -273,4 +273,4 @@ static struct platform_driver ohci_hcd_jz4740_driver = { |
5740 | }, |
5741 | }; |
5742 | |
5743 | -MODULE_ALIAS("platfrom:jz4740-ohci"); |
5744 | +MODULE_ALIAS("platform:jz4740-ohci"); |
5745 | diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c |
5746 | index a1a7a97..480936a 100644 |
5747 | --- a/drivers/usb/host/xhci-hub.c |
5748 | +++ b/drivers/usb/host/xhci-hub.c |
5749 | @@ -132,6 +132,13 @@ static u32 xhci_port_state_to_neutral(u32 state) |
5750 | static void xhci_disable_port(struct xhci_hcd *xhci, u16 wIndex, |
5751 | u32 __iomem *addr, u32 port_status) |
5752 | { |
5753 | + /* Don't allow the USB core to disable SuperSpeed ports. */ |
5754 | + if (xhci->port_array[wIndex] == 0x03) { |
5755 | + xhci_dbg(xhci, "Ignoring request to disable " |
5756 | + "SuperSpeed port.\n"); |
5757 | + return; |
5758 | + } |
5759 | + |
5760 | /* Write 1 to disable the port */ |
5761 | xhci_writel(xhci, port_status | PORT_PE, addr); |
5762 | port_status = xhci_readl(xhci, addr); |
5763 | diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c |
5764 | index 4e51343..e0ec1a2 100644 |
5765 | --- a/drivers/usb/host/xhci-mem.c |
5766 | +++ b/drivers/usb/host/xhci-mem.c |
5767 | @@ -1043,7 +1043,7 @@ static inline u32 xhci_get_max_esit_payload(struct xhci_hcd *xhci, |
5768 | if (udev->speed == USB_SPEED_SUPER) |
5769 | return ep->ss_ep_comp.wBytesPerInterval; |
5770 | |
5771 | - max_packet = ep->desc.wMaxPacketSize & 0x3ff; |
5772 | + max_packet = GET_MAX_PACKET(ep->desc.wMaxPacketSize); |
5773 | max_burst = (ep->desc.wMaxPacketSize & 0x1800) >> 11; |
5774 | /* A 0 in max burst means 1 transfer per ESIT */ |
5775 | return max_packet * (max_burst + 1); |
5776 | @@ -1133,7 +1133,7 @@ int xhci_endpoint_init(struct xhci_hcd *xhci, |
5777 | /* Fall through */ |
5778 | case USB_SPEED_FULL: |
5779 | case USB_SPEED_LOW: |
5780 | - max_packet = ep->desc.wMaxPacketSize & 0x3ff; |
5781 | + max_packet = GET_MAX_PACKET(ep->desc.wMaxPacketSize); |
5782 | ep_ctx->ep_info2 |= MAX_PACKET(max_packet); |
5783 | break; |
5784 | default: |
5785 | @@ -1441,6 +1441,13 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) |
5786 | xhci->dcbaa = NULL; |
5787 | |
5788 | scratchpad_free(xhci); |
5789 | + |
5790 | + xhci->num_usb2_ports = 0; |
5791 | + xhci->num_usb3_ports = 0; |
5792 | + kfree(xhci->usb2_ports); |
5793 | + kfree(xhci->usb3_ports); |
5794 | + kfree(xhci->port_array); |
5795 | + |
5796 | xhci->page_size = 0; |
5797 | xhci->page_shift = 0; |
5798 | } |
5799 | @@ -1624,6 +1631,161 @@ static void xhci_set_hc_event_deq(struct xhci_hcd *xhci) |
5800 | &xhci->ir_set->erst_dequeue); |
5801 | } |
5802 | |
5803 | +static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports, |
5804 | + u32 __iomem *addr, u8 major_revision) |
5805 | +{ |
5806 | + u32 temp, port_offset, port_count; |
5807 | + int i; |
5808 | + |
5809 | + if (major_revision > 0x03) { |
5810 | + xhci_warn(xhci, "Ignoring unknown port speed, " |
5811 | + "Ext Cap %p, revision = 0x%x\n", |
5812 | + addr, major_revision); |
5813 | + /* Ignoring port protocol we can't understand. FIXME */ |
5814 | + return; |
5815 | + } |
5816 | + |
5817 | + /* Port offset and count in the third dword, see section 7.2 */ |
5818 | + temp = xhci_readl(xhci, addr + 2); |
5819 | + port_offset = XHCI_EXT_PORT_OFF(temp); |
5820 | + port_count = XHCI_EXT_PORT_COUNT(temp); |
5821 | + xhci_dbg(xhci, "Ext Cap %p, port offset = %u, " |
5822 | + "count = %u, revision = 0x%x\n", |
5823 | + addr, port_offset, port_count, major_revision); |
5824 | + /* Port count includes the current port offset */ |
5825 | + if (port_offset == 0 || (port_offset + port_count - 1) > num_ports) |
5826 | + /* WTF? "Valid values are ‘1’ to MaxPorts" */ |
5827 | + return; |
5828 | + port_offset--; |
5829 | + for (i = port_offset; i < (port_offset + port_count); i++) { |
5830 | + /* Duplicate entry. Ignore the port if the revisions differ. */ |
5831 | + if (xhci->port_array[i] != 0) { |
5832 | + xhci_warn(xhci, "Duplicate port entry, Ext Cap %p," |
5833 | + " port %u\n", addr, i); |
5834 | + xhci_warn(xhci, "Port was marked as USB %u, " |
5835 | + "duplicated as USB %u\n", |
5836 | + xhci->port_array[i], major_revision); |
5837 | + /* Only adjust the roothub port counts if we haven't |
5838 | + * found a similar duplicate. |
5839 | + */ |
5840 | + if (xhci->port_array[i] != major_revision && |
5841 | + xhci->port_array[i] != (u8) -1) { |
5842 | + if (xhci->port_array[i] == 0x03) |
5843 | + xhci->num_usb3_ports--; |
5844 | + else |
5845 | + xhci->num_usb2_ports--; |
5846 | + xhci->port_array[i] = (u8) -1; |
5847 | + } |
5848 | + /* FIXME: Should we disable the port? */ |
5849 | + } |
5850 | + xhci->port_array[i] = major_revision; |
5851 | + if (major_revision == 0x03) |
5852 | + xhci->num_usb3_ports++; |
5853 | + else |
5854 | + xhci->num_usb2_ports++; |
5855 | + } |
5856 | + /* FIXME: Should we disable ports not in the Extended Capabilities? */ |
5857 | +} |
5858 | + |
5859 | +/* |
5860 | + * Scan the Extended Capabilities for the "Supported Protocol Capabilities" that |
5861 | + * specify what speeds each port is supposed to be. We can't count on the port |
5862 | + * speed bits in the PORTSC register being correct until a device is connected, |
5863 | + * but we need to set up the two fake roothubs with the correct number of USB |
5864 | + * 3.0 and USB 2.0 ports at host controller initialization time. |
5865 | + */ |
5866 | +static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags) |
5867 | +{ |
5868 | + u32 __iomem *addr; |
5869 | + u32 offset; |
5870 | + unsigned int num_ports; |
5871 | + int i, port_index; |
5872 | + |
5873 | + addr = &xhci->cap_regs->hcc_params; |
5874 | + offset = XHCI_HCC_EXT_CAPS(xhci_readl(xhci, addr)); |
5875 | + if (offset == 0) { |
5876 | + xhci_err(xhci, "No Extended Capability registers, " |
5877 | + "unable to set up roothub.\n"); |
5878 | + return -ENODEV; |
5879 | + } |
5880 | + |
5881 | + num_ports = HCS_MAX_PORTS(xhci->hcs_params1); |
5882 | + xhci->port_array = kzalloc(sizeof(*xhci->port_array)*num_ports, flags); |
5883 | + if (!xhci->port_array) |
5884 | + return -ENOMEM; |
5885 | + |
5886 | + /* |
5887 | + * For whatever reason, the first capability offset is from the |
5888 | + * capability register base, not from the HCCPARAMS register. |
5889 | + * See section 5.3.6 for offset calculation. |
5890 | + */ |
5891 | + addr = &xhci->cap_regs->hc_capbase + offset; |
5892 | + while (1) { |
5893 | + u32 cap_id; |
5894 | + |
5895 | + cap_id = xhci_readl(xhci, addr); |
5896 | + if (XHCI_EXT_CAPS_ID(cap_id) == XHCI_EXT_CAPS_PROTOCOL) |
5897 | + xhci_add_in_port(xhci, num_ports, addr, |
5898 | + (u8) XHCI_EXT_PORT_MAJOR(cap_id)); |
5899 | + offset = XHCI_EXT_CAPS_NEXT(cap_id); |
5900 | + if (!offset || (xhci->num_usb2_ports + xhci->num_usb3_ports) |
5901 | + == num_ports) |
5902 | + break; |
5903 | + /* |
5904 | + * Once you're into the Extended Capabilities, the offset is |
5905 | + * always relative to the register holding the offset. |
5906 | + */ |
5907 | + addr += offset; |
5908 | + } |
5909 | + |
5910 | + if (xhci->num_usb2_ports == 0 && xhci->num_usb3_ports == 0) { |
5911 | + xhci_warn(xhci, "No ports on the roothubs?\n"); |
5912 | + return -ENODEV; |
5913 | + } |
5914 | + xhci_dbg(xhci, "Found %u USB 2.0 ports and %u USB 3.0 ports.\n", |
5915 | + xhci->num_usb2_ports, xhci->num_usb3_ports); |
5916 | + /* |
5917 | + * Note we could have all USB 3.0 ports, or all USB 2.0 ports. |
5918 | + * Not sure how the USB core will handle a hub with no ports... |
5919 | + */ |
5920 | + if (xhci->num_usb2_ports) { |
5921 | + xhci->usb2_ports = kmalloc(sizeof(*xhci->usb2_ports)* |
5922 | + xhci->num_usb2_ports, flags); |
5923 | + if (!xhci->usb2_ports) |
5924 | + return -ENOMEM; |
5925 | + |
5926 | + port_index = 0; |
5927 | + for (i = 0; i < num_ports; i++) |
5928 | + if (xhci->port_array[i] != 0x03) { |
5929 | + xhci->usb2_ports[port_index] = |
5930 | + &xhci->op_regs->port_status_base + |
5931 | + NUM_PORT_REGS*i; |
5932 | + xhci_dbg(xhci, "USB 2.0 port at index %u, " |
5933 | + "addr = %p\n", i, |
5934 | + xhci->usb2_ports[port_index]); |
5935 | + port_index++; |
5936 | + } |
5937 | + } |
5938 | + if (xhci->num_usb3_ports) { |
5939 | + xhci->usb3_ports = kmalloc(sizeof(*xhci->usb3_ports)* |
5940 | + xhci->num_usb3_ports, flags); |
5941 | + if (!xhci->usb3_ports) |
5942 | + return -ENOMEM; |
5943 | + |
5944 | + port_index = 0; |
5945 | + for (i = 0; i < num_ports; i++) |
5946 | + if (xhci->port_array[i] == 0x03) { |
5947 | + xhci->usb3_ports[port_index] = |
5948 | + &xhci->op_regs->port_status_base + |
5949 | + NUM_PORT_REGS*i; |
5950 | + xhci_dbg(xhci, "USB 3.0 port at index %u, " |
5951 | + "addr = %p\n", i, |
5952 | + xhci->usb3_ports[port_index]); |
5953 | + port_index++; |
5954 | + } |
5955 | + } |
5956 | + return 0; |
5957 | +} |
5958 | |
5959 | int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) |
5960 | { |
5961 | @@ -1804,6 +1966,8 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) |
5962 | |
5963 | if (scratchpad_alloc(xhci, flags)) |
5964 | goto fail; |
5965 | + if (xhci_setup_port_arrays(xhci, flags)) |
5966 | + goto fail; |
5967 | |
5968 | return 0; |
5969 | |
5970 | diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c |
5971 | index 48e60d1..e7547d8 100644 |
5972 | --- a/drivers/usb/host/xhci-ring.c |
5973 | +++ b/drivers/usb/host/xhci-ring.c |
5974 | @@ -2028,7 +2028,6 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) |
5975 | |
5976 | if (!(status & STS_EINT)) { |
5977 | spin_unlock(&xhci->lock); |
5978 | - xhci_warn(xhci, "Spurious interrupt.\n"); |
5979 | return IRQ_NONE; |
5980 | } |
5981 | xhci_dbg(xhci, "op reg status = %08x\n", status); |
5982 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c |
5983 | index d5c550e..f3d5222 100644 |
5984 | --- a/drivers/usb/host/xhci.c |
5985 | +++ b/drivers/usb/host/xhci.c |
5986 | @@ -1284,6 +1284,15 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci, |
5987 | cmd_completion = command->completion; |
5988 | cmd_status = &command->status; |
5989 | command->command_trb = xhci->cmd_ring->enqueue; |
5990 | + |
5991 | + /* Enqueue pointer can be left pointing to the link TRB, |
5992 | + * we must handle that |
5993 | + */ |
5994 | + if ((command->command_trb->link.control & TRB_TYPE_BITMASK) |
5995 | + == TRB_TYPE(TRB_LINK)) |
5996 | + command->command_trb = |
5997 | + xhci->cmd_ring->enq_seg->next->trbs; |
5998 | + |
5999 | list_add_tail(&command->cmd_list, &virt_dev->cmd_list); |
6000 | } else { |
6001 | in_ctx = virt_dev->in_ctx; |
6002 | @@ -1993,6 +2002,15 @@ int xhci_reset_device(struct usb_hcd *hcd, struct usb_device *udev) |
6003 | /* Attempt to submit the Reset Device command to the command ring */ |
6004 | spin_lock_irqsave(&xhci->lock, flags); |
6005 | reset_device_cmd->command_trb = xhci->cmd_ring->enqueue; |
6006 | + |
6007 | + /* Enqueue pointer can be left pointing to the link TRB, |
6008 | + * we must handle that |
6009 | + */ |
6010 | + if ((reset_device_cmd->command_trb->link.control & TRB_TYPE_BITMASK) |
6011 | + == TRB_TYPE(TRB_LINK)) |
6012 | + reset_device_cmd->command_trb = |
6013 | + xhci->cmd_ring->enq_seg->next->trbs; |
6014 | + |
6015 | list_add_tail(&reset_device_cmd->cmd_list, &virt_dev->cmd_list); |
6016 | ret = xhci_queue_reset_device(xhci, slot_id); |
6017 | if (ret) { |
6018 | diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h |
6019 | index 34a60d9..404ecbc 100644 |
6020 | --- a/drivers/usb/host/xhci.h |
6021 | +++ b/drivers/usb/host/xhci.h |
6022 | @@ -448,6 +448,24 @@ struct xhci_doorbell_array { |
6023 | |
6024 | |
6025 | /** |
6026 | + * struct xhci_protocol_caps |
6027 | + * @revision: major revision, minor revision, capability ID, |
6028 | + * and next capability pointer. |
6029 | + * @name_string: Four ASCII characters to say which spec this xHC |
6030 | + * follows, typically "USB ". |
6031 | + * @port_info: Port offset, count, and protocol-defined information. |
6032 | + */ |
6033 | +struct xhci_protocol_caps { |
6034 | + u32 revision; |
6035 | + u32 name_string; |
6036 | + u32 port_info; |
6037 | +}; |
6038 | + |
6039 | +#define XHCI_EXT_PORT_MAJOR(x) (((x) >> 24) & 0xff) |
6040 | +#define XHCI_EXT_PORT_OFF(x) ((x) & 0xff) |
6041 | +#define XHCI_EXT_PORT_COUNT(x) (((x) >> 8) & 0xff) |
6042 | + |
6043 | +/** |
6044 | * struct xhci_container_ctx |
6045 | * @type: Type of context. Used to calculated offsets to contained contexts. |
6046 | * @size: Size of the context data |
6047 | @@ -614,6 +632,11 @@ struct xhci_ep_ctx { |
6048 | #define MAX_PACKET_MASK (0xffff << 16) |
6049 | #define MAX_PACKET_DECODED(p) (((p) >> 16) & 0xffff) |
6050 | |
6051 | +/* Get max packet size from ep desc. Bit 10..0 specify the max packet size. |
6052 | + * USB2.0 spec 9.6.6. |
6053 | + */ |
6054 | +#define GET_MAX_PACKET(p) ((p) & 0x7ff) |
6055 | + |
6056 | /* tx_info bitmasks */ |
6057 | #define AVG_TRB_LENGTH_FOR_EP(p) ((p) & 0xffff) |
6058 | #define MAX_ESIT_PAYLOAD_FOR_EP(p) (((p) & 0xffff) << 16) |
6059 | @@ -1199,6 +1222,15 @@ struct xhci_hcd { |
6060 | #define XHCI_LINK_TRB_QUIRK (1 << 0) |
6061 | #define XHCI_RESET_EP_QUIRK (1 << 1) |
6062 | #define XHCI_NEC_HOST (1 << 2) |
6063 | + |
6064 | + /* Is each xHCI roothub port a USB 3.0, USB 2.0, or USB 1.1 port? */ |
6065 | + u8 *port_array; |
6066 | + /* Array of pointers to USB 3.0 PORTSC registers */ |
6067 | + u32 __iomem **usb3_ports; |
6068 | + unsigned int num_usb3_ports; |
6069 | + /* Array of pointers to USB 2.0 PORTSC registers */ |
6070 | + u32 __iomem **usb2_ports; |
6071 | + unsigned int num_usb2_ports; |
6072 | }; |
6073 | |
6074 | /* For testing purposes */ |
6075 | diff --git a/drivers/usb/misc/cypress_cy7c63.c b/drivers/usb/misc/cypress_cy7c63.c |
6076 | index 2f43c57..9251773 100644 |
6077 | --- a/drivers/usb/misc/cypress_cy7c63.c |
6078 | +++ b/drivers/usb/misc/cypress_cy7c63.c |
6079 | @@ -196,11 +196,9 @@ static ssize_t get_port1_handler(struct device *dev, |
6080 | return read_port(dev, attr, buf, 1, CYPRESS_READ_PORT_ID1); |
6081 | } |
6082 | |
6083 | -static DEVICE_ATTR(port0, S_IWUGO | S_IRUGO, |
6084 | - get_port0_handler, set_port0_handler); |
6085 | +static DEVICE_ATTR(port0, S_IRUGO | S_IWUSR, get_port0_handler, set_port0_handler); |
6086 | |
6087 | -static DEVICE_ATTR(port1, S_IWUGO | S_IRUGO, |
6088 | - get_port1_handler, set_port1_handler); |
6089 | +static DEVICE_ATTR(port1, S_IRUGO | S_IWUSR, get_port1_handler, set_port1_handler); |
6090 | |
6091 | |
6092 | static int cypress_probe(struct usb_interface *interface, |
6093 | diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c |
6094 | index bc88c79..0db05b2 100644 |
6095 | --- a/drivers/usb/misc/iowarrior.c |
6096 | +++ b/drivers/usb/misc/iowarrior.c |
6097 | @@ -553,6 +553,7 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd, |
6098 | /* needed for power consumption */ |
6099 | struct usb_config_descriptor *cfg_descriptor = &dev->udev->actconfig->desc; |
6100 | |
6101 | + memset(&info, 0, sizeof(info)); |
6102 | /* directly from the descriptor */ |
6103 | info.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); |
6104 | info.product = dev->product_id; |
6105 | diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c |
6106 | index 70d00e9..dd573ab 100644 |
6107 | --- a/drivers/usb/misc/sisusbvga/sisusb.c |
6108 | +++ b/drivers/usb/misc/sisusbvga/sisusb.c |
6109 | @@ -3008,6 +3008,7 @@ sisusb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
6110 | #else |
6111 | x.sisusb_conactive = 0; |
6112 | #endif |
6113 | + memset(x.sisusb_reserved, 0, sizeof(x.sisusb_reserved)); |
6114 | |
6115 | if (copy_to_user((void __user *)arg, &x, sizeof(x))) |
6116 | retval = -EFAULT; |
6117 | diff --git a/drivers/usb/misc/trancevibrator.c b/drivers/usb/misc/trancevibrator.c |
6118 | index d77aba4..f63776a 100644 |
6119 | --- a/drivers/usb/misc/trancevibrator.c |
6120 | +++ b/drivers/usb/misc/trancevibrator.c |
6121 | @@ -86,7 +86,7 @@ static ssize_t set_speed(struct device *dev, struct device_attribute *attr, |
6122 | return count; |
6123 | } |
6124 | |
6125 | -static DEVICE_ATTR(speed, S_IWUGO | S_IRUGO, show_speed, set_speed); |
6126 | +static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR, show_speed, set_speed); |
6127 | |
6128 | static int tv_probe(struct usb_interface *interface, |
6129 | const struct usb_device_id *id) |
6130 | diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c |
6131 | index 63da2c3..c96f51d 100644 |
6132 | --- a/drivers/usb/misc/usbled.c |
6133 | +++ b/drivers/usb/misc/usbled.c |
6134 | @@ -94,7 +94,7 @@ static ssize_t set_##value(struct device *dev, struct device_attribute *attr, co |
6135 | change_color(led); \ |
6136 | return count; \ |
6137 | } \ |
6138 | -static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value); |
6139 | +static DEVICE_ATTR(value, S_IRUGO | S_IWUSR, show_##value, set_##value); |
6140 | show_set(blue); |
6141 | show_set(red); |
6142 | show_set(green); |
6143 | diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c |
6144 | index de8ef94..417b8f2 100644 |
6145 | --- a/drivers/usb/misc/usbsevseg.c |
6146 | +++ b/drivers/usb/misc/usbsevseg.c |
6147 | @@ -192,7 +192,7 @@ static ssize_t set_attr_##name(struct device *dev, \ |
6148 | \ |
6149 | return count; \ |
6150 | } \ |
6151 | -static DEVICE_ATTR(name, S_IWUGO | S_IRUGO, show_attr_##name, set_attr_##name); |
6152 | +static DEVICE_ATTR(name, S_IRUGO | S_IWUSR, show_attr_##name, set_attr_##name); |
6153 | |
6154 | static ssize_t show_attr_text(struct device *dev, |
6155 | struct device_attribute *attr, char *buf) |
6156 | @@ -223,7 +223,7 @@ static ssize_t set_attr_text(struct device *dev, |
6157 | return count; |
6158 | } |
6159 | |
6160 | -static DEVICE_ATTR(text, S_IWUGO | S_IRUGO, show_attr_text, set_attr_text); |
6161 | +static DEVICE_ATTR(text, S_IRUGO | S_IWUSR, show_attr_text, set_attr_text); |
6162 | |
6163 | static ssize_t show_attr_decimals(struct device *dev, |
6164 | struct device_attribute *attr, char *buf) |
6165 | @@ -272,8 +272,7 @@ static ssize_t set_attr_decimals(struct device *dev, |
6166 | return count; |
6167 | } |
6168 | |
6169 | -static DEVICE_ATTR(decimals, S_IWUGO | S_IRUGO, |
6170 | - show_attr_decimals, set_attr_decimals); |
6171 | +static DEVICE_ATTR(decimals, S_IRUGO | S_IWUSR, show_attr_decimals, set_attr_decimals); |
6172 | |
6173 | static ssize_t show_attr_textmode(struct device *dev, |
6174 | struct device_attribute *attr, char *buf) |
6175 | @@ -319,8 +318,7 @@ static ssize_t set_attr_textmode(struct device *dev, |
6176 | return -EINVAL; |
6177 | } |
6178 | |
6179 | -static DEVICE_ATTR(textmode, S_IWUGO | S_IRUGO, |
6180 | - show_attr_textmode, set_attr_textmode); |
6181 | +static DEVICE_ATTR(textmode, S_IRUGO | S_IWUSR, show_attr_textmode, set_attr_textmode); |
6182 | |
6183 | |
6184 | MYDEV_ATTR_SIMPLE_UNSIGNED(powered, update_display_powered); |
6185 | diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c |
6186 | index 513d6bd..0707b29 100644 |
6187 | --- a/drivers/usb/musb/musb_core.c |
6188 | +++ b/drivers/usb/musb/musb_core.c |
6189 | @@ -2243,7 +2243,6 @@ static int __exit musb_remove(struct platform_device *pdev) |
6190 | #endif |
6191 | musb_writeb(musb->mregs, MUSB_DEVCTL, 0); |
6192 | musb_platform_exit(musb); |
6193 | - musb_writeb(musb->mregs, MUSB_DEVCTL, 0); |
6194 | |
6195 | musb_free(musb); |
6196 | iounmap(ctrl_base); |
6197 | diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c |
6198 | index 01ba740..bc1d9c1 100644 |
6199 | --- a/drivers/usb/serial/ftdi_sio.c |
6200 | +++ b/drivers/usb/serial/ftdi_sio.c |
6201 | @@ -201,6 +201,7 @@ static struct usb_device_id id_table_combined [] = { |
6202 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, |
6203 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, |
6204 | { USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) }, |
6205 | + { USB_DEVICE(FTDI_VID, FTDI_VARDAAN_PID) }, |
6206 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) }, |
6207 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) }, |
6208 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) }, |
6209 | @@ -696,6 +697,7 @@ static struct usb_device_id id_table_combined [] = { |
6210 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, |
6211 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, |
6212 | { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_SERIAL_VX7_PID) }, |
6213 | + { USB_DEVICE(RTSYSTEMS_VID, RTSYSTEMS_CT29B_PID) }, |
6214 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, |
6215 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, |
6216 | { USB_DEVICE(TML_VID, TML_USB_SERIAL_PID) }, |
6217 | @@ -794,6 +796,8 @@ static struct usb_device_id id_table_combined [] = { |
6218 | { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) }, |
6219 | { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) }, |
6220 | { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) }, |
6221 | + { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID), |
6222 | + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
6223 | { }, /* Optional parameter entry */ |
6224 | { } /* Terminating entry */ |
6225 | }; |
6226 | diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h |
6227 | index cf1aea1b..393c37d 100644 |
6228 | --- a/drivers/usb/serial/ftdi_sio_ids.h |
6229 | +++ b/drivers/usb/serial/ftdi_sio_ids.h |
6230 | @@ -114,6 +114,9 @@ |
6231 | /* Lenz LI-USB Computer Interface. */ |
6232 | #define FTDI_LENZ_LIUSB_PID 0xD780 |
6233 | |
6234 | +/* Vardaan Enterprises Serial Interface VEUSB422R3 */ |
6235 | +#define FTDI_VARDAAN_PID 0xF070 |
6236 | + |
6237 | /* |
6238 | * Xsens Technologies BV products (http://www.xsens.com). |
6239 | */ |
6240 | @@ -721,6 +724,7 @@ |
6241 | */ |
6242 | #define RTSYSTEMS_VID 0x2100 /* Vendor ID */ |
6243 | #define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */ |
6244 | +#define RTSYSTEMS_CT29B_PID 0x9e54 /* CT29B Radio Cable */ |
6245 | |
6246 | /* |
6247 | * Bayer Ascensia Contour blood glucose meter USB-converter cable. |
6248 | @@ -1100,3 +1104,10 @@ |
6249 | #define FTDI_SCIENCESCOPE_LOGBOOKML_PID 0xFF18 |
6250 | #define FTDI_SCIENCESCOPE_LS_LOGBOOK_PID 0xFF1C |
6251 | #define FTDI_SCIENCESCOPE_HS_LOGBOOK_PID 0xFF1D |
6252 | + |
6253 | +/* |
6254 | + * Milkymist One JTAG/Serial |
6255 | + */ |
6256 | +#define QIHARDWARE_VID 0x20B7 |
6257 | +#define MILKYMISTONE_JTAGSERIAL_PID 0x0713 |
6258 | + |
6259 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c |
6260 | index 51de0dd..12d5f82 100644 |
6261 | --- a/drivers/usb/serial/option.c |
6262 | +++ b/drivers/usb/serial/option.c |
6263 | @@ -512,7 +512,7 @@ static const struct usb_device_id option_ids[] = { |
6264 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff) }, |
6265 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff) }, |
6266 | { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) }, |
6267 | - { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC) }, |
6268 | + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC, 0xff, 0xff, 0xff) }, |
6269 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, |
6270 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, |
6271 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, |
6272 | diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c |
6273 | index 7a2177c..b993e8d 100644 |
6274 | --- a/drivers/usb/serial/usb-serial.c |
6275 | +++ b/drivers/usb/serial/usb-serial.c |
6276 | @@ -52,6 +52,7 @@ static struct usb_driver usb_serial_driver = { |
6277 | .suspend = usb_serial_suspend, |
6278 | .resume = usb_serial_resume, |
6279 | .no_dynamic_id = 1, |
6280 | + .supports_autosuspend = 1, |
6281 | }; |
6282 | |
6283 | /* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead |
6284 | @@ -1331,6 +1332,8 @@ int usb_serial_register(struct usb_serial_driver *driver) |
6285 | return -ENODEV; |
6286 | |
6287 | fixup_generic(driver); |
6288 | + if (driver->usb_driver) |
6289 | + driver->usb_driver->supports_autosuspend = 1; |
6290 | |
6291 | if (!driver->description) |
6292 | driver->description = driver->driver.name; |
6293 | diff --git a/drivers/usb/storage/sierra_ms.c b/drivers/usb/storage/sierra_ms.c |
6294 | index 57fc2f5..ceba512 100644 |
6295 | --- a/drivers/usb/storage/sierra_ms.c |
6296 | +++ b/drivers/usb/storage/sierra_ms.c |
6297 | @@ -121,7 +121,7 @@ static ssize_t show_truinst(struct device *dev, struct device_attribute *attr, |
6298 | } |
6299 | return result; |
6300 | } |
6301 | -static DEVICE_ATTR(truinst, S_IWUGO | S_IRUGO, show_truinst, NULL); |
6302 | +static DEVICE_ATTR(truinst, S_IRUGO, show_truinst, NULL); |
6303 | |
6304 | int sierra_ms_init(struct us_data *us) |
6305 | { |
6306 | diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c |
6307 | index e207810..0870329 100644 |
6308 | --- a/drivers/video/backlight/backlight.c |
6309 | +++ b/drivers/video/backlight/backlight.c |
6310 | @@ -197,12 +197,12 @@ static int backlight_suspend(struct device *dev, pm_message_t state) |
6311 | { |
6312 | struct backlight_device *bd = to_backlight_device(dev); |
6313 | |
6314 | - if (bd->ops->options & BL_CORE_SUSPENDRESUME) { |
6315 | - mutex_lock(&bd->ops_lock); |
6316 | + mutex_lock(&bd->ops_lock); |
6317 | + if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { |
6318 | bd->props.state |= BL_CORE_SUSPENDED; |
6319 | backlight_update_status(bd); |
6320 | - mutex_unlock(&bd->ops_lock); |
6321 | } |
6322 | + mutex_unlock(&bd->ops_lock); |
6323 | |
6324 | return 0; |
6325 | } |
6326 | @@ -211,12 +211,12 @@ static int backlight_resume(struct device *dev) |
6327 | { |
6328 | struct backlight_device *bd = to_backlight_device(dev); |
6329 | |
6330 | - if (bd->ops->options & BL_CORE_SUSPENDRESUME) { |
6331 | - mutex_lock(&bd->ops_lock); |
6332 | + mutex_lock(&bd->ops_lock); |
6333 | + if (bd->ops && bd->ops->options & BL_CORE_SUSPENDRESUME) { |
6334 | bd->props.state &= ~BL_CORE_SUSPENDED; |
6335 | backlight_update_status(bd); |
6336 | - mutex_unlock(&bd->ops_lock); |
6337 | } |
6338 | + mutex_unlock(&bd->ops_lock); |
6339 | |
6340 | return 0; |
6341 | } |
6342 | diff --git a/drivers/video/via/accel.c b/drivers/video/via/accel.c |
6343 | index e44893e..c2f4e6e 100644 |
6344 | --- a/drivers/video/via/accel.c |
6345 | +++ b/drivers/video/via/accel.c |
6346 | @@ -283,11 +283,12 @@ static int hw_bitblt_2(void __iomem *engine, u8 op, u32 width, u32 height, |
6347 | writel(tmp, engine + 0x1C); |
6348 | } |
6349 | |
6350 | - if (op != VIA_BITBLT_COLOR) |
6351 | + if (op == VIA_BITBLT_FILL) { |
6352 | + writel(fg_color, engine + 0x58); |
6353 | + } else if (op == VIA_BITBLT_MONO) { |
6354 | writel(fg_color, engine + 0x4C); |
6355 | - |
6356 | - if (op == VIA_BITBLT_MONO) |
6357 | writel(bg_color, engine + 0x50); |
6358 | + } |
6359 | |
6360 | if (op == VIA_BITBLT_FILL) |
6361 | ge_cmd |= fill_rop << 24 | 0x00002000 | 0x00000001; |
6362 | diff --git a/drivers/video/via/via_i2c.c b/drivers/video/via/via_i2c.c |
6363 | index da9e4ca..021112e 100644 |
6364 | --- a/drivers/video/via/via_i2c.c |
6365 | +++ b/drivers/video/via/via_i2c.c |
6366 | @@ -114,6 +114,7 @@ static void via_i2c_setsda(void *data, int state) |
6367 | |
6368 | int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata) |
6369 | { |
6370 | + int ret; |
6371 | u8 mm1[] = {0x00}; |
6372 | struct i2c_msg msgs[2]; |
6373 | |
6374 | @@ -126,11 +127,18 @@ int viafb_i2c_readbyte(u8 adap, u8 slave_addr, u8 index, u8 *pdata) |
6375 | mm1[0] = index; |
6376 | msgs[0].len = 1; msgs[1].len = 1; |
6377 | msgs[0].buf = mm1; msgs[1].buf = pdata; |
6378 | - return i2c_transfer(&via_i2c_par[adap].adapter, msgs, 2); |
6379 | + ret = i2c_transfer(&via_i2c_par[adap].adapter, msgs, 2); |
6380 | + if (ret == 2) |
6381 | + ret = 0; |
6382 | + else if (ret >= 0) |
6383 | + ret = -EIO; |
6384 | + |
6385 | + return ret; |
6386 | } |
6387 | |
6388 | int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data) |
6389 | { |
6390 | + int ret; |
6391 | u8 msg[2] = { index, data }; |
6392 | struct i2c_msg msgs; |
6393 | |
6394 | @@ -140,11 +148,18 @@ int viafb_i2c_writebyte(u8 adap, u8 slave_addr, u8 index, u8 data) |
6395 | msgs.addr = slave_addr / 2; |
6396 | msgs.len = 2; |
6397 | msgs.buf = msg; |
6398 | - return i2c_transfer(&via_i2c_par[adap].adapter, &msgs, 1); |
6399 | + ret = i2c_transfer(&via_i2c_par[adap].adapter, &msgs, 1); |
6400 | + if (ret == 1) |
6401 | + ret = 0; |
6402 | + else if (ret >= 0) |
6403 | + ret = -EIO; |
6404 | + |
6405 | + return ret; |
6406 | } |
6407 | |
6408 | int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len) |
6409 | { |
6410 | + int ret; |
6411 | u8 mm1[] = {0x00}; |
6412 | struct i2c_msg msgs[2]; |
6413 | |
6414 | @@ -156,7 +171,13 @@ int viafb_i2c_readbytes(u8 adap, u8 slave_addr, u8 index, u8 *buff, int buff_len |
6415 | mm1[0] = index; |
6416 | msgs[0].len = 1; msgs[1].len = buff_len; |
6417 | msgs[0].buf = mm1; msgs[1].buf = buff; |
6418 | - return i2c_transfer(&via_i2c_par[adap].adapter, msgs, 2); |
6419 | + ret = i2c_transfer(&via_i2c_par[adap].adapter, msgs, 2); |
6420 | + if (ret == 2) |
6421 | + ret = 0; |
6422 | + else if (ret >= 0) |
6423 | + ret = -EIO; |
6424 | + |
6425 | + return ret; |
6426 | } |
6427 | |
6428 | /* |
6429 | diff --git a/drivers/xen/events.c b/drivers/xen/events.c |
6430 | index 13365ba..a68cc62 100644 |
6431 | --- a/drivers/xen/events.c |
6432 | +++ b/drivers/xen/events.c |
6433 | @@ -261,7 +261,7 @@ static void init_evtchn_cpu_bindings(void) |
6434 | } |
6435 | #endif |
6436 | |
6437 | - memset(cpu_evtchn_mask(0), ~0, sizeof(cpu_evtchn_mask(0))); |
6438 | + memset(cpu_evtchn_mask(0), ~0, sizeof(struct cpu_evtchn_s)); |
6439 | } |
6440 | |
6441 | static inline void clear_evtchn(int port) |
6442 | diff --git a/fs/bio.c b/fs/bio.c |
6443 | index 8abb2df..4bd454f 100644 |
6444 | --- a/fs/bio.c |
6445 | +++ b/fs/bio.c |
6446 | @@ -370,6 +370,9 @@ struct bio *bio_kmalloc(gfp_t gfp_mask, int nr_iovecs) |
6447 | { |
6448 | struct bio *bio; |
6449 | |
6450 | + if (nr_iovecs > UIO_MAXIOV) |
6451 | + return NULL; |
6452 | + |
6453 | bio = kmalloc(sizeof(struct bio) + nr_iovecs * sizeof(struct bio_vec), |
6454 | gfp_mask); |
6455 | if (unlikely(!bio)) |
6456 | @@ -697,8 +700,12 @@ static void bio_free_map_data(struct bio_map_data *bmd) |
6457 | static struct bio_map_data *bio_alloc_map_data(int nr_segs, int iov_count, |
6458 | gfp_t gfp_mask) |
6459 | { |
6460 | - struct bio_map_data *bmd = kmalloc(sizeof(*bmd), gfp_mask); |
6461 | + struct bio_map_data *bmd; |
6462 | |
6463 | + if (iov_count > UIO_MAXIOV) |
6464 | + return NULL; |
6465 | + |
6466 | + bmd = kmalloc(sizeof(*bmd), gfp_mask); |
6467 | if (!bmd) |
6468 | return NULL; |
6469 | |
6470 | @@ -827,6 +834,12 @@ struct bio *bio_copy_user_iov(struct request_queue *q, |
6471 | end = (uaddr + iov[i].iov_len + PAGE_SIZE - 1) >> PAGE_SHIFT; |
6472 | start = uaddr >> PAGE_SHIFT; |
6473 | |
6474 | + /* |
6475 | + * Overflow, abort |
6476 | + */ |
6477 | + if (end < start) |
6478 | + return ERR_PTR(-EINVAL); |
6479 | + |
6480 | nr_pages += end - start; |
6481 | len += iov[i].iov_len; |
6482 | } |
6483 | @@ -955,6 +968,12 @@ static struct bio *__bio_map_user_iov(struct request_queue *q, |
6484 | unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT; |
6485 | unsigned long start = uaddr >> PAGE_SHIFT; |
6486 | |
6487 | + /* |
6488 | + * Overflow, abort |
6489 | + */ |
6490 | + if (end < start) |
6491 | + return ERR_PTR(-EINVAL); |
6492 | + |
6493 | nr_pages += end - start; |
6494 | /* |
6495 | * buffer must be aligned to at least hardsector size for now |
6496 | @@ -982,7 +1001,7 @@ static struct bio *__bio_map_user_iov(struct request_queue *q, |
6497 | unsigned long start = uaddr >> PAGE_SHIFT; |
6498 | const int local_nr_pages = end - start; |
6499 | const int page_limit = cur_page + local_nr_pages; |
6500 | - |
6501 | + |
6502 | ret = get_user_pages_fast(uaddr, local_nr_pages, |
6503 | write_to_vm, &pages[cur_page]); |
6504 | if (ret < local_nr_pages) { |
6505 | diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c |
6506 | index 0eb8702..548f062 100644 |
6507 | --- a/fs/cifs/dns_resolve.c |
6508 | +++ b/fs/cifs/dns_resolve.c |
6509 | @@ -66,7 +66,7 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr) |
6510 | /* Search for server name delimiter */ |
6511 | sep = memchr(hostname, '\\', len); |
6512 | if (sep) |
6513 | - len = sep - unc; |
6514 | + len = sep - hostname; |
6515 | else |
6516 | cFYI(1, "%s: probably server name is whole unc: %s", |
6517 | __func__, unc); |
6518 | diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c |
6519 | index 53cce8c..00d1ff3 100644 |
6520 | --- a/fs/cifs/inode.c |
6521 | +++ b/fs/cifs/inode.c |
6522 | @@ -835,8 +835,10 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) |
6523 | rc = cifs_get_inode_info(&inode, full_path, NULL, sb, |
6524 | xid, NULL); |
6525 | |
6526 | - if (!inode) |
6527 | - return ERR_PTR(rc); |
6528 | + if (!inode) { |
6529 | + inode = ERR_PTR(rc); |
6530 | + goto out; |
6531 | + } |
6532 | |
6533 | #ifdef CONFIG_CIFS_FSCACHE |
6534 | /* populate tcon->resource_id */ |
6535 | @@ -852,13 +854,11 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) |
6536 | inode->i_uid = cifs_sb->mnt_uid; |
6537 | inode->i_gid = cifs_sb->mnt_gid; |
6538 | } else if (rc) { |
6539 | - kfree(full_path); |
6540 | - _FreeXid(xid); |
6541 | iget_failed(inode); |
6542 | - return ERR_PTR(rc); |
6543 | + inode = ERR_PTR(rc); |
6544 | } |
6545 | |
6546 | - |
6547 | +out: |
6548 | kfree(full_path); |
6549 | /* can not call macro FreeXid here since in a void func |
6550 | * TODO: This is no longer true |
6551 | diff --git a/fs/compat.c b/fs/compat.c |
6552 | index 0644a15..8b41dcd 100644 |
6553 | --- a/fs/compat.c |
6554 | +++ b/fs/compat.c |
6555 | @@ -1378,6 +1378,10 @@ static int compat_count(compat_uptr_t __user *argv, int max) |
6556 | argv++; |
6557 | if (i++ >= max) |
6558 | return -E2BIG; |
6559 | + |
6560 | + if (fatal_signal_pending(current)) |
6561 | + return -ERESTARTNOHAND; |
6562 | + cond_resched(); |
6563 | } |
6564 | } |
6565 | return i; |
6566 | @@ -1419,6 +1423,12 @@ static int compat_copy_strings(int argc, compat_uptr_t __user *argv, |
6567 | while (len > 0) { |
6568 | int offset, bytes_to_copy; |
6569 | |
6570 | + if (fatal_signal_pending(current)) { |
6571 | + ret = -ERESTARTNOHAND; |
6572 | + goto out; |
6573 | + } |
6574 | + cond_resched(); |
6575 | + |
6576 | offset = pos % PAGE_SIZE; |
6577 | if (offset == 0) |
6578 | offset = PAGE_SIZE; |
6579 | @@ -1435,18 +1445,8 @@ static int compat_copy_strings(int argc, compat_uptr_t __user *argv, |
6580 | if (!kmapped_page || kpos != (pos & PAGE_MASK)) { |
6581 | struct page *page; |
6582 | |
6583 | -#ifdef CONFIG_STACK_GROWSUP |
6584 | - ret = expand_stack_downwards(bprm->vma, pos); |
6585 | - if (ret < 0) { |
6586 | - /* We've exceed the stack rlimit. */ |
6587 | - ret = -E2BIG; |
6588 | - goto out; |
6589 | - } |
6590 | -#endif |
6591 | - ret = get_user_pages(current, bprm->mm, pos, |
6592 | - 1, 1, 1, &page, NULL); |
6593 | - if (ret <= 0) { |
6594 | - /* We've exceed the stack rlimit. */ |
6595 | + page = get_arg_page(bprm, pos, 1); |
6596 | + if (!page) { |
6597 | ret = -E2BIG; |
6598 | goto out; |
6599 | } |
6600 | @@ -1567,8 +1567,10 @@ int compat_do_execve(char * filename, |
6601 | return retval; |
6602 | |
6603 | out: |
6604 | - if (bprm->mm) |
6605 | + if (bprm->mm) { |
6606 | + acct_arg_size(bprm, 0); |
6607 | mmput(bprm->mm); |
6608 | + } |
6609 | |
6610 | out_file: |
6611 | if (bprm->file) { |
6612 | diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c |
6613 | index 3fbc942..9d1a22d 100644 |
6614 | --- a/fs/ecryptfs/inode.c |
6615 | +++ b/fs/ecryptfs/inode.c |
6616 | @@ -32,6 +32,7 @@ |
6617 | #include <linux/crypto.h> |
6618 | #include <linux/fs_stack.h> |
6619 | #include <linux/slab.h> |
6620 | +#include <linux/xattr.h> |
6621 | #include <asm/unaligned.h> |
6622 | #include "ecryptfs_kernel.h" |
6623 | |
6624 | @@ -70,15 +71,19 @@ ecryptfs_create_underlying_file(struct inode *lower_dir_inode, |
6625 | struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); |
6626 | struct dentry *dentry_save; |
6627 | struct vfsmount *vfsmount_save; |
6628 | + unsigned int flags_save; |
6629 | int rc; |
6630 | |
6631 | dentry_save = nd->path.dentry; |
6632 | vfsmount_save = nd->path.mnt; |
6633 | + flags_save = nd->flags; |
6634 | nd->path.dentry = lower_dentry; |
6635 | nd->path.mnt = lower_mnt; |
6636 | + nd->flags &= ~LOOKUP_OPEN; |
6637 | rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd); |
6638 | nd->path.dentry = dentry_save; |
6639 | nd->path.mnt = vfsmount_save; |
6640 | + nd->flags = flags_save; |
6641 | return rc; |
6642 | } |
6643 | |
6644 | @@ -1108,10 +1113,8 @@ ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, |
6645 | rc = -EOPNOTSUPP; |
6646 | goto out; |
6647 | } |
6648 | - mutex_lock(&lower_dentry->d_inode->i_mutex); |
6649 | - rc = lower_dentry->d_inode->i_op->setxattr(lower_dentry, name, value, |
6650 | - size, flags); |
6651 | - mutex_unlock(&lower_dentry->d_inode->i_mutex); |
6652 | + |
6653 | + rc = vfs_setxattr(lower_dentry, name, value, size, flags); |
6654 | out: |
6655 | return rc; |
6656 | } |
6657 | diff --git a/fs/exec.c b/fs/exec.c |
6658 | index 6d2b6f9..d750cc0 100644 |
6659 | --- a/fs/exec.c |
6660 | +++ b/fs/exec.c |
6661 | @@ -157,7 +157,26 @@ out: |
6662 | |
6663 | #ifdef CONFIG_MMU |
6664 | |
6665 | -static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, |
6666 | +void acct_arg_size(struct linux_binprm *bprm, unsigned long pages) |
6667 | +{ |
6668 | + struct mm_struct *mm = current->mm; |
6669 | + long diff = (long)(pages - bprm->vma_pages); |
6670 | + |
6671 | + if (!mm || !diff) |
6672 | + return; |
6673 | + |
6674 | + bprm->vma_pages = pages; |
6675 | + |
6676 | +#ifdef SPLIT_RSS_COUNTING |
6677 | + add_mm_counter(mm, MM_ANONPAGES, diff); |
6678 | +#else |
6679 | + spin_lock(&mm->page_table_lock); |
6680 | + add_mm_counter(mm, MM_ANONPAGES, diff); |
6681 | + spin_unlock(&mm->page_table_lock); |
6682 | +#endif |
6683 | +} |
6684 | + |
6685 | +struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, |
6686 | int write) |
6687 | { |
6688 | struct page *page; |
6689 | @@ -179,6 +198,8 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, |
6690 | unsigned long size = bprm->vma->vm_end - bprm->vma->vm_start; |
6691 | struct rlimit *rlim; |
6692 | |
6693 | + acct_arg_size(bprm, size / PAGE_SIZE); |
6694 | + |
6695 | /* |
6696 | * We've historically supported up to 32 pages (ARG_MAX) |
6697 | * of argument strings even with small stacks |
6698 | @@ -269,7 +290,11 @@ static bool valid_arg_len(struct linux_binprm *bprm, long len) |
6699 | |
6700 | #else |
6701 | |
6702 | -static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, |
6703 | +void acct_arg_size(struct linux_binprm *bprm, unsigned long pages) |
6704 | +{ |
6705 | +} |
6706 | + |
6707 | +struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, |
6708 | int write) |
6709 | { |
6710 | struct page *page; |
6711 | @@ -992,6 +1017,7 @@ int flush_old_exec(struct linux_binprm * bprm) |
6712 | /* |
6713 | * Release all of the old mmap stuff |
6714 | */ |
6715 | + acct_arg_size(bprm, 0); |
6716 | retval = exec_mmap(bprm->mm); |
6717 | if (retval) |
6718 | goto out; |
6719 | @@ -1416,8 +1442,10 @@ int do_execve(const char * filename, |
6720 | return retval; |
6721 | |
6722 | out: |
6723 | - if (bprm->mm) |
6724 | - mmput (bprm->mm); |
6725 | + if (bprm->mm) { |
6726 | + acct_arg_size(bprm, 0); |
6727 | + mmput(bprm->mm); |
6728 | + } |
6729 | |
6730 | out_file: |
6731 | if (bprm->file) { |
6732 | diff --git a/fs/ext4/super.c b/fs/ext4/super.c |
6733 | index 2614774..751997d 100644 |
6734 | --- a/fs/ext4/super.c |
6735 | +++ b/fs/ext4/super.c |
6736 | @@ -719,6 +719,7 @@ static void ext4_put_super(struct super_block *sb) |
6737 | ext4_abort(sb, "Couldn't clean up the journal"); |
6738 | } |
6739 | |
6740 | + del_timer(&sbi->s_err_report); |
6741 | ext4_release_system_zone(sb); |
6742 | ext4_mb_release(sb); |
6743 | ext4_ext_release(sb); |
6744 | diff --git a/fs/fuse/file.c b/fs/fuse/file.c |
6745 | index c822458..9242d29 100644 |
6746 | --- a/fs/fuse/file.c |
6747 | +++ b/fs/fuse/file.c |
6748 | @@ -134,6 +134,7 @@ EXPORT_SYMBOL_GPL(fuse_do_open); |
6749 | void fuse_finish_open(struct inode *inode, struct file *file) |
6750 | { |
6751 | struct fuse_file *ff = file->private_data; |
6752 | + struct fuse_conn *fc = get_fuse_conn(inode); |
6753 | |
6754 | if (ff->open_flags & FOPEN_DIRECT_IO) |
6755 | file->f_op = &fuse_direct_io_file_operations; |
6756 | @@ -141,6 +142,15 @@ void fuse_finish_open(struct inode *inode, struct file *file) |
6757 | invalidate_inode_pages2(inode->i_mapping); |
6758 | if (ff->open_flags & FOPEN_NONSEEKABLE) |
6759 | nonseekable_open(inode, file); |
6760 | + if (fc->atomic_o_trunc && (file->f_flags & O_TRUNC)) { |
6761 | + struct fuse_inode *fi = get_fuse_inode(inode); |
6762 | + |
6763 | + spin_lock(&fc->lock); |
6764 | + fi->attr_version = ++fc->attr_version; |
6765 | + i_size_write(inode, 0); |
6766 | + spin_unlock(&fc->lock); |
6767 | + fuse_invalidate_attr(inode); |
6768 | + } |
6769 | } |
6770 | |
6771 | int fuse_open_common(struct inode *inode, struct file *file, bool isdir) |
6772 | diff --git a/fs/hostfs/hostfs.h b/fs/hostfs/hostfs.h |
6773 | index 6bbd75c..3ccb4e4 100644 |
6774 | --- a/fs/hostfs/hostfs.h |
6775 | +++ b/fs/hostfs/hostfs.h |
6776 | @@ -96,7 +96,6 @@ extern int rename_file(char *from, char *to); |
6777 | extern int do_statfs(char *root, long *bsize_out, long long *blocks_out, |
6778 | long long *bfree_out, long long *bavail_out, |
6779 | long long *files_out, long long *ffree_out, |
6780 | - void *fsid_out, int fsid_size, long *namelen_out, |
6781 | - long *spare_out); |
6782 | + void *fsid_out, int fsid_size, long *namelen_out); |
6783 | |
6784 | #endif |
6785 | diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c |
6786 | index f7dc9b5..cd7c939 100644 |
6787 | --- a/fs/hostfs/hostfs_kern.c |
6788 | +++ b/fs/hostfs/hostfs_kern.c |
6789 | @@ -217,7 +217,7 @@ int hostfs_statfs(struct dentry *dentry, struct kstatfs *sf) |
6790 | err = do_statfs(dentry->d_sb->s_fs_info, |
6791 | &sf->f_bsize, &f_blocks, &f_bfree, &f_bavail, &f_files, |
6792 | &f_ffree, &sf->f_fsid, sizeof(sf->f_fsid), |
6793 | - &sf->f_namelen, sf->f_spare); |
6794 | + &sf->f_namelen); |
6795 | if (err) |
6796 | return err; |
6797 | sf->f_blocks = f_blocks; |
6798 | diff --git a/fs/hostfs/hostfs_user.c b/fs/hostfs/hostfs_user.c |
6799 | index 6777aa0..8d02683 100644 |
6800 | --- a/fs/hostfs/hostfs_user.c |
6801 | +++ b/fs/hostfs/hostfs_user.c |
6802 | @@ -364,8 +364,7 @@ int rename_file(char *from, char *to) |
6803 | int do_statfs(char *root, long *bsize_out, long long *blocks_out, |
6804 | long long *bfree_out, long long *bavail_out, |
6805 | long long *files_out, long long *ffree_out, |
6806 | - void *fsid_out, int fsid_size, long *namelen_out, |
6807 | - long *spare_out) |
6808 | + void *fsid_out, int fsid_size, long *namelen_out) |
6809 | { |
6810 | struct statfs64 buf; |
6811 | int err; |
6812 | @@ -384,10 +383,6 @@ int do_statfs(char *root, long *bsize_out, long long *blocks_out, |
6813 | sizeof(buf.f_fsid) > fsid_size ? fsid_size : |
6814 | sizeof(buf.f_fsid)); |
6815 | *namelen_out = buf.f_namelen; |
6816 | - spare_out[0] = buf.f_spare[0]; |
6817 | - spare_out[1] = buf.f_spare[1]; |
6818 | - spare_out[2] = buf.f_spare[2]; |
6819 | - spare_out[3] = buf.f_spare[3]; |
6820 | - spare_out[4] = buf.f_spare[4]; |
6821 | + |
6822 | return 0; |
6823 | } |
6824 | diff --git a/fs/nfs/file.c b/fs/nfs/file.c |
6825 | index 05bf3c0..6d95e24 100644 |
6826 | --- a/fs/nfs/file.c |
6827 | +++ b/fs/nfs/file.c |
6828 | @@ -551,7 +551,7 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) |
6829 | struct file *filp = vma->vm_file; |
6830 | struct dentry *dentry = filp->f_path.dentry; |
6831 | unsigned pagelen; |
6832 | - int ret = -EINVAL; |
6833 | + int ret = VM_FAULT_NOPAGE; |
6834 | struct address_space *mapping; |
6835 | |
6836 | dfprintk(PAGECACHE, "NFS: vm_page_mkwrite(%s/%s(%ld), offset %lld)\n", |
6837 | @@ -567,21 +567,20 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) |
6838 | if (mapping != dentry->d_inode->i_mapping) |
6839 | goto out_unlock; |
6840 | |
6841 | - ret = 0; |
6842 | pagelen = nfs_page_length(page); |
6843 | if (pagelen == 0) |
6844 | goto out_unlock; |
6845 | |
6846 | - ret = nfs_flush_incompatible(filp, page); |
6847 | - if (ret != 0) |
6848 | - goto out_unlock; |
6849 | + ret = VM_FAULT_LOCKED; |
6850 | + if (nfs_flush_incompatible(filp, page) == 0 && |
6851 | + nfs_updatepage(filp, page, 0, pagelen) == 0) |
6852 | + goto out; |
6853 | |
6854 | - ret = nfs_updatepage(filp, page, 0, pagelen); |
6855 | + ret = VM_FAULT_SIGBUS; |
6856 | out_unlock: |
6857 | - if (!ret) |
6858 | - return VM_FAULT_LOCKED; |
6859 | unlock_page(page); |
6860 | - return VM_FAULT_SIGBUS; |
6861 | +out: |
6862 | + return ret; |
6863 | } |
6864 | |
6865 | static const struct vm_operations_struct nfs_file_vm_ops = { |
6866 | diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c |
6867 | index 089da5b..74aa54e 100644 |
6868 | --- a/fs/nfs/nfs4proc.c |
6869 | +++ b/fs/nfs/nfs4proc.c |
6870 | @@ -255,9 +255,6 @@ static int nfs4_handle_exception(const struct nfs_server *server, int errorcode, |
6871 | nfs4_state_mark_reclaim_nograce(clp, state); |
6872 | goto do_state_recovery; |
6873 | case -NFS4ERR_STALE_STATEID: |
6874 | - if (state == NULL) |
6875 | - break; |
6876 | - nfs4_state_mark_reclaim_reboot(clp, state); |
6877 | case -NFS4ERR_STALE_CLIENTID: |
6878 | case -NFS4ERR_EXPIRED: |
6879 | goto do_state_recovery; |
6880 | @@ -1120,6 +1117,7 @@ static int nfs4_open_recover(struct nfs4_opendata *opendata, struct nfs4_state * |
6881 | clear_bit(NFS_DELEGATED_STATE, &state->flags); |
6882 | smp_rmb(); |
6883 | if (state->n_rdwr != 0) { |
6884 | + clear_bit(NFS_O_RDWR_STATE, &state->flags); |
6885 | ret = nfs4_open_recover_helper(opendata, FMODE_READ|FMODE_WRITE, &newstate); |
6886 | if (ret != 0) |
6887 | return ret; |
6888 | @@ -1127,6 +1125,7 @@ static int nfs4_open_recover(struct nfs4_opendata *opendata, struct nfs4_state * |
6889 | return -ESTALE; |
6890 | } |
6891 | if (state->n_wronly != 0) { |
6892 | + clear_bit(NFS_O_WRONLY_STATE, &state->flags); |
6893 | ret = nfs4_open_recover_helper(opendata, FMODE_WRITE, &newstate); |
6894 | if (ret != 0) |
6895 | return ret; |
6896 | @@ -1134,6 +1133,7 @@ static int nfs4_open_recover(struct nfs4_opendata *opendata, struct nfs4_state * |
6897 | return -ESTALE; |
6898 | } |
6899 | if (state->n_rdonly != 0) { |
6900 | + clear_bit(NFS_O_RDONLY_STATE, &state->flags); |
6901 | ret = nfs4_open_recover_helper(opendata, FMODE_READ, &newstate); |
6902 | if (ret != 0) |
6903 | return ret; |
6904 | @@ -3490,9 +3490,6 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, |
6905 | nfs4_state_mark_reclaim_nograce(clp, state); |
6906 | goto do_state_recovery; |
6907 | case -NFS4ERR_STALE_STATEID: |
6908 | - if (state == NULL) |
6909 | - break; |
6910 | - nfs4_state_mark_reclaim_reboot(clp, state); |
6911 | case -NFS4ERR_STALE_CLIENTID: |
6912 | case -NFS4ERR_EXPIRED: |
6913 | goto do_state_recovery; |
6914 | diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c |
6915 | index 3e2f19b..940cf7c 100644 |
6916 | --- a/fs/nfs/nfs4state.c |
6917 | +++ b/fs/nfs/nfs4state.c |
6918 | @@ -1138,16 +1138,14 @@ static void nfs4_reclaim_complete(struct nfs_client *clp, |
6919 | (void)ops->reclaim_complete(clp); |
6920 | } |
6921 | |
6922 | -static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp) |
6923 | +static int nfs4_state_clear_reclaim_reboot(struct nfs_client *clp) |
6924 | { |
6925 | struct nfs4_state_owner *sp; |
6926 | struct rb_node *pos; |
6927 | struct nfs4_state *state; |
6928 | |
6929 | if (!test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) |
6930 | - return; |
6931 | - |
6932 | - nfs4_reclaim_complete(clp, clp->cl_mvops->reboot_recovery_ops); |
6933 | + return 0; |
6934 | |
6935 | for (pos = rb_first(&clp->cl_state_owners); pos != NULL; pos = rb_next(pos)) { |
6936 | sp = rb_entry(pos, struct nfs4_state_owner, so_client_node); |
6937 | @@ -1161,6 +1159,14 @@ static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp) |
6938 | } |
6939 | |
6940 | nfs_delegation_reap_unclaimed(clp); |
6941 | + return 1; |
6942 | +} |
6943 | + |
6944 | +static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp) |
6945 | +{ |
6946 | + if (!nfs4_state_clear_reclaim_reboot(clp)) |
6947 | + return; |
6948 | + nfs4_reclaim_complete(clp, clp->cl_mvops->reboot_recovery_ops); |
6949 | } |
6950 | |
6951 | static void nfs_delegation_clear_all(struct nfs_client *clp) |
6952 | @@ -1187,7 +1193,7 @@ static int nfs4_recovery_handle_error(struct nfs_client *clp, int error) |
6953 | case -NFS4ERR_STALE_CLIENTID: |
6954 | case -NFS4ERR_LEASE_MOVED: |
6955 | set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); |
6956 | - nfs4_state_end_reclaim_reboot(clp); |
6957 | + nfs4_state_clear_reclaim_reboot(clp); |
6958 | nfs4_state_start_reclaim_reboot(clp); |
6959 | break; |
6960 | case -NFS4ERR_EXPIRED: |
6961 | diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c |
6962 | index 9194902..137b549 100644 |
6963 | --- a/fs/nfs/pagelist.c |
6964 | +++ b/fs/nfs/pagelist.c |
6965 | @@ -65,6 +65,13 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode, |
6966 | if (req == NULL) |
6967 | return ERR_PTR(-ENOMEM); |
6968 | |
6969 | + /* get lock context early so we can deal with alloc failures */ |
6970 | + req->wb_lock_context = nfs_get_lock_context(ctx); |
6971 | + if (req->wb_lock_context == NULL) { |
6972 | + nfs_page_free(req); |
6973 | + return ERR_PTR(-ENOMEM); |
6974 | + } |
6975 | + |
6976 | /* Initialize the request struct. Initially, we assume a |
6977 | * long write-back delay. This will be adjusted in |
6978 | * update_nfs_request below if the region is not locked. */ |
6979 | @@ -79,7 +86,6 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode, |
6980 | req->wb_pgbase = offset; |
6981 | req->wb_bytes = count; |
6982 | req->wb_context = get_nfs_open_context(ctx); |
6983 | - req->wb_lock_context = nfs_get_lock_context(ctx); |
6984 | kref_init(&req->wb_kref); |
6985 | return req; |
6986 | } |
6987 | diff --git a/fs/pipe.c b/fs/pipe.c |
6988 | index 37eb1eb..a58d7ee 100644 |
6989 | --- a/fs/pipe.c |
6990 | +++ b/fs/pipe.c |
6991 | @@ -1197,12 +1197,24 @@ int pipe_proc_fn(struct ctl_table *table, int write, void __user *buf, |
6992 | return ret; |
6993 | } |
6994 | |
6995 | +/* |
6996 | + * After the inode slimming patch, i_pipe/i_bdev/i_cdev share the same |
6997 | + * location, so checking ->i_pipe is not enough to verify that this is a |
6998 | + * pipe. |
6999 | + */ |
7000 | +struct pipe_inode_info *get_pipe_info(struct file *file) |
7001 | +{ |
7002 | + struct inode *i = file->f_path.dentry->d_inode; |
7003 | + |
7004 | + return S_ISFIFO(i->i_mode) ? i->i_pipe : NULL; |
7005 | +} |
7006 | + |
7007 | long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg) |
7008 | { |
7009 | struct pipe_inode_info *pipe; |
7010 | long ret; |
7011 | |
7012 | - pipe = file->f_path.dentry->d_inode->i_pipe; |
7013 | + pipe = get_pipe_info(file); |
7014 | if (!pipe) |
7015 | return -EBADF; |
7016 | |
7017 | diff --git a/fs/proc/base.c b/fs/proc/base.c |
7018 | index 8e4adda..632b907 100644 |
7019 | --- a/fs/proc/base.c |
7020 | +++ b/fs/proc/base.c |
7021 | @@ -1526,7 +1526,7 @@ static int do_proc_readlink(struct path *path, char __user *buffer, int buflen) |
7022 | if (!tmp) |
7023 | return -ENOMEM; |
7024 | |
7025 | - pathname = d_path_with_unreachable(path, tmp, PAGE_SIZE); |
7026 | + pathname = d_path(path, tmp, PAGE_SIZE); |
7027 | len = PTR_ERR(pathname); |
7028 | if (IS_ERR(pathname)) |
7029 | goto out; |
7030 | diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c |
7031 | index 5cbb81e..4131f4a 100644 |
7032 | --- a/fs/reiserfs/ioctl.c |
7033 | +++ b/fs/reiserfs/ioctl.c |
7034 | @@ -186,12 +186,11 @@ int reiserfs_unpack(struct inode *inode, struct file *filp) |
7035 | return 0; |
7036 | } |
7037 | |
7038 | - /* we need to make sure nobody is changing the file size beneath |
7039 | - ** us |
7040 | - */ |
7041 | - reiserfs_mutex_lock_safe(&inode->i_mutex, inode->i_sb); |
7042 | depth = reiserfs_write_lock_once(inode->i_sb); |
7043 | |
7044 | + /* we need to make sure nobody is changing the file size beneath us */ |
7045 | + reiserfs_mutex_lock_safe(&inode->i_mutex, inode->i_sb); |
7046 | + |
7047 | write_from = inode->i_size & (blocksize - 1); |
7048 | /* if we are on a block boundary, we are already unpacked. */ |
7049 | if (write_from == 0) { |
7050 | diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c |
7051 | index 536d697..90d2fcb 100644 |
7052 | --- a/fs/reiserfs/xattr_acl.c |
7053 | +++ b/fs/reiserfs/xattr_acl.c |
7054 | @@ -472,7 +472,9 @@ int reiserfs_acl_chmod(struct inode *inode) |
7055 | struct reiserfs_transaction_handle th; |
7056 | size_t size = reiserfs_xattr_nblocks(inode, |
7057 | reiserfs_acl_size(clone->a_count)); |
7058 | - reiserfs_write_lock(inode->i_sb); |
7059 | + int depth; |
7060 | + |
7061 | + depth = reiserfs_write_lock_once(inode->i_sb); |
7062 | error = journal_begin(&th, inode->i_sb, size * 2); |
7063 | if (!error) { |
7064 | int error2; |
7065 | @@ -482,7 +484,7 @@ int reiserfs_acl_chmod(struct inode *inode) |
7066 | if (error2) |
7067 | error = error2; |
7068 | } |
7069 | - reiserfs_write_unlock(inode->i_sb); |
7070 | + reiserfs_write_unlock_once(inode->i_sb, depth); |
7071 | } |
7072 | posix_acl_release(clone); |
7073 | return error; |
7074 | diff --git a/fs/splice.c b/fs/splice.c |
7075 | index 8f1dfae..ce2f025 100644 |
7076 | --- a/fs/splice.c |
7077 | +++ b/fs/splice.c |
7078 | @@ -1311,18 +1311,6 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, |
7079 | static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe, |
7080 | struct pipe_inode_info *opipe, |
7081 | size_t len, unsigned int flags); |
7082 | -/* |
7083 | - * After the inode slimming patch, i_pipe/i_bdev/i_cdev share the same |
7084 | - * location, so checking ->i_pipe is not enough to verify that this is a |
7085 | - * pipe. |
7086 | - */ |
7087 | -static inline struct pipe_inode_info *pipe_info(struct inode *inode) |
7088 | -{ |
7089 | - if (S_ISFIFO(inode->i_mode)) |
7090 | - return inode->i_pipe; |
7091 | - |
7092 | - return NULL; |
7093 | -} |
7094 | |
7095 | /* |
7096 | * Determine where to splice to/from. |
7097 | @@ -1336,8 +1324,8 @@ static long do_splice(struct file *in, loff_t __user *off_in, |
7098 | loff_t offset, *off; |
7099 | long ret; |
7100 | |
7101 | - ipipe = pipe_info(in->f_path.dentry->d_inode); |
7102 | - opipe = pipe_info(out->f_path.dentry->d_inode); |
7103 | + ipipe = get_pipe_info(in); |
7104 | + opipe = get_pipe_info(out); |
7105 | |
7106 | if (ipipe && opipe) { |
7107 | if (off_in || off_out) |
7108 | @@ -1555,7 +1543,7 @@ static long vmsplice_to_user(struct file *file, const struct iovec __user *iov, |
7109 | int error; |
7110 | long ret; |
7111 | |
7112 | - pipe = pipe_info(file->f_path.dentry->d_inode); |
7113 | + pipe = get_pipe_info(file); |
7114 | if (!pipe) |
7115 | return -EBADF; |
7116 | |
7117 | @@ -1642,7 +1630,7 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *iov, |
7118 | }; |
7119 | long ret; |
7120 | |
7121 | - pipe = pipe_info(file->f_path.dentry->d_inode); |
7122 | + pipe = get_pipe_info(file); |
7123 | if (!pipe) |
7124 | return -EBADF; |
7125 | |
7126 | @@ -2022,8 +2010,8 @@ static int link_pipe(struct pipe_inode_info *ipipe, |
7127 | static long do_tee(struct file *in, struct file *out, size_t len, |
7128 | unsigned int flags) |
7129 | { |
7130 | - struct pipe_inode_info *ipipe = pipe_info(in->f_path.dentry->d_inode); |
7131 | - struct pipe_inode_info *opipe = pipe_info(out->f_path.dentry->d_inode); |
7132 | + struct pipe_inode_info *ipipe = get_pipe_info(in); |
7133 | + struct pipe_inode_info *opipe = get_pipe_info(out); |
7134 | int ret = -EINVAL; |
7135 | |
7136 | /* |
7137 | diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h |
7138 | index a065612..64a7114 100644 |
7139 | --- a/include/linux/binfmts.h |
7140 | +++ b/include/linux/binfmts.h |
7141 | @@ -29,6 +29,7 @@ struct linux_binprm{ |
7142 | char buf[BINPRM_BUF_SIZE]; |
7143 | #ifdef CONFIG_MMU |
7144 | struct vm_area_struct *vma; |
7145 | + unsigned long vma_pages; |
7146 | #else |
7147 | # define MAX_ARG_PAGES 32 |
7148 | struct page *page[MAX_ARG_PAGES]; |
7149 | @@ -59,6 +60,10 @@ struct linux_binprm{ |
7150 | unsigned long loader, exec; |
7151 | }; |
7152 | |
7153 | +extern void acct_arg_size(struct linux_binprm *bprm, unsigned long pages); |
7154 | +extern struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, |
7155 | + int write); |
7156 | + |
7157 | #define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0 |
7158 | #define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT) |
7159 | |
7160 | diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h |
7161 | index 2c54906..9e443b9 100644 |
7162 | --- a/include/linux/blkdev.h |
7163 | +++ b/include/linux/blkdev.h |
7164 | @@ -851,7 +851,7 @@ extern void blk_queue_max_segment_size(struct request_queue *, unsigned int); |
7165 | extern void blk_queue_max_discard_sectors(struct request_queue *q, |
7166 | unsigned int max_discard_sectors); |
7167 | extern void blk_queue_logical_block_size(struct request_queue *, unsigned short); |
7168 | -extern void blk_queue_physical_block_size(struct request_queue *, unsigned short); |
7169 | +extern void blk_queue_physical_block_size(struct request_queue *, unsigned int); |
7170 | extern void blk_queue_alignment_offset(struct request_queue *q, |
7171 | unsigned int alignment); |
7172 | extern void blk_limits_io_min(struct queue_limits *limits, unsigned int min); |
7173 | @@ -1004,7 +1004,7 @@ static inline unsigned int queue_physical_block_size(struct request_queue *q) |
7174 | return q->limits.physical_block_size; |
7175 | } |
7176 | |
7177 | -static inline int bdev_physical_block_size(struct block_device *bdev) |
7178 | +static inline unsigned int bdev_physical_block_size(struct block_device *bdev) |
7179 | { |
7180 | return queue_physical_block_size(bdev_get_queue(bdev)); |
7181 | } |
7182 | diff --git a/include/linux/gfp.h b/include/linux/gfp.h |
7183 | index 975609c..81483c2 100644 |
7184 | --- a/include/linux/gfp.h |
7185 | +++ b/include/linux/gfp.h |
7186 | @@ -339,7 +339,7 @@ void drain_local_pages(void *dummy); |
7187 | |
7188 | extern gfp_t gfp_allowed_mask; |
7189 | |
7190 | -extern void set_gfp_allowed_mask(gfp_t mask); |
7191 | -extern gfp_t clear_gfp_allowed_mask(gfp_t mask); |
7192 | +extern void pm_restrict_gfp_mask(void); |
7193 | +extern void pm_restore_gfp_mask(void); |
7194 | |
7195 | #endif /* __LINUX_GFP_H */ |
7196 | diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h |
7197 | index 62dbee5..c238ad2 100644 |
7198 | --- a/include/linux/kfifo.h |
7199 | +++ b/include/linux/kfifo.h |
7200 | @@ -171,11 +171,8 @@ struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PTR(unsigned char, 2, void); |
7201 | } |
7202 | |
7203 | |
7204 | -static inline unsigned int __must_check |
7205 | -__kfifo_must_check_helper(unsigned int val) |
7206 | -{ |
7207 | - return val; |
7208 | -} |
7209 | +/* __kfifo_must_check_helper() is temporarily disabled because it was faulty */ |
7210 | +#define __kfifo_must_check_helper(x) (x) |
7211 | |
7212 | /** |
7213 | * kfifo_initialized - Check if the fifo is initialized |
7214 | diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h |
7215 | index 89341c3..03317c8 100644 |
7216 | --- a/include/linux/netfilter.h |
7217 | +++ b/include/linux/netfilter.h |
7218 | @@ -215,7 +215,7 @@ NF_HOOK_COND(uint8_t pf, unsigned int hook, struct sk_buff *skb, |
7219 | int ret; |
7220 | |
7221 | if (!cond || |
7222 | - (ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, INT_MIN) == 1)) |
7223 | + ((ret = nf_hook_thresh(pf, hook, skb, in, out, okfn, INT_MIN)) == 1)) |
7224 | ret = okfn(skb); |
7225 | return ret; |
7226 | } |
7227 | diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h |
7228 | index 570fdde..db8aa93 100644 |
7229 | --- a/include/linux/pci_ids.h |
7230 | +++ b/include/linux/pci_ids.h |
7231 | @@ -2041,6 +2041,7 @@ |
7232 | #define PCI_DEVICE_ID_AFAVLAB_P030 0x2182 |
7233 | #define PCI_SUBDEVICE_ID_AFAVLAB_P061 0x2150 |
7234 | |
7235 | +#define PCI_VENDOR_ID_BCM_GVC 0x14a4 |
7236 | #define PCI_VENDOR_ID_BROADCOM 0x14e4 |
7237 | #define PCI_DEVICE_ID_TIGON3_5752 0x1600 |
7238 | #define PCI_DEVICE_ID_TIGON3_5752M 0x1601 |
7239 | diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h |
7240 | index 716f99b..1d42c6e 100644 |
7241 | --- a/include/linux/perf_event.h |
7242 | +++ b/include/linux/perf_event.h |
7243 | @@ -788,6 +788,7 @@ struct perf_event_context { |
7244 | int nr_active; |
7245 | int is_active; |
7246 | int nr_stat; |
7247 | + int rotate_disable; |
7248 | atomic_t refcount; |
7249 | struct task_struct *task; |
7250 | |
7251 | diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h |
7252 | index 4457969..bb27d7e 100644 |
7253 | --- a/include/linux/pipe_fs_i.h |
7254 | +++ b/include/linux/pipe_fs_i.h |
7255 | @@ -160,5 +160,6 @@ void generic_pipe_buf_release(struct pipe_inode_info *, struct pipe_buffer *); |
7256 | |
7257 | /* for F_SETPIPE_SZ and F_GETPIPE_SZ */ |
7258 | long pipe_fcntl(struct file *, unsigned int, unsigned long arg); |
7259 | +struct pipe_inode_info *get_pipe_info(struct file *file); |
7260 | |
7261 | #endif |
7262 | diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h |
7263 | index 634b8e6..9f38fe5 100644 |
7264 | --- a/include/linux/radix-tree.h |
7265 | +++ b/include/linux/radix-tree.h |
7266 | @@ -36,17 +36,6 @@ |
7267 | * RCU. |
7268 | */ |
7269 | #define RADIX_TREE_INDIRECT_PTR 1 |
7270 | -#define RADIX_TREE_RETRY ((void *)-1UL) |
7271 | - |
7272 | -static inline void *radix_tree_ptr_to_indirect(void *ptr) |
7273 | -{ |
7274 | - return (void *)((unsigned long)ptr | RADIX_TREE_INDIRECT_PTR); |
7275 | -} |
7276 | - |
7277 | -static inline void *radix_tree_indirect_to_ptr(void *ptr) |
7278 | -{ |
7279 | - return (void *)((unsigned long)ptr & ~RADIX_TREE_INDIRECT_PTR); |
7280 | -} |
7281 | |
7282 | static inline int radix_tree_is_indirect_ptr(void *ptr) |
7283 | { |
7284 | @@ -138,16 +127,29 @@ do { \ |
7285 | * removed. |
7286 | * |
7287 | * For use with radix_tree_lookup_slot(). Caller must hold tree at least read |
7288 | - * locked across slot lookup and dereference. More likely, will be used with |
7289 | - * radix_tree_replace_slot(), as well, so caller will hold tree write locked. |
7290 | + * locked across slot lookup and dereference. Not required if write lock is |
7291 | + * held (ie. items cannot be concurrently inserted). |
7292 | + * |
7293 | + * radix_tree_deref_retry must be used to confirm validity of the pointer if |
7294 | + * only the read lock is held. |
7295 | */ |
7296 | static inline void *radix_tree_deref_slot(void **pslot) |
7297 | { |
7298 | - void *ret = rcu_dereference(*pslot); |
7299 | - if (unlikely(radix_tree_is_indirect_ptr(ret))) |
7300 | - ret = RADIX_TREE_RETRY; |
7301 | - return ret; |
7302 | + return rcu_dereference(*pslot); |
7303 | } |
7304 | + |
7305 | +/** |
7306 | + * radix_tree_deref_retry - check radix_tree_deref_slot |
7307 | + * @arg: pointer returned by radix_tree_deref_slot |
7308 | + * Returns: 0 if retry is not required, otherwise retry is required |
7309 | + * |
7310 | + * radix_tree_deref_retry must be used with radix_tree_deref_slot. |
7311 | + */ |
7312 | +static inline int radix_tree_deref_retry(void *arg) |
7313 | +{ |
7314 | + return unlikely((unsigned long)arg & RADIX_TREE_INDIRECT_PTR); |
7315 | +} |
7316 | + |
7317 | /** |
7318 | * radix_tree_replace_slot - replace item in a slot |
7319 | * @pslot: pointer to slot, returned by radix_tree_lookup_slot |
7320 | diff --git a/include/linux/socket.h b/include/linux/socket.h |
7321 | index a8f56e1..a2fada9 100644 |
7322 | --- a/include/linux/socket.h |
7323 | +++ b/include/linux/socket.h |
7324 | @@ -322,7 +322,7 @@ extern int csum_partial_copy_fromiovecend(unsigned char *kdata, |
7325 | int offset, |
7326 | unsigned int len, __wsum *csump); |
7327 | |
7328 | -extern long verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode); |
7329 | +extern int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode); |
7330 | extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len); |
7331 | extern int memcpy_toiovecend(const struct iovec *v, unsigned char *kdata, |
7332 | int offset, int len); |
7333 | diff --git a/include/linux/tty.h b/include/linux/tty.h |
7334 | index 67d64e6..6f62c30 100644 |
7335 | --- a/include/linux/tty.h |
7336 | +++ b/include/linux/tty.h |
7337 | @@ -365,6 +365,7 @@ struct tty_file_private { |
7338 | #define TTY_HUPPED 18 /* Post driver->hangup() */ |
7339 | #define TTY_FLUSHING 19 /* Flushing to ldisc in progress */ |
7340 | #define TTY_FLUSHPENDING 20 /* Queued buffer flush pending */ |
7341 | +#define TTY_HUPPING 21 /* ->hangup() in progress */ |
7342 | |
7343 | #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) |
7344 | |
7345 | diff --git a/include/net/mac80211.h b/include/net/mac80211.h |
7346 | index b0787a1..05aaa87 100644 |
7347 | --- a/include/net/mac80211.h |
7348 | +++ b/include/net/mac80211.h |
7349 | @@ -315,6 +315,9 @@ struct ieee80211_bss_conf { |
7350 | * @IEEE80211_TX_CTL_LDPC: tells the driver to use LDPC for this frame |
7351 | * @IEEE80211_TX_CTL_STBC: Enables Space-Time Block Coding (STBC) for this |
7352 | * frame and selects the maximum number of streams that it can use. |
7353 | + * |
7354 | + * Note: If you have to add new flags to the enumeration, then don't |
7355 | + * forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary. |
7356 | */ |
7357 | enum mac80211_tx_control_flags { |
7358 | IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), |
7359 | @@ -344,6 +347,19 @@ enum mac80211_tx_control_flags { |
7360 | |
7361 | #define IEEE80211_TX_CTL_STBC_SHIFT 23 |
7362 | |
7363 | +/* |
7364 | + * This definition is used as a mask to clear all temporary flags, which are |
7365 | + * set by the tx handlers for each transmission attempt by the mac80211 stack. |
7366 | + */ |
7367 | +#define IEEE80211_TX_TEMPORARY_FLAGS (IEEE80211_TX_CTL_NO_ACK | \ |
7368 | + IEEE80211_TX_CTL_CLEAR_PS_FILT | IEEE80211_TX_CTL_FIRST_FRAGMENT | \ |
7369 | + IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \ |
7370 | + IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \ |
7371 | + IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \ |
7372 | + IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_PSPOLL_RESPONSE | \ |
7373 | + IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \ |
7374 | + IEEE80211_TX_CTL_STBC) |
7375 | + |
7376 | /** |
7377 | * enum mac80211_rate_control_flags - per-rate flags set by the |
7378 | * Rate Control algorithm. |
7379 | diff --git a/ipc/compat.c b/ipc/compat.c |
7380 | index 9dc2c7d..845a287 100644 |
7381 | --- a/ipc/compat.c |
7382 | +++ b/ipc/compat.c |
7383 | @@ -241,6 +241,8 @@ long compat_sys_semctl(int first, int second, int third, void __user *uptr) |
7384 | struct semid64_ds __user *up64; |
7385 | int version = compat_ipc_parse_version(&third); |
7386 | |
7387 | + memset(&s64, 0, sizeof(s64)); |
7388 | + |
7389 | if (!uptr) |
7390 | return -EINVAL; |
7391 | if (get_user(pad, (u32 __user *) uptr)) |
7392 | @@ -421,6 +423,8 @@ long compat_sys_msgctl(int first, int second, void __user *uptr) |
7393 | int version = compat_ipc_parse_version(&second); |
7394 | void __user *p; |
7395 | |
7396 | + memset(&m64, 0, sizeof(m64)); |
7397 | + |
7398 | switch (second & (~IPC_64)) { |
7399 | case IPC_INFO: |
7400 | case IPC_RMID: |
7401 | @@ -594,6 +598,8 @@ long compat_sys_shmctl(int first, int second, void __user *uptr) |
7402 | int err, err2; |
7403 | int version = compat_ipc_parse_version(&second); |
7404 | |
7405 | + memset(&s64, 0, sizeof(s64)); |
7406 | + |
7407 | switch (second & (~IPC_64)) { |
7408 | case IPC_RMID: |
7409 | case SHM_LOCK: |
7410 | diff --git a/ipc/compat_mq.c b/ipc/compat_mq.c |
7411 | index d8d1e9f..380ea4f 100644 |
7412 | --- a/ipc/compat_mq.c |
7413 | +++ b/ipc/compat_mq.c |
7414 | @@ -53,6 +53,9 @@ asmlinkage long compat_sys_mq_open(const char __user *u_name, |
7415 | void __user *p = NULL; |
7416 | if (u_attr && oflag & O_CREAT) { |
7417 | struct mq_attr attr; |
7418 | + |
7419 | + memset(&attr, 0, sizeof(attr)); |
7420 | + |
7421 | p = compat_alloc_user_space(sizeof(attr)); |
7422 | if (get_compat_mq_attr(&attr, u_attr) || |
7423 | copy_to_user(p, &attr, sizeof(attr))) |
7424 | @@ -127,6 +130,8 @@ asmlinkage long compat_sys_mq_getsetattr(mqd_t mqdes, |
7425 | struct mq_attr __user *p = compat_alloc_user_space(2 * sizeof(*p)); |
7426 | long ret; |
7427 | |
7428 | + memset(&mqstat, 0, sizeof(mqstat)); |
7429 | + |
7430 | if (u_mqstat) { |
7431 | if (get_compat_mq_attr(&mqstat, u_mqstat) || |
7432 | copy_to_user(p, &mqstat, sizeof(mqstat))) |
7433 | diff --git a/ipc/shm.c b/ipc/shm.c |
7434 | index 52ed77e..b427380 100644 |
7435 | --- a/ipc/shm.c |
7436 | +++ b/ipc/shm.c |
7437 | @@ -473,6 +473,7 @@ static inline unsigned long copy_shmid_to_user(void __user *buf, struct shmid64_ |
7438 | { |
7439 | struct shmid_ds out; |
7440 | |
7441 | + memset(&out, 0, sizeof(out)); |
7442 | ipc64_perm_to_ipc_perm(&in->shm_perm, &out.shm_perm); |
7443 | out.shm_segsz = in->shm_segsz; |
7444 | out.shm_atime = in->shm_atime; |
7445 | diff --git a/kernel/exit.c b/kernel/exit.c |
7446 | index 0312022..d72167d 100644 |
7447 | --- a/kernel/exit.c |
7448 | +++ b/kernel/exit.c |
7449 | @@ -903,6 +903,15 @@ NORET_TYPE void do_exit(long code) |
7450 | if (unlikely(!tsk->pid)) |
7451 | panic("Attempted to kill the idle task!"); |
7452 | |
7453 | + /* |
7454 | + * If do_exit is called because this processes oopsed, it's possible |
7455 | + * that get_fs() was left as KERNEL_DS, so reset it to USER_DS before |
7456 | + * continuing. Amongst other possible reasons, this is to prevent |
7457 | + * mm_release()->clear_child_tid() from writing to a user-controlled |
7458 | + * kernel address. |
7459 | + */ |
7460 | + set_fs(USER_DS); |
7461 | + |
7462 | tracehook_report_exit(&code); |
7463 | |
7464 | validate_creds_for_do_exit(tsk); |
7465 | diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c |
7466 | index 09a2ee5..345e0b7 100644 |
7467 | --- a/kernel/irq/proc.c |
7468 | +++ b/kernel/irq/proc.c |
7469 | @@ -214,7 +214,7 @@ static int irq_spurious_proc_show(struct seq_file *m, void *v) |
7470 | |
7471 | static int irq_spurious_proc_open(struct inode *inode, struct file *file) |
7472 | { |
7473 | - return single_open(file, irq_spurious_proc_show, NULL); |
7474 | + return single_open(file, irq_spurious_proc_show, PDE(inode)->data); |
7475 | } |
7476 | |
7477 | static const struct file_operations irq_spurious_proc_fops = { |
7478 | diff --git a/kernel/latencytop.c b/kernel/latencytop.c |
7479 | index 877fb30..17110a4 100644 |
7480 | --- a/kernel/latencytop.c |
7481 | +++ b/kernel/latencytop.c |
7482 | @@ -194,14 +194,7 @@ __account_scheduler_latency(struct task_struct *tsk, int usecs, int inter) |
7483 | |
7484 | account_global_scheduler_latency(tsk, &lat); |
7485 | |
7486 | - /* |
7487 | - * short term hack; if we're > 32 we stop; future we recycle: |
7488 | - */ |
7489 | - tsk->latency_record_count++; |
7490 | - if (tsk->latency_record_count >= LT_SAVECOUNT) |
7491 | - goto out_unlock; |
7492 | - |
7493 | - for (i = 0; i < LT_SAVECOUNT; i++) { |
7494 | + for (i = 0; i < tsk->latency_record_count; i++) { |
7495 | struct latency_record *mylat; |
7496 | int same = 1; |
7497 | |
7498 | @@ -227,8 +220,14 @@ __account_scheduler_latency(struct task_struct *tsk, int usecs, int inter) |
7499 | } |
7500 | } |
7501 | |
7502 | + /* |
7503 | + * short term hack; if we're > 32 we stop; future we recycle: |
7504 | + */ |
7505 | + if (tsk->latency_record_count >= LT_SAVECOUNT) |
7506 | + goto out_unlock; |
7507 | + |
7508 | /* Allocated a new one: */ |
7509 | - i = tsk->latency_record_count; |
7510 | + i = tsk->latency_record_count++; |
7511 | memcpy(&tsk->latency_record[i], &lat, sizeof(struct latency_record)); |
7512 | |
7513 | out_unlock: |
7514 | diff --git a/kernel/perf_event.c b/kernel/perf_event.c |
7515 | index 03bb897..65b09a8 100644 |
7516 | --- a/kernel/perf_event.c |
7517 | +++ b/kernel/perf_event.c |
7518 | @@ -1620,8 +1620,12 @@ static void rotate_ctx(struct perf_event_context *ctx) |
7519 | { |
7520 | raw_spin_lock(&ctx->lock); |
7521 | |
7522 | - /* Rotate the first entry last of non-pinned groups */ |
7523 | - list_rotate_left(&ctx->flexible_groups); |
7524 | + /* |
7525 | + * Rotate the first entry last of non-pinned groups. Rotation might be |
7526 | + * disabled by the inheritance code. |
7527 | + */ |
7528 | + if (!ctx->rotate_disable) |
7529 | + list_rotate_left(&ctx->flexible_groups); |
7530 | |
7531 | raw_spin_unlock(&ctx->lock); |
7532 | } |
7533 | @@ -5622,6 +5626,7 @@ int perf_event_init_task(struct task_struct *child) |
7534 | struct perf_event *event; |
7535 | struct task_struct *parent = current; |
7536 | int inherited_all = 1; |
7537 | + unsigned long flags; |
7538 | int ret = 0; |
7539 | |
7540 | child->perf_event_ctxp = NULL; |
7541 | @@ -5662,6 +5667,15 @@ int perf_event_init_task(struct task_struct *child) |
7542 | break; |
7543 | } |
7544 | |
7545 | + /* |
7546 | + * We can't hold ctx->lock when iterating the ->flexible_group list due |
7547 | + * to allocations, but we need to prevent rotation because |
7548 | + * rotate_ctx() will change the list from interrupt context. |
7549 | + */ |
7550 | + raw_spin_lock_irqsave(&parent_ctx->lock, flags); |
7551 | + parent_ctx->rotate_disable = 1; |
7552 | + raw_spin_unlock_irqrestore(&parent_ctx->lock, flags); |
7553 | + |
7554 | list_for_each_entry(event, &parent_ctx->flexible_groups, group_entry) { |
7555 | ret = inherit_task_group(event, parent, parent_ctx, child, |
7556 | &inherited_all); |
7557 | @@ -5669,6 +5683,10 @@ int perf_event_init_task(struct task_struct *child) |
7558 | break; |
7559 | } |
7560 | |
7561 | + raw_spin_lock_irqsave(&parent_ctx->lock, flags); |
7562 | + parent_ctx->rotate_disable = 0; |
7563 | + raw_spin_unlock_irqrestore(&parent_ctx->lock, flags); |
7564 | + |
7565 | child_ctx = child->perf_event_ctxp; |
7566 | |
7567 | if (child_ctx && inherited_all) { |
7568 | diff --git a/kernel/pm_qos_params.c b/kernel/pm_qos_params.c |
7569 | index 645e541..0da2837 100644 |
7570 | --- a/kernel/pm_qos_params.c |
7571 | +++ b/kernel/pm_qos_params.c |
7572 | @@ -120,10 +120,10 @@ static inline int pm_qos_get_value(struct pm_qos_object *o) |
7573 | |
7574 | switch (o->type) { |
7575 | case PM_QOS_MIN: |
7576 | - return plist_last(&o->requests)->prio; |
7577 | + return plist_first(&o->requests)->prio; |
7578 | |
7579 | case PM_QOS_MAX: |
7580 | - return plist_first(&o->requests)->prio; |
7581 | + return plist_last(&o->requests)->prio; |
7582 | |
7583 | default: |
7584 | /* runtime check for not using enum */ |
7585 | diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c |
7586 | index 8dc31e0..7a931a9 100644 |
7587 | --- a/kernel/power/hibernate.c |
7588 | +++ b/kernel/power/hibernate.c |
7589 | @@ -326,7 +326,6 @@ static int create_image(int platform_mode) |
7590 | int hibernation_snapshot(int platform_mode) |
7591 | { |
7592 | int error; |
7593 | - gfp_t saved_mask; |
7594 | |
7595 | error = platform_begin(platform_mode); |
7596 | if (error) |
7597 | @@ -338,7 +337,7 @@ int hibernation_snapshot(int platform_mode) |
7598 | goto Close; |
7599 | |
7600 | suspend_console(); |
7601 | - saved_mask = clear_gfp_allowed_mask(GFP_IOFS); |
7602 | + pm_restrict_gfp_mask(); |
7603 | error = dpm_suspend_start(PMSG_FREEZE); |
7604 | if (error) |
7605 | goto Recover_platform; |
7606 | @@ -347,7 +346,10 @@ int hibernation_snapshot(int platform_mode) |
7607 | goto Recover_platform; |
7608 | |
7609 | error = create_image(platform_mode); |
7610 | - /* Control returns here after successful restore */ |
7611 | + /* |
7612 | + * Control returns here (1) after the image has been created or the |
7613 | + * image creation has failed and (2) after a successful restore. |
7614 | + */ |
7615 | |
7616 | Resume_devices: |
7617 | /* We may need to release the preallocated image pages here. */ |
7618 | @@ -356,7 +358,10 @@ int hibernation_snapshot(int platform_mode) |
7619 | |
7620 | dpm_resume_end(in_suspend ? |
7621 | (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); |
7622 | - set_gfp_allowed_mask(saved_mask); |
7623 | + |
7624 | + if (error || !in_suspend) |
7625 | + pm_restore_gfp_mask(); |
7626 | + |
7627 | resume_console(); |
7628 | Close: |
7629 | platform_end(platform_mode); |
7630 | @@ -451,17 +456,16 @@ static int resume_target_kernel(bool platform_mode) |
7631 | int hibernation_restore(int platform_mode) |
7632 | { |
7633 | int error; |
7634 | - gfp_t saved_mask; |
7635 | |
7636 | pm_prepare_console(); |
7637 | suspend_console(); |
7638 | - saved_mask = clear_gfp_allowed_mask(GFP_IOFS); |
7639 | + pm_restrict_gfp_mask(); |
7640 | error = dpm_suspend_start(PMSG_QUIESCE); |
7641 | if (!error) { |
7642 | error = resume_target_kernel(platform_mode); |
7643 | dpm_resume_end(PMSG_RECOVER); |
7644 | } |
7645 | - set_gfp_allowed_mask(saved_mask); |
7646 | + pm_restore_gfp_mask(); |
7647 | resume_console(); |
7648 | pm_restore_console(); |
7649 | return error; |
7650 | @@ -475,7 +479,6 @@ int hibernation_restore(int platform_mode) |
7651 | int hibernation_platform_enter(void) |
7652 | { |
7653 | int error; |
7654 | - gfp_t saved_mask; |
7655 | |
7656 | if (!hibernation_ops) |
7657 | return -ENOSYS; |
7658 | @@ -491,7 +494,6 @@ int hibernation_platform_enter(void) |
7659 | |
7660 | entering_platform_hibernation = true; |
7661 | suspend_console(); |
7662 | - saved_mask = clear_gfp_allowed_mask(GFP_IOFS); |
7663 | error = dpm_suspend_start(PMSG_HIBERNATE); |
7664 | if (error) { |
7665 | if (hibernation_ops->recover) |
7666 | @@ -535,7 +537,6 @@ int hibernation_platform_enter(void) |
7667 | Resume_devices: |
7668 | entering_platform_hibernation = false; |
7669 | dpm_resume_end(PMSG_RESTORE); |
7670 | - set_gfp_allowed_mask(saved_mask); |
7671 | resume_console(); |
7672 | |
7673 | Close: |
7674 | @@ -643,6 +644,7 @@ int hibernate(void) |
7675 | swsusp_free(); |
7676 | if (!error) |
7677 | power_down(); |
7678 | + pm_restore_gfp_mask(); |
7679 | } else { |
7680 | pr_debug("PM: Image restored successfully.\n"); |
7681 | } |
7682 | diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c |
7683 | index 7335952..ecf7705 100644 |
7684 | --- a/kernel/power/suspend.c |
7685 | +++ b/kernel/power/suspend.c |
7686 | @@ -197,7 +197,6 @@ static int suspend_enter(suspend_state_t state) |
7687 | int suspend_devices_and_enter(suspend_state_t state) |
7688 | { |
7689 | int error; |
7690 | - gfp_t saved_mask; |
7691 | |
7692 | if (!suspend_ops) |
7693 | return -ENOSYS; |
7694 | @@ -208,7 +207,7 @@ int suspend_devices_and_enter(suspend_state_t state) |
7695 | goto Close; |
7696 | } |
7697 | suspend_console(); |
7698 | - saved_mask = clear_gfp_allowed_mask(GFP_IOFS); |
7699 | + pm_restrict_gfp_mask(); |
7700 | suspend_test_start(); |
7701 | error = dpm_suspend_start(PMSG_SUSPEND); |
7702 | if (error) { |
7703 | @@ -225,7 +224,7 @@ int suspend_devices_and_enter(suspend_state_t state) |
7704 | suspend_test_start(); |
7705 | dpm_resume_end(PMSG_RESUME); |
7706 | suspend_test_finish("resume devices"); |
7707 | - set_gfp_allowed_mask(saved_mask); |
7708 | + pm_restore_gfp_mask(); |
7709 | resume_console(); |
7710 | Close: |
7711 | if (suspend_ops->end) |
7712 | diff --git a/kernel/power/user.c b/kernel/power/user.c |
7713 | index e819e17..1b2ea31 100644 |
7714 | --- a/kernel/power/user.c |
7715 | +++ b/kernel/power/user.c |
7716 | @@ -263,6 +263,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd, |
7717 | case SNAPSHOT_UNFREEZE: |
7718 | if (!data->frozen || data->ready) |
7719 | break; |
7720 | + pm_restore_gfp_mask(); |
7721 | thaw_processes(); |
7722 | usermodehelper_enable(); |
7723 | data->frozen = 0; |
7724 | @@ -275,6 +276,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd, |
7725 | error = -EPERM; |
7726 | break; |
7727 | } |
7728 | + pm_restore_gfp_mask(); |
7729 | error = hibernation_snapshot(data->platform_support); |
7730 | if (!error) |
7731 | error = put_user(in_suspend, (int __user *)arg); |
7732 | diff --git a/kernel/sched.c b/kernel/sched.c |
7733 | index 3fd774c..285f587 100644 |
7734 | --- a/kernel/sched.c |
7735 | +++ b/kernel/sched.c |
7736 | @@ -5330,7 +5330,19 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu) |
7737 | idle->se.exec_start = sched_clock(); |
7738 | |
7739 | cpumask_copy(&idle->cpus_allowed, cpumask_of(cpu)); |
7740 | + /* |
7741 | + * We're having a chicken and egg problem, even though we are |
7742 | + * holding rq->lock, the cpu isn't yet set to this cpu so the |
7743 | + * lockdep check in task_group() will fail. |
7744 | + * |
7745 | + * Similar case to sched_fork(). / Alternatively we could |
7746 | + * use task_rq_lock() here and obtain the other rq->lock. |
7747 | + * |
7748 | + * Silence PROVE_RCU |
7749 | + */ |
7750 | + rcu_read_lock(); |
7751 | __set_task_cpu(idle, cpu); |
7752 | + rcu_read_unlock(); |
7753 | |
7754 | rq->curr = rq->idle = idle; |
7755 | #if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW) |
7756 | diff --git a/lib/percpu_counter.c b/lib/percpu_counter.c |
7757 | index ec9048e..209448e 100644 |
7758 | --- a/lib/percpu_counter.c |
7759 | +++ b/lib/percpu_counter.c |
7760 | @@ -76,6 +76,7 @@ int __percpu_counter_init(struct percpu_counter *fbc, s64 amount, |
7761 | if (!fbc->counters) |
7762 | return -ENOMEM; |
7763 | #ifdef CONFIG_HOTPLUG_CPU |
7764 | + INIT_LIST_HEAD(&fbc->list); |
7765 | mutex_lock(&percpu_counters_lock); |
7766 | list_add(&fbc->list, &percpu_counters); |
7767 | mutex_unlock(&percpu_counters_lock); |
7768 | diff --git a/lib/radix-tree.c b/lib/radix-tree.c |
7769 | index efd16fa..296eb81 100644 |
7770 | --- a/lib/radix-tree.c |
7771 | +++ b/lib/radix-tree.c |
7772 | @@ -82,6 +82,16 @@ struct radix_tree_preload { |
7773 | }; |
7774 | static DEFINE_PER_CPU(struct radix_tree_preload, radix_tree_preloads) = { 0, }; |
7775 | |
7776 | +static inline void *ptr_to_indirect(void *ptr) |
7777 | +{ |
7778 | + return (void *)((unsigned long)ptr | RADIX_TREE_INDIRECT_PTR); |
7779 | +} |
7780 | + |
7781 | +static inline void *indirect_to_ptr(void *ptr) |
7782 | +{ |
7783 | + return (void *)((unsigned long)ptr & ~RADIX_TREE_INDIRECT_PTR); |
7784 | +} |
7785 | + |
7786 | static inline gfp_t root_gfp_mask(struct radix_tree_root *root) |
7787 | { |
7788 | return root->gfp_mask & __GFP_BITS_MASK; |
7789 | @@ -265,7 +275,7 @@ static int radix_tree_extend(struct radix_tree_root *root, unsigned long index) |
7790 | return -ENOMEM; |
7791 | |
7792 | /* Increase the height. */ |
7793 | - node->slots[0] = radix_tree_indirect_to_ptr(root->rnode); |
7794 | + node->slots[0] = indirect_to_ptr(root->rnode); |
7795 | |
7796 | /* Propagate the aggregated tag info into the new root */ |
7797 | for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) { |
7798 | @@ -276,7 +286,7 @@ static int radix_tree_extend(struct radix_tree_root *root, unsigned long index) |
7799 | newheight = root->height+1; |
7800 | node->height = newheight; |
7801 | node->count = 1; |
7802 | - node = radix_tree_ptr_to_indirect(node); |
7803 | + node = ptr_to_indirect(node); |
7804 | rcu_assign_pointer(root->rnode, node); |
7805 | root->height = newheight; |
7806 | } while (height > root->height); |
7807 | @@ -309,7 +319,7 @@ int radix_tree_insert(struct radix_tree_root *root, |
7808 | return error; |
7809 | } |
7810 | |
7811 | - slot = radix_tree_indirect_to_ptr(root->rnode); |
7812 | + slot = indirect_to_ptr(root->rnode); |
7813 | |
7814 | height = root->height; |
7815 | shift = (height-1) * RADIX_TREE_MAP_SHIFT; |
7816 | @@ -325,8 +335,7 @@ int radix_tree_insert(struct radix_tree_root *root, |
7817 | rcu_assign_pointer(node->slots[offset], slot); |
7818 | node->count++; |
7819 | } else |
7820 | - rcu_assign_pointer(root->rnode, |
7821 | - radix_tree_ptr_to_indirect(slot)); |
7822 | + rcu_assign_pointer(root->rnode, ptr_to_indirect(slot)); |
7823 | } |
7824 | |
7825 | /* Go a level down */ |
7826 | @@ -374,7 +383,7 @@ static void *radix_tree_lookup_element(struct radix_tree_root *root, |
7827 | return NULL; |
7828 | return is_slot ? (void *)&root->rnode : node; |
7829 | } |
7830 | - node = radix_tree_indirect_to_ptr(node); |
7831 | + node = indirect_to_ptr(node); |
7832 | |
7833 | height = node->height; |
7834 | if (index > radix_tree_maxindex(height)) |
7835 | @@ -393,7 +402,7 @@ static void *radix_tree_lookup_element(struct radix_tree_root *root, |
7836 | height--; |
7837 | } while (height > 0); |
7838 | |
7839 | - return is_slot ? (void *)slot:node; |
7840 | + return is_slot ? (void *)slot : indirect_to_ptr(node); |
7841 | } |
7842 | |
7843 | /** |
7844 | @@ -455,7 +464,7 @@ void *radix_tree_tag_set(struct radix_tree_root *root, |
7845 | height = root->height; |
7846 | BUG_ON(index > radix_tree_maxindex(height)); |
7847 | |
7848 | - slot = radix_tree_indirect_to_ptr(root->rnode); |
7849 | + slot = indirect_to_ptr(root->rnode); |
7850 | shift = (height - 1) * RADIX_TREE_MAP_SHIFT; |
7851 | |
7852 | while (height > 0) { |
7853 | @@ -509,7 +518,7 @@ void *radix_tree_tag_clear(struct radix_tree_root *root, |
7854 | |
7855 | shift = (height - 1) * RADIX_TREE_MAP_SHIFT; |
7856 | pathp->node = NULL; |
7857 | - slot = radix_tree_indirect_to_ptr(root->rnode); |
7858 | + slot = indirect_to_ptr(root->rnode); |
7859 | |
7860 | while (height > 0) { |
7861 | int offset; |
7862 | @@ -579,7 +588,7 @@ int radix_tree_tag_get(struct radix_tree_root *root, |
7863 | |
7864 | if (!radix_tree_is_indirect_ptr(node)) |
7865 | return (index == 0); |
7866 | - node = radix_tree_indirect_to_ptr(node); |
7867 | + node = indirect_to_ptr(node); |
7868 | |
7869 | height = node->height; |
7870 | if (index > radix_tree_maxindex(height)) |
7871 | @@ -666,7 +675,7 @@ unsigned long radix_tree_range_tag_if_tagged(struct radix_tree_root *root, |
7872 | } |
7873 | |
7874 | shift = (height - 1) * RADIX_TREE_MAP_SHIFT; |
7875 | - slot = radix_tree_indirect_to_ptr(root->rnode); |
7876 | + slot = indirect_to_ptr(root->rnode); |
7877 | |
7878 | /* |
7879 | * we fill the path from (root->height - 2) to 0, leaving the index at |
7880 | @@ -897,7 +906,7 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results, |
7881 | results[0] = node; |
7882 | return 1; |
7883 | } |
7884 | - node = radix_tree_indirect_to_ptr(node); |
7885 | + node = indirect_to_ptr(node); |
7886 | |
7887 | max_index = radix_tree_maxindex(node->height); |
7888 | |
7889 | @@ -916,7 +925,8 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results, |
7890 | slot = *(((void ***)results)[ret + i]); |
7891 | if (!slot) |
7892 | continue; |
7893 | - results[ret + nr_found] = rcu_dereference_raw(slot); |
7894 | + results[ret + nr_found] = |
7895 | + indirect_to_ptr(rcu_dereference_raw(slot)); |
7896 | nr_found++; |
7897 | } |
7898 | ret += nr_found; |
7899 | @@ -965,7 +975,7 @@ radix_tree_gang_lookup_slot(struct radix_tree_root *root, void ***results, |
7900 | results[0] = (void **)&root->rnode; |
7901 | return 1; |
7902 | } |
7903 | - node = radix_tree_indirect_to_ptr(node); |
7904 | + node = indirect_to_ptr(node); |
7905 | |
7906 | max_index = radix_tree_maxindex(node->height); |
7907 | |
7908 | @@ -1090,7 +1100,7 @@ radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, |
7909 | results[0] = node; |
7910 | return 1; |
7911 | } |
7912 | - node = radix_tree_indirect_to_ptr(node); |
7913 | + node = indirect_to_ptr(node); |
7914 | |
7915 | max_index = radix_tree_maxindex(node->height); |
7916 | |
7917 | @@ -1109,7 +1119,8 @@ radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, |
7918 | slot = *(((void ***)results)[ret + i]); |
7919 | if (!slot) |
7920 | continue; |
7921 | - results[ret + nr_found] = rcu_dereference_raw(slot); |
7922 | + results[ret + nr_found] = |
7923 | + indirect_to_ptr(rcu_dereference_raw(slot)); |
7924 | nr_found++; |
7925 | } |
7926 | ret += nr_found; |
7927 | @@ -1159,7 +1170,7 @@ radix_tree_gang_lookup_tag_slot(struct radix_tree_root *root, void ***results, |
7928 | results[0] = (void **)&root->rnode; |
7929 | return 1; |
7930 | } |
7931 | - node = radix_tree_indirect_to_ptr(node); |
7932 | + node = indirect_to_ptr(node); |
7933 | |
7934 | max_index = radix_tree_maxindex(node->height); |
7935 | |
7936 | @@ -1195,7 +1206,7 @@ static inline void radix_tree_shrink(struct radix_tree_root *root) |
7937 | void *newptr; |
7938 | |
7939 | BUG_ON(!radix_tree_is_indirect_ptr(to_free)); |
7940 | - to_free = radix_tree_indirect_to_ptr(to_free); |
7941 | + to_free = indirect_to_ptr(to_free); |
7942 | |
7943 | /* |
7944 | * The candidate node has more than one child, or its child |
7945 | @@ -1208,16 +1219,39 @@ static inline void radix_tree_shrink(struct radix_tree_root *root) |
7946 | |
7947 | /* |
7948 | * We don't need rcu_assign_pointer(), since we are simply |
7949 | - * moving the node from one part of the tree to another. If |
7950 | - * it was safe to dereference the old pointer to it |
7951 | + * moving the node from one part of the tree to another: if it |
7952 | + * was safe to dereference the old pointer to it |
7953 | * (to_free->slots[0]), it will be safe to dereference the new |
7954 | - * one (root->rnode). |
7955 | + * one (root->rnode) as far as dependent read barriers go. |
7956 | */ |
7957 | newptr = to_free->slots[0]; |
7958 | if (root->height > 1) |
7959 | - newptr = radix_tree_ptr_to_indirect(newptr); |
7960 | + newptr = ptr_to_indirect(newptr); |
7961 | root->rnode = newptr; |
7962 | root->height--; |
7963 | + |
7964 | + /* |
7965 | + * We have a dilemma here. The node's slot[0] must not be |
7966 | + * NULLed in case there are concurrent lookups expecting to |
7967 | + * find the item. However if this was a bottom-level node, |
7968 | + * then it may be subject to the slot pointer being visible |
7969 | + * to callers dereferencing it. If item corresponding to |
7970 | + * slot[0] is subsequently deleted, these callers would expect |
7971 | + * their slot to become empty sooner or later. |
7972 | + * |
7973 | + * For example, lockless pagecache will look up a slot, deref |
7974 | + * the page pointer, and if the page is 0 refcount it means it |
7975 | + * was concurrently deleted from pagecache so try the deref |
7976 | + * again. Fortunately there is already a requirement for logic |
7977 | + * to retry the entire slot lookup -- the indirect pointer |
7978 | + * problem (replacing direct root node with an indirect pointer |
7979 | + * also results in a stale slot). So tag the slot as indirect |
7980 | + * to force callers to retry. |
7981 | + */ |
7982 | + if (root->height == 0) |
7983 | + *((unsigned long *)&to_free->slots[0]) |= |
7984 | + RADIX_TREE_INDIRECT_PTR; |
7985 | + |
7986 | radix_tree_node_free(to_free); |
7987 | } |
7988 | } |
7989 | @@ -1254,7 +1288,7 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index) |
7990 | root->rnode = NULL; |
7991 | goto out; |
7992 | } |
7993 | - slot = radix_tree_indirect_to_ptr(slot); |
7994 | + slot = indirect_to_ptr(slot); |
7995 | |
7996 | shift = (height - 1) * RADIX_TREE_MAP_SHIFT; |
7997 | pathp->node = NULL; |
7998 | @@ -1296,8 +1330,7 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index) |
7999 | radix_tree_node_free(to_free); |
8000 | |
8001 | if (pathp->node->count) { |
8002 | - if (pathp->node == |
8003 | - radix_tree_indirect_to_ptr(root->rnode)) |
8004 | + if (pathp->node == indirect_to_ptr(root->rnode)) |
8005 | radix_tree_shrink(root); |
8006 | goto out; |
8007 | } |
8008 | diff --git a/mm/filemap.c b/mm/filemap.c |
8009 | index 3d4df44..9701a50 100644 |
8010 | --- a/mm/filemap.c |
8011 | +++ b/mm/filemap.c |
8012 | @@ -631,7 +631,9 @@ repeat: |
8013 | pagep = radix_tree_lookup_slot(&mapping->page_tree, offset); |
8014 | if (pagep) { |
8015 | page = radix_tree_deref_slot(pagep); |
8016 | - if (unlikely(!page || page == RADIX_TREE_RETRY)) |
8017 | + if (unlikely(!page)) |
8018 | + goto out; |
8019 | + if (radix_tree_deref_retry(page)) |
8020 | goto repeat; |
8021 | |
8022 | if (!page_cache_get_speculative(page)) |
8023 | @@ -647,6 +649,7 @@ repeat: |
8024 | goto repeat; |
8025 | } |
8026 | } |
8027 | +out: |
8028 | rcu_read_unlock(); |
8029 | |
8030 | return page; |
8031 | @@ -764,12 +767,11 @@ repeat: |
8032 | page = radix_tree_deref_slot((void **)pages[i]); |
8033 | if (unlikely(!page)) |
8034 | continue; |
8035 | - /* |
8036 | - * this can only trigger if nr_found == 1, making livelock |
8037 | - * a non issue. |
8038 | - */ |
8039 | - if (unlikely(page == RADIX_TREE_RETRY)) |
8040 | + if (radix_tree_deref_retry(page)) { |
8041 | + if (ret) |
8042 | + start = pages[ret-1]->index; |
8043 | goto restart; |
8044 | + } |
8045 | |
8046 | if (!page_cache_get_speculative(page)) |
8047 | goto repeat; |
8048 | @@ -817,11 +819,7 @@ repeat: |
8049 | page = radix_tree_deref_slot((void **)pages[i]); |
8050 | if (unlikely(!page)) |
8051 | continue; |
8052 | - /* |
8053 | - * this can only trigger if nr_found == 1, making livelock |
8054 | - * a non issue. |
8055 | - */ |
8056 | - if (unlikely(page == RADIX_TREE_RETRY)) |
8057 | + if (radix_tree_deref_retry(page)) |
8058 | goto restart; |
8059 | |
8060 | if (page->mapping == NULL || page->index != index) |
8061 | @@ -874,11 +872,7 @@ repeat: |
8062 | page = radix_tree_deref_slot((void **)pages[i]); |
8063 | if (unlikely(!page)) |
8064 | continue; |
8065 | - /* |
8066 | - * this can only trigger if nr_found == 1, making livelock |
8067 | - * a non issue. |
8068 | - */ |
8069 | - if (unlikely(page == RADIX_TREE_RETRY)) |
8070 | + if (radix_tree_deref_retry(page)) |
8071 | goto restart; |
8072 | |
8073 | if (!page_cache_get_speculative(page)) |
8074 | @@ -1016,6 +1010,9 @@ find_page: |
8075 | goto page_not_up_to_date; |
8076 | if (!trylock_page(page)) |
8077 | goto page_not_up_to_date; |
8078 | + /* Did it get truncated before we got the lock? */ |
8079 | + if (!page->mapping) |
8080 | + goto page_not_up_to_date_locked; |
8081 | if (!mapping->a_ops->is_partially_uptodate(page, |
8082 | desc, offset)) |
8083 | goto page_not_up_to_date_locked; |
8084 | diff --git a/mm/hugetlb.c b/mm/hugetlb.c |
8085 | index c032738..2697806 100644 |
8086 | --- a/mm/hugetlb.c |
8087 | +++ b/mm/hugetlb.c |
8088 | @@ -2380,8 +2380,11 @@ retry_avoidcopy: |
8089 | * When the original hugepage is shared one, it does not have |
8090 | * anon_vma prepared. |
8091 | */ |
8092 | - if (unlikely(anon_vma_prepare(vma))) |
8093 | + if (unlikely(anon_vma_prepare(vma))) { |
8094 | + /* Caller expects lock to be held */ |
8095 | + spin_lock(&mm->page_table_lock); |
8096 | return VM_FAULT_OOM; |
8097 | + } |
8098 | |
8099 | copy_huge_page(new_page, old_page, address, vma); |
8100 | __SetPageUptodate(new_page); |
8101 | @@ -2665,7 +2668,8 @@ out_page_table_lock: |
8102 | unlock_page(pagecache_page); |
8103 | put_page(pagecache_page); |
8104 | } |
8105 | - unlock_page(page); |
8106 | + if (page != pagecache_page) |
8107 | + unlock_page(page); |
8108 | |
8109 | out_mutex: |
8110 | mutex_unlock(&hugetlb_instantiation_mutex); |
8111 | diff --git a/mm/internal.h b/mm/internal.h |
8112 | index 6a697bb..dedb0af 100644 |
8113 | --- a/mm/internal.h |
8114 | +++ b/mm/internal.h |
8115 | @@ -62,7 +62,7 @@ extern bool is_free_buddy_page(struct page *page); |
8116 | */ |
8117 | static inline unsigned long page_order(struct page *page) |
8118 | { |
8119 | - VM_BUG_ON(!PageBuddy(page)); |
8120 | + /* PageBuddy() must be checked by the caller */ |
8121 | return page_private(page); |
8122 | } |
8123 | |
8124 | diff --git a/mm/memcontrol.c b/mm/memcontrol.c |
8125 | index 9be3cf8..e6aadd6 100644 |
8126 | --- a/mm/memcontrol.c |
8127 | +++ b/mm/memcontrol.c |
8128 | @@ -269,13 +269,14 @@ enum move_type { |
8129 | |
8130 | /* "mc" and its members are protected by cgroup_mutex */ |
8131 | static struct move_charge_struct { |
8132 | - spinlock_t lock; /* for from, to, moving_task */ |
8133 | + spinlock_t lock; /* for from, to */ |
8134 | struct mem_cgroup *from; |
8135 | struct mem_cgroup *to; |
8136 | unsigned long precharge; |
8137 | unsigned long moved_charge; |
8138 | unsigned long moved_swap; |
8139 | struct task_struct *moving_task; /* a task moving charges */ |
8140 | + struct mm_struct *mm; |
8141 | wait_queue_head_t waitq; /* a waitq for other context */ |
8142 | } mc = { |
8143 | .lock = __SPIN_LOCK_UNLOCKED(mc.lock), |
8144 | @@ -4445,7 +4446,7 @@ static unsigned long mem_cgroup_count_precharge(struct mm_struct *mm) |
8145 | unsigned long precharge; |
8146 | struct vm_area_struct *vma; |
8147 | |
8148 | - down_read(&mm->mmap_sem); |
8149 | + /* We've already held the mmap_sem */ |
8150 | for (vma = mm->mmap; vma; vma = vma->vm_next) { |
8151 | struct mm_walk mem_cgroup_count_precharge_walk = { |
8152 | .pmd_entry = mem_cgroup_count_precharge_pte_range, |
8153 | @@ -4457,7 +4458,6 @@ static unsigned long mem_cgroup_count_precharge(struct mm_struct *mm) |
8154 | walk_page_range(vma->vm_start, vma->vm_end, |
8155 | &mem_cgroup_count_precharge_walk); |
8156 | } |
8157 | - up_read(&mm->mmap_sem); |
8158 | |
8159 | precharge = mc.precharge; |
8160 | mc.precharge = 0; |
8161 | @@ -4508,11 +4508,16 @@ static void mem_cgroup_clear_mc(void) |
8162 | |
8163 | mc.moved_swap = 0; |
8164 | } |
8165 | + if (mc.mm) { |
8166 | + up_read(&mc.mm->mmap_sem); |
8167 | + mmput(mc.mm); |
8168 | + } |
8169 | spin_lock(&mc.lock); |
8170 | mc.from = NULL; |
8171 | mc.to = NULL; |
8172 | - mc.moving_task = NULL; |
8173 | spin_unlock(&mc.lock); |
8174 | + mc.moving_task = NULL; |
8175 | + mc.mm = NULL; |
8176 | memcg_oom_recover(from); |
8177 | memcg_oom_recover(to); |
8178 | wake_up_all(&mc.waitq); |
8179 | @@ -4537,26 +4542,37 @@ static int mem_cgroup_can_attach(struct cgroup_subsys *ss, |
8180 | return 0; |
8181 | /* We move charges only when we move a owner of the mm */ |
8182 | if (mm->owner == p) { |
8183 | + /* |
8184 | + * We do all the move charge works under one mmap_sem to |
8185 | + * avoid deadlock with down_write(&mmap_sem) |
8186 | + * -> try_charge() -> if (mc.moving_task) -> sleep. |
8187 | + */ |
8188 | + down_read(&mm->mmap_sem); |
8189 | + |
8190 | VM_BUG_ON(mc.from); |
8191 | VM_BUG_ON(mc.to); |
8192 | VM_BUG_ON(mc.precharge); |
8193 | VM_BUG_ON(mc.moved_charge); |
8194 | VM_BUG_ON(mc.moved_swap); |
8195 | VM_BUG_ON(mc.moving_task); |
8196 | + VM_BUG_ON(mc.mm); |
8197 | + |
8198 | spin_lock(&mc.lock); |
8199 | mc.from = from; |
8200 | mc.to = mem; |
8201 | mc.precharge = 0; |
8202 | mc.moved_charge = 0; |
8203 | mc.moved_swap = 0; |
8204 | - mc.moving_task = current; |
8205 | spin_unlock(&mc.lock); |
8206 | + mc.moving_task = current; |
8207 | + mc.mm = mm; |
8208 | |
8209 | ret = mem_cgroup_precharge_mc(mm); |
8210 | if (ret) |
8211 | mem_cgroup_clear_mc(); |
8212 | - } |
8213 | - mmput(mm); |
8214 | + /* We call up_read() and mmput() in clear_mc(). */ |
8215 | + } else |
8216 | + mmput(mm); |
8217 | } |
8218 | return ret; |
8219 | } |
8220 | @@ -4644,7 +4660,7 @@ static void mem_cgroup_move_charge(struct mm_struct *mm) |
8221 | struct vm_area_struct *vma; |
8222 | |
8223 | lru_add_drain_all(); |
8224 | - down_read(&mm->mmap_sem); |
8225 | + /* We've already held the mmap_sem */ |
8226 | for (vma = mm->mmap; vma; vma = vma->vm_next) { |
8227 | int ret; |
8228 | struct mm_walk mem_cgroup_move_charge_walk = { |
8229 | @@ -4663,7 +4679,6 @@ static void mem_cgroup_move_charge(struct mm_struct *mm) |
8230 | */ |
8231 | break; |
8232 | } |
8233 | - up_read(&mm->mmap_sem); |
8234 | } |
8235 | |
8236 | static void mem_cgroup_move_task(struct cgroup_subsys *ss, |
8237 | @@ -4672,17 +4687,11 @@ static void mem_cgroup_move_task(struct cgroup_subsys *ss, |
8238 | struct task_struct *p, |
8239 | bool threadgroup) |
8240 | { |
8241 | - struct mm_struct *mm; |
8242 | - |
8243 | - if (!mc.to) |
8244 | + if (!mc.mm) |
8245 | /* no need to move charge */ |
8246 | return; |
8247 | |
8248 | - mm = get_task_mm(p); |
8249 | - if (mm) { |
8250 | - mem_cgroup_move_charge(mm); |
8251 | - mmput(mm); |
8252 | - } |
8253 | + mem_cgroup_move_charge(mc.mm); |
8254 | mem_cgroup_clear_mc(); |
8255 | } |
8256 | #else /* !CONFIG_MMU */ |
8257 | diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c |
8258 | index dd186c1..6345dfe 100644 |
8259 | --- a/mm/memory_hotplug.c |
8260 | +++ b/mm/memory_hotplug.c |
8261 | @@ -659,7 +659,7 @@ static int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn) |
8262 | * Scanning pfn is much easier than scanning lru list. |
8263 | * Scan pfn from start to end and Find LRU page. |
8264 | */ |
8265 | -int scan_lru_pages(unsigned long start, unsigned long end) |
8266 | +unsigned long scan_lru_pages(unsigned long start, unsigned long end) |
8267 | { |
8268 | unsigned long pfn; |
8269 | struct page *page; |
8270 | diff --git a/mm/mempolicy.c b/mm/mempolicy.c |
8271 | index f969da5..c1002c6 100644 |
8272 | --- a/mm/mempolicy.c |
8273 | +++ b/mm/mempolicy.c |
8274 | @@ -1588,7 +1588,7 @@ unsigned slab_node(struct mempolicy *policy) |
8275 | (void)first_zones_zonelist(zonelist, highest_zoneidx, |
8276 | &policy->v.nodes, |
8277 | &zone); |
8278 | - return zone->node; |
8279 | + return zone ? zone->node : numa_node_id(); |
8280 | } |
8281 | |
8282 | default: |
8283 | diff --git a/mm/mprotect.c b/mm/mprotect.c |
8284 | index 2d1bf7c..4c51338 100644 |
8285 | --- a/mm/mprotect.c |
8286 | +++ b/mm/mprotect.c |
8287 | @@ -211,6 +211,7 @@ success: |
8288 | mmu_notifier_invalidate_range_end(mm, start, end); |
8289 | vm_stat_account(mm, oldflags, vma->vm_file, -nrpages); |
8290 | vm_stat_account(mm, newflags, vma->vm_file, nrpages); |
8291 | + perf_event_mmap(vma); |
8292 | return 0; |
8293 | |
8294 | fail: |
8295 | @@ -299,7 +300,6 @@ SYSCALL_DEFINE3(mprotect, unsigned long, start, size_t, len, |
8296 | error = mprotect_fixup(vma, &prev, nstart, tmp, newflags); |
8297 | if (error) |
8298 | goto out; |
8299 | - perf_event_mmap(vma); |
8300 | nstart = tmp; |
8301 | |
8302 | if (nstart < prev->vm_end) |
8303 | diff --git a/mm/nommu.c b/mm/nommu.c |
8304 | index 88ff091..acb3bd3 100644 |
8305 | --- a/mm/nommu.c |
8306 | +++ b/mm/nommu.c |
8307 | @@ -1668,6 +1668,7 @@ void exit_mmap(struct mm_struct *mm) |
8308 | mm->mmap = vma->vm_next; |
8309 | delete_vma_from_mm(vma); |
8310 | delete_vma(mm, vma); |
8311 | + cond_resched(); |
8312 | } |
8313 | |
8314 | kleave(""); |
8315 | diff --git a/mm/page_alloc.c b/mm/page_alloc.c |
8316 | index f12ad18..2bd6f6d 100644 |
8317 | --- a/mm/page_alloc.c |
8318 | +++ b/mm/page_alloc.c |
8319 | @@ -103,19 +103,24 @@ gfp_t gfp_allowed_mask __read_mostly = GFP_BOOT_MASK; |
8320 | * only be modified with pm_mutex held, unless the suspend/hibernate code is |
8321 | * guaranteed not to run in parallel with that modification). |
8322 | */ |
8323 | -void set_gfp_allowed_mask(gfp_t mask) |
8324 | + |
8325 | +static gfp_t saved_gfp_mask; |
8326 | + |
8327 | +void pm_restore_gfp_mask(void) |
8328 | { |
8329 | WARN_ON(!mutex_is_locked(&pm_mutex)); |
8330 | - gfp_allowed_mask = mask; |
8331 | + if (saved_gfp_mask) { |
8332 | + gfp_allowed_mask = saved_gfp_mask; |
8333 | + saved_gfp_mask = 0; |
8334 | + } |
8335 | } |
8336 | |
8337 | -gfp_t clear_gfp_allowed_mask(gfp_t mask) |
8338 | +void pm_restrict_gfp_mask(void) |
8339 | { |
8340 | - gfp_t ret = gfp_allowed_mask; |
8341 | - |
8342 | WARN_ON(!mutex_is_locked(&pm_mutex)); |
8343 | - gfp_allowed_mask &= ~mask; |
8344 | - return ret; |
8345 | + WARN_ON(saved_gfp_mask); |
8346 | + saved_gfp_mask = gfp_allowed_mask; |
8347 | + gfp_allowed_mask &= ~GFP_IOFS; |
8348 | } |
8349 | #endif /* CONFIG_PM_SLEEP */ |
8350 | |
8351 | @@ -530,7 +535,7 @@ static inline void __free_one_page(struct page *page, |
8352 | * so it's less likely to be used soon and more likely to be merged |
8353 | * as a higher order page |
8354 | */ |
8355 | - if ((order < MAX_ORDER-1) && pfn_valid_within(page_to_pfn(buddy))) { |
8356 | + if ((order < MAX_ORDER-2) && pfn_valid_within(page_to_pfn(buddy))) { |
8357 | struct page *higher_page, *higher_buddy; |
8358 | combined_idx = __find_combined_index(page_idx, order); |
8359 | higher_page = page + combined_idx - page_idx; |
8360 | diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c |
8361 | index 0eb96f7..2dcff0b 100644 |
8362 | --- a/net/8021q/vlan_core.c |
8363 | +++ b/net/8021q/vlan_core.c |
8364 | @@ -43,6 +43,9 @@ int vlan_hwaccel_do_receive(struct sk_buff *skb) |
8365 | struct net_device *dev = skb->dev; |
8366 | struct vlan_rx_stats *rx_stats; |
8367 | |
8368 | + if (unlikely(!is_vlan_dev(dev))) |
8369 | + return 0; |
8370 | + |
8371 | skb->dev = vlan_dev_info(dev)->real_dev; |
8372 | netif_nit_deliver(skb); |
8373 | |
8374 | diff --git a/net/can/bcm.c b/net/can/bcm.c |
8375 | index 08ffe9e..6faa825 100644 |
8376 | --- a/net/can/bcm.c |
8377 | +++ b/net/can/bcm.c |
8378 | @@ -125,7 +125,7 @@ struct bcm_sock { |
8379 | struct list_head tx_ops; |
8380 | unsigned long dropped_usr_msgs; |
8381 | struct proc_dir_entry *bcm_proc_read; |
8382 | - char procname [9]; /* pointer printed in ASCII with \0 */ |
8383 | + char procname [20]; /* pointer printed in ASCII with \0 */ |
8384 | }; |
8385 | |
8386 | static inline struct bcm_sock *bcm_sk(const struct sock *sk) |
8387 | diff --git a/net/compat.c b/net/compat.c |
8388 | index 63d260e..3649d58 100644 |
8389 | --- a/net/compat.c |
8390 | +++ b/net/compat.c |
8391 | @@ -41,10 +41,12 @@ static inline int iov_from_user_compat_to_kern(struct iovec *kiov, |
8392 | compat_size_t len; |
8393 | |
8394 | if (get_user(len, &uiov32->iov_len) || |
8395 | - get_user(buf, &uiov32->iov_base)) { |
8396 | - tot_len = -EFAULT; |
8397 | - break; |
8398 | - } |
8399 | + get_user(buf, &uiov32->iov_base)) |
8400 | + return -EFAULT; |
8401 | + |
8402 | + if (len > INT_MAX - tot_len) |
8403 | + len = INT_MAX - tot_len; |
8404 | + |
8405 | tot_len += len; |
8406 | kiov->iov_base = compat_ptr(buf); |
8407 | kiov->iov_len = (__kernel_size_t) len; |
8408 | diff --git a/net/core/dev.c b/net/core/dev.c |
8409 | index 660dd41..1dad6c0 100644 |
8410 | --- a/net/core/dev.c |
8411 | +++ b/net/core/dev.c |
8412 | @@ -1648,10 +1648,10 @@ EXPORT_SYMBOL(netif_device_attach); |
8413 | |
8414 | static bool can_checksum_protocol(unsigned long features, __be16 protocol) |
8415 | { |
8416 | - return ((features & NETIF_F_GEN_CSUM) || |
8417 | - ((features & NETIF_F_IP_CSUM) && |
8418 | + return ((features & NETIF_F_NO_CSUM) || |
8419 | + ((features & NETIF_F_V4_CSUM) && |
8420 | protocol == htons(ETH_P_IP)) || |
8421 | - ((features & NETIF_F_IPV6_CSUM) && |
8422 | + ((features & NETIF_F_V6_CSUM) && |
8423 | protocol == htons(ETH_P_IPV6)) || |
8424 | ((features & NETIF_F_FCOE_CRC) && |
8425 | protocol == htons(ETH_P_FCOE))); |
8426 | @@ -2891,6 +2891,15 @@ static int __netif_receive_skb(struct sk_buff *skb) |
8427 | ncls: |
8428 | #endif |
8429 | |
8430 | + /* If we got this far with a hardware accelerated VLAN tag, it means |
8431 | + * that we were put in promiscuous mode but nobody is interested in |
8432 | + * this vid. Drop the packet now to prevent it from getting propagated |
8433 | + * to other parts of the stack that won't know how to deal with packets |
8434 | + * tagged in this manner. |
8435 | + */ |
8436 | + if (unlikely(vlan_tx_tag_present(skb))) |
8437 | + goto bypass; |
8438 | + |
8439 | /* Handle special case of bridge or macvlan */ |
8440 | rx_handler = rcu_dereference(skb->dev->rx_handler); |
8441 | if (rx_handler) { |
8442 | @@ -2927,6 +2936,7 @@ ncls: |
8443 | } |
8444 | } |
8445 | |
8446 | +bypass: |
8447 | if (pt_prev) { |
8448 | ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev); |
8449 | } else { |
8450 | diff --git a/net/core/filter.c b/net/core/filter.c |
8451 | index 52b051f..f68e497 100644 |
8452 | --- a/net/core/filter.c |
8453 | +++ b/net/core/filter.c |
8454 | @@ -112,39 +112,41 @@ EXPORT_SYMBOL(sk_filter); |
8455 | */ |
8456 | unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen) |
8457 | { |
8458 | - struct sock_filter *fentry; /* We walk down these */ |
8459 | void *ptr; |
8460 | u32 A = 0; /* Accumulator */ |
8461 | u32 X = 0; /* Index Register */ |
8462 | u32 mem[BPF_MEMWORDS]; /* Scratch Memory Store */ |
8463 | + unsigned long memvalid = 0; |
8464 | u32 tmp; |
8465 | int k; |
8466 | int pc; |
8467 | |
8468 | + BUILD_BUG_ON(BPF_MEMWORDS > BITS_PER_LONG); |
8469 | /* |
8470 | * Process array of filter instructions. |
8471 | */ |
8472 | for (pc = 0; pc < flen; pc++) { |
8473 | - fentry = &filter[pc]; |
8474 | + const struct sock_filter *fentry = &filter[pc]; |
8475 | + u32 f_k = fentry->k; |
8476 | |
8477 | switch (fentry->code) { |
8478 | case BPF_S_ALU_ADD_X: |
8479 | A += X; |
8480 | continue; |
8481 | case BPF_S_ALU_ADD_K: |
8482 | - A += fentry->k; |
8483 | + A += f_k; |
8484 | continue; |
8485 | case BPF_S_ALU_SUB_X: |
8486 | A -= X; |
8487 | continue; |
8488 | case BPF_S_ALU_SUB_K: |
8489 | - A -= fentry->k; |
8490 | + A -= f_k; |
8491 | continue; |
8492 | case BPF_S_ALU_MUL_X: |
8493 | A *= X; |
8494 | continue; |
8495 | case BPF_S_ALU_MUL_K: |
8496 | - A *= fentry->k; |
8497 | + A *= f_k; |
8498 | continue; |
8499 | case BPF_S_ALU_DIV_X: |
8500 | if (X == 0) |
8501 | @@ -152,49 +154,49 @@ unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int |
8502 | A /= X; |
8503 | continue; |
8504 | case BPF_S_ALU_DIV_K: |
8505 | - A /= fentry->k; |
8506 | + A /= f_k; |
8507 | continue; |
8508 | case BPF_S_ALU_AND_X: |
8509 | A &= X; |
8510 | continue; |
8511 | case BPF_S_ALU_AND_K: |
8512 | - A &= fentry->k; |
8513 | + A &= f_k; |
8514 | continue; |
8515 | case BPF_S_ALU_OR_X: |
8516 | A |= X; |
8517 | continue; |
8518 | case BPF_S_ALU_OR_K: |
8519 | - A |= fentry->k; |
8520 | + A |= f_k; |
8521 | continue; |
8522 | case BPF_S_ALU_LSH_X: |
8523 | A <<= X; |
8524 | continue; |
8525 | case BPF_S_ALU_LSH_K: |
8526 | - A <<= fentry->k; |
8527 | + A <<= f_k; |
8528 | continue; |
8529 | case BPF_S_ALU_RSH_X: |
8530 | A >>= X; |
8531 | continue; |
8532 | case BPF_S_ALU_RSH_K: |
8533 | - A >>= fentry->k; |
8534 | + A >>= f_k; |
8535 | continue; |
8536 | case BPF_S_ALU_NEG: |
8537 | A = -A; |
8538 | continue; |
8539 | case BPF_S_JMP_JA: |
8540 | - pc += fentry->k; |
8541 | + pc += f_k; |
8542 | continue; |
8543 | case BPF_S_JMP_JGT_K: |
8544 | - pc += (A > fentry->k) ? fentry->jt : fentry->jf; |
8545 | + pc += (A > f_k) ? fentry->jt : fentry->jf; |
8546 | continue; |
8547 | case BPF_S_JMP_JGE_K: |
8548 | - pc += (A >= fentry->k) ? fentry->jt : fentry->jf; |
8549 | + pc += (A >= f_k) ? fentry->jt : fentry->jf; |
8550 | continue; |
8551 | case BPF_S_JMP_JEQ_K: |
8552 | - pc += (A == fentry->k) ? fentry->jt : fentry->jf; |
8553 | + pc += (A == f_k) ? fentry->jt : fentry->jf; |
8554 | continue; |
8555 | case BPF_S_JMP_JSET_K: |
8556 | - pc += (A & fentry->k) ? fentry->jt : fentry->jf; |
8557 | + pc += (A & f_k) ? fentry->jt : fentry->jf; |
8558 | continue; |
8559 | case BPF_S_JMP_JGT_X: |
8560 | pc += (A > X) ? fentry->jt : fentry->jf; |
8561 | @@ -209,7 +211,7 @@ unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int |
8562 | pc += (A & X) ? fentry->jt : fentry->jf; |
8563 | continue; |
8564 | case BPF_S_LD_W_ABS: |
8565 | - k = fentry->k; |
8566 | + k = f_k; |
8567 | load_w: |
8568 | ptr = load_pointer(skb, k, 4, &tmp); |
8569 | if (ptr != NULL) { |
8570 | @@ -218,7 +220,7 @@ load_w: |
8571 | } |
8572 | break; |
8573 | case BPF_S_LD_H_ABS: |
8574 | - k = fentry->k; |
8575 | + k = f_k; |
8576 | load_h: |
8577 | ptr = load_pointer(skb, k, 2, &tmp); |
8578 | if (ptr != NULL) { |
8579 | @@ -227,7 +229,7 @@ load_h: |
8580 | } |
8581 | break; |
8582 | case BPF_S_LD_B_ABS: |
8583 | - k = fentry->k; |
8584 | + k = f_k; |
8585 | load_b: |
8586 | ptr = load_pointer(skb, k, 1, &tmp); |
8587 | if (ptr != NULL) { |
8588 | @@ -242,32 +244,34 @@ load_b: |
8589 | X = skb->len; |
8590 | continue; |
8591 | case BPF_S_LD_W_IND: |
8592 | - k = X + fentry->k; |
8593 | + k = X + f_k; |
8594 | goto load_w; |
8595 | case BPF_S_LD_H_IND: |
8596 | - k = X + fentry->k; |
8597 | + k = X + f_k; |
8598 | goto load_h; |
8599 | case BPF_S_LD_B_IND: |
8600 | - k = X + fentry->k; |
8601 | + k = X + f_k; |
8602 | goto load_b; |
8603 | case BPF_S_LDX_B_MSH: |
8604 | - ptr = load_pointer(skb, fentry->k, 1, &tmp); |
8605 | + ptr = load_pointer(skb, f_k, 1, &tmp); |
8606 | if (ptr != NULL) { |
8607 | X = (*(u8 *)ptr & 0xf) << 2; |
8608 | continue; |
8609 | } |
8610 | return 0; |
8611 | case BPF_S_LD_IMM: |
8612 | - A = fentry->k; |
8613 | + A = f_k; |
8614 | continue; |
8615 | case BPF_S_LDX_IMM: |
8616 | - X = fentry->k; |
8617 | + X = f_k; |
8618 | continue; |
8619 | case BPF_S_LD_MEM: |
8620 | - A = mem[fentry->k]; |
8621 | + A = (memvalid & (1UL << f_k)) ? |
8622 | + mem[f_k] : 0; |
8623 | continue; |
8624 | case BPF_S_LDX_MEM: |
8625 | - X = mem[fentry->k]; |
8626 | + X = (memvalid & (1UL << f_k)) ? |
8627 | + mem[f_k] : 0; |
8628 | continue; |
8629 | case BPF_S_MISC_TAX: |
8630 | X = A; |
8631 | @@ -276,14 +280,16 @@ load_b: |
8632 | A = X; |
8633 | continue; |
8634 | case BPF_S_RET_K: |
8635 | - return fentry->k; |
8636 | + return f_k; |
8637 | case BPF_S_RET_A: |
8638 | return A; |
8639 | case BPF_S_ST: |
8640 | - mem[fentry->k] = A; |
8641 | + memvalid |= 1UL << f_k; |
8642 | + mem[f_k] = A; |
8643 | continue; |
8644 | case BPF_S_STX: |
8645 | - mem[fentry->k] = X; |
8646 | + memvalid |= 1UL << f_k; |
8647 | + mem[f_k] = X; |
8648 | continue; |
8649 | default: |
8650 | WARN_ON(1); |
8651 | diff --git a/net/core/iovec.c b/net/core/iovec.c |
8652 | index e6b133b..58eb999 100644 |
8653 | --- a/net/core/iovec.c |
8654 | +++ b/net/core/iovec.c |
8655 | @@ -35,10 +35,9 @@ |
8656 | * in any case. |
8657 | */ |
8658 | |
8659 | -long verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode) |
8660 | +int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode) |
8661 | { |
8662 | - int size, ct; |
8663 | - long err; |
8664 | + int size, ct, err; |
8665 | |
8666 | if (m->msg_namelen) { |
8667 | if (mode == VERIFY_READ) { |
8668 | @@ -60,14 +59,13 @@ long verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, |
8669 | err = 0; |
8670 | |
8671 | for (ct = 0; ct < m->msg_iovlen; ct++) { |
8672 | - err += iov[ct].iov_len; |
8673 | - /* |
8674 | - * Goal is not to verify user data, but to prevent returning |
8675 | - * negative value, which is interpreted as errno. |
8676 | - * Overflow is still possible, but it is harmless. |
8677 | - */ |
8678 | - if (err < 0) |
8679 | - return -EMSGSIZE; |
8680 | + size_t len = iov[ct].iov_len; |
8681 | + |
8682 | + if (len > INT_MAX - err) { |
8683 | + len = INT_MAX - err; |
8684 | + iov[ct].iov_len = len; |
8685 | + } |
8686 | + err += len; |
8687 | } |
8688 | |
8689 | return err; |
8690 | diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c |
8691 | index d6b93d1..cf38f52 100644 |
8692 | --- a/net/decnet/af_decnet.c |
8693 | +++ b/net/decnet/af_decnet.c |
8694 | @@ -1556,6 +1556,8 @@ static int __dn_getsockopt(struct socket *sock, int level,int optname, char __us |
8695 | if (r_len > sizeof(struct linkinfo_dn)) |
8696 | r_len = sizeof(struct linkinfo_dn); |
8697 | |
8698 | + memset(&link, 0, sizeof(link)); |
8699 | + |
8700 | switch(sock->state) { |
8701 | case SS_CONNECTING: |
8702 | link.idn_linkstate = LL_CONNECTING; |
8703 | diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c |
8704 | index dc54bd0..d2fe17d 100644 |
8705 | --- a/net/econet/af_econet.c |
8706 | +++ b/net/econet/af_econet.c |
8707 | @@ -31,6 +31,7 @@ |
8708 | #include <linux/skbuff.h> |
8709 | #include <linux/udp.h> |
8710 | #include <linux/slab.h> |
8711 | +#include <linux/vmalloc.h> |
8712 | #include <net/sock.h> |
8713 | #include <net/inet_common.h> |
8714 | #include <linux/stat.h> |
8715 | @@ -276,12 +277,12 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, |
8716 | #endif |
8717 | #ifdef CONFIG_ECONET_AUNUDP |
8718 | struct msghdr udpmsg; |
8719 | - struct iovec iov[msg->msg_iovlen+1]; |
8720 | + struct iovec iov[2]; |
8721 | struct aunhdr ah; |
8722 | struct sockaddr_in udpdest; |
8723 | __kernel_size_t size; |
8724 | - int i; |
8725 | mm_segment_t oldfs; |
8726 | + char *userbuf; |
8727 | #endif |
8728 | |
8729 | /* |
8730 | @@ -297,23 +298,14 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, |
8731 | |
8732 | mutex_lock(&econet_mutex); |
8733 | |
8734 | - if (saddr == NULL) { |
8735 | - struct econet_sock *eo = ec_sk(sk); |
8736 | - |
8737 | - addr.station = eo->station; |
8738 | - addr.net = eo->net; |
8739 | - port = eo->port; |
8740 | - cb = eo->cb; |
8741 | - } else { |
8742 | - if (msg->msg_namelen < sizeof(struct sockaddr_ec)) { |
8743 | - mutex_unlock(&econet_mutex); |
8744 | - return -EINVAL; |
8745 | - } |
8746 | - addr.station = saddr->addr.station; |
8747 | - addr.net = saddr->addr.net; |
8748 | - port = saddr->port; |
8749 | - cb = saddr->cb; |
8750 | - } |
8751 | + if (saddr == NULL || msg->msg_namelen < sizeof(struct sockaddr_ec)) { |
8752 | + mutex_unlock(&econet_mutex); |
8753 | + return -EINVAL; |
8754 | + } |
8755 | + addr.station = saddr->addr.station; |
8756 | + addr.net = saddr->addr.net; |
8757 | + port = saddr->port; |
8758 | + cb = saddr->cb; |
8759 | |
8760 | /* Look for a device with the right network number. */ |
8761 | dev = net2dev_map[addr.net]; |
8762 | @@ -328,17 +320,17 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, |
8763 | } |
8764 | } |
8765 | |
8766 | - if (len + 15 > dev->mtu) { |
8767 | - mutex_unlock(&econet_mutex); |
8768 | - return -EMSGSIZE; |
8769 | - } |
8770 | - |
8771 | if (dev->type == ARPHRD_ECONET) { |
8772 | /* Real hardware Econet. We're not worthy etc. */ |
8773 | #ifdef CONFIG_ECONET_NATIVE |
8774 | unsigned short proto = 0; |
8775 | int res; |
8776 | |
8777 | + if (len + 15 > dev->mtu) { |
8778 | + mutex_unlock(&econet_mutex); |
8779 | + return -EMSGSIZE; |
8780 | + } |
8781 | + |
8782 | dev_hold(dev); |
8783 | |
8784 | skb = sock_alloc_send_skb(sk, len+LL_ALLOCATED_SPACE(dev), |
8785 | @@ -351,7 +343,6 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, |
8786 | |
8787 | eb = (struct ec_cb *)&skb->cb; |
8788 | |
8789 | - /* BUG: saddr may be NULL */ |
8790 | eb->cookie = saddr->cookie; |
8791 | eb->sec = *saddr; |
8792 | eb->sent = ec_tx_done; |
8793 | @@ -415,6 +406,11 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, |
8794 | return -ENETDOWN; /* No socket - can't send */ |
8795 | } |
8796 | |
8797 | + if (len > 32768) { |
8798 | + err = -E2BIG; |
8799 | + goto error; |
8800 | + } |
8801 | + |
8802 | /* Make up a UDP datagram and hand it off to some higher intellect. */ |
8803 | |
8804 | memset(&udpdest, 0, sizeof(udpdest)); |
8805 | @@ -446,36 +442,26 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, |
8806 | |
8807 | /* tack our header on the front of the iovec */ |
8808 | size = sizeof(struct aunhdr); |
8809 | - /* |
8810 | - * XXX: that is b0rken. We can't mix userland and kernel pointers |
8811 | - * in iovec, since on a lot of platforms copy_from_user() will |
8812 | - * *not* work with the kernel and userland ones at the same time, |
8813 | - * regardless of what we do with set_fs(). And we are talking about |
8814 | - * econet-over-ethernet here, so "it's only ARM anyway" doesn't |
8815 | - * apply. Any suggestions on fixing that code? -- AV |
8816 | - */ |
8817 | iov[0].iov_base = (void *)&ah; |
8818 | iov[0].iov_len = size; |
8819 | - for (i = 0; i < msg->msg_iovlen; i++) { |
8820 | - void __user *base = msg->msg_iov[i].iov_base; |
8821 | - size_t iov_len = msg->msg_iov[i].iov_len; |
8822 | - /* Check it now since we switch to KERNEL_DS later. */ |
8823 | - if (!access_ok(VERIFY_READ, base, iov_len)) { |
8824 | - mutex_unlock(&econet_mutex); |
8825 | - return -EFAULT; |
8826 | - } |
8827 | - iov[i+1].iov_base = base; |
8828 | - iov[i+1].iov_len = iov_len; |
8829 | - size += iov_len; |
8830 | + |
8831 | + userbuf = vmalloc(len); |
8832 | + if (userbuf == NULL) { |
8833 | + err = -ENOMEM; |
8834 | + goto error; |
8835 | } |
8836 | |
8837 | + iov[1].iov_base = userbuf; |
8838 | + iov[1].iov_len = len; |
8839 | + err = memcpy_fromiovec(userbuf, msg->msg_iov, len); |
8840 | + if (err) |
8841 | + goto error_free_buf; |
8842 | + |
8843 | /* Get a skbuff (no data, just holds our cb information) */ |
8844 | if ((skb = sock_alloc_send_skb(sk, 0, |
8845 | msg->msg_flags & MSG_DONTWAIT, |
8846 | - &err)) == NULL) { |
8847 | - mutex_unlock(&econet_mutex); |
8848 | - return err; |
8849 | - } |
8850 | + &err)) == NULL) |
8851 | + goto error_free_buf; |
8852 | |
8853 | eb = (struct ec_cb *)&skb->cb; |
8854 | |
8855 | @@ -491,7 +477,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, |
8856 | udpmsg.msg_name = (void *)&udpdest; |
8857 | udpmsg.msg_namelen = sizeof(udpdest); |
8858 | udpmsg.msg_iov = &iov[0]; |
8859 | - udpmsg.msg_iovlen = msg->msg_iovlen + 1; |
8860 | + udpmsg.msg_iovlen = 2; |
8861 | udpmsg.msg_control = NULL; |
8862 | udpmsg.msg_controllen = 0; |
8863 | udpmsg.msg_flags=0; |
8864 | @@ -499,9 +485,13 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, |
8865 | oldfs = get_fs(); set_fs(KERNEL_DS); /* More privs :-) */ |
8866 | err = sock_sendmsg(udpsock, &udpmsg, size); |
8867 | set_fs(oldfs); |
8868 | + |
8869 | +error_free_buf: |
8870 | + vfree(userbuf); |
8871 | #else |
8872 | err = -EPROTOTYPE; |
8873 | #endif |
8874 | + error: |
8875 | mutex_unlock(&econet_mutex); |
8876 | |
8877 | return err; |
8878 | @@ -671,6 +661,9 @@ static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg) |
8879 | err = 0; |
8880 | switch (cmd) { |
8881 | case SIOCSIFADDR: |
8882 | + if (!capable(CAP_NET_ADMIN)) |
8883 | + return -EPERM; |
8884 | + |
8885 | edev = dev->ec_ptr; |
8886 | if (edev == NULL) { |
8887 | /* Magic up a new one. */ |
8888 | diff --git a/net/irda/iriap.c b/net/irda/iriap.c |
8889 | index fce364c..5b743bd 100644 |
8890 | --- a/net/irda/iriap.c |
8891 | +++ b/net/irda/iriap.c |
8892 | @@ -502,7 +502,8 @@ static void iriap_getvaluebyclass_confirm(struct iriap_cb *self, |
8893 | IRDA_DEBUG(4, "%s(), strlen=%d\n", __func__, value_len); |
8894 | |
8895 | /* Make sure the string is null-terminated */ |
8896 | - fp[n+value_len] = 0x00; |
8897 | + if (n + value_len < skb->len) |
8898 | + fp[n + value_len] = 0x00; |
8899 | IRDA_DEBUG(4, "Got string %s\n", fp+n); |
8900 | |
8901 | /* Will truncate to IAS_MAX_STRING bytes */ |
8902 | diff --git a/net/irda/parameters.c b/net/irda/parameters.c |
8903 | index fc1a205..71cd38c 100644 |
8904 | --- a/net/irda/parameters.c |
8905 | +++ b/net/irda/parameters.c |
8906 | @@ -298,6 +298,8 @@ static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi, |
8907 | |
8908 | p.pi = pi; /* In case handler needs to know */ |
8909 | p.pl = buf[1]; /* Extract length of value */ |
8910 | + if (p.pl > 32) |
8911 | + p.pl = 32; |
8912 | |
8913 | IRDA_DEBUG(2, "%s(), pi=%#x, pl=%d\n", __func__, |
8914 | p.pi, p.pl); |
8915 | @@ -318,7 +320,7 @@ static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi, |
8916 | (__u8) str[0], (__u8) str[1]); |
8917 | |
8918 | /* Null terminate string */ |
8919 | - str[p.pl+1] = '\0'; |
8920 | + str[p.pl] = '\0'; |
8921 | |
8922 | p.pv.c = str; /* Handler will need to take a copy */ |
8923 | |
8924 | diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c |
8925 | index 29ac8e1..2095602 100644 |
8926 | --- a/net/mac80211/cfg.c |
8927 | +++ b/net/mac80211/cfg.c |
8928 | @@ -634,6 +634,7 @@ static void sta_apply_parameters(struct ieee80211_local *local, |
8929 | struct sta_info *sta, |
8930 | struct station_parameters *params) |
8931 | { |
8932 | + unsigned long flags; |
8933 | u32 rates; |
8934 | int i, j; |
8935 | struct ieee80211_supported_band *sband; |
8936 | @@ -642,7 +643,7 @@ static void sta_apply_parameters(struct ieee80211_local *local, |
8937 | |
8938 | sband = local->hw.wiphy->bands[local->oper_channel->band]; |
8939 | |
8940 | - spin_lock_bh(&sta->lock); |
8941 | + spin_lock_irqsave(&sta->flaglock, flags); |
8942 | mask = params->sta_flags_mask; |
8943 | set = params->sta_flags_set; |
8944 | |
8945 | @@ -669,7 +670,7 @@ static void sta_apply_parameters(struct ieee80211_local *local, |
8946 | if (set & BIT(NL80211_STA_FLAG_MFP)) |
8947 | sta->flags |= WLAN_STA_MFP; |
8948 | } |
8949 | - spin_unlock_bh(&sta->lock); |
8950 | + spin_unlock_irqrestore(&sta->flaglock, flags); |
8951 | |
8952 | /* |
8953 | * cfg80211 validates this (1-2007) and allows setting the AID |
8954 | diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c |
8955 | index c691780..45c99f0 100644 |
8956 | --- a/net/mac80211/ibss.c |
8957 | +++ b/net/mac80211/ibss.c |
8958 | @@ -435,6 +435,7 @@ struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, |
8959 | if (!sta) |
8960 | return NULL; |
8961 | |
8962 | + sta->last_rx = jiffies; |
8963 | set_sta_flags(sta, WLAN_STA_AUTHORIZED); |
8964 | |
8965 | /* make sure mandatory rates are always added */ |
8966 | diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h |
8967 | index 65e0ed6..3546054 100644 |
8968 | --- a/net/mac80211/ieee80211_i.h |
8969 | +++ b/net/mac80211/ieee80211_i.h |
8970 | @@ -1003,6 +1003,8 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata); |
8971 | void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata); |
8972 | void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, |
8973 | struct sk_buff *skb); |
8974 | +void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata); |
8975 | +void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata); |
8976 | |
8977 | /* IBSS code */ |
8978 | void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); |
8979 | diff --git a/net/mac80211/main.c b/net/mac80211/main.c |
8980 | index ded5c38..e8acdb2 100644 |
8981 | --- a/net/mac80211/main.c |
8982 | +++ b/net/mac80211/main.c |
8983 | @@ -108,7 +108,8 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) |
8984 | chan = scan_chan; |
8985 | channel_type = NL80211_CHAN_NO_HT; |
8986 | local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL; |
8987 | - } else if (local->tmp_channel) { |
8988 | + } else if (local->tmp_channel && |
8989 | + local->oper_channel != local->tmp_channel) { |
8990 | chan = scan_chan = local->tmp_channel; |
8991 | channel_type = local->tmp_channel_type; |
8992 | local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL; |
8993 | diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c |
8994 | index ea13a80..1c91f0f 100644 |
8995 | --- a/net/mac80211/mesh_plink.c |
8996 | +++ b/net/mac80211/mesh_plink.c |
8997 | @@ -412,7 +412,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m |
8998 | enum plink_event event; |
8999 | enum plink_frame_type ftype; |
9000 | size_t baselen; |
9001 | - bool deactivated; |
9002 | + bool deactivated, matches_local = true; |
9003 | u8 ie_len; |
9004 | u8 *baseaddr; |
9005 | __le16 plid, llid, reason; |
9006 | @@ -487,6 +487,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m |
9007 | /* Now we will figure out the appropriate event... */ |
9008 | event = PLINK_UNDEFINED; |
9009 | if (ftype != PLINK_CLOSE && (!mesh_matches_local(&elems, sdata))) { |
9010 | + matches_local = false; |
9011 | switch (ftype) { |
9012 | case PLINK_OPEN: |
9013 | event = OPN_RJCT; |
9014 | @@ -498,7 +499,15 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m |
9015 | /* avoid warning */ |
9016 | break; |
9017 | } |
9018 | - spin_lock_bh(&sta->lock); |
9019 | + } |
9020 | + |
9021 | + if (!sta && !matches_local) { |
9022 | + rcu_read_unlock(); |
9023 | + reason = cpu_to_le16(MESH_CAPABILITY_POLICY_VIOLATION); |
9024 | + llid = 0; |
9025 | + mesh_plink_frame_tx(sdata, PLINK_CLOSE, mgmt->sa, llid, |
9026 | + plid, reason); |
9027 | + return; |
9028 | } else if (!sta) { |
9029 | /* ftype == PLINK_OPEN */ |
9030 | u32 rates; |
9031 | @@ -522,7 +531,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m |
9032 | } |
9033 | event = OPN_ACPT; |
9034 | spin_lock_bh(&sta->lock); |
9035 | - } else { |
9036 | + } else if (matches_local) { |
9037 | spin_lock_bh(&sta->lock); |
9038 | switch (ftype) { |
9039 | case PLINK_OPEN: |
9040 | @@ -564,6 +573,8 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m |
9041 | rcu_read_unlock(); |
9042 | return; |
9043 | } |
9044 | + } else { |
9045 | + spin_lock_bh(&sta->lock); |
9046 | } |
9047 | |
9048 | mpl_dbg("Mesh plink (peer, state, llid, plid, event): %pM %s %d %d %d\n", |
9049 | diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c |
9050 | index b6c163a..4c5eed9 100644 |
9051 | --- a/net/mac80211/mlme.c |
9052 | +++ b/net/mac80211/mlme.c |
9053 | @@ -109,7 +109,7 @@ static void run_again(struct ieee80211_if_managed *ifmgd, |
9054 | mod_timer(&ifmgd->timer, timeout); |
9055 | } |
9056 | |
9057 | -static void mod_beacon_timer(struct ieee80211_sub_if_data *sdata) |
9058 | +void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata) |
9059 | { |
9060 | if (sdata->local->hw.flags & IEEE80211_HW_BEACON_FILTER) |
9061 | return; |
9062 | @@ -118,6 +118,19 @@ static void mod_beacon_timer(struct ieee80211_sub_if_data *sdata) |
9063 | round_jiffies_up(jiffies + IEEE80211_BEACON_LOSS_TIME)); |
9064 | } |
9065 | |
9066 | +void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata) |
9067 | +{ |
9068 | + struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
9069 | + |
9070 | + if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) |
9071 | + return; |
9072 | + |
9073 | + mod_timer(&sdata->u.mgd.conn_mon_timer, |
9074 | + round_jiffies_up(jiffies + IEEE80211_CONNECTION_IDLE_TIME)); |
9075 | + |
9076 | + ifmgd->probe_send_count = 0; |
9077 | +} |
9078 | + |
9079 | static int ecw2cw(int ecw) |
9080 | { |
9081 | return (1 << ecw) - 1; |
9082 | @@ -1006,21 +1019,26 @@ void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, |
9083 | if (is_multicast_ether_addr(hdr->addr1)) |
9084 | return; |
9085 | |
9086 | - if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) |
9087 | - return; |
9088 | - |
9089 | - mod_timer(&sdata->u.mgd.conn_mon_timer, |
9090 | - round_jiffies_up(jiffies + IEEE80211_CONNECTION_IDLE_TIME)); |
9091 | + ieee80211_sta_reset_conn_monitor(sdata); |
9092 | } |
9093 | |
9094 | static void ieee80211_mgd_probe_ap_send(struct ieee80211_sub_if_data *sdata) |
9095 | { |
9096 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
9097 | const u8 *ssid; |
9098 | + u8 *dst = ifmgd->associated->bssid; |
9099 | + u8 unicast_limit = max(1, IEEE80211_MAX_PROBE_TRIES - 3); |
9100 | + |
9101 | + /* |
9102 | + * Try sending broadcast probe requests for the last three |
9103 | + * probe requests after the first ones failed since some |
9104 | + * buggy APs only support broadcast probe requests. |
9105 | + */ |
9106 | + if (ifmgd->probe_send_count >= unicast_limit) |
9107 | + dst = NULL; |
9108 | |
9109 | ssid = ieee80211_bss_get_ie(ifmgd->associated, WLAN_EID_SSID); |
9110 | - ieee80211_send_probe_req(sdata, ifmgd->associated->bssid, |
9111 | - ssid + 2, ssid[1], NULL, 0); |
9112 | + ieee80211_send_probe_req(sdata, dst, ssid + 2, ssid[1], NULL, 0); |
9113 | |
9114 | ifmgd->probe_send_count++; |
9115 | ifmgd->probe_timeout = jiffies + IEEE80211_PROBE_WAIT; |
9116 | @@ -1262,7 +1280,7 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk, |
9117 | |
9118 | rates = 0; |
9119 | basic_rates = 0; |
9120 | - sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
9121 | + sband = local->hw.wiphy->bands[wk->chan->band]; |
9122 | |
9123 | for (i = 0; i < elems.supp_rates_len; i++) { |
9124 | int rate = (elems.supp_rates[i] & 0x7f) * 5; |
9125 | @@ -1298,11 +1316,11 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk, |
9126 | } |
9127 | } |
9128 | |
9129 | - sta->sta.supp_rates[local->hw.conf.channel->band] = rates; |
9130 | + sta->sta.supp_rates[wk->chan->band] = rates; |
9131 | sdata->vif.bss_conf.basic_rates = basic_rates; |
9132 | |
9133 | /* cf. IEEE 802.11 9.2.12 */ |
9134 | - if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ && |
9135 | + if (wk->chan->band == IEEE80211_BAND_2GHZ && |
9136 | have_higher_than_11mbit) |
9137 | sdata->flags |= IEEE80211_SDATA_OPERATING_GMODE; |
9138 | else |
9139 | @@ -1362,7 +1380,7 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk, |
9140 | * Also start the timer that will detect beacon loss. |
9141 | */ |
9142 | ieee80211_sta_rx_notify(sdata, (struct ieee80211_hdr *)mgmt); |
9143 | - mod_beacon_timer(sdata); |
9144 | + ieee80211_sta_reset_beacon_monitor(sdata); |
9145 | |
9146 | return true; |
9147 | } |
9148 | @@ -1465,7 +1483,7 @@ static void ieee80211_rx_mgmt_probe_resp(struct ieee80211_sub_if_data *sdata, |
9149 | * we have or will be receiving any beacons or data, so let's |
9150 | * schedule the timers again, just in case. |
9151 | */ |
9152 | - mod_beacon_timer(sdata); |
9153 | + ieee80211_sta_reset_beacon_monitor(sdata); |
9154 | |
9155 | mod_timer(&ifmgd->conn_mon_timer, |
9156 | round_jiffies_up(jiffies + |
9157 | @@ -1540,7 +1558,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, |
9158 | ifmgd->last_beacon_signal = rx_status->signal; |
9159 | if (ifmgd->flags & IEEE80211_STA_RESET_SIGNAL_AVE) { |
9160 | ifmgd->flags &= ~IEEE80211_STA_RESET_SIGNAL_AVE; |
9161 | - ifmgd->ave_beacon_signal = rx_status->signal; |
9162 | + ifmgd->ave_beacon_signal = rx_status->signal * 16; |
9163 | ifmgd->last_cqm_event_signal = 0; |
9164 | } else { |
9165 | ifmgd->ave_beacon_signal = |
9166 | @@ -1588,7 +1606,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, |
9167 | * Push the beacon loss detection into the future since |
9168 | * we are processing a beacon from the AP just now. |
9169 | */ |
9170 | - mod_beacon_timer(sdata); |
9171 | + ieee80211_sta_reset_beacon_monitor(sdata); |
9172 | |
9173 | ncrc = crc32_be(0, (void *)&mgmt->u.beacon.beacon_int, 4); |
9174 | ncrc = ieee802_11_parse_elems_crc(mgmt->u.beacon.variable, |
9175 | diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c |
9176 | index c36b191..cf5ee30 100644 |
9177 | --- a/net/mac80211/offchannel.c |
9178 | +++ b/net/mac80211/offchannel.c |
9179 | @@ -22,12 +22,16 @@ |
9180 | static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata) |
9181 | { |
9182 | struct ieee80211_local *local = sdata->local; |
9183 | + struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
9184 | |
9185 | local->offchannel_ps_enabled = false; |
9186 | |
9187 | /* FIXME: what to do when local->pspolling is true? */ |
9188 | |
9189 | del_timer_sync(&local->dynamic_ps_timer); |
9190 | + del_timer_sync(&ifmgd->bcn_mon_timer); |
9191 | + del_timer_sync(&ifmgd->conn_mon_timer); |
9192 | + |
9193 | cancel_work_sync(&local->dynamic_ps_enable_work); |
9194 | |
9195 | if (local->hw.conf.flags & IEEE80211_CONF_PS) { |
9196 | @@ -85,6 +89,9 @@ static void ieee80211_offchannel_ps_disable(struct ieee80211_sub_if_data *sdata) |
9197 | mod_timer(&local->dynamic_ps_timer, jiffies + |
9198 | msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout)); |
9199 | } |
9200 | + |
9201 | + ieee80211_sta_reset_beacon_monitor(sdata); |
9202 | + ieee80211_sta_reset_conn_monitor(sdata); |
9203 | } |
9204 | |
9205 | void ieee80211_offchannel_stop_beaconing(struct ieee80211_local *local) |
9206 | diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c |
9207 | index be04d461..82d5750 100644 |
9208 | --- a/net/mac80211/rate.c |
9209 | +++ b/net/mac80211/rate.c |
9210 | @@ -328,6 +328,9 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, |
9211 | * if needed. |
9212 | */ |
9213 | for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { |
9214 | + /* Skip invalid rates */ |
9215 | + if (info->control.rates[i].idx < 0) |
9216 | + break; |
9217 | /* Rate masking supports only legacy rates for now */ |
9218 | if (info->control.rates[i].flags & IEEE80211_TX_RC_MCS) |
9219 | continue; |
9220 | diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c |
9221 | index c5b4659..2a18d66 100644 |
9222 | --- a/net/mac80211/rc80211_minstrel_ht.c |
9223 | +++ b/net/mac80211/rc80211_minstrel_ht.c |
9224 | @@ -397,8 +397,9 @@ minstrel_ht_tx_status(void *priv, struct ieee80211_supported_band *sband, |
9225 | !(info->flags & IEEE80211_TX_STAT_AMPDU)) |
9226 | return; |
9227 | |
9228 | - if (!info->status.ampdu_len) { |
9229 | - info->status.ampdu_ack_len = 1; |
9230 | + if (!(info->flags & IEEE80211_TX_STAT_AMPDU)) { |
9231 | + info->status.ampdu_ack_len = |
9232 | + (info->flags & IEEE80211_TX_STAT_ACK ? 1 : 0); |
9233 | info->status.ampdu_len = 1; |
9234 | } |
9235 | |
9236 | @@ -426,7 +427,7 @@ minstrel_ht_tx_status(void *priv, struct ieee80211_supported_band *sband, |
9237 | group = minstrel_ht_get_group_idx(&ar[i]); |
9238 | rate = &mi->groups[group].rates[ar[i].idx % 8]; |
9239 | |
9240 | - if (last && (info->flags & IEEE80211_TX_STAT_ACK)) |
9241 | + if (last) |
9242 | rate->success += info->status.ampdu_ack_len; |
9243 | |
9244 | rate->attempts += ar[i].count * info->status.ampdu_len; |
9245 | diff --git a/net/mac80211/status.c b/net/mac80211/status.c |
9246 | index 34da679..6ffa26a 100644 |
9247 | --- a/net/mac80211/status.c |
9248 | +++ b/net/mac80211/status.c |
9249 | @@ -58,6 +58,7 @@ static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, |
9250 | info->control.vif = &sta->sdata->vif; |
9251 | info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING | |
9252 | IEEE80211_TX_INTFL_RETRANSMISSION; |
9253 | + info->flags &= ~IEEE80211_TX_TEMPORARY_FLAGS; |
9254 | |
9255 | sta->tx_filtered_count++; |
9256 | |
9257 | diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c |
9258 | index df3eedb..a37a6b1 100644 |
9259 | --- a/net/netfilter/nf_conntrack_core.c |
9260 | +++ b/net/netfilter/nf_conntrack_core.c |
9261 | @@ -1260,7 +1260,8 @@ void *nf_ct_alloc_hashtable(unsigned int *sizep, int *vmalloced, int nulls) |
9262 | if (!hash) { |
9263 | *vmalloced = 1; |
9264 | printk(KERN_WARNING "nf_conntrack: falling back to vmalloc.\n"); |
9265 | - hash = __vmalloc(sz, GFP_KERNEL | __GFP_ZERO, PAGE_KERNEL); |
9266 | + hash = __vmalloc(sz, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, |
9267 | + PAGE_KERNEL); |
9268 | } |
9269 | |
9270 | if (hash && nulls) |
9271 | diff --git a/net/rds/rdma.c b/net/rds/rdma.c |
9272 | index 75fd13b..3998967 100644 |
9273 | --- a/net/rds/rdma.c |
9274 | +++ b/net/rds/rdma.c |
9275 | @@ -474,7 +474,7 @@ static struct rds_rdma_op *rds_rdma_prepare(struct rds_sock *rs, |
9276 | goto out; |
9277 | } |
9278 | |
9279 | - if (args->nr_local > (u64)UINT_MAX) { |
9280 | + if (args->nr_local > UIO_MAXIOV) { |
9281 | ret = -EMSGSIZE; |
9282 | goto out; |
9283 | } |
9284 | diff --git a/net/socket.c b/net/socket.c |
9285 | index 2270b94..58dfc91 100644 |
9286 | --- a/net/socket.c |
9287 | +++ b/net/socket.c |
9288 | @@ -1651,6 +1651,8 @@ SYSCALL_DEFINE6(sendto, int, fd, void __user *, buff, size_t, len, |
9289 | struct iovec iov; |
9290 | int fput_needed; |
9291 | |
9292 | + if (len > INT_MAX) |
9293 | + len = INT_MAX; |
9294 | sock = sockfd_lookup_light(fd, &err, &fput_needed); |
9295 | if (!sock) |
9296 | goto out; |
9297 | @@ -1708,6 +1710,8 @@ SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size, |
9298 | int err, err2; |
9299 | int fput_needed; |
9300 | |
9301 | + if (size > INT_MAX) |
9302 | + size = INT_MAX; |
9303 | sock = sockfd_lookup_light(fd, &err, &fput_needed); |
9304 | if (!sock) |
9305 | goto out; |
9306 | diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c |
9307 | index fa55490..cbc5b8c 100644 |
9308 | --- a/net/sunrpc/clnt.c |
9309 | +++ b/net/sunrpc/clnt.c |
9310 | @@ -1675,7 +1675,7 @@ rpc_verify_header(struct rpc_task *task) |
9311 | rpcauth_invalcred(task); |
9312 | /* Ensure we obtain a new XID! */ |
9313 | xprt_release(task); |
9314 | - task->tk_action = call_refresh; |
9315 | + task->tk_action = call_reserve; |
9316 | goto out_retry; |
9317 | case RPC_AUTH_BADCRED: |
9318 | case RPC_AUTH_BADVERF: |
9319 | diff --git a/net/wireless/chan.c b/net/wireless/chan.c |
9320 | index d0c92dd..d8f443b 100644 |
9321 | --- a/net/wireless/chan.c |
9322 | +++ b/net/wireless/chan.c |
9323 | @@ -44,6 +44,36 @@ rdev_freq_to_chan(struct cfg80211_registered_device *rdev, |
9324 | return chan; |
9325 | } |
9326 | |
9327 | +static bool can_beacon_sec_chan(struct wiphy *wiphy, |
9328 | + struct ieee80211_channel *chan, |
9329 | + enum nl80211_channel_type channel_type) |
9330 | +{ |
9331 | + struct ieee80211_channel *sec_chan; |
9332 | + int diff; |
9333 | + |
9334 | + switch (channel_type) { |
9335 | + case NL80211_CHAN_HT40PLUS: |
9336 | + diff = 20; |
9337 | + case NL80211_CHAN_HT40MINUS: |
9338 | + diff = -20; |
9339 | + default: |
9340 | + return false; |
9341 | + } |
9342 | + |
9343 | + sec_chan = ieee80211_get_channel(wiphy, chan->center_freq + diff); |
9344 | + if (!sec_chan) |
9345 | + return false; |
9346 | + |
9347 | + /* we'll need a DFS capability later */ |
9348 | + if (sec_chan->flags & (IEEE80211_CHAN_DISABLED | |
9349 | + IEEE80211_CHAN_PASSIVE_SCAN | |
9350 | + IEEE80211_CHAN_NO_IBSS | |
9351 | + IEEE80211_CHAN_RADAR)) |
9352 | + return false; |
9353 | + |
9354 | + return true; |
9355 | +} |
9356 | + |
9357 | int cfg80211_set_freq(struct cfg80211_registered_device *rdev, |
9358 | struct wireless_dev *wdev, int freq, |
9359 | enum nl80211_channel_type channel_type) |
9360 | @@ -68,6 +98,27 @@ int cfg80211_set_freq(struct cfg80211_registered_device *rdev, |
9361 | if (!chan) |
9362 | return -EINVAL; |
9363 | |
9364 | + /* Both channels should be able to initiate communication */ |
9365 | + if (wdev && (wdev->iftype == NL80211_IFTYPE_ADHOC || |
9366 | + wdev->iftype == NL80211_IFTYPE_AP || |
9367 | + wdev->iftype == NL80211_IFTYPE_AP_VLAN || |
9368 | + wdev->iftype == NL80211_IFTYPE_MESH_POINT)) { |
9369 | + switch (channel_type) { |
9370 | + case NL80211_CHAN_HT40PLUS: |
9371 | + case NL80211_CHAN_HT40MINUS: |
9372 | + if (!can_beacon_sec_chan(&rdev->wiphy, chan, |
9373 | + channel_type)) { |
9374 | + printk(KERN_DEBUG |
9375 | + "cfg80211: Secondary channel not " |
9376 | + "allowed to initiate communication\n"); |
9377 | + return -EINVAL; |
9378 | + } |
9379 | + break; |
9380 | + default: |
9381 | + break; |
9382 | + } |
9383 | + } |
9384 | + |
9385 | result = rdev->ops->set_channel(&rdev->wiphy, |
9386 | wdev ? wdev->netdev : NULL, |
9387 | chan, channel_type); |
9388 | diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c |
9389 | index 37902a5..9a8cde9 100644 |
9390 | --- a/net/wireless/nl80211.c |
9391 | +++ b/net/wireless/nl80211.c |
9392 | @@ -761,11 +761,13 @@ static int nl80211_set_channel(struct sk_buff *skb, struct genl_info *info) |
9393 | |
9394 | result = get_rdev_dev_by_info_ifindex(info, &rdev, &netdev); |
9395 | if (result) |
9396 | - goto unlock; |
9397 | + goto unlock_rtnl; |
9398 | |
9399 | result = __nl80211_set_channel(rdev, netdev->ieee80211_ptr, info); |
9400 | |
9401 | - unlock: |
9402 | + dev_put(netdev); |
9403 | + cfg80211_unlock_rdev(rdev); |
9404 | + unlock_rtnl: |
9405 | rtnl_unlock(); |
9406 | |
9407 | return result; |
9408 | @@ -4996,7 +4998,7 @@ static int nl80211_set_cqm_rssi(struct genl_info *info, |
9409 | |
9410 | err = get_rdev_dev_by_info_ifindex(info, &rdev, &dev); |
9411 | if (err) |
9412 | - goto unlock_rdev; |
9413 | + goto unlock_rtnl; |
9414 | |
9415 | wdev = dev->ieee80211_ptr; |
9416 | |
9417 | @@ -5013,9 +5015,10 @@ static int nl80211_set_cqm_rssi(struct genl_info *info, |
9418 | err = rdev->ops->set_cqm_rssi_config(wdev->wiphy, dev, |
9419 | threshold, hysteresis); |
9420 | |
9421 | -unlock_rdev: |
9422 | + unlock_rdev: |
9423 | cfg80211_unlock_rdev(rdev); |
9424 | dev_put(dev); |
9425 | + unlock_rtnl: |
9426 | rtnl_unlock(); |
9427 | |
9428 | return err; |
9429 | diff --git a/net/wireless/reg.c b/net/wireless/reg.c |
9430 | index f180db0..39890ef 100644 |
9431 | --- a/net/wireless/reg.c |
9432 | +++ b/net/wireless/reg.c |
9433 | @@ -1170,7 +1170,7 @@ static int ignore_request(struct wiphy *wiphy, |
9434 | return 0; |
9435 | return -EALREADY; |
9436 | } |
9437 | - return REG_INTERSECT; |
9438 | + return 0; |
9439 | case NL80211_REGDOM_SET_BY_DRIVER: |
9440 | if (last_request->initiator == NL80211_REGDOM_SET_BY_CORE) { |
9441 | if (regdom_changes(pending_request->alpha2)) |
9442 | diff --git a/net/wireless/scan.c b/net/wireless/scan.c |
9443 | index 5ca8c71..503ebb8 100644 |
9444 | --- a/net/wireless/scan.c |
9445 | +++ b/net/wireless/scan.c |
9446 | @@ -650,14 +650,14 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) |
9447 | bss = container_of(pub, struct cfg80211_internal_bss, pub); |
9448 | |
9449 | spin_lock_bh(&dev->bss_lock); |
9450 | + if (!list_empty(&bss->list)) { |
9451 | + list_del_init(&bss->list); |
9452 | + dev->bss_generation++; |
9453 | + rb_erase(&bss->rbn, &dev->bss_tree); |
9454 | |
9455 | - list_del(&bss->list); |
9456 | - dev->bss_generation++; |
9457 | - rb_erase(&bss->rbn, &dev->bss_tree); |
9458 | - |
9459 | + kref_put(&bss->ref, bss_release); |
9460 | + } |
9461 | spin_unlock_bh(&dev->bss_lock); |
9462 | - |
9463 | - kref_put(&bss->ref, bss_release); |
9464 | } |
9465 | EXPORT_SYMBOL(cfg80211_unlink_bss); |
9466 | |
9467 | diff --git a/net/x25/x25_facilities.c b/net/x25/x25_facilities.c |
9468 | index 771bab0..55187c8 100644 |
9469 | --- a/net/x25/x25_facilities.c |
9470 | +++ b/net/x25/x25_facilities.c |
9471 | @@ -61,6 +61,8 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, |
9472 | while (len > 0) { |
9473 | switch (*p & X25_FAC_CLASS_MASK) { |
9474 | case X25_FAC_CLASS_A: |
9475 | + if (len < 2) |
9476 | + return 0; |
9477 | switch (*p) { |
9478 | case X25_FAC_REVERSE: |
9479 | if((p[1] & 0x81) == 0x81) { |
9480 | @@ -104,6 +106,8 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, |
9481 | len -= 2; |
9482 | break; |
9483 | case X25_FAC_CLASS_B: |
9484 | + if (len < 3) |
9485 | + return 0; |
9486 | switch (*p) { |
9487 | case X25_FAC_PACKET_SIZE: |
9488 | facilities->pacsize_in = p[1]; |
9489 | @@ -125,6 +129,8 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, |
9490 | len -= 3; |
9491 | break; |
9492 | case X25_FAC_CLASS_C: |
9493 | + if (len < 4) |
9494 | + return 0; |
9495 | printk(KERN_DEBUG "X.25: unknown facility %02X, " |
9496 | "values %02X, %02X, %02X\n", |
9497 | p[0], p[1], p[2], p[3]); |
9498 | @@ -132,26 +138,26 @@ int x25_parse_facilities(struct sk_buff *skb, struct x25_facilities *facilities, |
9499 | len -= 4; |
9500 | break; |
9501 | case X25_FAC_CLASS_D: |
9502 | + if (len < p[1] + 2) |
9503 | + return 0; |
9504 | switch (*p) { |
9505 | case X25_FAC_CALLING_AE: |
9506 | - if (p[1] > X25_MAX_DTE_FACIL_LEN) |
9507 | - break; |
9508 | + if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1) |
9509 | + return 0; |
9510 | dte_facs->calling_len = p[2]; |
9511 | memcpy(dte_facs->calling_ae, &p[3], p[1] - 1); |
9512 | *vc_fac_mask |= X25_MASK_CALLING_AE; |
9513 | break; |
9514 | case X25_FAC_CALLED_AE: |
9515 | - if (p[1] > X25_MAX_DTE_FACIL_LEN) |
9516 | - break; |
9517 | + if (p[1] > X25_MAX_DTE_FACIL_LEN || p[1] <= 1) |
9518 | + return 0; |
9519 | dte_facs->called_len = p[2]; |
9520 | memcpy(dte_facs->called_ae, &p[3], p[1] - 1); |
9521 | *vc_fac_mask |= X25_MASK_CALLED_AE; |
9522 | break; |
9523 | default: |
9524 | printk(KERN_DEBUG "X.25: unknown facility %02X," |
9525 | - "length %d, values %02X, %02X, " |
9526 | - "%02X, %02X\n", |
9527 | - p[0], p[1], p[2], p[3], p[4], p[5]); |
9528 | + "length %d\n", p[0], p[1]); |
9529 | break; |
9530 | } |
9531 | len -= p[1] + 2; |
9532 | diff --git a/net/x25/x25_in.c b/net/x25/x25_in.c |
9533 | index 6317896..f729f02 100644 |
9534 | --- a/net/x25/x25_in.c |
9535 | +++ b/net/x25/x25_in.c |
9536 | @@ -119,6 +119,8 @@ static int x25_state1_machine(struct sock *sk, struct sk_buff *skb, int frametyp |
9537 | &x25->vc_facil_mask); |
9538 | if (len > 0) |
9539 | skb_pull(skb, len); |
9540 | + else |
9541 | + return -1; |
9542 | /* |
9543 | * Copy any Call User Data. |
9544 | */ |
9545 | diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c |
9546 | index 7ef429c..6968f5b 100644 |
9547 | --- a/scripts/kconfig/conf.c |
9548 | +++ b/scripts/kconfig/conf.c |
9549 | @@ -466,7 +466,7 @@ int main(int ac, char **av) |
9550 | bindtextdomain(PACKAGE, LOCALEDIR); |
9551 | textdomain(PACKAGE); |
9552 | |
9553 | - while ((opt = getopt_long_only(ac, av, "", long_opts, NULL)) != -1) { |
9554 | + while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) { |
9555 | input_mode = (enum input_mode)opt; |
9556 | switch (opt) { |
9557 | case silentoldconfig: |
9558 | diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c |
9559 | index f50ebf2..8442a08 100644 |
9560 | --- a/sound/core/oss/mixer_oss.c |
9561 | +++ b/sound/core/oss/mixer_oss.c |
9562 | @@ -618,8 +618,10 @@ static void snd_mixer_oss_put_volume1_vol(struct snd_mixer_oss_file *fmixer, |
9563 | if (numid == ID_UNKNOWN) |
9564 | return; |
9565 | down_read(&card->controls_rwsem); |
9566 | - if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) |
9567 | + if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) { |
9568 | + up_read(&card->controls_rwsem); |
9569 | return; |
9570 | + } |
9571 | uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); |
9572 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
9573 | if (uinfo == NULL || uctl == NULL) |
9574 | @@ -658,7 +660,7 @@ static void snd_mixer_oss_put_volume1_sw(struct snd_mixer_oss_file *fmixer, |
9575 | return; |
9576 | down_read(&card->controls_rwsem); |
9577 | if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) { |
9578 | - up_read(&fmixer->card->controls_rwsem); |
9579 | + up_read(&card->controls_rwsem); |
9580 | return; |
9581 | } |
9582 | uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL); |
9583 | @@ -797,7 +799,7 @@ static int snd_mixer_oss_get_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned |
9584 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
9585 | if (uinfo == NULL || uctl == NULL) { |
9586 | err = -ENOMEM; |
9587 | - goto __unlock; |
9588 | + goto __free_only; |
9589 | } |
9590 | down_read(&card->controls_rwsem); |
9591 | kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); |
9592 | @@ -826,6 +828,7 @@ static int snd_mixer_oss_get_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned |
9593 | err = 0; |
9594 | __unlock: |
9595 | up_read(&card->controls_rwsem); |
9596 | + __free_only: |
9597 | kfree(uctl); |
9598 | kfree(uinfo); |
9599 | return err; |
9600 | @@ -847,7 +850,7 @@ static int snd_mixer_oss_put_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned |
9601 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
9602 | if (uinfo == NULL || uctl == NULL) { |
9603 | err = -ENOMEM; |
9604 | - goto __unlock; |
9605 | + goto __free_only; |
9606 | } |
9607 | down_read(&card->controls_rwsem); |
9608 | kctl = snd_mixer_oss_test_id(mixer, "Capture Source", 0); |
9609 | @@ -880,6 +883,7 @@ static int snd_mixer_oss_put_recsrc2(struct snd_mixer_oss_file *fmixer, unsigned |
9610 | err = 0; |
9611 | __unlock: |
9612 | up_read(&card->controls_rwsem); |
9613 | + __free_only: |
9614 | kfree(uctl); |
9615 | kfree(uinfo); |
9616 | return err; |
9617 | diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c |
9618 | index 5c8c7df..aed06c9 100644 |
9619 | --- a/sound/core/oss/pcm_oss.c |
9620 | +++ b/sound/core/oss/pcm_oss.c |
9621 | @@ -1510,16 +1510,19 @@ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __use |
9622 | static int snd_pcm_oss_reset(struct snd_pcm_oss_file *pcm_oss_file) |
9623 | { |
9624 | struct snd_pcm_substream *substream; |
9625 | + struct snd_pcm_runtime *runtime; |
9626 | + int i; |
9627 | |
9628 | - substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK]; |
9629 | - if (substream != NULL) { |
9630 | - snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); |
9631 | - substream->runtime->oss.prepare = 1; |
9632 | - } |
9633 | - substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; |
9634 | - if (substream != NULL) { |
9635 | + for (i = 0; i < 2; i++) { |
9636 | + substream = pcm_oss_file->streams[i]; |
9637 | + if (!substream) |
9638 | + continue; |
9639 | + runtime = substream->runtime; |
9640 | snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL); |
9641 | - substream->runtime->oss.prepare = 1; |
9642 | + runtime->oss.prepare = 1; |
9643 | + runtime->oss.buffer_used = 0; |
9644 | + runtime->oss.prev_hw_ptr_period = 0; |
9645 | + runtime->oss.period_ptr = 0; |
9646 | } |
9647 | return 0; |
9648 | } |
9649 | diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c |
9650 | index 1482921..b959c9f 100644 |
9651 | --- a/sound/pci/hda/hda_codec.c |
9652 | +++ b/sound/pci/hda/hda_codec.c |
9653 | @@ -1216,6 +1216,7 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, |
9654 | struct hda_codec *c; |
9655 | struct hda_cvt_setup *p; |
9656 | unsigned int oldval, newval; |
9657 | + int type; |
9658 | int i; |
9659 | |
9660 | if (!nid) |
9661 | @@ -1254,10 +1255,12 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, |
9662 | p->dirty = 0; |
9663 | |
9664 | /* make other inactive cvts with the same stream-tag dirty */ |
9665 | + type = get_wcaps_type(get_wcaps(codec, nid)); |
9666 | list_for_each_entry(c, &codec->bus->codec_list, list) { |
9667 | for (i = 0; i < c->cvt_setups.used; i++) { |
9668 | p = snd_array_elem(&c->cvt_setups, i); |
9669 | - if (!p->active && p->stream_tag == stream_tag) |
9670 | + if (!p->active && p->stream_tag == stream_tag && |
9671 | + get_wcaps_type(get_wcaps(codec, p->nid)) == type) |
9672 | p->dirty = 1; |
9673 | } |
9674 | } |
9675 | @@ -1281,6 +1284,9 @@ void __snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid, |
9676 | if (!nid) |
9677 | return; |
9678 | |
9679 | + if (codec->no_sticky_stream) |
9680 | + do_now = 1; |
9681 | + |
9682 | snd_printdd("hda_codec_cleanup_stream: NID=0x%x\n", nid); |
9683 | p = get_hda_cvt_setup(codec, nid); |
9684 | if (p) { |
9685 | diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h |
9686 | index 62c7022..c3ad374 100644 |
9687 | --- a/sound/pci/hda/hda_codec.h |
9688 | +++ b/sound/pci/hda/hda_codec.h |
9689 | @@ -850,6 +850,7 @@ struct hda_codec { |
9690 | unsigned int pin_amp_workaround:1; /* pin out-amp takes index |
9691 | * (e.g. Conexant codecs) |
9692 | */ |
9693 | + unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */ |
9694 | unsigned int pins_shutup:1; /* pins are shut up */ |
9695 | unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */ |
9696 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
9697 | diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c |
9698 | index 34940a0..935ffca 100644 |
9699 | --- a/sound/pci/hda/hda_intel.c |
9700 | +++ b/sound/pci/hda/hda_intel.c |
9701 | @@ -458,6 +458,7 @@ enum { |
9702 | AZX_DRIVER_ULI, |
9703 | AZX_DRIVER_NVIDIA, |
9704 | AZX_DRIVER_TERA, |
9705 | + AZX_DRIVER_CTX, |
9706 | AZX_DRIVER_GENERIC, |
9707 | AZX_NUM_DRIVERS, /* keep this as last entry */ |
9708 | }; |
9709 | @@ -473,6 +474,7 @@ static char *driver_short_names[] __devinitdata = { |
9710 | [AZX_DRIVER_ULI] = "HDA ULI M5461", |
9711 | [AZX_DRIVER_NVIDIA] = "HDA NVidia", |
9712 | [AZX_DRIVER_TERA] = "HDA Teradici", |
9713 | + [AZX_DRIVER_CTX] = "HDA Creative", |
9714 | [AZX_DRIVER_GENERIC] = "HD-Audio Generic", |
9715 | }; |
9716 | |
9717 | @@ -563,7 +565,10 @@ static void azx_init_cmd_io(struct azx *chip) |
9718 | /* reset the rirb hw write pointer */ |
9719 | azx_writew(chip, RIRBWP, ICH6_RIRBWP_RST); |
9720 | /* set N=1, get RIRB response interrupt for new entry */ |
9721 | - azx_writew(chip, RINTCNT, 1); |
9722 | + if (chip->driver_type == AZX_DRIVER_CTX) |
9723 | + azx_writew(chip, RINTCNT, 0xc0); |
9724 | + else |
9725 | + azx_writew(chip, RINTCNT, 1); |
9726 | /* enable rirb dma and response irq */ |
9727 | azx_writeb(chip, RIRBCTL, ICH6_RBCTL_DMA_EN | ICH6_RBCTL_IRQ_EN); |
9728 | spin_unlock_irq(&chip->reg_lock); |
9729 | @@ -1136,8 +1141,11 @@ static irqreturn_t azx_interrupt(int irq, void *dev_id) |
9730 | /* clear rirb int */ |
9731 | status = azx_readb(chip, RIRBSTS); |
9732 | if (status & RIRB_INT_MASK) { |
9733 | - if (status & RIRB_INT_RESPONSE) |
9734 | + if (status & RIRB_INT_RESPONSE) { |
9735 | + if (chip->driver_type == AZX_DRIVER_CTX) |
9736 | + udelay(80); |
9737 | azx_update_rirb(chip); |
9738 | + } |
9739 | azx_writeb(chip, RIRBSTS, RIRB_INT_MASK); |
9740 | } |
9741 | |
9742 | @@ -1647,7 +1655,7 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) |
9743 | struct azx_dev *azx_dev = get_azx_dev(substream); |
9744 | struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; |
9745 | struct snd_pcm_runtime *runtime = substream->runtime; |
9746 | - unsigned int bufsize, period_bytes, format_val; |
9747 | + unsigned int bufsize, period_bytes, format_val, stream_tag; |
9748 | int err; |
9749 | |
9750 | azx_stream_reset(chip, azx_dev); |
9751 | @@ -1689,7 +1697,12 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) |
9752 | else |
9753 | azx_dev->fifo_size = 0; |
9754 | |
9755 | - return snd_hda_codec_prepare(apcm->codec, hinfo, azx_dev->stream_tag, |
9756 | + stream_tag = azx_dev->stream_tag; |
9757 | + /* CA-IBG chips need the playback stream starting from 1 */ |
9758 | + if (chip->driver_type == AZX_DRIVER_CTX && |
9759 | + stream_tag > chip->capture_streams) |
9760 | + stream_tag -= chip->capture_streams; |
9761 | + return snd_hda_codec_prepare(apcm->codec, hinfo, stream_tag, |
9762 | azx_dev->format_val, substream); |
9763 | } |
9764 | |
9765 | @@ -2794,10 +2807,10 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { |
9766 | { PCI_DEVICE(PCI_VENDOR_ID_CREATIVE, PCI_ANY_ID), |
9767 | .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, |
9768 | .class_mask = 0xffffff, |
9769 | - .driver_data = AZX_DRIVER_GENERIC }, |
9770 | + .driver_data = AZX_DRIVER_CTX }, |
9771 | #else |
9772 | /* this entry seems still valid -- i.e. without emu20kx chip */ |
9773 | - { PCI_DEVICE(0x1102, 0x0009), .driver_data = AZX_DRIVER_GENERIC }, |
9774 | + { PCI_DEVICE(0x1102, 0x0009), .driver_data = AZX_DRIVER_CTX }, |
9775 | #endif |
9776 | /* AMD/ATI Generic, PCI class code and Vendor ID for HD Audio */ |
9777 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_ANY_ID), |
9778 | diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c |
9779 | index 10bbbaf..0da636d 100644 |
9780 | --- a/sound/pci/hda/patch_analog.c |
9781 | +++ b/sound/pci/hda/patch_analog.c |
9782 | @@ -1276,6 +1276,7 @@ static int patch_ad1986a(struct hda_codec *codec) |
9783 | spec->multiout.no_share_stream = 1; |
9784 | |
9785 | codec->no_trigger_sense = 1; |
9786 | + codec->no_sticky_stream = 1; |
9787 | |
9788 | return 0; |
9789 | } |
9790 | @@ -1463,6 +1464,7 @@ static int patch_ad1983(struct hda_codec *codec) |
9791 | codec->patch_ops = ad198x_patch_ops; |
9792 | |
9793 | codec->no_trigger_sense = 1; |
9794 | + codec->no_sticky_stream = 1; |
9795 | |
9796 | return 0; |
9797 | } |
9798 | @@ -1917,6 +1919,7 @@ static int patch_ad1981(struct hda_codec *codec) |
9799 | } |
9800 | |
9801 | codec->no_trigger_sense = 1; |
9802 | + codec->no_sticky_stream = 1; |
9803 | |
9804 | return 0; |
9805 | } |
9806 | @@ -3235,6 +3238,7 @@ static int patch_ad1988(struct hda_codec *codec) |
9807 | spec->vmaster_nid = 0x04; |
9808 | |
9809 | codec->no_trigger_sense = 1; |
9810 | + codec->no_sticky_stream = 1; |
9811 | |
9812 | return 0; |
9813 | } |
9814 | @@ -3449,6 +3453,7 @@ static int patch_ad1884(struct hda_codec *codec) |
9815 | codec->patch_ops = ad198x_patch_ops; |
9816 | |
9817 | codec->no_trigger_sense = 1; |
9818 | + codec->no_sticky_stream = 1; |
9819 | |
9820 | return 0; |
9821 | } |
9822 | @@ -4422,6 +4427,7 @@ static int patch_ad1884a(struct hda_codec *codec) |
9823 | } |
9824 | |
9825 | codec->no_trigger_sense = 1; |
9826 | + codec->no_sticky_stream = 1; |
9827 | |
9828 | return 0; |
9829 | } |
9830 | @@ -4761,6 +4767,7 @@ static int patch_ad1882(struct hda_codec *codec) |
9831 | } |
9832 | |
9833 | codec->no_trigger_sense = 1; |
9834 | + codec->no_sticky_stream = 1; |
9835 | |
9836 | return 0; |
9837 | } |
9838 | diff --git a/sound/pci/hda/patch_ca0110.c b/sound/pci/hda/patch_ca0110.c |
9839 | index af47801..9544463 100644 |
9840 | --- a/sound/pci/hda/patch_ca0110.c |
9841 | +++ b/sound/pci/hda/patch_ca0110.c |
9842 | @@ -489,7 +489,7 @@ static void parse_digital(struct hda_codec *codec) |
9843 | if (cfg->dig_outs && |
9844 | snd_hda_get_connections(codec, cfg->dig_out_pins[0], |
9845 | &spec->dig_out, 1) == 1) |
9846 | - spec->multiout.dig_out_nid = cfg->dig_out_pins[0]; |
9847 | + spec->multiout.dig_out_nid = spec->dig_out; |
9848 | } |
9849 | |
9850 | static int ca0110_parse_auto_config(struct hda_codec *codec) |
9851 | diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c |
9852 | index 972e7c4..32ab7a6 100644 |
9853 | --- a/sound/pci/hda/patch_conexant.c |
9854 | +++ b/sound/pci/hda/patch_conexant.c |
9855 | @@ -3092,6 +3092,7 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { |
9856 | SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTO), |
9857 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), |
9858 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), |
9859 | + SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_HP_LAPTOP), |
9860 | SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD), |
9861 | SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), |
9862 | SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5), |
9863 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c |
9864 | index a432e6e..7262980 100644 |
9865 | --- a/sound/pci/hda/patch_realtek.c |
9866 | +++ b/sound/pci/hda/patch_realtek.c |
9867 | @@ -1438,6 +1438,7 @@ do_sku: |
9868 | spec->init_amp = ALC_INIT_GPIO3; |
9869 | break; |
9870 | case 5: |
9871 | + default: |
9872 | spec->init_amp = ALC_INIT_DEFAULT; |
9873 | break; |
9874 | } |
9875 | @@ -9664,7 +9665,6 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = { |
9876 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
9877 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
9878 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), |
9879 | - SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
9880 | SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG), |
9881 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
9882 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
9883 | @@ -16557,7 +16557,7 @@ static struct alc_config_preset alc861vd_presets[] = { |
9884 | static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, |
9885 | const struct auto_pin_cfg *cfg) |
9886 | { |
9887 | - return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); |
9888 | + return alc_auto_create_input_ctls(codec, cfg, 0x0b, 0x22, 0); |
9889 | } |
9890 | |
9891 | |
9892 | @@ -18612,6 +18612,8 @@ static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
9893 | return 0x02; |
9894 | else if (nid >= 0x0c && nid <= 0x0e) |
9895 | return nid - 0x0c + 0x02; |
9896 | + else if (nid == 0x26) /* ALC887-VD has this DAC too */ |
9897 | + return 0x25; |
9898 | else |
9899 | return 0; |
9900 | } |
9901 | @@ -18620,7 +18622,7 @@ static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid) |
9902 | static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin, |
9903 | hda_nid_t dac) |
9904 | { |
9905 | - hda_nid_t mix[4]; |
9906 | + hda_nid_t mix[5]; |
9907 | int i, num; |
9908 | |
9909 | num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix)); |
9910 | @@ -18935,6 +18937,36 @@ static void alc662_auto_init(struct hda_codec *codec) |
9911 | alc_inithook(codec); |
9912 | } |
9913 | |
9914 | +enum { |
9915 | + ALC662_FIXUP_ASPIRE, |
9916 | + ALC662_FIXUP_IDEAPAD, |
9917 | +}; |
9918 | + |
9919 | +static const struct alc_fixup alc662_fixups[] = { |
9920 | + [ALC662_FIXUP_ASPIRE] = { |
9921 | + .pins = (const struct alc_pincfg[]) { |
9922 | + { 0x15, 0x99130112 }, /* subwoofer */ |
9923 | + { } |
9924 | + } |
9925 | + }, |
9926 | + [ALC662_FIXUP_IDEAPAD] = { |
9927 | + .pins = (const struct alc_pincfg[]) { |
9928 | + { 0x17, 0x99130112 }, /* subwoofer */ |
9929 | + { } |
9930 | + } |
9931 | + }, |
9932 | +}; |
9933 | + |
9934 | +static struct snd_pci_quirk alc662_fixup_tbl[] = { |
9935 | + SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
9936 | + SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
9937 | + SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
9938 | + SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
9939 | + {} |
9940 | +}; |
9941 | + |
9942 | + |
9943 | + |
9944 | static int patch_alc662(struct hda_codec *codec) |
9945 | { |
9946 | struct alc_spec *spec; |
9947 | @@ -18967,6 +18999,7 @@ static int patch_alc662(struct hda_codec *codec) |
9948 | } |
9949 | |
9950 | if (board_config == ALC662_AUTO) { |
9951 | + alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1); |
9952 | /* automatic parse from the BIOS config */ |
9953 | err = alc662_parse_auto_config(codec); |
9954 | if (err < 0) { |
9955 | @@ -19025,8 +19058,11 @@ static int patch_alc662(struct hda_codec *codec) |
9956 | spec->vmaster_nid = 0x02; |
9957 | |
9958 | codec->patch_ops = alc_patch_ops; |
9959 | - if (board_config == ALC662_AUTO) |
9960 | + if (board_config == ALC662_AUTO) { |
9961 | spec->init_hook = alc662_auto_init; |
9962 | + alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 0); |
9963 | + } |
9964 | + |
9965 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
9966 | if (!spec->loopback.amplist) |
9967 | spec->loopback.amplist = alc662_loopbacks; |
9968 | @@ -19039,7 +19075,10 @@ static int patch_alc888(struct hda_codec *codec) |
9969 | { |
9970 | if ((alc_read_coef_idx(codec, 0) & 0x00f0)==0x0030){ |
9971 | kfree(codec->chip_name); |
9972 | - codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
9973 | + if (codec->vendor_id == 0x10ec0887) |
9974 | + codec->chip_name = kstrdup("ALC887-VD", GFP_KERNEL); |
9975 | + else |
9976 | + codec->chip_name = kstrdup("ALC888-VD", GFP_KERNEL); |
9977 | if (!codec->chip_name) { |
9978 | alc_free(codec); |
9979 | return -ENOMEM; |
9980 | @@ -19521,7 +19560,7 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = { |
9981 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
9982 | .patch = patch_alc882 }, |
9983 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
9984 | - { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
9985 | + { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc888 }, |
9986 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
9987 | .patch = patch_alc882 }, |
9988 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc888 }, |
9989 | diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c |
9990 | index c16c5ba..78f1206 100644 |
9991 | --- a/sound/pci/hda/patch_sigmatel.c |
9992 | +++ b/sound/pci/hda/patch_sigmatel.c |
9993 | @@ -93,6 +93,7 @@ enum { |
9994 | STAC_92HD83XXX_REF, |
9995 | STAC_92HD83XXX_PWR_REF, |
9996 | STAC_DELL_S14, |
9997 | + STAC_DELL_E6410, |
9998 | STAC_92HD83XXX_HP, |
9999 | STAC_HP_DV7_4000, |
10000 | STAC_92HD83XXX_MODELS |
10001 | @@ -1618,6 +1619,8 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { |
10002 | static struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = { |
10003 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1, |
10004 | "Alienware M17x", STAC_ALIENWARE_M17X), |
10005 | + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a, |
10006 | + "Alienware M17x", STAC_ALIENWARE_M17X), |
10007 | {} /* terminator */ |
10008 | }; |
10009 | |
10010 | @@ -1633,6 +1636,13 @@ static unsigned int dell_s14_pin_configs[10] = { |
10011 | 0x40f000f0, 0x40f000f0, |
10012 | }; |
10013 | |
10014 | +/* Deliberately turn off 0x0f (Dock Mic) to make it choose Int Mic instead */ |
10015 | +static unsigned int dell_e6410_pin_configs[10] = { |
10016 | + 0x04a11020, 0x0421101f, 0x400000f0, 0x90170110, |
10017 | + 0x23011050, 0x40f000f0, 0x400000f0, 0x90a60130, |
10018 | + 0x40f000f0, 0x40f000f0, |
10019 | +}; |
10020 | + |
10021 | static unsigned int hp_dv7_4000_pin_configs[10] = { |
10022 | 0x03a12050, 0x0321201f, 0x40f000f0, 0x90170110, |
10023 | 0x40f000f0, 0x40f000f0, 0x90170110, 0xd5a30140, |
10024 | @@ -1643,6 +1653,7 @@ static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { |
10025 | [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, |
10026 | [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs, |
10027 | [STAC_DELL_S14] = dell_s14_pin_configs, |
10028 | + [STAC_DELL_E6410] = dell_e6410_pin_configs, |
10029 | [STAC_HP_DV7_4000] = hp_dv7_4000_pin_configs, |
10030 | }; |
10031 | |
10032 | @@ -1651,6 +1662,7 @@ static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { |
10033 | [STAC_92HD83XXX_REF] = "ref", |
10034 | [STAC_92HD83XXX_PWR_REF] = "mic-ref", |
10035 | [STAC_DELL_S14] = "dell-s14", |
10036 | + [STAC_DELL_E6410] = "dell-e6410", |
10037 | [STAC_92HD83XXX_HP] = "hp", |
10038 | [STAC_HP_DV7_4000] = "hp-dv7-4000", |
10039 | }; |
10040 | @@ -1663,6 +1675,10 @@ static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { |
10041 | "DFI LanParty", STAC_92HD83XXX_REF), |
10042 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba, |
10043 | "unknown Dell", STAC_DELL_S14), |
10044 | + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x040a, |
10045 | + "Dell E6410", STAC_DELL_E6410), |
10046 | + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x040b, |
10047 | + "Dell E6510", STAC_DELL_E6410), |
10048 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x3600, |
10049 | "HP", STAC_92HD83XXX_HP), |
10050 | {} /* terminator */ |
10051 | diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c |
10052 | index 4677492..ebfa1f8 100644 |
10053 | --- a/sound/pci/intel8x0.c |
10054 | +++ b/sound/pci/intel8x0.c |
10055 | @@ -1866,6 +1866,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = { |
10056 | }, |
10057 | { |
10058 | .subvendor = 0x1028, |
10059 | + .subdevice = 0x0182, |
10060 | + .name = "Dell Latitude D610", /* STAC9750/51 */ |
10061 | + .type = AC97_TUNE_HP_ONLY |
10062 | + }, |
10063 | + { |
10064 | + .subvendor = 0x1028, |
10065 | .subdevice = 0x0186, |
10066 | .name = "Dell Latitude D810", /* cf. Malone #41015 */ |
10067 | .type = AC97_TUNE_HP_MUTE_LED |
10068 | diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c |
10069 | index 5da17a7..4b8ffc2 100644 |
10070 | --- a/sound/soc/codecs/wm8900.c |
10071 | +++ b/sound/soc/codecs/wm8900.c |
10072 | @@ -188,7 +188,6 @@ static int wm8900_volatile_register(unsigned int reg) |
10073 | { |
10074 | switch (reg) { |
10075 | case WM8900_REG_ID: |
10076 | - case WM8900_REG_POWER1: |
10077 | return 1; |
10078 | default: |
10079 | return 0; |
10080 | @@ -1236,11 +1235,6 @@ static __devinit int wm8900_i2c_probe(struct i2c_client *i2c, |
10081 | goto err; |
10082 | } |
10083 | |
10084 | - /* Read back from the chip */ |
10085 | - reg = snd_soc_read(codec, WM8900_REG_POWER1); |
10086 | - reg = (reg >> 12) & 0xf; |
10087 | - dev_info(&i2c->dev, "WM8900 revision %d\n", reg); |
10088 | - |
10089 | wm8900_reset(codec); |
10090 | |
10091 | /* Turn the chip on */ |
10092 | diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c |
10093 | index 2549d3a..3bd65c8 100644 |
10094 | --- a/sound/soc/codecs/wm8961.c |
10095 | +++ b/sound/soc/codecs/wm8961.c |
10096 | @@ -711,7 +711,7 @@ static int wm8961_hw_params(struct snd_pcm_substream *substream, |
10097 | if (fs <= 24000) |
10098 | reg |= WM8961_DACSLOPE; |
10099 | else |
10100 | - reg &= WM8961_DACSLOPE; |
10101 | + reg &= ~WM8961_DACSLOPE; |
10102 | snd_soc_write(codec, WM8961_ADC_DAC_CONTROL_2, reg); |
10103 | |
10104 | return 0; |
10105 | @@ -736,7 +736,7 @@ static int wm8961_set_sysclk(struct snd_soc_dai *dai, int clk_id, |
10106 | freq /= 2; |
10107 | } else { |
10108 | dev_dbg(codec->dev, "Using MCLK/1 for %dHz MCLK\n", freq); |
10109 | - reg &= WM8961_MCLKDIV; |
10110 | + reg &= ~WM8961_MCLKDIV; |
10111 | } |
10112 | |
10113 | snd_soc_write(codec, WM8961_CLOCKING1, reg); |