diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2013-01-31 08:57:38 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2013-02-04 14:18:19 +0000 |
commit | 1c8dc37ed5deb7491d24372cd95d63800a09b553 (patch) | |
tree | 3599cd002ebbaf7148ec4692bad5de2ab2f9daeb | |
parent | 6e7a198caf826fdaa18be3cbcdcb69dd3560d016 (diff) | |
download | alpine_aports-1c8dc37ed5deb7491d24372cd95d63800a09b553.tar.bz2 alpine_aports-1c8dc37ed5deb7491d24372cd95d63800a09b553.tar.xz alpine_aports-1c8dc37ed5deb7491d24372cd95d63800a09b553.zip |
main/linux-vserver: add backported stable fixes
(cherry picked from commit a9bd39bfca3d66d1337b944302be2f52394f9e9e)
-rw-r--r-- | main/linux-vserver/APKBUILD | 4 | ||||
-rw-r--r-- | main/linux-vserver/patch-3.6.11-al2.patch | 9417 |
2 files changed, 9420 insertions, 1 deletions
diff --git a/main/linux-vserver/APKBUILD b/main/linux-vserver/APKBUILD index 3b6b7b41cc..073acc0726 100644 --- a/main/linux-vserver/APKBUILD +++ b/main/linux-vserver/APKBUILD | |||
@@ -3,7 +3,7 @@ | |||
3 | _flavor=vserver | 3 | _flavor=vserver |
4 | pkgname=linux-${_flavor} | 4 | pkgname=linux-${_flavor} |
5 | pkgver=3.6.11 | 5 | pkgver=3.6.11 |
6 | pkgrel=0 | 6 | pkgrel=1 |
7 | _vsver=vs2.3.4.6 | 7 | _vsver=vs2.3.4.6 |
8 | 8 | ||
9 | if [ "${pkgver##*.*.*}" = "$pkgver" ]; then | 9 | if [ "${pkgver##*.*.*}" = "$pkgver" ]; then |
@@ -21,6 +21,7 @@ _config=${config:-kernelconfig.${CARCH}} | |||
21 | install= | 21 | install= |
22 | source="http://www.kernel.org/pub/linux/kernel/v3.x/linux-$_kernver.tar.xz | 22 | source="http://www.kernel.org/pub/linux/kernel/v3.x/linux-$_kernver.tar.xz |
23 | http://www.kernel.org/pub/linux/kernel/v3.x/patch-$pkgver.xz | 23 | http://www.kernel.org/pub/linux/kernel/v3.x/patch-$pkgver.xz |
24 | patch-3.6.11-al2.patch | ||
24 | patch-$pkgver-$_vsver.diff | 25 | patch-$pkgver-$_vsver.diff |
25 | kernelconfig.x86 | 26 | kernelconfig.x86 |
26 | kernelconfig.x86_64 | 27 | kernelconfig.x86_64 |
@@ -137,6 +138,7 @@ dev() { | |||
137 | 138 | ||
138 | md5sums="1a1760420eac802c541a20ab51a093d1 linux-3.6.tar.xz | 139 | md5sums="1a1760420eac802c541a20ab51a093d1 linux-3.6.tar.xz |
139 | bd4bba74093405887d521309a74c19e9 patch-3.6.11.xz | 140 | bd4bba74093405887d521309a74c19e9 patch-3.6.11.xz |
141 | 4d225839f004e4133c5fa48b7ca0ddf5 patch-3.6.11-al2.patch | ||
140 | 27809872b8bc0dffce4e383d68d1c989 patch-3.6.11-vs2.3.4.6.diff | 142 | 27809872b8bc0dffce4e383d68d1c989 patch-3.6.11-vs2.3.4.6.diff |
141 | b28263bb0d529a80d4f13fbdd76520b2 kernelconfig.x86 | 143 | b28263bb0d529a80d4f13fbdd76520b2 kernelconfig.x86 |
142 | 1e9e12d5bd63552127331b875a554992 kernelconfig.x86_64" | 144 | 1e9e12d5bd63552127331b875a554992 kernelconfig.x86_64" |
diff --git a/main/linux-vserver/patch-3.6.11-al2.patch b/main/linux-vserver/patch-3.6.11-al2.patch new file mode 100644 index 0000000000..3139bf3a63 --- /dev/null +++ b/main/linux-vserver/patch-3.6.11-al2.patch | |||
@@ -0,0 +1,9417 @@ | |||
1 | diff --git a/arch/arm/kernel/swp_emulate.c b/arch/arm/kernel/swp_emulate.c | ||
2 | index df74518..ab1017b 100644 | ||
3 | --- a/arch/arm/kernel/swp_emulate.c | ||
4 | +++ b/arch/arm/kernel/swp_emulate.c | ||
5 | @@ -109,10 +109,12 @@ static void set_segfault(struct pt_regs *regs, unsigned long addr) | ||
6 | { | ||
7 | siginfo_t info; | ||
8 | |||
9 | + down_read(¤t->mm->mmap_sem); | ||
10 | if (find_vma(current->mm, addr) == NULL) | ||
11 | info.si_code = SEGV_MAPERR; | ||
12 | else | ||
13 | info.si_code = SEGV_ACCERR; | ||
14 | + up_read(¤t->mm->mmap_sem); | ||
15 | |||
16 | info.si_signo = SIGSEGV; | ||
17 | info.si_errno = 0; | ||
18 | diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h | ||
19 | index a611ad3..b6132aa 100644 | ||
20 | --- a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h | ||
21 | +++ b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h | ||
22 | @@ -463,6 +463,9 @@ | ||
23 | GPIO76_LCD_PCLK, \ | ||
24 | GPIO77_LCD_BIAS | ||
25 | |||
26 | +/* these enable a work-around for a hw bug in pxa27x during ac97 warm reset */ | ||
27 | +#define GPIO113_AC97_nRESET_GPIO_HIGH MFP_CFG_OUT(GPIO113, AF0, DEFAULT) | ||
28 | +#define GPIO95_AC97_nRESET_GPIO_HIGH MFP_CFG_OUT(GPIO95, AF0, DEFAULT) | ||
29 | |||
30 | extern int keypad_set_wake(unsigned int on); | ||
31 | #endif /* __ASM_ARCH_MFP_PXA27X_H */ | ||
32 | diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c | ||
33 | index 4726c24..a2fe795 100644 | ||
34 | --- a/arch/arm/mach-pxa/pxa27x.c | ||
35 | +++ b/arch/arm/mach-pxa/pxa27x.c | ||
36 | @@ -47,9 +47,9 @@ void pxa27x_clear_otgph(void) | ||
37 | EXPORT_SYMBOL(pxa27x_clear_otgph); | ||
38 | |||
39 | static unsigned long ac97_reset_config[] = { | ||
40 | - GPIO113_GPIO, | ||
41 | + GPIO113_AC97_nRESET_GPIO_HIGH, | ||
42 | GPIO113_AC97_nRESET, | ||
43 | - GPIO95_GPIO, | ||
44 | + GPIO95_AC97_nRESET_GPIO_HIGH, | ||
45 | GPIO95_AC97_nRESET, | ||
46 | }; | ||
47 | |||
48 | diff --git a/arch/arm/mach-realview/include/mach/board-eb.h b/arch/arm/mach-realview/include/mach/board-eb.h | ||
49 | index 124bce6..a301e61 100644 | ||
50 | --- a/arch/arm/mach-realview/include/mach/board-eb.h | ||
51 | +++ b/arch/arm/mach-realview/include/mach/board-eb.h | ||
52 | @@ -47,7 +47,7 @@ | ||
53 | #define REALVIEW_EB_USB_BASE 0x4F000000 /* USB */ | ||
54 | |||
55 | #ifdef CONFIG_REALVIEW_EB_ARM11MP_REVB | ||
56 | -#define REALVIEW_EB11MP_PRIV_MEM_BASE 0x1F000000 | ||
57 | +#define REALVIEW_EB11MP_PRIV_MEM_BASE 0x10100000 | ||
58 | #define REALVIEW_EB11MP_L220_BASE 0x10102000 /* L220 registers */ | ||
59 | #define REALVIEW_EB11MP_SYS_PLD_CTRL1 0xD8 /* Register offset for MPCore sysctl */ | ||
60 | #else | ||
61 | diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c | ||
62 | index c2fa21d..b68b531 100644 | ||
63 | --- a/arch/arm/mm/mmu.c | ||
64 | +++ b/arch/arm/mm/mmu.c | ||
65 | @@ -498,7 +498,7 @@ static void __init build_mem_type_table(void) | ||
66 | #endif | ||
67 | |||
68 | for (i = 0; i < 16; i++) { | ||
69 | - unsigned long v = pgprot_val(protection_map[i]); | ||
70 | + pteval_t v = pgprot_val(protection_map[i]); | ||
71 | protection_map[i] = __pgprot(v | user_pgprot); | ||
72 | } | ||
73 | |||
74 | diff --git a/arch/cris/include/asm/io.h b/arch/cris/include/asm/io.h | ||
75 | index 32567bc..ac12ae2 100644 | ||
76 | --- a/arch/cris/include/asm/io.h | ||
77 | +++ b/arch/cris/include/asm/io.h | ||
78 | @@ -133,12 +133,39 @@ static inline void writel(unsigned int b, volatile void __iomem *addr) | ||
79 | #define insb(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,1,count) : 0) | ||
80 | #define insw(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,2,count) : 0) | ||
81 | #define insl(port,addr,count) (cris_iops ? cris_iops->read_io(port,addr,4,count) : 0) | ||
82 | -#define outb(data,port) if (cris_iops) cris_iops->write_io(port,(void*)(unsigned)data,1,1) | ||
83 | -#define outw(data,port) if (cris_iops) cris_iops->write_io(port,(void*)(unsigned)data,2,1) | ||
84 | -#define outl(data,port) if (cris_iops) cris_iops->write_io(port,(void*)(unsigned)data,4,1) | ||
85 | -#define outsb(port,addr,count) if(cris_iops) cris_iops->write_io(port,(void*)addr,1,count) | ||
86 | -#define outsw(port,addr,count) if(cris_iops) cris_iops->write_io(port,(void*)addr,2,count) | ||
87 | -#define outsl(port,addr,count) if(cris_iops) cris_iops->write_io(port,(void*)addr,3,count) | ||
88 | +static inline void outb(unsigned char data, unsigned int port) | ||
89 | +{ | ||
90 | + if (cris_iops) | ||
91 | + cris_iops->write_io(port, (void *) &data, 1, 1); | ||
92 | +} | ||
93 | +static inline void outw(unsigned short data, unsigned int port) | ||
94 | +{ | ||
95 | + if (cris_iops) | ||
96 | + cris_iops->write_io(port, (void *) &data, 2, 1); | ||
97 | +} | ||
98 | +static inline void outl(unsigned int data, unsigned int port) | ||
99 | +{ | ||
100 | + if (cris_iops) | ||
101 | + cris_iops->write_io(port, (void *) &data, 4, 1); | ||
102 | +} | ||
103 | +static inline void outsb(unsigned int port, const void *addr, | ||
104 | + unsigned long count) | ||
105 | +{ | ||
106 | + if (cris_iops) | ||
107 | + cris_iops->write_io(port, (void *)addr, 1, count); | ||
108 | +} | ||
109 | +static inline void outsw(unsigned int port, const void *addr, | ||
110 | + unsigned long count) | ||
111 | +{ | ||
112 | + if (cris_iops) | ||
113 | + cris_iops->write_io(port, (void *)addr, 2, count); | ||
114 | +} | ||
115 | +static inline void outsl(unsigned int port, const void *addr, | ||
116 | + unsigned long count) | ||
117 | +{ | ||
118 | + if (cris_iops) | ||
119 | + cris_iops->write_io(port, (void *)addr, 4, count); | ||
120 | +} | ||
121 | |||
122 | /* | ||
123 | * Convert a physical pointer to a virtual kernel pointer for /dev/mem | ||
124 | diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c | ||
125 | index e9a5fd7..69b17a9 100644 | ||
126 | --- a/arch/mips/kernel/process.c | ||
127 | +++ b/arch/mips/kernel/process.c | ||
128 | @@ -72,9 +72,7 @@ void __noreturn cpu_idle(void) | ||
129 | } | ||
130 | } | ||
131 | #ifdef CONFIG_HOTPLUG_CPU | ||
132 | - if (!cpu_online(cpu) && !cpu_isset(cpu, cpu_callin_map) && | ||
133 | - (system_state == SYSTEM_RUNNING || | ||
134 | - system_state == SYSTEM_BOOTING)) | ||
135 | + if (!cpu_online(cpu) && !cpu_isset(cpu, cpu_callin_map)) | ||
136 | play_dead(); | ||
137 | #endif | ||
138 | rcu_idle_exit(); | ||
139 | diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S | ||
140 | index 58bddee..9e07bd0 100644 | ||
141 | --- a/arch/powerpc/kernel/head_64.S | ||
142 | +++ b/arch/powerpc/kernel/head_64.S | ||
143 | @@ -422,7 +422,7 @@ _STATIC(__after_prom_start) | ||
144 | tovirt(r6,r6) /* on booke, we already run at PAGE_OFFSET */ | ||
145 | #endif | ||
146 | |||
147 | -#ifdef CONFIG_CRASH_DUMP | ||
148 | +#ifdef CONFIG_RELOCATABLE | ||
149 | /* | ||
150 | * Check if the kernel has to be running as relocatable kernel based on the | ||
151 | * variable __run_at_load, if it is set the kernel is treated as relocatable | ||
152 | diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c | ||
153 | index e49e931..5395666 100644 | ||
154 | --- a/arch/powerpc/kernel/time.c | ||
155 | +++ b/arch/powerpc/kernel/time.c | ||
156 | @@ -759,13 +759,8 @@ void update_vsyscall(struct timespec *wall_time, struct timespec *wtm, | ||
157 | |||
158 | void update_vsyscall_tz(void) | ||
159 | { | ||
160 | - /* Make userspace gettimeofday spin until we're done. */ | ||
161 | - ++vdso_data->tb_update_count; | ||
162 | - smp_mb(); | ||
163 | vdso_data->tz_minuteswest = sys_tz.tz_minuteswest; | ||
164 | vdso_data->tz_dsttime = sys_tz.tz_dsttime; | ||
165 | - smp_mb(); | ||
166 | - ++vdso_data->tb_update_count; | ||
167 | } | ||
168 | |||
169 | static void __init clocksource_init(void) | ||
170 | diff --git a/arch/powerpc/kvm/44x_emulate.c b/arch/powerpc/kvm/44x_emulate.c | ||
171 | index c8c6157..c39cd0b 100644 | ||
172 | --- a/arch/powerpc/kvm/44x_emulate.c | ||
173 | +++ b/arch/powerpc/kvm/44x_emulate.c | ||
174 | @@ -76,6 +76,7 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, | ||
175 | run->dcr.dcrn = dcrn; | ||
176 | run->dcr.data = 0; | ||
177 | run->dcr.is_write = 0; | ||
178 | + vcpu->arch.dcr_is_write = 0; | ||
179 | vcpu->arch.io_gpr = rt; | ||
180 | vcpu->arch.dcr_needed = 1; | ||
181 | kvmppc_account_exit(vcpu, DCR_EXITS); | ||
182 | @@ -94,6 +95,7 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, | ||
183 | run->dcr.dcrn = dcrn; | ||
184 | run->dcr.data = kvmppc_get_gpr(vcpu, rs); | ||
185 | run->dcr.is_write = 1; | ||
186 | + vcpu->arch.dcr_is_write = 1; | ||
187 | vcpu->arch.dcr_needed = 1; | ||
188 | kvmppc_account_exit(vcpu, DCR_EXITS); | ||
189 | emulated = EMULATE_DO_DCR; | ||
190 | diff --git a/arch/powerpc/platforms/40x/ppc40x_simple.c b/arch/powerpc/platforms/40x/ppc40x_simple.c | ||
191 | index 9761206..f0eee75 100644 | ||
192 | --- a/arch/powerpc/platforms/40x/ppc40x_simple.c | ||
193 | +++ b/arch/powerpc/platforms/40x/ppc40x_simple.c | ||
194 | @@ -57,7 +57,8 @@ static const char *board[] __initdata = { | ||
195 | "amcc,makalu", | ||
196 | "apm,klondike", | ||
197 | "est,hotfoot", | ||
198 | - "plathome,obs600" | ||
199 | + "plathome,obs600", | ||
200 | + NULL | ||
201 | }; | ||
202 | |||
203 | static int __init ppc40x_probe(void) | ||
204 | diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h | ||
205 | index fba4d66..4c060bb 100644 | ||
206 | --- a/arch/s390/include/asm/timex.h | ||
207 | +++ b/arch/s390/include/asm/timex.h | ||
208 | @@ -128,4 +128,32 @@ static inline unsigned long long get_clock_monotonic(void) | ||
209 | return get_clock_xt() - sched_clock_base_cc; | ||
210 | } | ||
211 | |||
212 | +/** | ||
213 | + * tod_to_ns - convert a TOD format value to nanoseconds | ||
214 | + * @todval: to be converted TOD format value | ||
215 | + * Returns: number of nanoseconds that correspond to the TOD format value | ||
216 | + * | ||
217 | + * Converting a 64 Bit TOD format value to nanoseconds means that the value | ||
218 | + * must be divided by 4.096. In order to achieve that we multiply with 125 | ||
219 | + * and divide by 512: | ||
220 | + * | ||
221 | + * ns = (todval * 125) >> 9; | ||
222 | + * | ||
223 | + * In order to avoid an overflow with the multiplication we can rewrite this. | ||
224 | + * With a split todval == 2^32 * th + tl (th upper 32 bits, tl lower 32 bits) | ||
225 | + * we end up with | ||
226 | + * | ||
227 | + * ns = ((2^32 * th + tl) * 125 ) >> 9; | ||
228 | + * -> ns = (2^23 * th * 125) + ((tl * 125) >> 9); | ||
229 | + * | ||
230 | + */ | ||
231 | +static inline unsigned long long tod_to_ns(unsigned long long todval) | ||
232 | +{ | ||
233 | + unsigned long long ns; | ||
234 | + | ||
235 | + ns = ((todval >> 32) << 23) * 125; | ||
236 | + ns += ((todval & 0xffffffff) * 125) >> 9; | ||
237 | + return ns; | ||
238 | +} | ||
239 | + | ||
240 | #endif | ||
241 | diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c | ||
242 | index dcec960..0cb14ba 100644 | ||
243 | --- a/arch/s390/kernel/time.c | ||
244 | +++ b/arch/s390/kernel/time.c | ||
245 | @@ -63,7 +63,7 @@ static DEFINE_PER_CPU(struct clock_event_device, comparators); | ||
246 | */ | ||
247 | unsigned long long notrace __kprobes sched_clock(void) | ||
248 | { | ||
249 | - return (get_clock_monotonic() * 125) >> 9; | ||
250 | + return tod_to_ns(get_clock_monotonic()); | ||
251 | } | ||
252 | |||
253 | /* | ||
254 | diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c | ||
255 | index b7bc1aa..a80b585 100644 | ||
256 | --- a/arch/s390/kvm/interrupt.c | ||
257 | +++ b/arch/s390/kvm/interrupt.c | ||
258 | @@ -390,7 +390,7 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu) | ||
259 | return 0; | ||
260 | } | ||
261 | |||
262 | - sltime = ((vcpu->arch.sie_block->ckc - now)*125)>>9; | ||
263 | + sltime = tod_to_ns(vcpu->arch.sie_block->ckc - now); | ||
264 | |||
265 | hrtimer_start(&vcpu->arch.ckc_timer, ktime_set (0, sltime) , HRTIMER_MODE_REL); | ||
266 | VCPU_EVENT(vcpu, 5, "enabled wait via clock comparator: %llx ns", sltime); | ||
267 | diff --git a/arch/sh/include/asm/elf.h b/arch/sh/include/asm/elf.h | ||
268 | index f38112b..978b7fd 100644 | ||
269 | --- a/arch/sh/include/asm/elf.h | ||
270 | +++ b/arch/sh/include/asm/elf.h | ||
271 | @@ -202,9 +202,9 @@ extern void __kernel_vsyscall; | ||
272 | if (vdso_enabled) \ | ||
273 | NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); \ | ||
274 | else \ | ||
275 | - NEW_AUX_ENT(AT_IGNORE, 0); | ||
276 | + NEW_AUX_ENT(AT_IGNORE, 0) | ||
277 | #else | ||
278 | -#define VSYSCALL_AUX_ENT | ||
279 | +#define VSYSCALL_AUX_ENT NEW_AUX_ENT(AT_IGNORE, 0) | ||
280 | #endif /* CONFIG_VSYSCALL */ | ||
281 | |||
282 | #ifdef CONFIG_SH_FPU | ||
283 | diff --git a/arch/sparc/include/asm/hugetlb.h b/arch/sparc/include/asm/hugetlb.h | ||
284 | index 1770610..f368cef 100644 | ||
285 | --- a/arch/sparc/include/asm/hugetlb.h | ||
286 | +++ b/arch/sparc/include/asm/hugetlb.h | ||
287 | @@ -58,14 +58,20 @@ static inline pte_t huge_pte_wrprotect(pte_t pte) | ||
288 | static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, | ||
289 | unsigned long addr, pte_t *ptep) | ||
290 | { | ||
291 | - ptep_set_wrprotect(mm, addr, ptep); | ||
292 | + pte_t old_pte = *ptep; | ||
293 | + set_huge_pte_at(mm, addr, ptep, pte_wrprotect(old_pte)); | ||
294 | } | ||
295 | |||
296 | static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, | ||
297 | unsigned long addr, pte_t *ptep, | ||
298 | pte_t pte, int dirty) | ||
299 | { | ||
300 | - return ptep_set_access_flags(vma, addr, ptep, pte, dirty); | ||
301 | + int changed = !pte_same(*ptep, pte); | ||
302 | + if (changed) { | ||
303 | + set_huge_pte_at(vma->vm_mm, addr, ptep, pte); | ||
304 | + flush_tlb_page(vma, addr); | ||
305 | + } | ||
306 | + return changed; | ||
307 | } | ||
308 | |||
309 | static inline pte_t huge_ptep_get(pte_t *ptep) | ||
310 | diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S | ||
311 | index 8f8e8ee..2a6919e 100644 | ||
312 | --- a/arch/x86/kernel/entry_32.S | ||
313 | +++ b/arch/x86/kernel/entry_32.S | ||
314 | @@ -1065,7 +1065,6 @@ ENTRY(xen_failsafe_callback) | ||
315 | lea 16(%esp),%esp | ||
316 | CFI_ADJUST_CFA_OFFSET -16 | ||
317 | jz 5f | ||
318 | - addl $16,%esp | ||
319 | jmp iret_exc | ||
320 | 5: pushl_cfi $-1 /* orig_ax = -1 => not a system call */ | ||
321 | SAVE_ALL | ||
322 | diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c | ||
323 | index 5cee802..53339c1 100644 | ||
324 | --- a/arch/x86/kernel/setup.c | ||
325 | +++ b/arch/x86/kernel/setup.c | ||
326 | @@ -613,6 +613,81 @@ static __init void reserve_ibft_region(void) | ||
327 | |||
328 | static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10; | ||
329 | |||
330 | +static bool __init snb_gfx_workaround_needed(void) | ||
331 | +{ | ||
332 | + int i; | ||
333 | + u16 vendor, devid; | ||
334 | + static const u16 snb_ids[] = { | ||
335 | + 0x0102, | ||
336 | + 0x0112, | ||
337 | + 0x0122, | ||
338 | + 0x0106, | ||
339 | + 0x0116, | ||
340 | + 0x0126, | ||
341 | + 0x010a, | ||
342 | + }; | ||
343 | + | ||
344 | + /* Assume no if something weird is going on with PCI */ | ||
345 | + if (!early_pci_allowed()) | ||
346 | + return false; | ||
347 | + | ||
348 | + vendor = read_pci_config_16(0, 2, 0, PCI_VENDOR_ID); | ||
349 | + if (vendor != 0x8086) | ||
350 | + return false; | ||
351 | + | ||
352 | + devid = read_pci_config_16(0, 2, 0, PCI_DEVICE_ID); | ||
353 | + for (i = 0; i < ARRAY_SIZE(snb_ids); i++) | ||
354 | + if (devid == snb_ids[i]) | ||
355 | + return true; | ||
356 | + | ||
357 | + return false; | ||
358 | +} | ||
359 | + | ||
360 | +/* | ||
361 | + * Sandy Bridge graphics has trouble with certain ranges, exclude | ||
362 | + * them from allocation. | ||
363 | + */ | ||
364 | +static void __init trim_snb_memory(void) | ||
365 | +{ | ||
366 | + static const unsigned long bad_pages[] = { | ||
367 | + 0x20050000, | ||
368 | + 0x20110000, | ||
369 | + 0x20130000, | ||
370 | + 0x20138000, | ||
371 | + 0x40004000, | ||
372 | + }; | ||
373 | + int i; | ||
374 | + | ||
375 | + if (!snb_gfx_workaround_needed()) | ||
376 | + return; | ||
377 | + | ||
378 | + printk(KERN_DEBUG "reserving inaccessible SNB gfx pages\n"); | ||
379 | + | ||
380 | + /* | ||
381 | + * Reserve all memory below the 1 MB mark that has not | ||
382 | + * already been reserved. | ||
383 | + */ | ||
384 | + memblock_reserve(0, 1<<20); | ||
385 | + | ||
386 | + for (i = 0; i < ARRAY_SIZE(bad_pages); i++) { | ||
387 | + if (memblock_reserve(bad_pages[i], PAGE_SIZE)) | ||
388 | + printk(KERN_WARNING "failed to reserve 0x%08lx\n", | ||
389 | + bad_pages[i]); | ||
390 | + } | ||
391 | +} | ||
392 | + | ||
393 | +/* | ||
394 | + * Here we put platform-specific memory range workarounds, i.e. | ||
395 | + * memory known to be corrupt or otherwise in need to be reserved on | ||
396 | + * specific platforms. | ||
397 | + * | ||
398 | + * If this gets used more widely it could use a real dispatch mechanism. | ||
399 | + */ | ||
400 | +static void __init trim_platform_memory_ranges(void) | ||
401 | +{ | ||
402 | + trim_snb_memory(); | ||
403 | +} | ||
404 | + | ||
405 | static void __init trim_bios_range(void) | ||
406 | { | ||
407 | /* | ||
408 | @@ -633,6 +708,7 @@ static void __init trim_bios_range(void) | ||
409 | * take them out. | ||
410 | */ | ||
411 | e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); | ||
412 | + | ||
413 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | ||
414 | } | ||
415 | |||
416 | @@ -911,6 +987,8 @@ void __init setup_arch(char **cmdline_p) | ||
417 | |||
418 | setup_real_mode(); | ||
419 | |||
420 | + trim_platform_memory_ranges(); | ||
421 | + | ||
422 | init_gbpages(); | ||
423 | |||
424 | /* max_pfn_mapped is updated here */ | ||
425 | diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c | ||
426 | index ad3730b..aac684d 100644 | ||
427 | --- a/drivers/acpi/processor_idle.c | ||
428 | +++ b/drivers/acpi/processor_idle.c | ||
429 | @@ -1009,6 +1009,9 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr) | ||
430 | return -EINVAL; | ||
431 | } | ||
432 | |||
433 | + if (!dev) | ||
434 | + return -EINVAL; | ||
435 | + | ||
436 | dev->cpu = pr->id; | ||
437 | |||
438 | if (max_cstate == 0) | ||
439 | @@ -1196,6 +1199,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) | ||
440 | } | ||
441 | |||
442 | /* Populate Updated C-state information */ | ||
443 | + acpi_processor_get_power_info(pr); | ||
444 | acpi_processor_setup_cpuidle_states(pr); | ||
445 | |||
446 | /* Enable all cpuidle devices */ | ||
447 | diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c | ||
448 | index d1ecca2..f1fcaca 100644 | ||
449 | --- a/drivers/acpi/scan.c | ||
450 | +++ b/drivers/acpi/scan.c | ||
451 | @@ -807,8 +807,8 @@ acpi_bus_extract_wakeup_device_power_package(acpi_handle handle, | ||
452 | static void acpi_bus_set_run_wake_flags(struct acpi_device *device) | ||
453 | { | ||
454 | struct acpi_device_id button_device_ids[] = { | ||
455 | - {"PNP0C0D", 0}, | ||
456 | {"PNP0C0C", 0}, | ||
457 | + {"PNP0C0D", 0}, | ||
458 | {"PNP0C0E", 0}, | ||
459 | {"", 0}, | ||
460 | }; | ||
461 | @@ -820,6 +820,11 @@ static void acpi_bus_set_run_wake_flags(struct acpi_device *device) | ||
462 | /* Power button, Lid switch always enable wakeup */ | ||
463 | if (!acpi_match_device_ids(device, button_device_ids)) { | ||
464 | device->wakeup.flags.run_wake = 1; | ||
465 | + if (!acpi_match_device_ids(device, &button_device_ids[1])) { | ||
466 | + /* Do not use Lid/sleep button for S5 wakeup */ | ||
467 | + if (device->wakeup.sleep_state == ACPI_STATE_S5) | ||
468 | + device->wakeup.sleep_state = ACPI_STATE_S4; | ||
469 | + } | ||
470 | device_set_wakeup_capable(&device->dev, true); | ||
471 | return; | ||
472 | } | ||
473 | @@ -1175,7 +1180,7 @@ static void acpi_device_set_id(struct acpi_device *device) | ||
474 | acpi_add_id(device, ACPI_DOCK_HID); | ||
475 | else if (!acpi_ibm_smbus_match(device)) | ||
476 | acpi_add_id(device, ACPI_SMBUS_IBM_HID); | ||
477 | - else if (!acpi_device_hid(device) && | ||
478 | + else if (list_empty(&device->pnp.ids) && | ||
479 | ACPI_IS_ROOT_DEVICE(device->parent)) { | ||
480 | acpi_add_id(device, ACPI_BUS_HID); /* \_SB, LNXSYBUS */ | ||
481 | strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME); | ||
482 | diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c | ||
483 | index 847ed55..813aa38 100644 | ||
484 | --- a/drivers/acpi/sleep.c | ||
485 | +++ b/drivers/acpi/sleep.c | ||
486 | @@ -109,6 +109,180 @@ void __init acpi_old_suspend_ordering(void) | ||
487 | old_suspend_ordering = true; | ||
488 | } | ||
489 | |||
490 | +static int __init init_old_suspend_ordering(const struct dmi_system_id *d) | ||
491 | +{ | ||
492 | + acpi_old_suspend_ordering(); | ||
493 | + return 0; | ||
494 | +} | ||
495 | + | ||
496 | +static int __init init_nvs_nosave(const struct dmi_system_id *d) | ||
497 | +{ | ||
498 | + acpi_nvs_nosave(); | ||
499 | + return 0; | ||
500 | +} | ||
501 | + | ||
502 | +static struct dmi_system_id __initdata acpisleep_dmi_table[] = { | ||
503 | + { | ||
504 | + .callback = init_old_suspend_ordering, | ||
505 | + .ident = "Abit KN9 (nForce4 variant)", | ||
506 | + .matches = { | ||
507 | + DMI_MATCH(DMI_BOARD_VENDOR, "http://www.abit.com.tw/"), | ||
508 | + DMI_MATCH(DMI_BOARD_NAME, "KN9 Series(NF-CK804)"), | ||
509 | + }, | ||
510 | + }, | ||
511 | + { | ||
512 | + .callback = init_old_suspend_ordering, | ||
513 | + .ident = "HP xw4600 Workstation", | ||
514 | + .matches = { | ||
515 | + DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
516 | + DMI_MATCH(DMI_PRODUCT_NAME, "HP xw4600 Workstation"), | ||
517 | + }, | ||
518 | + }, | ||
519 | + { | ||
520 | + .callback = init_old_suspend_ordering, | ||
521 | + .ident = "Asus Pundit P1-AH2 (M2N8L motherboard)", | ||
522 | + .matches = { | ||
523 | + DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTek Computer INC."), | ||
524 | + DMI_MATCH(DMI_BOARD_NAME, "M2N8L"), | ||
525 | + }, | ||
526 | + }, | ||
527 | + { | ||
528 | + .callback = init_old_suspend_ordering, | ||
529 | + .ident = "Panasonic CF51-2L", | ||
530 | + .matches = { | ||
531 | + DMI_MATCH(DMI_BOARD_VENDOR, | ||
532 | + "Matsushita Electric Industrial Co.,Ltd."), | ||
533 | + DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"), | ||
534 | + }, | ||
535 | + }, | ||
536 | + { | ||
537 | + .callback = init_nvs_nosave, | ||
538 | + .ident = "Sony Vaio VGN-FW21E", | ||
539 | + .matches = { | ||
540 | + DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
541 | + DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW21E"), | ||
542 | + }, | ||
543 | + }, | ||
544 | + { | ||
545 | + .callback = init_nvs_nosave, | ||
546 | + .ident = "Sony Vaio VPCEB17FX", | ||
547 | + .matches = { | ||
548 | + DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
549 | + DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB17FX"), | ||
550 | + }, | ||
551 | + }, | ||
552 | + { | ||
553 | + .callback = init_nvs_nosave, | ||
554 | + .ident = "Sony Vaio VGN-SR11M", | ||
555 | + .matches = { | ||
556 | + DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
557 | + DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR11M"), | ||
558 | + }, | ||
559 | + }, | ||
560 | + { | ||
561 | + .callback = init_nvs_nosave, | ||
562 | + .ident = "Everex StepNote Series", | ||
563 | + .matches = { | ||
564 | + DMI_MATCH(DMI_SYS_VENDOR, "Everex Systems, Inc."), | ||
565 | + DMI_MATCH(DMI_PRODUCT_NAME, "Everex StepNote Series"), | ||
566 | + }, | ||
567 | + }, | ||
568 | + { | ||
569 | + .callback = init_nvs_nosave, | ||
570 | + .ident = "Sony Vaio VPCEB1Z1E", | ||
571 | + .matches = { | ||
572 | + DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
573 | + DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB1Z1E"), | ||
574 | + }, | ||
575 | + }, | ||
576 | + { | ||
577 | + .callback = init_nvs_nosave, | ||
578 | + .ident = "Sony Vaio VGN-NW130D", | ||
579 | + .matches = { | ||
580 | + DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
581 | + DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NW130D"), | ||
582 | + }, | ||
583 | + }, | ||
584 | + { | ||
585 | + .callback = init_nvs_nosave, | ||
586 | + .ident = "Sony Vaio VPCCW29FX", | ||
587 | + .matches = { | ||
588 | + DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
589 | + DMI_MATCH(DMI_PRODUCT_NAME, "VPCCW29FX"), | ||
590 | + }, | ||
591 | + }, | ||
592 | + { | ||
593 | + .callback = init_nvs_nosave, | ||
594 | + .ident = "Averatec AV1020-ED2", | ||
595 | + .matches = { | ||
596 | + DMI_MATCH(DMI_SYS_VENDOR, "AVERATEC"), | ||
597 | + DMI_MATCH(DMI_PRODUCT_NAME, "1000 Series"), | ||
598 | + }, | ||
599 | + }, | ||
600 | + { | ||
601 | + .callback = init_old_suspend_ordering, | ||
602 | + .ident = "Asus A8N-SLI DELUXE", | ||
603 | + .matches = { | ||
604 | + DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), | ||
605 | + DMI_MATCH(DMI_BOARD_NAME, "A8N-SLI DELUXE"), | ||
606 | + }, | ||
607 | + }, | ||
608 | + { | ||
609 | + .callback = init_old_suspend_ordering, | ||
610 | + .ident = "Asus A8N-SLI Premium", | ||
611 | + .matches = { | ||
612 | + DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), | ||
613 | + DMI_MATCH(DMI_BOARD_NAME, "A8N-SLI Premium"), | ||
614 | + }, | ||
615 | + }, | ||
616 | + { | ||
617 | + .callback = init_nvs_nosave, | ||
618 | + .ident = "Sony Vaio VGN-SR26GN_P", | ||
619 | + .matches = { | ||
620 | + DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
621 | + DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR26GN_P"), | ||
622 | + }, | ||
623 | + }, | ||
624 | + { | ||
625 | + .callback = init_nvs_nosave, | ||
626 | + .ident = "Sony Vaio VPCEB1S1E", | ||
627 | + .matches = { | ||
628 | + DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
629 | + DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB1S1E"), | ||
630 | + }, | ||
631 | + }, | ||
632 | + { | ||
633 | + .callback = init_nvs_nosave, | ||
634 | + .ident = "Sony Vaio VGN-FW520F", | ||
635 | + .matches = { | ||
636 | + DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
637 | + DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW520F"), | ||
638 | + }, | ||
639 | + }, | ||
640 | + { | ||
641 | + .callback = init_nvs_nosave, | ||
642 | + .ident = "Asus K54C", | ||
643 | + .matches = { | ||
644 | + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), | ||
645 | + DMI_MATCH(DMI_PRODUCT_NAME, "K54C"), | ||
646 | + }, | ||
647 | + }, | ||
648 | + { | ||
649 | + .callback = init_nvs_nosave, | ||
650 | + .ident = "Asus K54HR", | ||
651 | + .matches = { | ||
652 | + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), | ||
653 | + DMI_MATCH(DMI_PRODUCT_NAME, "K54HR"), | ||
654 | + }, | ||
655 | + }, | ||
656 | + {}, | ||
657 | +}; | ||
658 | + | ||
659 | +static void acpi_sleep_dmi_check(void) | ||
660 | +{ | ||
661 | + dmi_check_system(acpisleep_dmi_table); | ||
662 | +} | ||
663 | + | ||
664 | /** | ||
665 | * acpi_pm_freeze - Disable the GPEs and suspend EC transactions. | ||
666 | */ | ||
667 | @@ -224,6 +398,7 @@ static void acpi_pm_end(void) | ||
668 | } | ||
669 | #else /* !CONFIG_ACPI_SLEEP */ | ||
670 | #define acpi_target_sleep_state ACPI_STATE_S0 | ||
671 | +static inline void acpi_sleep_dmi_check(void) {} | ||
672 | #endif /* CONFIG_ACPI_SLEEP */ | ||
673 | |||
674 | #ifdef CONFIG_SUSPEND | ||
675 | @@ -382,175 +557,6 @@ static const struct platform_suspend_ops acpi_suspend_ops_old = { | ||
676 | .end = acpi_pm_end, | ||
677 | .recover = acpi_pm_finish, | ||
678 | }; | ||
679 | - | ||
680 | -static int __init init_old_suspend_ordering(const struct dmi_system_id *d) | ||
681 | -{ | ||
682 | - old_suspend_ordering = true; | ||
683 | - return 0; | ||
684 | -} | ||
685 | - | ||
686 | -static int __init init_nvs_nosave(const struct dmi_system_id *d) | ||
687 | -{ | ||
688 | - acpi_nvs_nosave(); | ||
689 | - return 0; | ||
690 | -} | ||
691 | - | ||
692 | -static struct dmi_system_id __initdata acpisleep_dmi_table[] = { | ||
693 | - { | ||
694 | - .callback = init_old_suspend_ordering, | ||
695 | - .ident = "Abit KN9 (nForce4 variant)", | ||
696 | - .matches = { | ||
697 | - DMI_MATCH(DMI_BOARD_VENDOR, "http://www.abit.com.tw/"), | ||
698 | - DMI_MATCH(DMI_BOARD_NAME, "KN9 Series(NF-CK804)"), | ||
699 | - }, | ||
700 | - }, | ||
701 | - { | ||
702 | - .callback = init_old_suspend_ordering, | ||
703 | - .ident = "HP xw4600 Workstation", | ||
704 | - .matches = { | ||
705 | - DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), | ||
706 | - DMI_MATCH(DMI_PRODUCT_NAME, "HP xw4600 Workstation"), | ||
707 | - }, | ||
708 | - }, | ||
709 | - { | ||
710 | - .callback = init_old_suspend_ordering, | ||
711 | - .ident = "Asus Pundit P1-AH2 (M2N8L motherboard)", | ||
712 | - .matches = { | ||
713 | - DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTek Computer INC."), | ||
714 | - DMI_MATCH(DMI_BOARD_NAME, "M2N8L"), | ||
715 | - }, | ||
716 | - }, | ||
717 | - { | ||
718 | - .callback = init_old_suspend_ordering, | ||
719 | - .ident = "Panasonic CF51-2L", | ||
720 | - .matches = { | ||
721 | - DMI_MATCH(DMI_BOARD_VENDOR, | ||
722 | - "Matsushita Electric Industrial Co.,Ltd."), | ||
723 | - DMI_MATCH(DMI_BOARD_NAME, "CF51-2L"), | ||
724 | - }, | ||
725 | - }, | ||
726 | - { | ||
727 | - .callback = init_nvs_nosave, | ||
728 | - .ident = "Sony Vaio VGN-FW21E", | ||
729 | - .matches = { | ||
730 | - DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
731 | - DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW21E"), | ||
732 | - }, | ||
733 | - }, | ||
734 | - { | ||
735 | - .callback = init_nvs_nosave, | ||
736 | - .ident = "Sony Vaio VPCEB17FX", | ||
737 | - .matches = { | ||
738 | - DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
739 | - DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB17FX"), | ||
740 | - }, | ||
741 | - }, | ||
742 | - { | ||
743 | - .callback = init_nvs_nosave, | ||
744 | - .ident = "Sony Vaio VGN-SR11M", | ||
745 | - .matches = { | ||
746 | - DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
747 | - DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR11M"), | ||
748 | - }, | ||
749 | - }, | ||
750 | - { | ||
751 | - .callback = init_nvs_nosave, | ||
752 | - .ident = "Everex StepNote Series", | ||
753 | - .matches = { | ||
754 | - DMI_MATCH(DMI_SYS_VENDOR, "Everex Systems, Inc."), | ||
755 | - DMI_MATCH(DMI_PRODUCT_NAME, "Everex StepNote Series"), | ||
756 | - }, | ||
757 | - }, | ||
758 | - { | ||
759 | - .callback = init_nvs_nosave, | ||
760 | - .ident = "Sony Vaio VPCEB1Z1E", | ||
761 | - .matches = { | ||
762 | - DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
763 | - DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB1Z1E"), | ||
764 | - }, | ||
765 | - }, | ||
766 | - { | ||
767 | - .callback = init_nvs_nosave, | ||
768 | - .ident = "Sony Vaio VGN-NW130D", | ||
769 | - .matches = { | ||
770 | - DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
771 | - DMI_MATCH(DMI_PRODUCT_NAME, "VGN-NW130D"), | ||
772 | - }, | ||
773 | - }, | ||
774 | - { | ||
775 | - .callback = init_nvs_nosave, | ||
776 | - .ident = "Sony Vaio VPCCW29FX", | ||
777 | - .matches = { | ||
778 | - DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
779 | - DMI_MATCH(DMI_PRODUCT_NAME, "VPCCW29FX"), | ||
780 | - }, | ||
781 | - }, | ||
782 | - { | ||
783 | - .callback = init_nvs_nosave, | ||
784 | - .ident = "Averatec AV1020-ED2", | ||
785 | - .matches = { | ||
786 | - DMI_MATCH(DMI_SYS_VENDOR, "AVERATEC"), | ||
787 | - DMI_MATCH(DMI_PRODUCT_NAME, "1000 Series"), | ||
788 | - }, | ||
789 | - }, | ||
790 | - { | ||
791 | - .callback = init_old_suspend_ordering, | ||
792 | - .ident = "Asus A8N-SLI DELUXE", | ||
793 | - .matches = { | ||
794 | - DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), | ||
795 | - DMI_MATCH(DMI_BOARD_NAME, "A8N-SLI DELUXE"), | ||
796 | - }, | ||
797 | - }, | ||
798 | - { | ||
799 | - .callback = init_old_suspend_ordering, | ||
800 | - .ident = "Asus A8N-SLI Premium", | ||
801 | - .matches = { | ||
802 | - DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."), | ||
803 | - DMI_MATCH(DMI_BOARD_NAME, "A8N-SLI Premium"), | ||
804 | - }, | ||
805 | - }, | ||
806 | - { | ||
807 | - .callback = init_nvs_nosave, | ||
808 | - .ident = "Sony Vaio VGN-SR26GN_P", | ||
809 | - .matches = { | ||
810 | - DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
811 | - DMI_MATCH(DMI_PRODUCT_NAME, "VGN-SR26GN_P"), | ||
812 | - }, | ||
813 | - }, | ||
814 | - { | ||
815 | - .callback = init_nvs_nosave, | ||
816 | - .ident = "Sony Vaio VPCEB1S1E", | ||
817 | - .matches = { | ||
818 | - DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
819 | - DMI_MATCH(DMI_PRODUCT_NAME, "VPCEB1S1E"), | ||
820 | - }, | ||
821 | - }, | ||
822 | - { | ||
823 | - .callback = init_nvs_nosave, | ||
824 | - .ident = "Sony Vaio VGN-FW520F", | ||
825 | - .matches = { | ||
826 | - DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"), | ||
827 | - DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW520F"), | ||
828 | - }, | ||
829 | - }, | ||
830 | - { | ||
831 | - .callback = init_nvs_nosave, | ||
832 | - .ident = "Asus K54C", | ||
833 | - .matches = { | ||
834 | - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), | ||
835 | - DMI_MATCH(DMI_PRODUCT_NAME, "K54C"), | ||
836 | - }, | ||
837 | - }, | ||
838 | - { | ||
839 | - .callback = init_nvs_nosave, | ||
840 | - .ident = "Asus K54HR", | ||
841 | - .matches = { | ||
842 | - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), | ||
843 | - DMI_MATCH(DMI_PRODUCT_NAME, "K54HR"), | ||
844 | - }, | ||
845 | - }, | ||
846 | - {}, | ||
847 | -}; | ||
848 | #endif /* CONFIG_SUSPEND */ | ||
849 | |||
850 | #ifdef CONFIG_HIBERNATION | ||
851 | @@ -881,13 +887,13 @@ int __init acpi_sleep_init(void) | ||
852 | u8 type_a, type_b; | ||
853 | #ifdef CONFIG_SUSPEND | ||
854 | int i = 0; | ||
855 | - | ||
856 | - dmi_check_system(acpisleep_dmi_table); | ||
857 | #endif | ||
858 | |||
859 | if (acpi_disabled) | ||
860 | return 0; | ||
861 | |||
862 | + acpi_sleep_dmi_check(); | ||
863 | + | ||
864 | sleep_states[ACPI_STATE_S0] = 1; | ||
865 | printk(KERN_INFO PREFIX "(supports S0"); | ||
866 | |||
867 | diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c | ||
868 | index 7862d17..4979127 100644 | ||
869 | --- a/drivers/ata/ahci.c | ||
870 | +++ b/drivers/ata/ahci.c | ||
871 | @@ -53,6 +53,7 @@ | ||
872 | |||
873 | enum { | ||
874 | AHCI_PCI_BAR_STA2X11 = 0, | ||
875 | + AHCI_PCI_BAR_ENMOTUS = 2, | ||
876 | AHCI_PCI_BAR_STANDARD = 5, | ||
877 | }; | ||
878 | |||
879 | @@ -410,6 +411,9 @@ static const struct pci_device_id ahci_pci_tbl[] = { | ||
880 | { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci }, /* ASM1061 */ | ||
881 | { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */ | ||
882 | |||
883 | + /* Enmotus */ | ||
884 | + { PCI_DEVICE(0x1c44, 0x8000), board_ahci }, | ||
885 | + | ||
886 | /* Generic, PCI class code for AHCI */ | ||
887 | { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, | ||
888 | PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff, board_ahci }, | ||
889 | @@ -1098,9 +1102,11 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | ||
890 | dev_info(&pdev->dev, | ||
891 | "PDC42819 can only drive SATA devices with this driver\n"); | ||
892 | |||
893 | - /* The Connext uses non-standard BAR */ | ||
894 | + /* Both Connext and Enmotus devices use non-standard BARs */ | ||
895 | if (pdev->vendor == PCI_VENDOR_ID_STMICRO && pdev->device == 0xCC06) | ||
896 | ahci_pci_bar = AHCI_PCI_BAR_STA2X11; | ||
897 | + else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000) | ||
898 | + ahci_pci_bar = AHCI_PCI_BAR_ENMOTUS; | ||
899 | |||
900 | /* acquire resources */ | ||
901 | rc = pcim_enable_device(pdev); | ||
902 | diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c | ||
903 | index 8e1039c..8789aef 100644 | ||
904 | --- a/drivers/ata/libata-core.c | ||
905 | +++ b/drivers/ata/libata-core.c | ||
906 | @@ -2541,6 +2541,7 @@ int ata_bus_probe(struct ata_port *ap) | ||
907 | * bus as we may be talking too fast. | ||
908 | */ | ||
909 | dev->pio_mode = XFER_PIO_0; | ||
910 | + dev->dma_mode = 0xff; | ||
911 | |||
912 | /* If the controller has a pio mode setup function | ||
913 | * then use it to set the chipset to rights. Don't | ||
914 | diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c | ||
915 | index 7d4535e..105e31f 100644 | ||
916 | --- a/drivers/ata/libata-eh.c | ||
917 | +++ b/drivers/ata/libata-eh.c | ||
918 | @@ -2653,6 +2653,7 @@ int ata_eh_reset(struct ata_link *link, int classify, | ||
919 | * bus as we may be talking too fast. | ||
920 | */ | ||
921 | dev->pio_mode = XFER_PIO_0; | ||
922 | + dev->dma_mode = 0xff; | ||
923 | |||
924 | /* If the controller has a pio mode setup function | ||
925 | * then use it to set the chipset to rights. Don't | ||
926 | diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c | ||
927 | index 8ec81ca..9f8b751 100644 | ||
928 | --- a/drivers/ata/libata-scsi.c | ||
929 | +++ b/drivers/ata/libata-scsi.c | ||
930 | @@ -309,7 +309,8 @@ ata_scsi_activity_show(struct device *dev, struct device_attribute *attr, | ||
931 | struct ata_port *ap = ata_shost_to_port(sdev->host); | ||
932 | struct ata_device *atadev = ata_scsi_find_dev(ap, sdev); | ||
933 | |||
934 | - if (ap->ops->sw_activity_show && (ap->flags & ATA_FLAG_SW_ACTIVITY)) | ||
935 | + if (atadev && ap->ops->sw_activity_show && | ||
936 | + (ap->flags & ATA_FLAG_SW_ACTIVITY)) | ||
937 | return ap->ops->sw_activity_show(atadev, buf); | ||
938 | return -EINVAL; | ||
939 | } | ||
940 | @@ -324,7 +325,8 @@ ata_scsi_activity_store(struct device *dev, struct device_attribute *attr, | ||
941 | enum sw_activity val; | ||
942 | int rc; | ||
943 | |||
944 | - if (ap->ops->sw_activity_store && (ap->flags & ATA_FLAG_SW_ACTIVITY)) { | ||
945 | + if (atadev && ap->ops->sw_activity_store && | ||
946 | + (ap->flags & ATA_FLAG_SW_ACTIVITY)) { | ||
947 | val = simple_strtoul(buf, NULL, 0); | ||
948 | switch (val) { | ||
949 | case OFF: case BLINK_ON: case BLINK_OFF: | ||
950 | diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c | ||
951 | index 489c817..fb0dd87 100644 | ||
952 | --- a/drivers/ata/sata_promise.c | ||
953 | +++ b/drivers/ata/sata_promise.c | ||
954 | @@ -147,6 +147,10 @@ struct pdc_port_priv { | ||
955 | dma_addr_t pkt_dma; | ||
956 | }; | ||
957 | |||
958 | +struct pdc_host_priv { | ||
959 | + spinlock_t hard_reset_lock; | ||
960 | +}; | ||
961 | + | ||
962 | static int pdc_sata_scr_read(struct ata_link *link, unsigned int sc_reg, u32 *val); | ||
963 | static int pdc_sata_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); | ||
964 | static int pdc_ata_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); | ||
965 | @@ -801,9 +805,10 @@ static void pdc_hard_reset_port(struct ata_port *ap) | ||
966 | void __iomem *host_mmio = ap->host->iomap[PDC_MMIO_BAR]; | ||
967 | void __iomem *pcictl_b1_mmio = host_mmio + PDC_PCI_CTL + 1; | ||
968 | unsigned int ata_no = pdc_ata_port_to_ata_no(ap); | ||
969 | + struct pdc_host_priv *hpriv = ap->host->private_data; | ||
970 | u8 tmp; | ||
971 | |||
972 | - spin_lock(&ap->host->lock); | ||
973 | + spin_lock(&hpriv->hard_reset_lock); | ||
974 | |||
975 | tmp = readb(pcictl_b1_mmio); | ||
976 | tmp &= ~(0x10 << ata_no); | ||
977 | @@ -814,7 +819,7 @@ static void pdc_hard_reset_port(struct ata_port *ap) | ||
978 | writeb(tmp, pcictl_b1_mmio); | ||
979 | readb(pcictl_b1_mmio); /* flush */ | ||
980 | |||
981 | - spin_unlock(&ap->host->lock); | ||
982 | + spin_unlock(&hpriv->hard_reset_lock); | ||
983 | } | ||
984 | |||
985 | static int pdc_sata_hardreset(struct ata_link *link, unsigned int *class, | ||
986 | @@ -1182,6 +1187,7 @@ static int pdc_ata_init_one(struct pci_dev *pdev, | ||
987 | const struct ata_port_info *pi = &pdc_port_info[ent->driver_data]; | ||
988 | const struct ata_port_info *ppi[PDC_MAX_PORTS]; | ||
989 | struct ata_host *host; | ||
990 | + struct pdc_host_priv *hpriv; | ||
991 | void __iomem *host_mmio; | ||
992 | int n_ports, i, rc; | ||
993 | int is_sataii_tx4; | ||
994 | @@ -1218,6 +1224,11 @@ static int pdc_ata_init_one(struct pci_dev *pdev, | ||
995 | dev_err(&pdev->dev, "failed to allocate host\n"); | ||
996 | return -ENOMEM; | ||
997 | } | ||
998 | + hpriv = devm_kzalloc(&pdev->dev, sizeof *hpriv, GFP_KERNEL); | ||
999 | + if (!hpriv) | ||
1000 | + return -ENOMEM; | ||
1001 | + spin_lock_init(&hpriv->hard_reset_lock); | ||
1002 | + host->private_data = hpriv; | ||
1003 | host->iomap = pcim_iomap_table(pdev); | ||
1004 | |||
1005 | is_sataii_tx4 = pdc_is_sataii_tx4(pi->flags); | ||
1006 | diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c | ||
1007 | index 9851093..1853a45 100644 | ||
1008 | --- a/drivers/atm/solos-pci.c | ||
1009 | +++ b/drivers/atm/solos-pci.c | ||
1010 | @@ -967,10 +967,11 @@ static uint32_t fpga_tx(struct solos_card *card) | ||
1011 | for (port = 0; tx_pending; tx_pending >>= 1, port++) { | ||
1012 | if (tx_pending & 1) { | ||
1013 | struct sk_buff *oldskb = card->tx_skb[port]; | ||
1014 | - if (oldskb) | ||
1015 | + if (oldskb) { | ||
1016 | pci_unmap_single(card->dev, SKB_CB(oldskb)->dma_addr, | ||
1017 | oldskb->len, PCI_DMA_TODEVICE); | ||
1018 | - | ||
1019 | + card->tx_skb[port] = NULL; | ||
1020 | + } | ||
1021 | spin_lock(&card->tx_queue_lock); | ||
1022 | skb = skb_dequeue(&card->tx_queue[port]); | ||
1023 | if (!skb) | ||
1024 | diff --git a/drivers/base/regmap/regmap-debugfs.c b/drivers/base/regmap/regmap-debugfs.c | ||
1025 | index bb1ff17..c394041 100644 | ||
1026 | --- a/drivers/base/regmap/regmap-debugfs.c | ||
1027 | +++ b/drivers/base/regmap/regmap-debugfs.c | ||
1028 | @@ -90,7 +90,7 @@ static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf, | ||
1029 | /* If we're in the region the user is trying to read */ | ||
1030 | if (p >= *ppos) { | ||
1031 | /* ...but not beyond it */ | ||
1032 | - if (buf_pos >= count - 1 - tot_len) | ||
1033 | + if (buf_pos + 1 + tot_len >= count) | ||
1034 | break; | ||
1035 | |||
1036 | /* Format the register */ | ||
1037 | diff --git a/drivers/bcma/driver_mips.c b/drivers/bcma/driver_mips.c | ||
1038 | index cc65b45..b4e83b8 100644 | ||
1039 | --- a/drivers/bcma/driver_mips.c | ||
1040 | +++ b/drivers/bcma/driver_mips.c | ||
1041 | @@ -115,7 +115,7 @@ static void bcma_core_mips_set_irq(struct bcma_device *dev, unsigned int irq) | ||
1042 | bcma_read32(mdev, BCMA_MIPS_MIPS74K_INTMASK(0)) & | ||
1043 | ~(1 << irqflag)); | ||
1044 | else | ||
1045 | - bcma_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(irq), 0); | ||
1046 | + bcma_write32(mdev, BCMA_MIPS_MIPS74K_INTMASK(oldirq), 0); | ||
1047 | |||
1048 | /* assign the new one */ | ||
1049 | if (irq == 0) { | ||
1050 | diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h | ||
1051 | index db195ab..e49ddd0 100644 | ||
1052 | --- a/drivers/block/aoe/aoe.h | ||
1053 | +++ b/drivers/block/aoe/aoe.h | ||
1054 | @@ -1,5 +1,5 @@ | ||
1055 | /* Copyright (c) 2007 Coraid, Inc. See COPYING for GPL terms. */ | ||
1056 | -#define VERSION "47" | ||
1057 | +#define VERSION "47q" | ||
1058 | #define AOE_MAJOR 152 | ||
1059 | #define DEVICE_NAME "aoe" | ||
1060 | |||
1061 | diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c | ||
1062 | index 321de7b..7eca463 100644 | ||
1063 | --- a/drivers/block/aoe/aoeblk.c | ||
1064 | +++ b/drivers/block/aoe/aoeblk.c | ||
1065 | @@ -276,8 +276,6 @@ aoeblk_gdalloc(void *vp) | ||
1066 | goto err_mempool; | ||
1067 | blk_queue_make_request(d->blkq, aoeblk_make_request); | ||
1068 | d->blkq->backing_dev_info.name = "aoe"; | ||
1069 | - if (bdi_init(&d->blkq->backing_dev_info)) | ||
1070 | - goto err_blkq; | ||
1071 | spin_lock_irqsave(&d->lock, flags); | ||
1072 | gd->major = AOE_MAJOR; | ||
1073 | gd->first_minor = d->sysminor * AOE_PARTITIONS; | ||
1074 | @@ -298,9 +296,6 @@ aoeblk_gdalloc(void *vp) | ||
1075 | aoedisk_add_sysfs(d); | ||
1076 | return; | ||
1077 | |||
1078 | -err_blkq: | ||
1079 | - blk_cleanup_queue(d->blkq); | ||
1080 | - d->blkq = NULL; | ||
1081 | err_mempool: | ||
1082 | mempool_destroy(d->bufpool); | ||
1083 | err_disk: | ||
1084 | diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c | ||
1085 | index 54a55f0..7aac910 100644 | ||
1086 | --- a/drivers/block/rbd.c | ||
1087 | +++ b/drivers/block/rbd.c | ||
1088 | @@ -69,7 +69,7 @@ | ||
1089 | #define DEV_NAME_LEN 32 | ||
1090 | #define MAX_INT_FORMAT_WIDTH ((5 * sizeof (int)) / 2 + 1) | ||
1091 | |||
1092 | -#define RBD_NOTIFY_TIMEOUT_DEFAULT 10 | ||
1093 | +#define RBD_READ_ONLY_DEFAULT false | ||
1094 | |||
1095 | /* | ||
1096 | * block device image metadata (in-memory version) | ||
1097 | @@ -91,7 +91,7 @@ struct rbd_image_header { | ||
1098 | }; | ||
1099 | |||
1100 | struct rbd_options { | ||
1101 | - int notify_timeout; | ||
1102 | + bool read_only; | ||
1103 | }; | ||
1104 | |||
1105 | /* | ||
1106 | @@ -177,7 +177,7 @@ struct rbd_device { | ||
1107 | u64 snap_id; /* current snapshot id */ | ||
1108 | /* whether the snap_id this device reads from still exists */ | ||
1109 | bool snap_exists; | ||
1110 | - int read_only; | ||
1111 | + bool read_only; | ||
1112 | |||
1113 | struct list_head node; | ||
1114 | |||
1115 | @@ -186,6 +186,7 @@ struct rbd_device { | ||
1116 | |||
1117 | /* sysfs related */ | ||
1118 | struct device dev; | ||
1119 | + unsigned long open_count; | ||
1120 | }; | ||
1121 | |||
1122 | static DEFINE_MUTEX(ctl_mutex); /* Serialize open/close/setup/teardown */ | ||
1123 | @@ -249,8 +250,11 @@ static int rbd_open(struct block_device *bdev, fmode_t mode) | ||
1124 | if ((mode & FMODE_WRITE) && rbd_dev->read_only) | ||
1125 | return -EROFS; | ||
1126 | |||
1127 | + mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
1128 | rbd_get_dev(rbd_dev); | ||
1129 | set_device_ro(bdev, rbd_dev->read_only); | ||
1130 | + rbd_dev->open_count++; | ||
1131 | + mutex_unlock(&ctl_mutex); | ||
1132 | |||
1133 | return 0; | ||
1134 | } | ||
1135 | @@ -259,7 +263,11 @@ static int rbd_release(struct gendisk *disk, fmode_t mode) | ||
1136 | { | ||
1137 | struct rbd_device *rbd_dev = disk->private_data; | ||
1138 | |||
1139 | + mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
1140 | + BUG_ON(!rbd_dev->open_count); | ||
1141 | + rbd_dev->open_count--; | ||
1142 | rbd_put_dev(rbd_dev); | ||
1143 | + mutex_unlock(&ctl_mutex); | ||
1144 | |||
1145 | return 0; | ||
1146 | } | ||
1147 | @@ -341,17 +349,24 @@ static struct rbd_client *__rbd_client_find(struct ceph_options *ceph_opts) | ||
1148 | * mount options | ||
1149 | */ | ||
1150 | enum { | ||
1151 | - Opt_notify_timeout, | ||
1152 | Opt_last_int, | ||
1153 | /* int args above */ | ||
1154 | Opt_last_string, | ||
1155 | /* string args above */ | ||
1156 | + Opt_read_only, | ||
1157 | + Opt_read_write, | ||
1158 | + /* Boolean args above */ | ||
1159 | + Opt_last_bool, | ||
1160 | }; | ||
1161 | |||
1162 | static match_table_t rbd_opts_tokens = { | ||
1163 | - {Opt_notify_timeout, "notify_timeout=%d"}, | ||
1164 | /* int args above */ | ||
1165 | /* string args above */ | ||
1166 | + {Opt_read_only, "read_only"}, | ||
1167 | + {Opt_read_only, "ro"}, /* Alternate spelling */ | ||
1168 | + {Opt_read_write, "read_write"}, | ||
1169 | + {Opt_read_write, "rw"}, /* Alternate spelling */ | ||
1170 | + /* Boolean args above */ | ||
1171 | {-1, NULL} | ||
1172 | }; | ||
1173 | |||
1174 | @@ -376,13 +391,18 @@ static int parse_rbd_opts_token(char *c, void *private) | ||
1175 | } else if (token > Opt_last_int && token < Opt_last_string) { | ||
1176 | dout("got string token %d val %s\n", token, | ||
1177 | argstr[0].from); | ||
1178 | + } else if (token > Opt_last_string && token < Opt_last_bool) { | ||
1179 | + dout("got Boolean token %d\n", token); | ||
1180 | } else { | ||
1181 | dout("got token %d\n", token); | ||
1182 | } | ||
1183 | |||
1184 | switch (token) { | ||
1185 | - case Opt_notify_timeout: | ||
1186 | - rbd_opts->notify_timeout = intval; | ||
1187 | + case Opt_read_only: | ||
1188 | + rbd_opts->read_only = true; | ||
1189 | + break; | ||
1190 | + case Opt_read_write: | ||
1191 | + rbd_opts->read_only = false; | ||
1192 | break; | ||
1193 | default: | ||
1194 | BUG_ON(token); | ||
1195 | @@ -406,7 +426,7 @@ static struct rbd_client *rbd_get_client(const char *mon_addr, | ||
1196 | if (!rbd_opts) | ||
1197 | return ERR_PTR(-ENOMEM); | ||
1198 | |||
1199 | - rbd_opts->notify_timeout = RBD_NOTIFY_TIMEOUT_DEFAULT; | ||
1200 | + rbd_opts->read_only = RBD_READ_ONLY_DEFAULT; | ||
1201 | |||
1202 | ceph_opts = ceph_parse_options(options, mon_addr, | ||
1203 | mon_addr + mon_addr_len, | ||
1204 | @@ -606,7 +626,7 @@ static int rbd_header_set_snap(struct rbd_device *rbd_dev, u64 *size) | ||
1205 | sizeof (RBD_SNAP_HEAD_NAME))) { | ||
1206 | rbd_dev->snap_id = CEPH_NOSNAP; | ||
1207 | rbd_dev->snap_exists = false; | ||
1208 | - rbd_dev->read_only = 0; | ||
1209 | + rbd_dev->read_only = rbd_dev->rbd_opts.read_only; | ||
1210 | if (size) | ||
1211 | *size = rbd_dev->header.image_size; | ||
1212 | } else { | ||
1213 | @@ -618,7 +638,7 @@ static int rbd_header_set_snap(struct rbd_device *rbd_dev, u64 *size) | ||
1214 | goto done; | ||
1215 | rbd_dev->snap_id = snap_id; | ||
1216 | rbd_dev->snap_exists = true; | ||
1217 | - rbd_dev->read_only = 1; | ||
1218 | + rbd_dev->read_only = true; /* No choice for snapshots */ | ||
1219 | } | ||
1220 | |||
1221 | ret = 0; | ||
1222 | @@ -938,8 +958,9 @@ static int rbd_do_request(struct request *rq, | ||
1223 | layout->fl_stripe_count = cpu_to_le32(1); | ||
1224 | layout->fl_object_size = cpu_to_le32(1 << RBD_MAX_OBJ_ORDER); | ||
1225 | layout->fl_pg_pool = cpu_to_le32(rbd_dev->pool_id); | ||
1226 | - ceph_calc_raw_layout(osdc, layout, snapid, ofs, &len, &bno, | ||
1227 | - req, ops); | ||
1228 | + ret = ceph_calc_raw_layout(osdc, layout, snapid, ofs, &len, &bno, | ||
1229 | + req, ops); | ||
1230 | + rbd_assert(ret == 0); | ||
1231 | |||
1232 | ceph_osdc_build_request(req, ofs, &len, | ||
1233 | ops, | ||
1234 | @@ -2260,8 +2281,8 @@ static void rbd_id_put(struct rbd_device *rbd_dev) | ||
1235 | struct rbd_device *rbd_dev; | ||
1236 | |||
1237 | rbd_dev = list_entry(tmp, struct rbd_device, node); | ||
1238 | - if (rbd_id > max_id) | ||
1239 | - max_id = rbd_id; | ||
1240 | + if (rbd_dev->id > max_id) | ||
1241 | + max_id = rbd_dev->id; | ||
1242 | } | ||
1243 | spin_unlock(&rbd_dev_list_lock); | ||
1244 | |||
1245 | @@ -2623,6 +2644,11 @@ static ssize_t rbd_remove(struct bus_type *bus, | ||
1246 | goto done; | ||
1247 | } | ||
1248 | |||
1249 | + if (rbd_dev->open_count) { | ||
1250 | + ret = -EBUSY; | ||
1251 | + goto done; | ||
1252 | + } | ||
1253 | + | ||
1254 | __rbd_remove_all_snaps(rbd_dev); | ||
1255 | rbd_bus_del_dev(rbd_dev); | ||
1256 | |||
1257 | diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c | ||
1258 | index fc2de55..b00000e 100644 | ||
1259 | --- a/drivers/bluetooth/ath3k.c | ||
1260 | +++ b/drivers/bluetooth/ath3k.c | ||
1261 | @@ -67,6 +67,7 @@ static struct usb_device_id ath3k_table[] = { | ||
1262 | { USB_DEVICE(0x13d3, 0x3304) }, | ||
1263 | { USB_DEVICE(0x0930, 0x0215) }, | ||
1264 | { USB_DEVICE(0x0489, 0xE03D) }, | ||
1265 | + { USB_DEVICE(0x0489, 0xE027) }, | ||
1266 | |||
1267 | /* Atheros AR9285 Malbec with sflash firmware */ | ||
1268 | { USB_DEVICE(0x03F0, 0x311D) }, | ||
1269 | diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c | ||
1270 | index 654e248..e023c65 100644 | ||
1271 | --- a/drivers/bluetooth/btusb.c | ||
1272 | +++ b/drivers/bluetooth/btusb.c | ||
1273 | @@ -123,6 +123,7 @@ static struct usb_device_id blacklist_table[] = { | ||
1274 | { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE }, | ||
1275 | { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE }, | ||
1276 | { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE }, | ||
1277 | + { USB_DEVICE(0x0489, 0xe027), .driver_info = BTUSB_IGNORE }, | ||
1278 | |||
1279 | /* Atheros AR9285 Malbec with sflash firmware */ | ||
1280 | { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, | ||
1281 | diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c | ||
1282 | index f7f1dc6..ed0e8b7 100644 | ||
1283 | --- a/drivers/dma/ioat/dma_v3.c | ||
1284 | +++ b/drivers/dma/ioat/dma_v3.c | ||
1285 | @@ -951,7 +951,7 @@ static int __devinit ioat_xor_val_self_test(struct ioatdma_device *device) | ||
1286 | goto free_resources; | ||
1287 | } | ||
1288 | } | ||
1289 | - dma_sync_single_for_device(dev, dest_dma, PAGE_SIZE, DMA_TO_DEVICE); | ||
1290 | + dma_sync_single_for_device(dev, dest_dma, PAGE_SIZE, DMA_FROM_DEVICE); | ||
1291 | |||
1292 | /* skip validate if the capability is not present */ | ||
1293 | if (!dma_has_cap(DMA_XOR_VAL, dma_chan->device->cap_mask)) | ||
1294 | diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c | ||
1295 | index 08c6749..638e1f7 100644 | ||
1296 | --- a/drivers/firewire/net.c | ||
1297 | +++ b/drivers/firewire/net.c | ||
1298 | @@ -861,8 +861,8 @@ static void fwnet_receive_broadcast(struct fw_iso_context *context, | ||
1299 | if (specifier_id == IANA_SPECIFIER_ID && ver == RFC2734_SW_VERSION) { | ||
1300 | buf_ptr += 2; | ||
1301 | length -= IEEE1394_GASP_HDR_SIZE; | ||
1302 | - fwnet_incoming_packet(dev, buf_ptr, length, | ||
1303 | - source_node_id, -1, true); | ||
1304 | + fwnet_incoming_packet(dev, buf_ptr, length, source_node_id, | ||
1305 | + context->card->generation, true); | ||
1306 | } | ||
1307 | |||
1308 | packet.payload_length = dev->rcv_buffer_size; | ||
1309 | @@ -958,7 +958,12 @@ static void fwnet_transmit_packet_done(struct fwnet_packet_task *ptask) | ||
1310 | break; | ||
1311 | } | ||
1312 | |||
1313 | - skb_pull(skb, ptask->max_payload); | ||
1314 | + if (ptask->dest_node == IEEE1394_ALL_NODES) { | ||
1315 | + skb_pull(skb, | ||
1316 | + ptask->max_payload + IEEE1394_GASP_HDR_SIZE); | ||
1317 | + } else { | ||
1318 | + skb_pull(skb, ptask->max_payload); | ||
1319 | + } | ||
1320 | if (ptask->outstanding_pkts > 1) { | ||
1321 | fwnet_make_sf_hdr(&ptask->hdr, RFC2374_HDR_INTFRAG, | ||
1322 | dg_size, fg_off, datagram_label); | ||
1323 | @@ -1062,7 +1067,7 @@ static int fwnet_send_packet(struct fwnet_packet_task *ptask) | ||
1324 | smp_rmb(); | ||
1325 | node_id = dev->card->node_id; | ||
1326 | |||
1327 | - p = skb_push(ptask->skb, 8); | ||
1328 | + p = skb_push(ptask->skb, IEEE1394_GASP_HDR_SIZE); | ||
1329 | put_unaligned_be32(node_id << 16 | IANA_SPECIFIER_ID >> 8, p); | ||
1330 | put_unaligned_be32((IANA_SPECIFIER_ID & 0xff) << 24 | ||
1331 | | RFC2734_SW_VERSION, &p[4]); | ||
1332 | diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c | ||
1333 | index b298158..fd3ae62 100644 | ||
1334 | --- a/drivers/firmware/dmi_scan.c | ||
1335 | +++ b/drivers/firmware/dmi_scan.c | ||
1336 | @@ -16,6 +16,7 @@ | ||
1337 | */ | ||
1338 | static char dmi_empty_string[] = " "; | ||
1339 | |||
1340 | +static u16 __initdata dmi_ver; | ||
1341 | /* | ||
1342 | * Catch too early calls to dmi_check_system(): | ||
1343 | */ | ||
1344 | @@ -118,12 +119,12 @@ static int __init dmi_walk_early(void (*decode)(const struct dmi_header *, | ||
1345 | return 0; | ||
1346 | } | ||
1347 | |||
1348 | -static int __init dmi_checksum(const u8 *buf) | ||
1349 | +static int __init dmi_checksum(const u8 *buf, u8 len) | ||
1350 | { | ||
1351 | u8 sum = 0; | ||
1352 | int a; | ||
1353 | |||
1354 | - for (a = 0; a < 15; a++) | ||
1355 | + for (a = 0; a < len; a++) | ||
1356 | sum += buf[a]; | ||
1357 | |||
1358 | return sum == 0; | ||
1359 | @@ -161,8 +162,10 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int inde | ||
1360 | return; | ||
1361 | |||
1362 | for (i = 0; i < 16 && (is_ff || is_00); i++) { | ||
1363 | - if(d[i] != 0x00) is_ff = 0; | ||
1364 | - if(d[i] != 0xFF) is_00 = 0; | ||
1365 | + if (d[i] != 0x00) | ||
1366 | + is_00 = 0; | ||
1367 | + if (d[i] != 0xFF) | ||
1368 | + is_ff = 0; | ||
1369 | } | ||
1370 | |||
1371 | if (is_ff || is_00) | ||
1372 | @@ -172,7 +175,15 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int inde | ||
1373 | if (!s) | ||
1374 | return; | ||
1375 | |||
1376 | - sprintf(s, "%pUB", d); | ||
1377 | + /* | ||
1378 | + * As of version 2.6 of the SMBIOS specification, the first 3 fields of | ||
1379 | + * the UUID are supposed to be little-endian encoded. The specification | ||
1380 | + * says that this is the defacto standard. | ||
1381 | + */ | ||
1382 | + if (dmi_ver >= 0x0206) | ||
1383 | + sprintf(s, "%pUL", d); | ||
1384 | + else | ||
1385 | + sprintf(s, "%pUB", d); | ||
1386 | |||
1387 | dmi_ident[slot] = s; | ||
1388 | } | ||
1389 | @@ -404,29 +415,57 @@ static int __init dmi_present(const char __iomem *p) | ||
1390 | u8 buf[15]; | ||
1391 | |||
1392 | memcpy_fromio(buf, p, 15); | ||
1393 | - if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) { | ||
1394 | + if (dmi_checksum(buf, 15)) { | ||
1395 | dmi_num = (buf[13] << 8) | buf[12]; | ||
1396 | dmi_len = (buf[7] << 8) | buf[6]; | ||
1397 | dmi_base = (buf[11] << 24) | (buf[10] << 16) | | ||
1398 | (buf[9] << 8) | buf[8]; | ||
1399 | |||
1400 | - /* | ||
1401 | - * DMI version 0.0 means that the real version is taken from | ||
1402 | - * the SMBIOS version, which we don't know at this point. | ||
1403 | - */ | ||
1404 | - if (buf[14] != 0) | ||
1405 | - printk(KERN_INFO "DMI %d.%d present.\n", | ||
1406 | - buf[14] >> 4, buf[14] & 0xF); | ||
1407 | - else | ||
1408 | - printk(KERN_INFO "DMI present.\n"); | ||
1409 | if (dmi_walk_early(dmi_decode) == 0) { | ||
1410 | + if (dmi_ver) | ||
1411 | + pr_info("SMBIOS %d.%d present.\n", | ||
1412 | + dmi_ver >> 8, dmi_ver & 0xFF); | ||
1413 | + else { | ||
1414 | + dmi_ver = (buf[14] & 0xF0) << 4 | | ||
1415 | + (buf[14] & 0x0F); | ||
1416 | + pr_info("Legacy DMI %d.%d present.\n", | ||
1417 | + dmi_ver >> 8, dmi_ver & 0xFF); | ||
1418 | + } | ||
1419 | dmi_dump_ids(); | ||
1420 | return 0; | ||
1421 | } | ||
1422 | } | ||
1423 | + dmi_ver = 0; | ||
1424 | return 1; | ||
1425 | } | ||
1426 | |||
1427 | +static int __init smbios_present(const char __iomem *p) | ||
1428 | +{ | ||
1429 | + u8 buf[32]; | ||
1430 | + int offset = 0; | ||
1431 | + | ||
1432 | + memcpy_fromio(buf, p, 32); | ||
1433 | + if ((buf[5] < 32) && dmi_checksum(buf, buf[5])) { | ||
1434 | + dmi_ver = (buf[6] << 8) + buf[7]; | ||
1435 | + | ||
1436 | + /* Some BIOS report weird SMBIOS version, fix that up */ | ||
1437 | + switch (dmi_ver) { | ||
1438 | + case 0x021F: | ||
1439 | + case 0x0221: | ||
1440 | + pr_debug("SMBIOS version fixup(2.%d->2.%d)\n", | ||
1441 | + dmi_ver & 0xFF, 3); | ||
1442 | + dmi_ver = 0x0203; | ||
1443 | + break; | ||
1444 | + case 0x0233: | ||
1445 | + pr_debug("SMBIOS version fixup(2.%d->2.%d)\n", 51, 6); | ||
1446 | + dmi_ver = 0x0206; | ||
1447 | + break; | ||
1448 | + } | ||
1449 | + offset = 16; | ||
1450 | + } | ||
1451 | + return dmi_present(buf + offset); | ||
1452 | +} | ||
1453 | + | ||
1454 | void __init dmi_scan_machine(void) | ||
1455 | { | ||
1456 | char __iomem *p, *q; | ||
1457 | @@ -444,7 +483,7 @@ void __init dmi_scan_machine(void) | ||
1458 | if (p == NULL) | ||
1459 | goto error; | ||
1460 | |||
1461 | - rc = dmi_present(p + 0x10); /* offset of _DMI_ string */ | ||
1462 | + rc = smbios_present(p); | ||
1463 | dmi_iounmap(p, 32); | ||
1464 | if (!rc) { | ||
1465 | dmi_available = 1; | ||
1466 | @@ -462,7 +501,12 @@ void __init dmi_scan_machine(void) | ||
1467 | goto error; | ||
1468 | |||
1469 | for (q = p; q < p + 0x10000; q += 16) { | ||
1470 | - rc = dmi_present(q); | ||
1471 | + if (memcmp(q, "_SM_", 4) == 0 && q - p <= 0xFFE0) | ||
1472 | + rc = smbios_present(q); | ||
1473 | + else if (memcmp(q, "_DMI_", 5) == 0) | ||
1474 | + rc = dmi_present(q); | ||
1475 | + else | ||
1476 | + continue; | ||
1477 | if (!rc) { | ||
1478 | dmi_available = 1; | ||
1479 | dmi_iounmap(p, 0x10000); | ||
1480 | diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | ||
1481 | index cdf46b5..d8bb392 100644 | ||
1482 | --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c | ||
1483 | +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | ||
1484 | @@ -749,6 +749,8 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev, | ||
1485 | total = 0; | ||
1486 | for (i = 0; i < count; i++) { | ||
1487 | struct drm_i915_gem_relocation_entry __user *user_relocs; | ||
1488 | + u64 invalid_offset = (u64)-1; | ||
1489 | + int j; | ||
1490 | |||
1491 | user_relocs = (void __user *)(uintptr_t)exec[i].relocs_ptr; | ||
1492 | |||
1493 | @@ -759,6 +761,25 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev, | ||
1494 | goto err; | ||
1495 | } | ||
1496 | |||
1497 | + /* As we do not update the known relocation offsets after | ||
1498 | + * relocating (due to the complexities in lock handling), | ||
1499 | + * we need to mark them as invalid now so that we force the | ||
1500 | + * relocation processing next time. Just in case the target | ||
1501 | + * object is evicted and then rebound into its old | ||
1502 | + * presumed_offset before the next execbuffer - if that | ||
1503 | + * happened we would make the mistake of assuming that the | ||
1504 | + * relocations were valid. | ||
1505 | + */ | ||
1506 | + for (j = 0; j < exec[i].relocation_count; j++) { | ||
1507 | + if (copy_to_user(&user_relocs[j].presumed_offset, | ||
1508 | + &invalid_offset, | ||
1509 | + sizeof(invalid_offset))) { | ||
1510 | + ret = -EFAULT; | ||
1511 | + mutex_lock(&dev->struct_mutex); | ||
1512 | + goto err; | ||
1513 | + } | ||
1514 | + } | ||
1515 | + | ||
1516 | reloc_offset[i] = total; | ||
1517 | total += exec[i].relocation_count; | ||
1518 | } | ||
1519 | diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h | ||
1520 | index f02cfad..380e7da 100644 | ||
1521 | --- a/drivers/gpu/drm/i915/i915_reg.h | ||
1522 | +++ b/drivers/gpu/drm/i915/i915_reg.h | ||
1523 | @@ -506,6 +506,7 @@ | ||
1524 | * the enables for writing to the corresponding low bit. | ||
1525 | */ | ||
1526 | #define _3D_CHICKEN 0x02084 | ||
1527 | +#define _3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB (1 << 10) | ||
1528 | #define _3D_CHICKEN2 0x0208c | ||
1529 | /* Disables pipelining of read flushes past the SF-WIZ interface. | ||
1530 | * Required on all Ironlake steppings according to the B-Spec, but the | ||
1531 | @@ -3274,6 +3275,8 @@ | ||
1532 | #define _PFA_CTL_1 0x68080 | ||
1533 | #define _PFB_CTL_1 0x68880 | ||
1534 | #define PF_ENABLE (1<<31) | ||
1535 | +#define PF_PIPE_SEL_MASK_IVB (3<<29) | ||
1536 | +#define PF_PIPE_SEL_IVB(pipe) ((pipe)<<29) | ||
1537 | #define PF_FILTER_MASK (3<<23) | ||
1538 | #define PF_FILTER_PROGRAMMED (0<<23) | ||
1539 | #define PF_FILTER_MED_3x3 (1<<23) | ||
1540 | diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c | ||
1541 | index 0777c79..81e013f 100644 | ||
1542 | --- a/drivers/gpu/drm/i915/intel_display.c | ||
1543 | +++ b/drivers/gpu/drm/i915/intel_display.c | ||
1544 | @@ -2347,18 +2347,6 @@ static void intel_fdi_normal_train(struct drm_crtc *crtc) | ||
1545 | FDI_FE_ERRC_ENABLE); | ||
1546 | } | ||
1547 | |||
1548 | -static void cpt_phase_pointer_enable(struct drm_device *dev, int pipe) | ||
1549 | -{ | ||
1550 | - struct drm_i915_private *dev_priv = dev->dev_private; | ||
1551 | - u32 flags = I915_READ(SOUTH_CHICKEN1); | ||
1552 | - | ||
1553 | - flags |= FDI_PHASE_SYNC_OVR(pipe); | ||
1554 | - I915_WRITE(SOUTH_CHICKEN1, flags); /* once to unlock... */ | ||
1555 | - flags |= FDI_PHASE_SYNC_EN(pipe); | ||
1556 | - I915_WRITE(SOUTH_CHICKEN1, flags); /* then again to enable */ | ||
1557 | - POSTING_READ(SOUTH_CHICKEN1); | ||
1558 | -} | ||
1559 | - | ||
1560 | /* The FDI link training functions for ILK/Ibexpeak. */ | ||
1561 | static void ironlake_fdi_link_train(struct drm_crtc *crtc) | ||
1562 | { | ||
1563 | @@ -2509,9 +2497,6 @@ static void gen6_fdi_link_train(struct drm_crtc *crtc) | ||
1564 | POSTING_READ(reg); | ||
1565 | udelay(150); | ||
1566 | |||
1567 | - if (HAS_PCH_CPT(dev)) | ||
1568 | - cpt_phase_pointer_enable(dev, pipe); | ||
1569 | - | ||
1570 | for (i = 0; i < 4; i++) { | ||
1571 | reg = FDI_TX_CTL(pipe); | ||
1572 | temp = I915_READ(reg); | ||
1573 | @@ -2638,9 +2623,6 @@ static void ivb_manual_fdi_link_train(struct drm_crtc *crtc) | ||
1574 | POSTING_READ(reg); | ||
1575 | udelay(150); | ||
1576 | |||
1577 | - if (HAS_PCH_CPT(dev)) | ||
1578 | - cpt_phase_pointer_enable(dev, pipe); | ||
1579 | - | ||
1580 | for (i = 0; i < 4; i++) { | ||
1581 | reg = FDI_TX_CTL(pipe); | ||
1582 | temp = I915_READ(reg); | ||
1583 | @@ -2754,17 +2736,6 @@ static void ironlake_fdi_pll_enable(struct drm_crtc *crtc) | ||
1584 | } | ||
1585 | } | ||
1586 | |||
1587 | -static void cpt_phase_pointer_disable(struct drm_device *dev, int pipe) | ||
1588 | -{ | ||
1589 | - struct drm_i915_private *dev_priv = dev->dev_private; | ||
1590 | - u32 flags = I915_READ(SOUTH_CHICKEN1); | ||
1591 | - | ||
1592 | - flags &= ~(FDI_PHASE_SYNC_EN(pipe)); | ||
1593 | - I915_WRITE(SOUTH_CHICKEN1, flags); /* once to disable... */ | ||
1594 | - flags &= ~(FDI_PHASE_SYNC_OVR(pipe)); | ||
1595 | - I915_WRITE(SOUTH_CHICKEN1, flags); /* then again to lock */ | ||
1596 | - POSTING_READ(SOUTH_CHICKEN1); | ||
1597 | -} | ||
1598 | static void ironlake_fdi_disable(struct drm_crtc *crtc) | ||
1599 | { | ||
1600 | struct drm_device *dev = crtc->dev; | ||
1601 | @@ -2794,8 +2765,6 @@ static void ironlake_fdi_disable(struct drm_crtc *crtc) | ||
1602 | I915_WRITE(FDI_RX_CHICKEN(pipe), | ||
1603 | I915_READ(FDI_RX_CHICKEN(pipe) & | ||
1604 | ~FDI_RX_PHASE_SYNC_POINTER_EN)); | ||
1605 | - } else if (HAS_PCH_CPT(dev)) { | ||
1606 | - cpt_phase_pointer_disable(dev, pipe); | ||
1607 | } | ||
1608 | |||
1609 | /* still set train pattern 1 */ | ||
1610 | @@ -3233,7 +3202,11 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | ||
1611 | * as some pre-programmed values are broken, | ||
1612 | * e.g. x201. | ||
1613 | */ | ||
1614 | - I915_WRITE(PF_CTL(pipe), PF_ENABLE | PF_FILTER_MED_3x3); | ||
1615 | + if (IS_IVYBRIDGE(dev)) | ||
1616 | + I915_WRITE(PF_CTL(pipe), PF_ENABLE | PF_FILTER_MED_3x3 | | ||
1617 | + PF_PIPE_SEL_IVB(pipe)); | ||
1618 | + else | ||
1619 | + I915_WRITE(PF_CTL(pipe), PF_ENABLE | PF_FILTER_MED_3x3); | ||
1620 | I915_WRITE(PF_WIN_POS(pipe), dev_priv->pch_pf_pos); | ||
1621 | I915_WRITE(PF_WIN_SZ(pipe), dev_priv->pch_pf_size); | ||
1622 | } | ||
1623 | diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c | ||
1624 | index 0c52448..2e6448c 100644 | ||
1625 | --- a/drivers/gpu/drm/i915/intel_lvds.c | ||
1626 | +++ b/drivers/gpu/drm/i915/intel_lvds.c | ||
1627 | @@ -774,14 +774,6 @@ static const struct dmi_system_id intel_no_lvds[] = { | ||
1628 | }, | ||
1629 | { | ||
1630 | .callback = intel_no_lvds_dmi_callback, | ||
1631 | - .ident = "ZOTAC ZBOXSD-ID12/ID13", | ||
1632 | - .matches = { | ||
1633 | - DMI_MATCH(DMI_BOARD_VENDOR, "ZOTAC"), | ||
1634 | - DMI_MATCH(DMI_BOARD_NAME, "ZBOXSD-ID12/ID13"), | ||
1635 | - }, | ||
1636 | - }, | ||
1637 | - { | ||
1638 | - .callback = intel_no_lvds_dmi_callback, | ||
1639 | .ident = "Gigabyte GA-D525TUD", | ||
1640 | .matches = { | ||
1641 | DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co., Ltd."), | ||
1642 | diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c | ||
1643 | index c23c9ea..572b2ca 100644 | ||
1644 | --- a/drivers/gpu/drm/i915/intel_pm.c | ||
1645 | +++ b/drivers/gpu/drm/i915/intel_pm.c | ||
1646 | @@ -3324,6 +3324,10 @@ static void gen6_init_clock_gating(struct drm_device *dev) | ||
1647 | I915_READ(ILK_DISPLAY_CHICKEN2) | | ||
1648 | ILK_ELPIN_409_SELECT); | ||
1649 | |||
1650 | + /* WaDisableHiZPlanesWhenMSAAEnabled */ | ||
1651 | + I915_WRITE(_3D_CHICKEN, | ||
1652 | + _MASKED_BIT_ENABLE(_3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB)); | ||
1653 | + | ||
1654 | I915_WRITE(WM3_LP_ILK, 0); | ||
1655 | I915_WRITE(WM2_LP_ILK, 0); | ||
1656 | I915_WRITE(WM1_LP_ILK, 0); | ||
1657 | diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau/nv04_dfp.c | ||
1658 | index 89640f2..2b59f41 100644 | ||
1659 | --- a/drivers/gpu/drm/nouveau/nv04_dfp.c | ||
1660 | +++ b/drivers/gpu/drm/nouveau/nv04_dfp.c | ||
1661 | @@ -504,7 +504,7 @@ static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode) | ||
1662 | |||
1663 | static inline bool is_powersaving_dpms(int mode) | ||
1664 | { | ||
1665 | - return (mode != DRM_MODE_DPMS_ON); | ||
1666 | + return mode != DRM_MODE_DPMS_ON && mode != NV_DPMS_CLEARED; | ||
1667 | } | ||
1668 | |||
1669 | static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode) | ||
1670 | diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c | ||
1671 | index 2eb418e..e53a91b 100644 | ||
1672 | --- a/drivers/gpu/drm/radeon/atombios_encoders.c | ||
1673 | +++ b/drivers/gpu/drm/radeon/atombios_encoders.c | ||
1674 | @@ -95,7 +95,7 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder, | ||
1675 | ((radeon_encoder->active_device & (ATOM_DEVICE_DFP_SUPPORT | ATOM_DEVICE_LCD_SUPPORT)) || | ||
1676 | (radeon_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_OBJECT_ID_NONE))) { | ||
1677 | struct drm_connector *connector = radeon_get_connector_for_encoder(encoder); | ||
1678 | - radeon_dp_set_link_config(connector, mode); | ||
1679 | + radeon_dp_set_link_config(connector, adjusted_mode); | ||
1680 | } | ||
1681 | |||
1682 | return true; | ||
1683 | diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c | ||
1684 | index 4a33cdc..bf849ea 100644 | ||
1685 | --- a/drivers/gpu/drm/radeon/evergreen_cs.c | ||
1686 | +++ b/drivers/gpu/drm/radeon/evergreen_cs.c | ||
1687 | @@ -2724,6 +2724,7 @@ static bool evergreen_vm_reg_valid(u32 reg) | ||
1688 | |||
1689 | /* check config regs */ | ||
1690 | switch (reg) { | ||
1691 | + case WAIT_UNTIL: | ||
1692 | case GRBM_GFX_INDEX: | ||
1693 | case CP_STRMOUT_CNTL: | ||
1694 | case CP_COHER_CNTL: | ||
1695 | diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c | ||
1696 | index 895e628..a7e797c 100644 | ||
1697 | --- a/drivers/gpu/drm/radeon/radeon_connectors.c | ||
1698 | +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | ||
1699 | @@ -745,7 +745,7 @@ radeon_vga_detect(struct drm_connector *connector, bool force) | ||
1700 | ret = connector_status_disconnected; | ||
1701 | |||
1702 | if (radeon_connector->ddc_bus) | ||
1703 | - dret = radeon_ddc_probe(radeon_connector); | ||
1704 | + dret = radeon_ddc_probe(radeon_connector, false); | ||
1705 | if (dret) { | ||
1706 | radeon_connector->detected_by_load = false; | ||
1707 | if (radeon_connector->edid) { | ||
1708 | @@ -951,7 +951,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | ||
1709 | return connector->status; | ||
1710 | |||
1711 | if (radeon_connector->ddc_bus) | ||
1712 | - dret = radeon_ddc_probe(radeon_connector); | ||
1713 | + dret = radeon_ddc_probe(radeon_connector, false); | ||
1714 | if (dret) { | ||
1715 | radeon_connector->detected_by_load = false; | ||
1716 | if (radeon_connector->edid) { | ||
1717 | @@ -1391,7 +1391,8 @@ radeon_dp_detect(struct drm_connector *connector, bool force) | ||
1718 | if (encoder) { | ||
1719 | /* setup ddc on the bridge */ | ||
1720 | radeon_atom_ext_encoder_setup_ddc(encoder); | ||
1721 | - if (radeon_ddc_probe(radeon_connector)) /* try DDC */ | ||
1722 | + /* bridge chips are always aux */ | ||
1723 | + if (radeon_ddc_probe(radeon_connector, true)) /* try DDC */ | ||
1724 | ret = connector_status_connected; | ||
1725 | else if (radeon_connector->dac_load_detect) { /* try load detection */ | ||
1726 | struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private; | ||
1727 | @@ -1409,7 +1410,8 @@ radeon_dp_detect(struct drm_connector *connector, bool force) | ||
1728 | if (radeon_dp_getdpcd(radeon_connector)) | ||
1729 | ret = connector_status_connected; | ||
1730 | } else { | ||
1731 | - if (radeon_ddc_probe(radeon_connector)) | ||
1732 | + /* try non-aux ddc (DP to DVI/HMDI/etc. adapter) */ | ||
1733 | + if (radeon_ddc_probe(radeon_connector, false)) | ||
1734 | ret = connector_status_connected; | ||
1735 | } | ||
1736 | } | ||
1737 | diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c | ||
1738 | index 7ddef8f..0125d34 100644 | ||
1739 | --- a/drivers/gpu/drm/radeon/radeon_display.c | ||
1740 | +++ b/drivers/gpu/drm/radeon/radeon_display.c | ||
1741 | @@ -695,10 +695,15 @@ int radeon_ddc_get_modes(struct radeon_connector *radeon_connector) | ||
1742 | if (radeon_connector->router.ddc_valid) | ||
1743 | radeon_router_select_ddc_port(radeon_connector); | ||
1744 | |||
1745 | - if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) || | ||
1746 | - (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP) || | ||
1747 | - (radeon_connector_encoder_get_dp_bridge_encoder_id(&radeon_connector->base) != | ||
1748 | - ENCODER_OBJECT_ID_NONE)) { | ||
1749 | + if (radeon_connector_encoder_get_dp_bridge_encoder_id(&radeon_connector->base) != | ||
1750 | + ENCODER_OBJECT_ID_NONE) { | ||
1751 | + struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; | ||
1752 | + | ||
1753 | + if (dig->dp_i2c_bus) | ||
1754 | + radeon_connector->edid = drm_get_edid(&radeon_connector->base, | ||
1755 | + &dig->dp_i2c_bus->adapter); | ||
1756 | + } else if ((radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_DisplayPort) || | ||
1757 | + (radeon_connector->base.connector_type == DRM_MODE_CONNECTOR_eDP)) { | ||
1758 | struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; | ||
1759 | |||
1760 | if ((dig->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT || | ||
1761 | diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c | ||
1762 | index 3edec1c..6076e85 100644 | ||
1763 | --- a/drivers/gpu/drm/radeon/radeon_i2c.c | ||
1764 | +++ b/drivers/gpu/drm/radeon/radeon_i2c.c | ||
1765 | @@ -39,7 +39,7 @@ extern u32 radeon_atom_hw_i2c_func(struct i2c_adapter *adap); | ||
1766 | * radeon_ddc_probe | ||
1767 | * | ||
1768 | */ | ||
1769 | -bool radeon_ddc_probe(struct radeon_connector *radeon_connector) | ||
1770 | +bool radeon_ddc_probe(struct radeon_connector *radeon_connector, bool use_aux) | ||
1771 | { | ||
1772 | u8 out = 0x0; | ||
1773 | u8 buf[8]; | ||
1774 | @@ -63,7 +63,13 @@ bool radeon_ddc_probe(struct radeon_connector *radeon_connector) | ||
1775 | if (radeon_connector->router.ddc_valid) | ||
1776 | radeon_router_select_ddc_port(radeon_connector); | ||
1777 | |||
1778 | - ret = i2c_transfer(&radeon_connector->ddc_bus->adapter, msgs, 2); | ||
1779 | + if (use_aux) { | ||
1780 | + struct radeon_connector_atom_dig *dig = radeon_connector->con_priv; | ||
1781 | + ret = i2c_transfer(&dig->dp_i2c_bus->adapter, msgs, 2); | ||
1782 | + } else { | ||
1783 | + ret = i2c_transfer(&radeon_connector->ddc_bus->adapter, msgs, 2); | ||
1784 | + } | ||
1785 | + | ||
1786 | if (ret != 2) | ||
1787 | /* Couldn't find an accessible DDC on this connector */ | ||
1788 | return false; | ||
1789 | diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | ||
1790 | index dd402bb..9633dbb 100644 | ||
1791 | --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | ||
1792 | +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | ||
1793 | @@ -618,6 +618,14 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc | ||
1794 | enum drm_connector_status found = connector_status_disconnected; | ||
1795 | bool color = true; | ||
1796 | |||
1797 | + /* just don't bother on RN50 those chip are often connected to remoting | ||
1798 | + * console hw and often we get failure to load detect those. So to make | ||
1799 | + * everyone happy report the encoder as always connected. | ||
1800 | + */ | ||
1801 | + if (ASIC_IS_RN50(rdev)) { | ||
1802 | + return connector_status_connected; | ||
1803 | + } | ||
1804 | + | ||
1805 | /* save the regs we need */ | ||
1806 | vclk_ecp_cntl = RREG32_PLL(RADEON_VCLK_ECP_CNTL); | ||
1807 | crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL); | ||
1808 | diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h | ||
1809 | index d569789..485d16e 100644 | ||
1810 | --- a/drivers/gpu/drm/radeon/radeon_mode.h | ||
1811 | +++ b/drivers/gpu/drm/radeon/radeon_mode.h | ||
1812 | @@ -534,7 +534,7 @@ extern void radeon_i2c_put_byte(struct radeon_i2c_chan *i2c, | ||
1813 | u8 val); | ||
1814 | extern void radeon_router_select_ddc_port(struct radeon_connector *radeon_connector); | ||
1815 | extern void radeon_router_select_cd_port(struct radeon_connector *radeon_connector); | ||
1816 | -extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector); | ||
1817 | +extern bool radeon_ddc_probe(struct radeon_connector *radeon_connector, bool use_aux); | ||
1818 | extern int radeon_ddc_get_modes(struct radeon_connector *radeon_connector); | ||
1819 | |||
1820 | extern struct drm_encoder *radeon_best_encoder(struct drm_connector *connector); | ||
1821 | diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c | ||
1822 | index 8d9dc44..3234224 100644 | ||
1823 | --- a/drivers/gpu/drm/udl/udl_connector.c | ||
1824 | +++ b/drivers/gpu/drm/udl/udl_connector.c | ||
1825 | @@ -22,13 +22,17 @@ | ||
1826 | static u8 *udl_get_edid(struct udl_device *udl) | ||
1827 | { | ||
1828 | u8 *block; | ||
1829 | - char rbuf[3]; | ||
1830 | + char *rbuf; | ||
1831 | int ret, i; | ||
1832 | |||
1833 | block = kmalloc(EDID_LENGTH, GFP_KERNEL); | ||
1834 | if (block == NULL) | ||
1835 | return NULL; | ||
1836 | |||
1837 | + rbuf = kmalloc(2, GFP_KERNEL); | ||
1838 | + if (rbuf == NULL) | ||
1839 | + goto error; | ||
1840 | + | ||
1841 | for (i = 0; i < EDID_LENGTH; i++) { | ||
1842 | ret = usb_control_msg(udl->ddev->usbdev, | ||
1843 | usb_rcvctrlpipe(udl->ddev->usbdev, 0), (0x02), | ||
1844 | @@ -36,16 +40,17 @@ static u8 *udl_get_edid(struct udl_device *udl) | ||
1845 | HZ); | ||
1846 | if (ret < 1) { | ||
1847 | DRM_ERROR("Read EDID byte %d failed err %x\n", i, ret); | ||
1848 | - i--; | ||
1849 | goto error; | ||
1850 | } | ||
1851 | block[i] = rbuf[1]; | ||
1852 | } | ||
1853 | |||
1854 | + kfree(rbuf); | ||
1855 | return block; | ||
1856 | |||
1857 | error: | ||
1858 | kfree(block); | ||
1859 | + kfree(rbuf); | ||
1860 | return NULL; | ||
1861 | } | ||
1862 | |||
1863 | @@ -59,6 +64,14 @@ static int udl_get_modes(struct drm_connector *connector) | ||
1864 | |||
1865 | connector->display_info.raw_edid = (char *)edid; | ||
1866 | |||
1867 | + /* | ||
1868 | + * We only read the main block, but if the monitor reports extension | ||
1869 | + * blocks then the drm edid code expects them to be present, so patch | ||
1870 | + * the extension count to 0. | ||
1871 | + */ | ||
1872 | + edid->checksum += edid->extensions; | ||
1873 | + edid->extensions = 0; | ||
1874 | + | ||
1875 | drm_mode_connector_update_edid_property(connector, edid); | ||
1876 | ret = drm_add_edid_modes(connector, edid); | ||
1877 | connector->display_info.raw_edid = NULL; | ||
1878 | diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c | ||
1879 | index 5de3bb3..10ef742 100644 | ||
1880 | --- a/drivers/hid/hid-core.c | ||
1881 | +++ b/drivers/hid/hid-core.c | ||
1882 | @@ -1528,6 +1528,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | ||
1883 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, | ||
1884 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, | ||
1885 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, | ||
1886 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI) }, | ||
1887 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) }, | ||
1888 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, | ||
1889 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, | ||
1890 | diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h | ||
1891 | index ab8ce9f..2a3f007 100644 | ||
1892 | --- a/drivers/hid/hid-ids.h | ||
1893 | +++ b/drivers/hid/hid-ids.h | ||
1894 | @@ -681,6 +681,9 @@ | ||
1895 | #define USB_VENDOR_ID_SIGMA_MICRO 0x1c4f | ||
1896 | #define USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD 0x0002 | ||
1897 | |||
1898 | +#define USB_VENDOR_ID_SIGMATEL 0x066F | ||
1899 | +#define USB_DEVICE_ID_SIGMATEL_STMP3780 0x3780 | ||
1900 | + | ||
1901 | #define USB_VENDOR_ID_SKYCABLE 0x1223 | ||
1902 | #define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07 | ||
1903 | |||
1904 | diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c | ||
1905 | index 8865fa3..eb55cef 100644 | ||
1906 | --- a/drivers/hid/usbhid/hid-quirks.c | ||
1907 | +++ b/drivers/hid/usbhid/hid-quirks.c | ||
1908 | @@ -79,6 +79,7 @@ static const struct hid_blacklist { | ||
1909 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_PIXART_IMAGING_INC_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NOGET }, | ||
1910 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008, HID_QUIRK_NOGET }, | ||
1911 | { USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB, HID_QUIRK_NOGET }, | ||
1912 | + { USB_VENDOR_ID_SIGMATEL, USB_DEVICE_ID_SIGMATEL_STMP3780, HID_QUIRK_NOGET }, | ||
1913 | { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, | ||
1914 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET }, | ||
1915 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET }, | ||
1916 | diff --git a/drivers/hwmon/lm73.c b/drivers/hwmon/lm73.c | ||
1917 | index 8fa2632..7272176 100644 | ||
1918 | --- a/drivers/hwmon/lm73.c | ||
1919 | +++ b/drivers/hwmon/lm73.c | ||
1920 | @@ -49,6 +49,7 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da, | ||
1921 | struct i2c_client *client = to_i2c_client(dev); | ||
1922 | long temp; | ||
1923 | short value; | ||
1924 | + s32 err; | ||
1925 | |||
1926 | int status = kstrtol(buf, 10, &temp); | ||
1927 | if (status < 0) | ||
1928 | @@ -57,8 +58,8 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da, | ||
1929 | /* Write value */ | ||
1930 | value = (short) SENSORS_LIMIT(temp/250, (LM73_TEMP_MIN*4), | ||
1931 | (LM73_TEMP_MAX*4)) << 5; | ||
1932 | - i2c_smbus_write_word_swapped(client, attr->index, value); | ||
1933 | - return count; | ||
1934 | + err = i2c_smbus_write_word_swapped(client, attr->index, value); | ||
1935 | + return (err < 0) ? err : count; | ||
1936 | } | ||
1937 | |||
1938 | static ssize_t show_temp(struct device *dev, struct device_attribute *da, | ||
1939 | @@ -66,11 +67,16 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *da, | ||
1940 | { | ||
1941 | struct sensor_device_attribute *attr = to_sensor_dev_attr(da); | ||
1942 | struct i2c_client *client = to_i2c_client(dev); | ||
1943 | + int temp; | ||
1944 | + | ||
1945 | + s32 err = i2c_smbus_read_word_swapped(client, attr->index); | ||
1946 | + if (err < 0) | ||
1947 | + return err; | ||
1948 | + | ||
1949 | /* use integer division instead of equivalent right shift to | ||
1950 | guarantee arithmetic shift and preserve the sign */ | ||
1951 | - int temp = ((s16) (i2c_smbus_read_word_swapped(client, | ||
1952 | - attr->index))*250) / 32; | ||
1953 | - return sprintf(buf, "%d\n", temp); | ||
1954 | + temp = (((s16) err) * 250) / 32; | ||
1955 | + return scnprintf(buf, PAGE_SIZE, "%d\n", temp); | ||
1956 | } | ||
1957 | |||
1958 | |||
1959 | diff --git a/drivers/infiniband/hw/nes/nes.h b/drivers/infiniband/hw/nes/nes.h | ||
1960 | index c438e46..3f41d9f 100644 | ||
1961 | --- a/drivers/infiniband/hw/nes/nes.h | ||
1962 | +++ b/drivers/infiniband/hw/nes/nes.h | ||
1963 | @@ -524,6 +524,7 @@ void nes_iwarp_ce_handler(struct nes_device *, struct nes_hw_cq *); | ||
1964 | int nes_destroy_cqp(struct nes_device *); | ||
1965 | int nes_nic_cm_xmit(struct sk_buff *, struct net_device *); | ||
1966 | void nes_recheck_link_status(struct work_struct *work); | ||
1967 | +void nes_terminate_timeout(unsigned long context); | ||
1968 | |||
1969 | /* nes_nic.c */ | ||
1970 | struct net_device *nes_netdev_init(struct nes_device *, void __iomem *); | ||
1971 | diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c | ||
1972 | index d42c9f4..96801c3 100644 | ||
1973 | --- a/drivers/infiniband/hw/nes/nes_hw.c | ||
1974 | +++ b/drivers/infiniband/hw/nes/nes_hw.c | ||
1975 | @@ -75,7 +75,6 @@ static void nes_process_iwarp_aeqe(struct nes_device *nesdev, | ||
1976 | static void process_critical_error(struct nes_device *nesdev); | ||
1977 | static void nes_process_mac_intr(struct nes_device *nesdev, u32 mac_number); | ||
1978 | static unsigned int nes_reset_adapter_ne020(struct nes_device *nesdev, u8 *OneG_Mode); | ||
1979 | -static void nes_terminate_timeout(unsigned long context); | ||
1980 | static void nes_terminate_start_timer(struct nes_qp *nesqp); | ||
1981 | |||
1982 | #ifdef CONFIG_INFINIBAND_NES_DEBUG | ||
1983 | @@ -3522,7 +3521,7 @@ static void nes_terminate_received(struct nes_device *nesdev, | ||
1984 | } | ||
1985 | |||
1986 | /* Timeout routine in case terminate fails to complete */ | ||
1987 | -static void nes_terminate_timeout(unsigned long context) | ||
1988 | +void nes_terminate_timeout(unsigned long context) | ||
1989 | { | ||
1990 | struct nes_qp *nesqp = (struct nes_qp *)(unsigned long)context; | ||
1991 | |||
1992 | @@ -3532,11 +3531,7 @@ static void nes_terminate_timeout(unsigned long context) | ||
1993 | /* Set a timer in case hw cannot complete the terminate sequence */ | ||
1994 | static void nes_terminate_start_timer(struct nes_qp *nesqp) | ||
1995 | { | ||
1996 | - init_timer(&nesqp->terminate_timer); | ||
1997 | - nesqp->terminate_timer.function = nes_terminate_timeout; | ||
1998 | - nesqp->terminate_timer.expires = jiffies + HZ; | ||
1999 | - nesqp->terminate_timer.data = (unsigned long)nesqp; | ||
2000 | - add_timer(&nesqp->terminate_timer); | ||
2001 | + mod_timer(&nesqp->terminate_timer, (jiffies + HZ)); | ||
2002 | } | ||
2003 | |||
2004 | /** | ||
2005 | diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c | ||
2006 | index 8b8812d..da84ea3 100644 | ||
2007 | --- a/drivers/infiniband/hw/nes/nes_verbs.c | ||
2008 | +++ b/drivers/infiniband/hw/nes/nes_verbs.c | ||
2009 | @@ -1404,6 +1404,9 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd, | ||
2010 | } | ||
2011 | |||
2012 | nesqp->sig_all = (init_attr->sq_sig_type == IB_SIGNAL_ALL_WR); | ||
2013 | + init_timer(&nesqp->terminate_timer); | ||
2014 | + nesqp->terminate_timer.function = nes_terminate_timeout; | ||
2015 | + nesqp->terminate_timer.data = (unsigned long)nesqp; | ||
2016 | |||
2017 | /* update the QP table */ | ||
2018 | nesdev->nesadapter->qp_table[nesqp->hwqp.qp_id-NES_FIRST_QPN] = nesqp; | ||
2019 | @@ -1413,7 +1416,6 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd, | ||
2020 | return &nesqp->ibqp; | ||
2021 | } | ||
2022 | |||
2023 | - | ||
2024 | /** | ||
2025 | * nes_clean_cq | ||
2026 | */ | ||
2027 | @@ -2559,6 +2561,11 @@ static struct ib_mr *nes_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, | ||
2028 | return ibmr; | ||
2029 | case IWNES_MEMREG_TYPE_QP: | ||
2030 | case IWNES_MEMREG_TYPE_CQ: | ||
2031 | + if (!region->length) { | ||
2032 | + nes_debug(NES_DBG_MR, "Unable to register zero length region for CQ\n"); | ||
2033 | + ib_umem_release(region); | ||
2034 | + return ERR_PTR(-EINVAL); | ||
2035 | + } | ||
2036 | nespbl = kzalloc(sizeof(*nespbl), GFP_KERNEL); | ||
2037 | if (!nespbl) { | ||
2038 | nes_debug(NES_DBG_MR, "Unable to allocate PBL\n"); | ||
2039 | diff --git a/drivers/input/joystick/walkera0701.c b/drivers/input/joystick/walkera0701.c | ||
2040 | index 4dfa1ee..f8f892b 100644 | ||
2041 | --- a/drivers/input/joystick/walkera0701.c | ||
2042 | +++ b/drivers/input/joystick/walkera0701.c | ||
2043 | @@ -196,6 +196,7 @@ static void walkera0701_close(struct input_dev *dev) | ||
2044 | struct walkera_dev *w = input_get_drvdata(dev); | ||
2045 | |||
2046 | parport_disable_irq(w->parport); | ||
2047 | + hrtimer_cancel(&w->timer); | ||
2048 | } | ||
2049 | |||
2050 | static int walkera0701_connect(struct walkera_dev *w, int parport) | ||
2051 | @@ -224,6 +225,9 @@ static int walkera0701_connect(struct walkera_dev *w, int parport) | ||
2052 | if (parport_claim(w->pardevice)) | ||
2053 | goto init_err1; | ||
2054 | |||
2055 | + hrtimer_init(&w->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | ||
2056 | + w->timer.function = timer_handler; | ||
2057 | + | ||
2058 | w->input_dev = input_allocate_device(); | ||
2059 | if (!w->input_dev) | ||
2060 | goto init_err2; | ||
2061 | @@ -254,8 +258,6 @@ static int walkera0701_connect(struct walkera_dev *w, int parport) | ||
2062 | if (err) | ||
2063 | goto init_err3; | ||
2064 | |||
2065 | - hrtimer_init(&w->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | ||
2066 | - w->timer.function = timer_handler; | ||
2067 | return 0; | ||
2068 | |||
2069 | init_err3: | ||
2070 | @@ -271,7 +273,6 @@ static int walkera0701_connect(struct walkera_dev *w, int parport) | ||
2071 | |||
2072 | static void walkera0701_disconnect(struct walkera_dev *w) | ||
2073 | { | ||
2074 | - hrtimer_cancel(&w->timer); | ||
2075 | input_unregister_device(w->input_dev); | ||
2076 | parport_release(w->pardevice); | ||
2077 | parport_unregister_device(w->pardevice); | ||
2078 | diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c | ||
2079 | index a261d85..c4c9218 100644 | ||
2080 | --- a/drivers/input/mouse/sentelic.c | ||
2081 | +++ b/drivers/input/mouse/sentelic.c | ||
2082 | @@ -791,7 +791,7 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse) | ||
2083 | fsp_set_slot(dev, 0, fgrs > 0, abs_x, abs_y); | ||
2084 | fsp_set_slot(dev, 1, false, 0, 0); | ||
2085 | } | ||
2086 | - if (fgrs > 0) { | ||
2087 | + if (fgrs == 1 || (fgrs == 2 && !(packet[0] & FSP_PB0_MFMC_FGR2))) { | ||
2088 | input_report_abs(dev, ABS_X, abs_x); | ||
2089 | input_report_abs(dev, ABS_Y, abs_y); | ||
2090 | } | ||
2091 | diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h | ||
2092 | index d6cc77a..5f306f7 100644 | ||
2093 | --- a/drivers/input/serio/i8042-x86ia64io.h | ||
2094 | +++ b/drivers/input/serio/i8042-x86ia64io.h | ||
2095 | @@ -921,6 +921,7 @@ static int __init i8042_platform_init(void) | ||
2096 | int retval; | ||
2097 | |||
2098 | #ifdef CONFIG_X86 | ||
2099 | + u8 a20_on = 0xdf; | ||
2100 | /* Just return if pre-detection shows no i8042 controller exist */ | ||
2101 | if (!x86_platform.i8042_detect()) | ||
2102 | return -ENODEV; | ||
2103 | @@ -960,6 +961,14 @@ static int __init i8042_platform_init(void) | ||
2104 | |||
2105 | if (dmi_check_system(i8042_dmi_dritek_table)) | ||
2106 | i8042_dritek = true; | ||
2107 | + | ||
2108 | + /* | ||
2109 | + * A20 was already enabled during early kernel init. But some buggy | ||
2110 | + * BIOSes (in MSI Laptops) require A20 to be enabled using 8042 to | ||
2111 | + * resume from S3. So we do it here and hope that nothing breaks. | ||
2112 | + */ | ||
2113 | + i8042_command(&a20_on, 0x10d1); | ||
2114 | + i8042_command(NULL, 0x00ff); /* Null command for SMM firmware */ | ||
2115 | #endif /* CONFIG_X86 */ | ||
2116 | |||
2117 | return retval; | ||
2118 | diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c | ||
2119 | index 554e6ac..c646a8e 100644 | ||
2120 | --- a/drivers/iommu/intel-iommu.c | ||
2121 | +++ b/drivers/iommu/intel-iommu.c | ||
2122 | @@ -1827,10 +1827,17 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, | ||
2123 | if (!pte) | ||
2124 | return -ENOMEM; | ||
2125 | /* It is large page*/ | ||
2126 | - if (largepage_lvl > 1) | ||
2127 | + if (largepage_lvl > 1) { | ||
2128 | pteval |= DMA_PTE_LARGE_PAGE; | ||
2129 | - else | ||
2130 | + /* Ensure that old small page tables are removed to make room | ||
2131 | + for superpage, if they exist. */ | ||
2132 | + dma_pte_clear_range(domain, iov_pfn, | ||
2133 | + iov_pfn + lvl_to_nr_pages(largepage_lvl) - 1); | ||
2134 | + dma_pte_free_pagetable(domain, iov_pfn, | ||
2135 | + iov_pfn + lvl_to_nr_pages(largepage_lvl) - 1); | ||
2136 | + } else { | ||
2137 | pteval &= ~(uint64_t)DMA_PTE_LARGE_PAGE; | ||
2138 | + } | ||
2139 | |||
2140 | } | ||
2141 | /* We don't need lock here, nobody else | ||
2142 | @@ -2320,8 +2327,39 @@ static int domain_add_dev_info(struct dmar_domain *domain, | ||
2143 | return 0; | ||
2144 | } | ||
2145 | |||
2146 | +static bool device_has_rmrr(struct pci_dev *dev) | ||
2147 | +{ | ||
2148 | + struct dmar_rmrr_unit *rmrr; | ||
2149 | + int i; | ||
2150 | + | ||
2151 | + for_each_rmrr_units(rmrr) { | ||
2152 | + for (i = 0; i < rmrr->devices_cnt; i++) { | ||
2153 | + /* | ||
2154 | + * Return TRUE if this RMRR contains the device that | ||
2155 | + * is passed in. | ||
2156 | + */ | ||
2157 | + if (rmrr->devices[i] == dev) | ||
2158 | + return true; | ||
2159 | + } | ||
2160 | + } | ||
2161 | + return false; | ||
2162 | +} | ||
2163 | + | ||
2164 | static int iommu_should_identity_map(struct pci_dev *pdev, int startup) | ||
2165 | { | ||
2166 | + | ||
2167 | + /* | ||
2168 | + * We want to prevent any device associated with an RMRR from | ||
2169 | + * getting placed into the SI Domain. This is done because | ||
2170 | + * problems exist when devices are moved in and out of domains | ||
2171 | + * and their respective RMRR info is lost. We exempt USB devices | ||
2172 | + * from this process due to their usage of RMRRs that are known | ||
2173 | + * to not be needed after BIOS hand-off to OS. | ||
2174 | + */ | ||
2175 | + if (device_has_rmrr(pdev) && | ||
2176 | + (pdev->class >> 8) != PCI_CLASS_SERIAL_USB) | ||
2177 | + return 0; | ||
2178 | + | ||
2179 | if ((iommu_identity_mapping & IDENTMAP_AZALIA) && IS_AZALIA(pdev)) | ||
2180 | return 1; | ||
2181 | |||
2182 | diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c | ||
2183 | index afd9598..a651d52 100644 | ||
2184 | --- a/drivers/md/dm-ioctl.c | ||
2185 | +++ b/drivers/md/dm-ioctl.c | ||
2186 | @@ -1566,6 +1566,14 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl **param) | ||
2187 | if (copy_from_user(dmi, user, tmp.data_size)) | ||
2188 | goto bad; | ||
2189 | |||
2190 | + /* | ||
2191 | + * Abort if something changed the ioctl data while it was being copied. | ||
2192 | + */ | ||
2193 | + if (dmi->data_size != tmp.data_size) { | ||
2194 | + DMERR("rejecting ioctl: data size modified while processing parameters"); | ||
2195 | + goto bad; | ||
2196 | + } | ||
2197 | + | ||
2198 | /* Wipe the user buffer so we do not return it to userspace */ | ||
2199 | if (secure_data && clear_user(user, tmp.data_size)) | ||
2200 | goto bad; | ||
2201 | diff --git a/drivers/md/persistent-data/dm-btree-internal.h b/drivers/md/persistent-data/dm-btree-internal.h | ||
2202 | index 5709bfe..accbb05 100644 | ||
2203 | --- a/drivers/md/persistent-data/dm-btree-internal.h | ||
2204 | +++ b/drivers/md/persistent-data/dm-btree-internal.h | ||
2205 | @@ -36,13 +36,13 @@ struct node_header { | ||
2206 | __le32 padding; | ||
2207 | } __packed; | ||
2208 | |||
2209 | -struct node { | ||
2210 | +struct btree_node { | ||
2211 | struct node_header header; | ||
2212 | __le64 keys[0]; | ||
2213 | } __packed; | ||
2214 | |||
2215 | |||
2216 | -void inc_children(struct dm_transaction_manager *tm, struct node *n, | ||
2217 | +void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, | ||
2218 | struct dm_btree_value_type *vt); | ||
2219 | |||
2220 | int new_block(struct dm_btree_info *info, struct dm_block **result); | ||
2221 | @@ -64,7 +64,7 @@ struct ro_spine { | ||
2222 | void init_ro_spine(struct ro_spine *s, struct dm_btree_info *info); | ||
2223 | int exit_ro_spine(struct ro_spine *s); | ||
2224 | int ro_step(struct ro_spine *s, dm_block_t new_child); | ||
2225 | -struct node *ro_node(struct ro_spine *s); | ||
2226 | +struct btree_node *ro_node(struct ro_spine *s); | ||
2227 | |||
2228 | struct shadow_spine { | ||
2229 | struct dm_btree_info *info; | ||
2230 | @@ -98,17 +98,17 @@ int shadow_root(struct shadow_spine *s); | ||
2231 | /* | ||
2232 | * Some inlines. | ||
2233 | */ | ||
2234 | -static inline __le64 *key_ptr(struct node *n, uint32_t index) | ||
2235 | +static inline __le64 *key_ptr(struct btree_node *n, uint32_t index) | ||
2236 | { | ||
2237 | return n->keys + index; | ||
2238 | } | ||
2239 | |||
2240 | -static inline void *value_base(struct node *n) | ||
2241 | +static inline void *value_base(struct btree_node *n) | ||
2242 | { | ||
2243 | return &n->keys[le32_to_cpu(n->header.max_entries)]; | ||
2244 | } | ||
2245 | |||
2246 | -static inline void *value_ptr(struct node *n, uint32_t index) | ||
2247 | +static inline void *value_ptr(struct btree_node *n, uint32_t index) | ||
2248 | { | ||
2249 | uint32_t value_size = le32_to_cpu(n->header.value_size); | ||
2250 | return value_base(n) + (value_size * index); | ||
2251 | @@ -117,7 +117,7 @@ static inline void *value_ptr(struct node *n, uint32_t index) | ||
2252 | /* | ||
2253 | * Assumes the values are suitably-aligned and converts to core format. | ||
2254 | */ | ||
2255 | -static inline uint64_t value64(struct node *n, uint32_t index) | ||
2256 | +static inline uint64_t value64(struct btree_node *n, uint32_t index) | ||
2257 | { | ||
2258 | __le64 *values_le = value_base(n); | ||
2259 | |||
2260 | @@ -127,7 +127,7 @@ static inline uint64_t value64(struct node *n, uint32_t index) | ||
2261 | /* | ||
2262 | * Searching for a key within a single node. | ||
2263 | */ | ||
2264 | -int lower_bound(struct node *n, uint64_t key); | ||
2265 | +int lower_bound(struct btree_node *n, uint64_t key); | ||
2266 | |||
2267 | extern struct dm_block_validator btree_node_validator; | ||
2268 | |||
2269 | diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c | ||
2270 | index aa71e23..c4f2813 100644 | ||
2271 | --- a/drivers/md/persistent-data/dm-btree-remove.c | ||
2272 | +++ b/drivers/md/persistent-data/dm-btree-remove.c | ||
2273 | @@ -53,7 +53,7 @@ | ||
2274 | /* | ||
2275 | * Some little utilities for moving node data around. | ||
2276 | */ | ||
2277 | -static void node_shift(struct node *n, int shift) | ||
2278 | +static void node_shift(struct btree_node *n, int shift) | ||
2279 | { | ||
2280 | uint32_t nr_entries = le32_to_cpu(n->header.nr_entries); | ||
2281 | uint32_t value_size = le32_to_cpu(n->header.value_size); | ||
2282 | @@ -79,7 +79,7 @@ static void node_shift(struct node *n, int shift) | ||
2283 | } | ||
2284 | } | ||
2285 | |||
2286 | -static void node_copy(struct node *left, struct node *right, int shift) | ||
2287 | +static void node_copy(struct btree_node *left, struct btree_node *right, int shift) | ||
2288 | { | ||
2289 | uint32_t nr_left = le32_to_cpu(left->header.nr_entries); | ||
2290 | uint32_t value_size = le32_to_cpu(left->header.value_size); | ||
2291 | @@ -108,7 +108,7 @@ static void node_copy(struct node *left, struct node *right, int shift) | ||
2292 | /* | ||
2293 | * Delete a specific entry from a leaf node. | ||
2294 | */ | ||
2295 | -static void delete_at(struct node *n, unsigned index) | ||
2296 | +static void delete_at(struct btree_node *n, unsigned index) | ||
2297 | { | ||
2298 | unsigned nr_entries = le32_to_cpu(n->header.nr_entries); | ||
2299 | unsigned nr_to_copy = nr_entries - (index + 1); | ||
2300 | @@ -128,7 +128,7 @@ static void delete_at(struct node *n, unsigned index) | ||
2301 | n->header.nr_entries = cpu_to_le32(nr_entries - 1); | ||
2302 | } | ||
2303 | |||
2304 | -static unsigned merge_threshold(struct node *n) | ||
2305 | +static unsigned merge_threshold(struct btree_node *n) | ||
2306 | { | ||
2307 | return le32_to_cpu(n->header.max_entries) / 3; | ||
2308 | } | ||
2309 | @@ -136,7 +136,7 @@ static unsigned merge_threshold(struct node *n) | ||
2310 | struct child { | ||
2311 | unsigned index; | ||
2312 | struct dm_block *block; | ||
2313 | - struct node *n; | ||
2314 | + struct btree_node *n; | ||
2315 | }; | ||
2316 | |||
2317 | static struct dm_btree_value_type le64_type = { | ||
2318 | @@ -147,7 +147,7 @@ static struct dm_btree_value_type le64_type = { | ||
2319 | .equal = NULL | ||
2320 | }; | ||
2321 | |||
2322 | -static int init_child(struct dm_btree_info *info, struct node *parent, | ||
2323 | +static int init_child(struct dm_btree_info *info, struct btree_node *parent, | ||
2324 | unsigned index, struct child *result) | ||
2325 | { | ||
2326 | int r, inc; | ||
2327 | @@ -177,7 +177,7 @@ static int exit_child(struct dm_btree_info *info, struct child *c) | ||
2328 | return dm_tm_unlock(info->tm, c->block); | ||
2329 | } | ||
2330 | |||
2331 | -static void shift(struct node *left, struct node *right, int count) | ||
2332 | +static void shift(struct btree_node *left, struct btree_node *right, int count) | ||
2333 | { | ||
2334 | uint32_t nr_left = le32_to_cpu(left->header.nr_entries); | ||
2335 | uint32_t nr_right = le32_to_cpu(right->header.nr_entries); | ||
2336 | @@ -203,11 +203,11 @@ static void shift(struct node *left, struct node *right, int count) | ||
2337 | right->header.nr_entries = cpu_to_le32(nr_right + count); | ||
2338 | } | ||
2339 | |||
2340 | -static void __rebalance2(struct dm_btree_info *info, struct node *parent, | ||
2341 | +static void __rebalance2(struct dm_btree_info *info, struct btree_node *parent, | ||
2342 | struct child *l, struct child *r) | ||
2343 | { | ||
2344 | - struct node *left = l->n; | ||
2345 | - struct node *right = r->n; | ||
2346 | + struct btree_node *left = l->n; | ||
2347 | + struct btree_node *right = r->n; | ||
2348 | uint32_t nr_left = le32_to_cpu(left->header.nr_entries); | ||
2349 | uint32_t nr_right = le32_to_cpu(right->header.nr_entries); | ||
2350 | unsigned threshold = 2 * merge_threshold(left) + 1; | ||
2351 | @@ -239,7 +239,7 @@ static int rebalance2(struct shadow_spine *s, struct dm_btree_info *info, | ||
2352 | unsigned left_index) | ||
2353 | { | ||
2354 | int r; | ||
2355 | - struct node *parent; | ||
2356 | + struct btree_node *parent; | ||
2357 | struct child left, right; | ||
2358 | |||
2359 | parent = dm_block_data(shadow_current(s)); | ||
2360 | @@ -270,9 +270,9 @@ static int rebalance2(struct shadow_spine *s, struct dm_btree_info *info, | ||
2361 | * in right, then rebalance2. This wastes some cpu, but I want something | ||
2362 | * simple atm. | ||
2363 | */ | ||
2364 | -static void delete_center_node(struct dm_btree_info *info, struct node *parent, | ||
2365 | +static void delete_center_node(struct dm_btree_info *info, struct btree_node *parent, | ||
2366 | struct child *l, struct child *c, struct child *r, | ||
2367 | - struct node *left, struct node *center, struct node *right, | ||
2368 | + struct btree_node *left, struct btree_node *center, struct btree_node *right, | ||
2369 | uint32_t nr_left, uint32_t nr_center, uint32_t nr_right) | ||
2370 | { | ||
2371 | uint32_t max_entries = le32_to_cpu(left->header.max_entries); | ||
2372 | @@ -301,9 +301,9 @@ static void delete_center_node(struct dm_btree_info *info, struct node *parent, | ||
2373 | /* | ||
2374 | * Redistributes entries among 3 sibling nodes. | ||
2375 | */ | ||
2376 | -static void redistribute3(struct dm_btree_info *info, struct node *parent, | ||
2377 | +static void redistribute3(struct dm_btree_info *info, struct btree_node *parent, | ||
2378 | struct child *l, struct child *c, struct child *r, | ||
2379 | - struct node *left, struct node *center, struct node *right, | ||
2380 | + struct btree_node *left, struct btree_node *center, struct btree_node *right, | ||
2381 | uint32_t nr_left, uint32_t nr_center, uint32_t nr_right) | ||
2382 | { | ||
2383 | int s; | ||
2384 | @@ -343,12 +343,12 @@ static void redistribute3(struct dm_btree_info *info, struct node *parent, | ||
2385 | *key_ptr(parent, r->index) = right->keys[0]; | ||
2386 | } | ||
2387 | |||
2388 | -static void __rebalance3(struct dm_btree_info *info, struct node *parent, | ||
2389 | +static void __rebalance3(struct dm_btree_info *info, struct btree_node *parent, | ||
2390 | struct child *l, struct child *c, struct child *r) | ||
2391 | { | ||
2392 | - struct node *left = l->n; | ||
2393 | - struct node *center = c->n; | ||
2394 | - struct node *right = r->n; | ||
2395 | + struct btree_node *left = l->n; | ||
2396 | + struct btree_node *center = c->n; | ||
2397 | + struct btree_node *right = r->n; | ||
2398 | |||
2399 | uint32_t nr_left = le32_to_cpu(left->header.nr_entries); | ||
2400 | uint32_t nr_center = le32_to_cpu(center->header.nr_entries); | ||
2401 | @@ -371,7 +371,7 @@ static int rebalance3(struct shadow_spine *s, struct dm_btree_info *info, | ||
2402 | unsigned left_index) | ||
2403 | { | ||
2404 | int r; | ||
2405 | - struct node *parent = dm_block_data(shadow_current(s)); | ||
2406 | + struct btree_node *parent = dm_block_data(shadow_current(s)); | ||
2407 | struct child left, center, right; | ||
2408 | |||
2409 | /* | ||
2410 | @@ -421,7 +421,7 @@ static int get_nr_entries(struct dm_transaction_manager *tm, | ||
2411 | { | ||
2412 | int r; | ||
2413 | struct dm_block *block; | ||
2414 | - struct node *n; | ||
2415 | + struct btree_node *n; | ||
2416 | |||
2417 | r = dm_tm_read_lock(tm, b, &btree_node_validator, &block); | ||
2418 | if (r) | ||
2419 | @@ -438,7 +438,7 @@ static int rebalance_children(struct shadow_spine *s, | ||
2420 | { | ||
2421 | int i, r, has_left_sibling, has_right_sibling; | ||
2422 | uint32_t child_entries; | ||
2423 | - struct node *n; | ||
2424 | + struct btree_node *n; | ||
2425 | |||
2426 | n = dm_block_data(shadow_current(s)); | ||
2427 | |||
2428 | @@ -483,7 +483,7 @@ static int rebalance_children(struct shadow_spine *s, | ||
2429 | return r; | ||
2430 | } | ||
2431 | |||
2432 | -static int do_leaf(struct node *n, uint64_t key, unsigned *index) | ||
2433 | +static int do_leaf(struct btree_node *n, uint64_t key, unsigned *index) | ||
2434 | { | ||
2435 | int i = lower_bound(n, key); | ||
2436 | |||
2437 | @@ -506,7 +506,7 @@ static int remove_raw(struct shadow_spine *s, struct dm_btree_info *info, | ||
2438 | uint64_t key, unsigned *index) | ||
2439 | { | ||
2440 | int i = *index, r; | ||
2441 | - struct node *n; | ||
2442 | + struct btree_node *n; | ||
2443 | |||
2444 | for (;;) { | ||
2445 | r = shadow_step(s, root, vt); | ||
2446 | @@ -556,7 +556,7 @@ int dm_btree_remove(struct dm_btree_info *info, dm_block_t root, | ||
2447 | unsigned level, last_level = info->levels - 1; | ||
2448 | int index = 0, r = 0; | ||
2449 | struct shadow_spine spine; | ||
2450 | - struct node *n; | ||
2451 | + struct btree_node *n; | ||
2452 | |||
2453 | init_shadow_spine(&spine, info); | ||
2454 | for (level = 0; level < info->levels; level++) { | ||
2455 | diff --git a/drivers/md/persistent-data/dm-btree-spine.c b/drivers/md/persistent-data/dm-btree-spine.c | ||
2456 | index d9a7912..2f0805c 100644 | ||
2457 | --- a/drivers/md/persistent-data/dm-btree-spine.c | ||
2458 | +++ b/drivers/md/persistent-data/dm-btree-spine.c | ||
2459 | @@ -23,7 +23,7 @@ static void node_prepare_for_write(struct dm_block_validator *v, | ||
2460 | struct dm_block *b, | ||
2461 | size_t block_size) | ||
2462 | { | ||
2463 | - struct node *n = dm_block_data(b); | ||
2464 | + struct btree_node *n = dm_block_data(b); | ||
2465 | struct node_header *h = &n->header; | ||
2466 | |||
2467 | h->blocknr = cpu_to_le64(dm_block_location(b)); | ||
2468 | @@ -38,7 +38,7 @@ static int node_check(struct dm_block_validator *v, | ||
2469 | struct dm_block *b, | ||
2470 | size_t block_size) | ||
2471 | { | ||
2472 | - struct node *n = dm_block_data(b); | ||
2473 | + struct btree_node *n = dm_block_data(b); | ||
2474 | struct node_header *h = &n->header; | ||
2475 | size_t value_size; | ||
2476 | __le32 csum_disk; | ||
2477 | @@ -164,7 +164,7 @@ int ro_step(struct ro_spine *s, dm_block_t new_child) | ||
2478 | return r; | ||
2479 | } | ||
2480 | |||
2481 | -struct node *ro_node(struct ro_spine *s) | ||
2482 | +struct btree_node *ro_node(struct ro_spine *s) | ||
2483 | { | ||
2484 | struct dm_block *block; | ||
2485 | |||
2486 | diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c | ||
2487 | index d12b2cc..371f3d4 100644 | ||
2488 | --- a/drivers/md/persistent-data/dm-btree.c | ||
2489 | +++ b/drivers/md/persistent-data/dm-btree.c | ||
2490 | @@ -38,7 +38,7 @@ static void array_insert(void *base, size_t elt_size, unsigned nr_elts, | ||
2491 | /*----------------------------------------------------------------*/ | ||
2492 | |||
2493 | /* makes the assumption that no two keys are the same. */ | ||
2494 | -static int bsearch(struct node *n, uint64_t key, int want_hi) | ||
2495 | +static int bsearch(struct btree_node *n, uint64_t key, int want_hi) | ||
2496 | { | ||
2497 | int lo = -1, hi = le32_to_cpu(n->header.nr_entries); | ||
2498 | |||
2499 | @@ -58,12 +58,12 @@ static int bsearch(struct node *n, uint64_t key, int want_hi) | ||
2500 | return want_hi ? hi : lo; | ||
2501 | } | ||
2502 | |||
2503 | -int lower_bound(struct node *n, uint64_t key) | ||
2504 | +int lower_bound(struct btree_node *n, uint64_t key) | ||
2505 | { | ||
2506 | return bsearch(n, key, 0); | ||
2507 | } | ||
2508 | |||
2509 | -void inc_children(struct dm_transaction_manager *tm, struct node *n, | ||
2510 | +void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, | ||
2511 | struct dm_btree_value_type *vt) | ||
2512 | { | ||
2513 | unsigned i; | ||
2514 | @@ -77,7 +77,7 @@ void inc_children(struct dm_transaction_manager *tm, struct node *n, | ||
2515 | vt->inc(vt->context, value_ptr(n, i)); | ||
2516 | } | ||
2517 | |||
2518 | -static int insert_at(size_t value_size, struct node *node, unsigned index, | ||
2519 | +static int insert_at(size_t value_size, struct btree_node *node, unsigned index, | ||
2520 | uint64_t key, void *value) | ||
2521 | __dm_written_to_disk(value) | ||
2522 | { | ||
2523 | @@ -122,7 +122,7 @@ int dm_btree_empty(struct dm_btree_info *info, dm_block_t *root) | ||
2524 | { | ||
2525 | int r; | ||
2526 | struct dm_block *b; | ||
2527 | - struct node *n; | ||
2528 | + struct btree_node *n; | ||
2529 | size_t block_size; | ||
2530 | uint32_t max_entries; | ||
2531 | |||
2532 | @@ -154,7 +154,7 @@ EXPORT_SYMBOL_GPL(dm_btree_empty); | ||
2533 | #define MAX_SPINE_DEPTH 64 | ||
2534 | struct frame { | ||
2535 | struct dm_block *b; | ||
2536 | - struct node *n; | ||
2537 | + struct btree_node *n; | ||
2538 | unsigned level; | ||
2539 | unsigned nr_children; | ||
2540 | unsigned current_child; | ||
2541 | @@ -295,7 +295,7 @@ EXPORT_SYMBOL_GPL(dm_btree_del); | ||
2542 | /*----------------------------------------------------------------*/ | ||
2543 | |||
2544 | static int btree_lookup_raw(struct ro_spine *s, dm_block_t block, uint64_t key, | ||
2545 | - int (*search_fn)(struct node *, uint64_t), | ||
2546 | + int (*search_fn)(struct btree_node *, uint64_t), | ||
2547 | uint64_t *result_key, void *v, size_t value_size) | ||
2548 | { | ||
2549 | int i, r; | ||
2550 | @@ -406,7 +406,7 @@ static int btree_split_sibling(struct shadow_spine *s, dm_block_t root, | ||
2551 | size_t size; | ||
2552 | unsigned nr_left, nr_right; | ||
2553 | struct dm_block *left, *right, *parent; | ||
2554 | - struct node *ln, *rn, *pn; | ||
2555 | + struct btree_node *ln, *rn, *pn; | ||
2556 | __le64 location; | ||
2557 | |||
2558 | left = shadow_current(s); | ||
2559 | @@ -491,7 +491,7 @@ static int btree_split_beneath(struct shadow_spine *s, uint64_t key) | ||
2560 | size_t size; | ||
2561 | unsigned nr_left, nr_right; | ||
2562 | struct dm_block *left, *right, *new_parent; | ||
2563 | - struct node *pn, *ln, *rn; | ||
2564 | + struct btree_node *pn, *ln, *rn; | ||
2565 | __le64 val; | ||
2566 | |||
2567 | new_parent = shadow_current(s); | ||
2568 | @@ -576,7 +576,7 @@ static int btree_insert_raw(struct shadow_spine *s, dm_block_t root, | ||
2569 | uint64_t key, unsigned *index) | ||
2570 | { | ||
2571 | int r, i = *index, top = 1; | ||
2572 | - struct node *node; | ||
2573 | + struct btree_node *node; | ||
2574 | |||
2575 | for (;;) { | ||
2576 | r = shadow_step(s, root, vt); | ||
2577 | @@ -643,7 +643,7 @@ static int insert(struct dm_btree_info *info, dm_block_t root, | ||
2578 | unsigned level, index = -1, last_level = info->levels - 1; | ||
2579 | dm_block_t block = root; | ||
2580 | struct shadow_spine spine; | ||
2581 | - struct node *n; | ||
2582 | + struct btree_node *n; | ||
2583 | struct dm_btree_value_type le64_type; | ||
2584 | |||
2585 | le64_type.context = NULL; | ||
2586 | diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c | ||
2587 | index f8b7771..7604f4e 100644 | ||
2588 | --- a/drivers/mfd/mfd-core.c | ||
2589 | +++ b/drivers/mfd/mfd-core.c | ||
2590 | @@ -21,6 +21,10 @@ | ||
2591 | #include <linux/irqdomain.h> | ||
2592 | #include <linux/of.h> | ||
2593 | |||
2594 | +static struct device_type mfd_dev_type = { | ||
2595 | + .name = "mfd_device", | ||
2596 | +}; | ||
2597 | + | ||
2598 | int mfd_cell_enable(struct platform_device *pdev) | ||
2599 | { | ||
2600 | const struct mfd_cell *cell = mfd_get_cell(pdev); | ||
2601 | @@ -91,6 +95,7 @@ static int mfd_add_device(struct device *parent, int id, | ||
2602 | goto fail_device; | ||
2603 | |||
2604 | pdev->dev.parent = parent; | ||
2605 | + pdev->dev.type = &mfd_dev_type; | ||
2606 | |||
2607 | if (parent->of_node && cell->of_compatible) { | ||
2608 | for_each_child_of_node(parent->of_node, np) { | ||
2609 | @@ -204,10 +209,16 @@ EXPORT_SYMBOL(mfd_add_devices); | ||
2610 | |||
2611 | static int mfd_remove_devices_fn(struct device *dev, void *c) | ||
2612 | { | ||
2613 | - struct platform_device *pdev = to_platform_device(dev); | ||
2614 | - const struct mfd_cell *cell = mfd_get_cell(pdev); | ||
2615 | + struct platform_device *pdev; | ||
2616 | + const struct mfd_cell *cell; | ||
2617 | atomic_t **usage_count = c; | ||
2618 | |||
2619 | + if (dev->type != &mfd_dev_type) | ||
2620 | + return 0; | ||
2621 | + | ||
2622 | + pdev = to_platform_device(dev); | ||
2623 | + cell = mfd_get_cell(pdev); | ||
2624 | + | ||
2625 | /* find the base address of usage_count pointers (for freeing) */ | ||
2626 | if (!*usage_count || (cell->usage_count < *usage_count)) | ||
2627 | *usage_count = cell->usage_count; | ||
2628 | diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c | ||
2629 | index 2febf88..38de846 100644 | ||
2630 | --- a/drivers/mfd/wm8994-core.c | ||
2631 | +++ b/drivers/mfd/wm8994-core.c | ||
2632 | @@ -557,6 +557,7 @@ static __devinit int wm8994_device_init(struct wm8994 *wm8994, int irq) | ||
2633 | case 1: | ||
2634 | case 2: | ||
2635 | case 3: | ||
2636 | + case 4: | ||
2637 | regmap_patch = wm1811_reva_patch; | ||
2638 | patch_regs = ARRAY_SIZE(wm1811_reva_patch); | ||
2639 | break; | ||
2640 | diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c | ||
2641 | index 8d082b4..d971817 100644 | ||
2642 | --- a/drivers/misc/sgi-xp/xpc_main.c | ||
2643 | +++ b/drivers/misc/sgi-xp/xpc_main.c | ||
2644 | @@ -53,6 +53,10 @@ | ||
2645 | #include <linux/kthread.h> | ||
2646 | #include "xpc.h" | ||
2647 | |||
2648 | +#ifdef CONFIG_X86_64 | ||
2649 | +#include <asm/traps.h> | ||
2650 | +#endif | ||
2651 | + | ||
2652 | /* define two XPC debug device structures to be used with dev_dbg() et al */ | ||
2653 | |||
2654 | struct device_driver xpc_dbg_name = { | ||
2655 | @@ -1079,6 +1083,9 @@ xpc_system_reboot(struct notifier_block *nb, unsigned long event, void *unused) | ||
2656 | return NOTIFY_DONE; | ||
2657 | } | ||
2658 | |||
2659 | +/* Used to only allow one cpu to complete disconnect */ | ||
2660 | +static unsigned int xpc_die_disconnecting; | ||
2661 | + | ||
2662 | /* | ||
2663 | * Notify other partitions to deactivate from us by first disengaging from all | ||
2664 | * references to our memory. | ||
2665 | @@ -1092,6 +1099,9 @@ xpc_die_deactivate(void) | ||
2666 | long keep_waiting; | ||
2667 | long wait_to_print; | ||
2668 | |||
2669 | + if (cmpxchg(&xpc_die_disconnecting, 0, 1)) | ||
2670 | + return; | ||
2671 | + | ||
2672 | /* keep xpc_hb_checker thread from doing anything (just in case) */ | ||
2673 | xpc_exiting = 1; | ||
2674 | |||
2675 | @@ -1159,7 +1169,7 @@ xpc_die_deactivate(void) | ||
2676 | * about the lack of a heartbeat. | ||
2677 | */ | ||
2678 | static int | ||
2679 | -xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused) | ||
2680 | +xpc_system_die(struct notifier_block *nb, unsigned long event, void *_die_args) | ||
2681 | { | ||
2682 | #ifdef CONFIG_IA64 /* !!! temporary kludge */ | ||
2683 | switch (event) { | ||
2684 | @@ -1191,7 +1201,27 @@ xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused) | ||
2685 | break; | ||
2686 | } | ||
2687 | #else | ||
2688 | - xpc_die_deactivate(); | ||
2689 | + struct die_args *die_args = _die_args; | ||
2690 | + | ||
2691 | + switch (event) { | ||
2692 | + case DIE_TRAP: | ||
2693 | + if (die_args->trapnr == X86_TRAP_DF) | ||
2694 | + xpc_die_deactivate(); | ||
2695 | + | ||
2696 | + if (((die_args->trapnr == X86_TRAP_MF) || | ||
2697 | + (die_args->trapnr == X86_TRAP_XF)) && | ||
2698 | + !user_mode_vm(die_args->regs)) | ||
2699 | + xpc_die_deactivate(); | ||
2700 | + | ||
2701 | + break; | ||
2702 | + case DIE_INT3: | ||
2703 | + case DIE_DEBUG: | ||
2704 | + break; | ||
2705 | + case DIE_OOPS: | ||
2706 | + case DIE_GPF: | ||
2707 | + default: | ||
2708 | + xpc_die_deactivate(); | ||
2709 | + } | ||
2710 | #endif | ||
2711 | |||
2712 | return NOTIFY_DONE; | ||
2713 | diff --git a/drivers/mtd/nand/cs553x_nand.c b/drivers/mtd/nand/cs553x_nand.c | ||
2714 | index adb6c3e..2cdeab8 100644 | ||
2715 | --- a/drivers/mtd/nand/cs553x_nand.c | ||
2716 | +++ b/drivers/mtd/nand/cs553x_nand.c | ||
2717 | @@ -237,6 +237,7 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr) | ||
2718 | this->ecc.hwctl = cs_enable_hwecc; | ||
2719 | this->ecc.calculate = cs_calculate_ecc; | ||
2720 | this->ecc.correct = nand_correct_data; | ||
2721 | + this->ecc.strength = 1; | ||
2722 | |||
2723 | /* Enable the following for a flash based bad block table */ | ||
2724 | this->bbt_options = NAND_BBT_USE_FLASH; | ||
2725 | @@ -247,8 +248,6 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr) | ||
2726 | goto out_ior; | ||
2727 | } | ||
2728 | |||
2729 | - this->ecc.strength = 1; | ||
2730 | - | ||
2731 | new_mtd->name = kasprintf(GFP_KERNEL, "cs553x_nand_cs%d", cs); | ||
2732 | |||
2733 | cs553x_mtd[cs] = new_mtd; | ||
2734 | diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c | ||
2735 | index a1f4332..b27e215 100644 | ||
2736 | --- a/drivers/mtd/nand/gpmi-nand/gpmi-lib.c | ||
2737 | +++ b/drivers/mtd/nand/gpmi-nand/gpmi-lib.c | ||
2738 | @@ -136,6 +136,15 @@ int gpmi_init(struct gpmi_nand_data *this) | ||
2739 | if (ret) | ||
2740 | goto err_out; | ||
2741 | |||
2742 | + /* | ||
2743 | + * Reset BCH here, too. We got failures otherwise :( | ||
2744 | + * See later BCH reset for explanation of MX23 handling | ||
2745 | + */ | ||
2746 | + ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this)); | ||
2747 | + if (ret) | ||
2748 | + goto err_out; | ||
2749 | + | ||
2750 | + | ||
2751 | /* Choose NAND mode. */ | ||
2752 | writel(BM_GPMI_CTRL1_GPMI_MODE, r->gpmi_regs + HW_GPMI_CTRL1_CLR); | ||
2753 | |||
2754 | diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c | ||
2755 | index 963e2cc..8233e5e 100644 | ||
2756 | --- a/drivers/net/can/dev.c | ||
2757 | +++ b/drivers/net/can/dev.c | ||
2758 | @@ -609,8 +609,7 @@ void close_candev(struct net_device *dev) | ||
2759 | { | ||
2760 | struct can_priv *priv = netdev_priv(dev); | ||
2761 | |||
2762 | - if (del_timer_sync(&priv->restart_timer)) | ||
2763 | - dev_put(dev); | ||
2764 | + del_timer_sync(&priv->restart_timer); | ||
2765 | can_flush_echo_skb(dev); | ||
2766 | } | ||
2767 | EXPORT_SYMBOL_GPL(close_candev); | ||
2768 | diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c | ||
2769 | index 48cc4fb..b1b8e96 100644 | ||
2770 | --- a/drivers/net/ethernet/intel/igb/igb_main.c | ||
2771 | +++ b/drivers/net/ethernet/intel/igb/igb_main.c | ||
2772 | @@ -936,17 +936,18 @@ static int igb_request_msix(struct igb_adapter *adapter) | ||
2773 | { | ||
2774 | struct net_device *netdev = adapter->netdev; | ||
2775 | struct e1000_hw *hw = &adapter->hw; | ||
2776 | - int i, err = 0, vector = 0; | ||
2777 | + int i, err = 0, vector = 0, free_vector = 0; | ||
2778 | |||
2779 | err = request_irq(adapter->msix_entries[vector].vector, | ||
2780 | igb_msix_other, 0, netdev->name, adapter); | ||
2781 | if (err) | ||
2782 | - goto out; | ||
2783 | - vector++; | ||
2784 | + goto err_out; | ||
2785 | |||
2786 | for (i = 0; i < adapter->num_q_vectors; i++) { | ||
2787 | struct igb_q_vector *q_vector = adapter->q_vector[i]; | ||
2788 | |||
2789 | + vector++; | ||
2790 | + | ||
2791 | q_vector->itr_register = hw->hw_addr + E1000_EITR(vector); | ||
2792 | |||
2793 | if (q_vector->rx.ring && q_vector->tx.ring) | ||
2794 | @@ -965,13 +966,22 @@ static int igb_request_msix(struct igb_adapter *adapter) | ||
2795 | igb_msix_ring, 0, q_vector->name, | ||
2796 | q_vector); | ||
2797 | if (err) | ||
2798 | - goto out; | ||
2799 | - vector++; | ||
2800 | + goto err_free; | ||
2801 | } | ||
2802 | |||
2803 | igb_configure_msix(adapter); | ||
2804 | return 0; | ||
2805 | -out: | ||
2806 | + | ||
2807 | +err_free: | ||
2808 | + /* free already assigned IRQs */ | ||
2809 | + free_irq(adapter->msix_entries[free_vector++].vector, adapter); | ||
2810 | + | ||
2811 | + vector--; | ||
2812 | + for (i = 0; i < vector; i++) { | ||
2813 | + free_irq(adapter->msix_entries[free_vector++].vector, | ||
2814 | + adapter->q_vector[i]); | ||
2815 | + } | ||
2816 | +err_out: | ||
2817 | return err; | ||
2818 | } | ||
2819 | |||
2820 | diff --git a/drivers/net/wimax/i2400m/i2400m-usb.h b/drivers/net/wimax/i2400m/i2400m-usb.h | ||
2821 | index 6650fde..9f1e947 100644 | ||
2822 | --- a/drivers/net/wimax/i2400m/i2400m-usb.h | ||
2823 | +++ b/drivers/net/wimax/i2400m/i2400m-usb.h | ||
2824 | @@ -152,6 +152,9 @@ enum { | ||
2825 | /* Device IDs */ | ||
2826 | USB_DEVICE_ID_I6050 = 0x0186, | ||
2827 | USB_DEVICE_ID_I6050_2 = 0x0188, | ||
2828 | + USB_DEVICE_ID_I6150 = 0x07d6, | ||
2829 | + USB_DEVICE_ID_I6150_2 = 0x07d7, | ||
2830 | + USB_DEVICE_ID_I6150_3 = 0x07d9, | ||
2831 | USB_DEVICE_ID_I6250 = 0x0187, | ||
2832 | }; | ||
2833 | |||
2834 | diff --git a/drivers/net/wimax/i2400m/usb.c b/drivers/net/wimax/i2400m/usb.c | ||
2835 | index 713d033..080f363 100644 | ||
2836 | --- a/drivers/net/wimax/i2400m/usb.c | ||
2837 | +++ b/drivers/net/wimax/i2400m/usb.c | ||
2838 | @@ -510,6 +510,9 @@ int i2400mu_probe(struct usb_interface *iface, | ||
2839 | switch (id->idProduct) { | ||
2840 | case USB_DEVICE_ID_I6050: | ||
2841 | case USB_DEVICE_ID_I6050_2: | ||
2842 | + case USB_DEVICE_ID_I6150: | ||
2843 | + case USB_DEVICE_ID_I6150_2: | ||
2844 | + case USB_DEVICE_ID_I6150_3: | ||
2845 | case USB_DEVICE_ID_I6250: | ||
2846 | i2400mu->i6050 = 1; | ||
2847 | break; | ||
2848 | @@ -759,6 +762,9 @@ static | ||
2849 | struct usb_device_id i2400mu_id_table[] = { | ||
2850 | { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050) }, | ||
2851 | { USB_DEVICE(0x8086, USB_DEVICE_ID_I6050_2) }, | ||
2852 | + { USB_DEVICE(0x8087, USB_DEVICE_ID_I6150) }, | ||
2853 | + { USB_DEVICE(0x8087, USB_DEVICE_ID_I6150_2) }, | ||
2854 | + { USB_DEVICE(0x8087, USB_DEVICE_ID_I6150_3) }, | ||
2855 | { USB_DEVICE(0x8086, USB_DEVICE_ID_I6250) }, | ||
2856 | { USB_DEVICE(0x8086, 0x0181) }, | ||
2857 | { USB_DEVICE(0x8086, 0x1403) }, | ||
2858 | diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c | ||
2859 | index 2aab20e..68a4046 100644 | ||
2860 | --- a/drivers/net/wireless/ath/ath5k/base.c | ||
2861 | +++ b/drivers/net/wireless/ath/ath5k/base.c | ||
2862 | @@ -848,7 +848,7 @@ ath5k_txbuf_free_skb(struct ath5k_hw *ah, struct ath5k_buf *bf) | ||
2863 | return; | ||
2864 | dma_unmap_single(ah->dev, bf->skbaddr, bf->skb->len, | ||
2865 | DMA_TO_DEVICE); | ||
2866 | - dev_kfree_skb_any(bf->skb); | ||
2867 | + ieee80211_free_txskb(ah->hw, bf->skb); | ||
2868 | bf->skb = NULL; | ||
2869 | bf->skbaddr = 0; | ||
2870 | bf->desc->ds_data = 0; | ||
2871 | @@ -1575,7 +1575,7 @@ ath5k_tx_queue(struct ieee80211_hw *hw, struct sk_buff *skb, | ||
2872 | return; | ||
2873 | |||
2874 | drop_packet: | ||
2875 | - dev_kfree_skb_any(skb); | ||
2876 | + ieee80211_free_txskb(hw, skb); | ||
2877 | } | ||
2878 | |||
2879 | static void | ||
2880 | diff --git a/drivers/net/wireless/ath/ath5k/mac80211-ops.c b/drivers/net/wireless/ath/ath5k/mac80211-ops.c | ||
2881 | index d56453e..b010a77 100644 | ||
2882 | --- a/drivers/net/wireless/ath/ath5k/mac80211-ops.c | ||
2883 | +++ b/drivers/net/wireless/ath/ath5k/mac80211-ops.c | ||
2884 | @@ -61,7 +61,7 @@ ath5k_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | ||
2885 | u16 qnum = skb_get_queue_mapping(skb); | ||
2886 | |||
2887 | if (WARN_ON(qnum >= ah->ah_capabilities.cap_queues.q_tx_num)) { | ||
2888 | - dev_kfree_skb_any(skb); | ||
2889 | + ieee80211_free_txskb(hw, skb); | ||
2890 | return; | ||
2891 | } | ||
2892 | |||
2893 | diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h | ||
2894 | index 6f7cf49..262e1e0 100644 | ||
2895 | --- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h | ||
2896 | +++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h | ||
2897 | @@ -534,98 +534,98 @@ static const u32 ar9300_2p2_baseband_core[][2] = { | ||
2898 | |||
2899 | static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { | ||
2900 | /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ | ||
2901 | - {0x0000a2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, | ||
2902 | - {0x0000a2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, | ||
2903 | - {0x0000a2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, | ||
2904 | + {0x0000a2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, | ||
2905 | + {0x0000a2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, | ||
2906 | + {0x0000a2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, | ||
2907 | {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | ||
2908 | - {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, | ||
2909 | - {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
2910 | - {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, | ||
2911 | - {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, | ||
2912 | - {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, | ||
2913 | - {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202}, | ||
2914 | - {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400}, | ||
2915 | - {0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402}, | ||
2916 | - {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404}, | ||
2917 | - {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603}, | ||
2918 | - {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02}, | ||
2919 | - {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04}, | ||
2920 | - {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20}, | ||
2921 | - {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20}, | ||
2922 | - {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22}, | ||
2923 | - {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24}, | ||
2924 | - {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640}, | ||
2925 | - {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660}, | ||
2926 | - {0x0000a544, 0x52022470, 0x52022470, 0x3f001861, 0x3f001861}, | ||
2927 | - {0x0000a548, 0x55022490, 0x55022490, 0x43001a81, 0x43001a81}, | ||
2928 | - {0x0000a54c, 0x59022492, 0x59022492, 0x47001a83, 0x47001a83}, | ||
2929 | - {0x0000a550, 0x5d022692, 0x5d022692, 0x4a001c84, 0x4a001c84}, | ||
2930 | - {0x0000a554, 0x61022892, 0x61022892, 0x4e001ce3, 0x4e001ce3}, | ||
2931 | - {0x0000a558, 0x65024890, 0x65024890, 0x52001ce5, 0x52001ce5}, | ||
2932 | - {0x0000a55c, 0x69024892, 0x69024892, 0x56001ce9, 0x56001ce9}, | ||
2933 | - {0x0000a560, 0x6e024c92, 0x6e024c92, 0x5a001ceb, 0x5a001ceb}, | ||
2934 | - {0x0000a564, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, | ||
2935 | - {0x0000a568, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, | ||
2936 | - {0x0000a56c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, | ||
2937 | - {0x0000a570, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, | ||
2938 | - {0x0000a574, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, | ||
2939 | - {0x0000a578, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, | ||
2940 | - {0x0000a57c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec}, | ||
2941 | - {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, | ||
2942 | - {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, | ||
2943 | - {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, | ||
2944 | - {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, | ||
2945 | - {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202}, | ||
2946 | - {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400}, | ||
2947 | - {0x0000a598, 0x21802220, 0x21802220, 0x16800402, 0x16800402}, | ||
2948 | - {0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404}, | ||
2949 | - {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603}, | ||
2950 | - {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02}, | ||
2951 | - {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04}, | ||
2952 | - {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20}, | ||
2953 | - {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20}, | ||
2954 | - {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22}, | ||
2955 | - {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24}, | ||
2956 | - {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640}, | ||
2957 | - {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660}, | ||
2958 | - {0x0000a5c4, 0x52822470, 0x52822470, 0x3f801861, 0x3f801861}, | ||
2959 | - {0x0000a5c8, 0x55822490, 0x55822490, 0x43801a81, 0x43801a81}, | ||
2960 | - {0x0000a5cc, 0x59822492, 0x59822492, 0x47801a83, 0x47801a83}, | ||
2961 | - {0x0000a5d0, 0x5d822692, 0x5d822692, 0x4a801c84, 0x4a801c84}, | ||
2962 | - {0x0000a5d4, 0x61822892, 0x61822892, 0x4e801ce3, 0x4e801ce3}, | ||
2963 | - {0x0000a5d8, 0x65824890, 0x65824890, 0x52801ce5, 0x52801ce5}, | ||
2964 | - {0x0000a5dc, 0x69824892, 0x69824892, 0x56801ce9, 0x56801ce9}, | ||
2965 | - {0x0000a5e0, 0x6e824c92, 0x6e824c92, 0x5a801ceb, 0x5a801ceb}, | ||
2966 | - {0x0000a5e4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, | ||
2967 | - {0x0000a5e8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, | ||
2968 | - {0x0000a5ec, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, | ||
2969 | - {0x0000a5f0, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, | ||
2970 | - {0x0000a5f4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, | ||
2971 | - {0x0000a5f8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, | ||
2972 | - {0x0000a5fc, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec}, | ||
2973 | + {0x0000a410, 0x000050d8, 0x000050d8, 0x000050d9, 0x000050d9}, | ||
2974 | + {0x0000a500, 0x00002220, 0x00002220, 0x00000000, 0x00000000}, | ||
2975 | + {0x0000a504, 0x04002222, 0x04002222, 0x04000002, 0x04000002}, | ||
2976 | + {0x0000a508, 0x09002421, 0x09002421, 0x08000004, 0x08000004}, | ||
2977 | + {0x0000a50c, 0x0d002621, 0x0d002621, 0x0b000200, 0x0b000200}, | ||
2978 | + {0x0000a510, 0x13004620, 0x13004620, 0x0f000202, 0x0f000202}, | ||
2979 | + {0x0000a514, 0x19004a20, 0x19004a20, 0x11000400, 0x11000400}, | ||
2980 | + {0x0000a518, 0x1d004e20, 0x1d004e20, 0x15000402, 0x15000402}, | ||
2981 | + {0x0000a51c, 0x21005420, 0x21005420, 0x19000404, 0x19000404}, | ||
2982 | + {0x0000a520, 0x26005e20, 0x26005e20, 0x1b000603, 0x1b000603}, | ||
2983 | + {0x0000a524, 0x2b005e40, 0x2b005e40, 0x1f000a02, 0x1f000a02}, | ||
2984 | + {0x0000a528, 0x2f005e42, 0x2f005e42, 0x23000a04, 0x23000a04}, | ||
2985 | + {0x0000a52c, 0x33005e44, 0x33005e44, 0x26000a20, 0x26000a20}, | ||
2986 | + {0x0000a530, 0x38005e65, 0x38005e65, 0x2a000e20, 0x2a000e20}, | ||
2987 | + {0x0000a534, 0x3c005e69, 0x3c005e69, 0x2e000e22, 0x2e000e22}, | ||
2988 | + {0x0000a538, 0x40005e6b, 0x40005e6b, 0x31000e24, 0x31000e24}, | ||
2989 | + {0x0000a53c, 0x44005e6d, 0x44005e6d, 0x34001640, 0x34001640}, | ||
2990 | + {0x0000a540, 0x49005e72, 0x49005e72, 0x38001660, 0x38001660}, | ||
2991 | + {0x0000a544, 0x4e005eb2, 0x4e005eb2, 0x3b001861, 0x3b001861}, | ||
2992 | + {0x0000a548, 0x53005f12, 0x53005f12, 0x3e001a81, 0x3e001a81}, | ||
2993 | + {0x0000a54c, 0x59025eb2, 0x59025eb2, 0x42001a83, 0x42001a83}, | ||
2994 | + {0x0000a550, 0x5e025f12, 0x5e025f12, 0x44001c84, 0x44001c84}, | ||
2995 | + {0x0000a554, 0x61027f12, 0x61027f12, 0x48001ce3, 0x48001ce3}, | ||
2996 | + {0x0000a558, 0x6702bf12, 0x6702bf12, 0x4c001ce5, 0x4c001ce5}, | ||
2997 | + {0x0000a55c, 0x6b02bf14, 0x6b02bf14, 0x50001ce9, 0x50001ce9}, | ||
2998 | + {0x0000a560, 0x6f02bf16, 0x6f02bf16, 0x54001ceb, 0x54001ceb}, | ||
2999 | + {0x0000a564, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
3000 | + {0x0000a568, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
3001 | + {0x0000a56c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
3002 | + {0x0000a570, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
3003 | + {0x0000a574, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
3004 | + {0x0000a578, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
3005 | + {0x0000a57c, 0x6f02bf16, 0x6f02bf16, 0x56001eec, 0x56001eec}, | ||
3006 | + {0x0000a580, 0x00802220, 0x00802220, 0x00800000, 0x00800000}, | ||
3007 | + {0x0000a584, 0x04802222, 0x04802222, 0x04800002, 0x04800002}, | ||
3008 | + {0x0000a588, 0x09802421, 0x09802421, 0x08800004, 0x08800004}, | ||
3009 | + {0x0000a58c, 0x0d802621, 0x0d802621, 0x0b800200, 0x0b800200}, | ||
3010 | + {0x0000a590, 0x13804620, 0x13804620, 0x0f800202, 0x0f800202}, | ||
3011 | + {0x0000a594, 0x19804a20, 0x19804a20, 0x11800400, 0x11800400}, | ||
3012 | + {0x0000a598, 0x1d804e20, 0x1d804e20, 0x15800402, 0x15800402}, | ||
3013 | + {0x0000a59c, 0x21805420, 0x21805420, 0x19800404, 0x19800404}, | ||
3014 | + {0x0000a5a0, 0x26805e20, 0x26805e20, 0x1b800603, 0x1b800603}, | ||
3015 | + {0x0000a5a4, 0x2b805e40, 0x2b805e40, 0x1f800a02, 0x1f800a02}, | ||
3016 | + {0x0000a5a8, 0x2f805e42, 0x2f805e42, 0x23800a04, 0x23800a04}, | ||
3017 | + {0x0000a5ac, 0x33805e44, 0x33805e44, 0x26800a20, 0x26800a20}, | ||
3018 | + {0x0000a5b0, 0x38805e65, 0x38805e65, 0x2a800e20, 0x2a800e20}, | ||
3019 | + {0x0000a5b4, 0x3c805e69, 0x3c805e69, 0x2e800e22, 0x2e800e22}, | ||
3020 | + {0x0000a5b8, 0x40805e6b, 0x40805e6b, 0x31800e24, 0x31800e24}, | ||
3021 | + {0x0000a5bc, 0x44805e6d, 0x44805e6d, 0x34801640, 0x34801640}, | ||
3022 | + {0x0000a5c0, 0x49805e72, 0x49805e72, 0x38801660, 0x38801660}, | ||
3023 | + {0x0000a5c4, 0x4e805eb2, 0x4e805eb2, 0x3b801861, 0x3b801861}, | ||
3024 | + {0x0000a5c8, 0x53805f12, 0x53805f12, 0x3e801a81, 0x3e801a81}, | ||
3025 | + {0x0000a5cc, 0x59825eb2, 0x59825eb2, 0x42801a83, 0x42801a83}, | ||
3026 | + {0x0000a5d0, 0x5e825f12, 0x5e825f12, 0x44801c84, 0x44801c84}, | ||
3027 | + {0x0000a5d4, 0x61827f12, 0x61827f12, 0x48801ce3, 0x48801ce3}, | ||
3028 | + {0x0000a5d8, 0x6782bf12, 0x6782bf12, 0x4c801ce5, 0x4c801ce5}, | ||
3029 | + {0x0000a5dc, 0x6b82bf14, 0x6b82bf14, 0x50801ce9, 0x50801ce9}, | ||
3030 | + {0x0000a5e0, 0x6f82bf16, 0x6f82bf16, 0x54801ceb, 0x54801ceb}, | ||
3031 | + {0x0000a5e4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
3032 | + {0x0000a5e8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
3033 | + {0x0000a5ec, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
3034 | + {0x0000a5f0, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
3035 | + {0x0000a5f4, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
3036 | + {0x0000a5f8, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
3037 | + {0x0000a5fc, 0x6f82bf16, 0x6f82bf16, 0x56801eec, 0x56801eec}, | ||
3038 | {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
3039 | {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
3040 | {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
3041 | {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
3042 | - {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, | ||
3043 | - {0x0000a614, 0x02004000, 0x02004000, 0x01404000, 0x01404000}, | ||
3044 | - {0x0000a618, 0x02004801, 0x02004801, 0x01404501, 0x01404501}, | ||
3045 | - {0x0000a61c, 0x02808a02, 0x02808a02, 0x02008501, 0x02008501}, | ||
3046 | - {0x0000a620, 0x0380ce03, 0x0380ce03, 0x0280ca03, 0x0280ca03}, | ||
3047 | - {0x0000a624, 0x04411104, 0x04411104, 0x03010c04, 0x03010c04}, | ||
3048 | - {0x0000a628, 0x04411104, 0x04411104, 0x04014c04, 0x04014c04}, | ||
3049 | - {0x0000a62c, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, | ||
3050 | - {0x0000a630, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, | ||
3051 | - {0x0000a634, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, | ||
3052 | - {0x0000a638, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, | ||
3053 | - {0x0000a63c, 0x04411104, 0x04411104, 0x04015005, 0x04015005}, | ||
3054 | - {0x0000b2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, | ||
3055 | - {0x0000b2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, | ||
3056 | - {0x0000b2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, | ||
3057 | + {0x0000a610, 0x00804000, 0x00804000, 0x00000000, 0x00000000}, | ||
3058 | + {0x0000a614, 0x00804201, 0x00804201, 0x01404000, 0x01404000}, | ||
3059 | + {0x0000a618, 0x0280c802, 0x0280c802, 0x01404501, 0x01404501}, | ||
3060 | + {0x0000a61c, 0x0280ca03, 0x0280ca03, 0x02008501, 0x02008501}, | ||
3061 | + {0x0000a620, 0x04c15104, 0x04c15104, 0x0280ca03, 0x0280ca03}, | ||
3062 | + {0x0000a624, 0x04c15305, 0x04c15305, 0x03010c04, 0x03010c04}, | ||
3063 | + {0x0000a628, 0x04c15305, 0x04c15305, 0x04014c04, 0x04014c04}, | ||
3064 | + {0x0000a62c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
3065 | + {0x0000a630, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
3066 | + {0x0000a634, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
3067 | + {0x0000a638, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
3068 | + {0x0000a63c, 0x04c15305, 0x04c15305, 0x04015005, 0x04015005}, | ||
3069 | + {0x0000b2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, | ||
3070 | + {0x0000b2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, | ||
3071 | + {0x0000b2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, | ||
3072 | {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | ||
3073 | - {0x0000c2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352}, | ||
3074 | - {0x0000c2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584}, | ||
3075 | - {0x0000c2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800}, | ||
3076 | + {0x0000c2dc, 0x0380c7fc, 0x0380c7fc, 0x03aaa352, 0x03aaa352}, | ||
3077 | + {0x0000c2e0, 0x0000f800, 0x0000f800, 0x03ccc584, 0x03ccc584}, | ||
3078 | + {0x0000c2e4, 0x03ff0000, 0x03ff0000, 0x03f0f800, 0x03f0f800}, | ||
3079 | {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, | ||
3080 | {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, | ||
3081 | {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001}, | ||
3082 | diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h | ||
3083 | index 3a1ff55..a633aea 100644 | ||
3084 | --- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h | ||
3085 | +++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.h | ||
3086 | @@ -68,13 +68,13 @@ | ||
3087 | #define AR9300_BASE_ADDR 0x3ff | ||
3088 | #define AR9300_BASE_ADDR_512 0x1ff | ||
3089 | |||
3090 | -#define AR9300_OTP_BASE 0x14000 | ||
3091 | -#define AR9300_OTP_STATUS 0x15f18 | ||
3092 | +#define AR9300_OTP_BASE (AR_SREV_9340(ah) ? 0x30000 : 0x14000) | ||
3093 | +#define AR9300_OTP_STATUS (AR_SREV_9340(ah) ? 0x30018 : 0x15f18) | ||
3094 | #define AR9300_OTP_STATUS_TYPE 0x7 | ||
3095 | #define AR9300_OTP_STATUS_VALID 0x4 | ||
3096 | #define AR9300_OTP_STATUS_ACCESS_BUSY 0x2 | ||
3097 | #define AR9300_OTP_STATUS_SM_BUSY 0x1 | ||
3098 | -#define AR9300_OTP_READ_DATA 0x15f1c | ||
3099 | +#define AR9300_OTP_READ_DATA (AR_SREV_9340(ah) ? 0x3001c : 0x15f1c) | ||
3100 | |||
3101 | enum targetPowerHTRates { | ||
3102 | HT_TARGET_RATE_0_8_16, | ||
3103 | diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c | ||
3104 | index e5cceb0..bbd249d 100644 | ||
3105 | --- a/drivers/net/wireless/ath/ath9k/calib.c | ||
3106 | +++ b/drivers/net/wireless/ath/ath9k/calib.c | ||
3107 | @@ -69,6 +69,7 @@ s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan) | ||
3108 | |||
3109 | if (chan && chan->noisefloor) { | ||
3110 | s8 delta = chan->noisefloor - | ||
3111 | + ATH9K_NF_CAL_NOISE_THRESH - | ||
3112 | ath9k_hw_get_default_nf(ah, chan); | ||
3113 | if (delta > 0) | ||
3114 | noise += delta; | ||
3115 | diff --git a/drivers/net/wireless/ath/ath9k/calib.h b/drivers/net/wireless/ath/ath9k/calib.h | ||
3116 | index 1060c19..60dcb6c 100644 | ||
3117 | --- a/drivers/net/wireless/ath/ath9k/calib.h | ||
3118 | +++ b/drivers/net/wireless/ath/ath9k/calib.h | ||
3119 | @@ -21,6 +21,9 @@ | ||
3120 | |||
3121 | #define AR_PHY_CCA_FILTERWINDOW_LENGTH 5 | ||
3122 | |||
3123 | +/* Internal noise floor can vary by about 6db depending on the frequency */ | ||
3124 | +#define ATH9K_NF_CAL_NOISE_THRESH 6 | ||
3125 | + | ||
3126 | #define NUM_NF_READINGS 6 | ||
3127 | #define ATH9K_NF_CAL_HIST_MAX 5 | ||
3128 | |||
3129 | diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h | ||
3130 | index 7c899fc..ac593ab 100644 | ||
3131 | --- a/drivers/net/wireless/b43/b43.h | ||
3132 | +++ b/drivers/net/wireless/b43/b43.h | ||
3133 | @@ -7,6 +7,7 @@ | ||
3134 | #include <linux/hw_random.h> | ||
3135 | #include <linux/bcma/bcma.h> | ||
3136 | #include <linux/ssb/ssb.h> | ||
3137 | +#include <linux/completion.h> | ||
3138 | #include <net/mac80211.h> | ||
3139 | |||
3140 | #include "debugfs.h" | ||
3141 | @@ -718,6 +719,10 @@ enum b43_firmware_file_type { | ||
3142 | struct b43_request_fw_context { | ||
3143 | /* The device we are requesting the fw for. */ | ||
3144 | struct b43_wldev *dev; | ||
3145 | + /* a completion event structure needed if this call is asynchronous */ | ||
3146 | + struct completion fw_load_complete; | ||
3147 | + /* a pointer to the firmware object */ | ||
3148 | + const struct firmware *blob; | ||
3149 | /* The type of firmware to request. */ | ||
3150 | enum b43_firmware_file_type req_type; | ||
3151 | /* Error messages for each firmware type. */ | ||
3152 | diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c | ||
3153 | index 777cd74..38bc5a7 100644 | ||
3154 | --- a/drivers/net/wireless/b43/dma.c | ||
3155 | +++ b/drivers/net/wireless/b43/dma.c | ||
3156 | @@ -409,7 +409,10 @@ static inline | ||
3157 | struct b43_dmadesc_meta *meta) | ||
3158 | { | ||
3159 | if (meta->skb) { | ||
3160 | - dev_kfree_skb_any(meta->skb); | ||
3161 | + if (ring->tx) | ||
3162 | + ieee80211_free_txskb(ring->dev->wl->hw, meta->skb); | ||
3163 | + else | ||
3164 | + dev_kfree_skb_any(meta->skb); | ||
3165 | meta->skb = NULL; | ||
3166 | } | ||
3167 | } | ||
3168 | @@ -1454,7 +1457,7 @@ int b43_dma_tx(struct b43_wldev *dev, struct sk_buff *skb) | ||
3169 | if (unlikely(err == -ENOKEY)) { | ||
3170 | /* Drop this packet, as we don't have the encryption key | ||
3171 | * anymore and must not transmit it unencrypted. */ | ||
3172 | - dev_kfree_skb_any(skb); | ||
3173 | + ieee80211_free_txskb(dev->wl->hw, skb); | ||
3174 | err = 0; | ||
3175 | goto out; | ||
3176 | } | ||
3177 | diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c | ||
3178 | index 46d9d4e..b70bc2d 100644 | ||
3179 | --- a/drivers/net/wireless/b43/main.c | ||
3180 | +++ b/drivers/net/wireless/b43/main.c | ||
3181 | @@ -2088,11 +2088,18 @@ static void b43_print_fw_helptext(struct b43_wl *wl, bool error) | ||
3182 | b43warn(wl, text); | ||
3183 | } | ||
3184 | |||
3185 | +static void b43_fw_cb(const struct firmware *firmware, void *context) | ||
3186 | +{ | ||
3187 | + struct b43_request_fw_context *ctx = context; | ||
3188 | + | ||
3189 | + ctx->blob = firmware; | ||
3190 | + complete(&ctx->fw_load_complete); | ||
3191 | +} | ||
3192 | + | ||
3193 | int b43_do_request_fw(struct b43_request_fw_context *ctx, | ||
3194 | const char *name, | ||
3195 | - struct b43_firmware_file *fw) | ||
3196 | + struct b43_firmware_file *fw, bool async) | ||
3197 | { | ||
3198 | - const struct firmware *blob; | ||
3199 | struct b43_fw_header *hdr; | ||
3200 | u32 size; | ||
3201 | int err; | ||
3202 | @@ -2131,11 +2138,31 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx, | ||
3203 | B43_WARN_ON(1); | ||
3204 | return -ENOSYS; | ||
3205 | } | ||
3206 | - err = request_firmware(&blob, ctx->fwname, ctx->dev->dev->dev); | ||
3207 | + if (async) { | ||
3208 | + /* do this part asynchronously */ | ||
3209 | + init_completion(&ctx->fw_load_complete); | ||
3210 | + err = request_firmware_nowait(THIS_MODULE, 1, ctx->fwname, | ||
3211 | + ctx->dev->dev->dev, GFP_KERNEL, | ||
3212 | + ctx, b43_fw_cb); | ||
3213 | + if (err < 0) { | ||
3214 | + pr_err("Unable to load firmware\n"); | ||
3215 | + return err; | ||
3216 | + } | ||
3217 | + /* stall here until fw ready */ | ||
3218 | + wait_for_completion(&ctx->fw_load_complete); | ||
3219 | + if (ctx->blob) | ||
3220 | + goto fw_ready; | ||
3221 | + /* On some ARM systems, the async request will fail, but the next sync | ||
3222 | + * request works. For this reason, we dall through here | ||
3223 | + */ | ||
3224 | + } | ||
3225 | + err = request_firmware(&ctx->blob, ctx->fwname, | ||
3226 | + ctx->dev->dev->dev); | ||
3227 | if (err == -ENOENT) { | ||
3228 | snprintf(ctx->errors[ctx->req_type], | ||
3229 | sizeof(ctx->errors[ctx->req_type]), | ||
3230 | - "Firmware file \"%s\" not found\n", ctx->fwname); | ||
3231 | + "Firmware file \"%s\" not found\n", | ||
3232 | + ctx->fwname); | ||
3233 | return err; | ||
3234 | } else if (err) { | ||
3235 | snprintf(ctx->errors[ctx->req_type], | ||
3236 | @@ -2144,14 +2171,15 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx, | ||
3237 | ctx->fwname, err); | ||
3238 | return err; | ||
3239 | } | ||
3240 | - if (blob->size < sizeof(struct b43_fw_header)) | ||
3241 | +fw_ready: | ||
3242 | + if (ctx->blob->size < sizeof(struct b43_fw_header)) | ||
3243 | goto err_format; | ||
3244 | - hdr = (struct b43_fw_header *)(blob->data); | ||
3245 | + hdr = (struct b43_fw_header *)(ctx->blob->data); | ||
3246 | switch (hdr->type) { | ||
3247 | case B43_FW_TYPE_UCODE: | ||
3248 | case B43_FW_TYPE_PCM: | ||
3249 | size = be32_to_cpu(hdr->size); | ||
3250 | - if (size != blob->size - sizeof(struct b43_fw_header)) | ||
3251 | + if (size != ctx->blob->size - sizeof(struct b43_fw_header)) | ||
3252 | goto err_format; | ||
3253 | /* fallthrough */ | ||
3254 | case B43_FW_TYPE_IV: | ||
3255 | @@ -2162,7 +2190,7 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx, | ||
3256 | goto err_format; | ||
3257 | } | ||
3258 | |||
3259 | - fw->data = blob; | ||
3260 | + fw->data = ctx->blob; | ||
3261 | fw->filename = name; | ||
3262 | fw->type = ctx->req_type; | ||
3263 | |||
3264 | @@ -2172,7 +2200,7 @@ err_format: | ||
3265 | snprintf(ctx->errors[ctx->req_type], | ||
3266 | sizeof(ctx->errors[ctx->req_type]), | ||
3267 | "Firmware file \"%s\" format error.\n", ctx->fwname); | ||
3268 | - release_firmware(blob); | ||
3269 | + release_firmware(ctx->blob); | ||
3270 | |||
3271 | return -EPROTO; | ||
3272 | } | ||
3273 | @@ -2223,7 +2251,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx) | ||
3274 | goto err_no_ucode; | ||
3275 | } | ||
3276 | } | ||
3277 | - err = b43_do_request_fw(ctx, filename, &fw->ucode); | ||
3278 | + err = b43_do_request_fw(ctx, filename, &fw->ucode, true); | ||
3279 | if (err) | ||
3280 | goto err_load; | ||
3281 | |||
3282 | @@ -2235,7 +2263,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx) | ||
3283 | else | ||
3284 | goto err_no_pcm; | ||
3285 | fw->pcm_request_failed = false; | ||
3286 | - err = b43_do_request_fw(ctx, filename, &fw->pcm); | ||
3287 | + err = b43_do_request_fw(ctx, filename, &fw->pcm, false); | ||
3288 | if (err == -ENOENT) { | ||
3289 | /* We did not find a PCM file? Not fatal, but | ||
3290 | * core rev <= 10 must do without hwcrypto then. */ | ||
3291 | @@ -2296,7 +2324,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx) | ||
3292 | default: | ||
3293 | goto err_no_initvals; | ||
3294 | } | ||
3295 | - err = b43_do_request_fw(ctx, filename, &fw->initvals); | ||
3296 | + err = b43_do_request_fw(ctx, filename, &fw->initvals, false); | ||
3297 | if (err) | ||
3298 | goto err_load; | ||
3299 | |||
3300 | @@ -2355,7 +2383,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx) | ||
3301 | default: | ||
3302 | goto err_no_initvals; | ||
3303 | } | ||
3304 | - err = b43_do_request_fw(ctx, filename, &fw->initvals_band); | ||
3305 | + err = b43_do_request_fw(ctx, filename, &fw->initvals_band, false); | ||
3306 | if (err) | ||
3307 | goto err_load; | ||
3308 | |||
3309 | @@ -3397,7 +3425,7 @@ static void b43_tx_work(struct work_struct *work) | ||
3310 | break; | ||
3311 | } | ||
3312 | if (unlikely(err)) | ||
3313 | - dev_kfree_skb(skb); /* Drop it */ | ||
3314 | + ieee80211_free_txskb(wl->hw, skb); | ||
3315 | err = 0; | ||
3316 | } | ||
3317 | |||
3318 | @@ -3418,7 +3446,7 @@ static void b43_op_tx(struct ieee80211_hw *hw, | ||
3319 | |||
3320 | if (unlikely(skb->len < 2 + 2 + 6)) { | ||
3321 | /* Too short, this can't be a valid frame. */ | ||
3322 | - dev_kfree_skb_any(skb); | ||
3323 | + ieee80211_free_txskb(hw, skb); | ||
3324 | return; | ||
3325 | } | ||
3326 | B43_WARN_ON(skb_shinfo(skb)->nr_frags); | ||
3327 | @@ -4228,8 +4256,12 @@ redo: | ||
3328 | |||
3329 | /* Drain all TX queues. */ | ||
3330 | for (queue_num = 0; queue_num < B43_QOS_QUEUE_NUM; queue_num++) { | ||
3331 | - while (skb_queue_len(&wl->tx_queue[queue_num])) | ||
3332 | - dev_kfree_skb(skb_dequeue(&wl->tx_queue[queue_num])); | ||
3333 | + while (skb_queue_len(&wl->tx_queue[queue_num])) { | ||
3334 | + struct sk_buff *skb; | ||
3335 | + | ||
3336 | + skb = skb_dequeue(&wl->tx_queue[queue_num]); | ||
3337 | + ieee80211_free_txskb(wl->hw, skb); | ||
3338 | + } | ||
3339 | } | ||
3340 | |||
3341 | b43_mac_suspend(dev); | ||
3342 | diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h | ||
3343 | index 8c684cd..abac25e 100644 | ||
3344 | --- a/drivers/net/wireless/b43/main.h | ||
3345 | +++ b/drivers/net/wireless/b43/main.h | ||
3346 | @@ -137,9 +137,8 @@ void b43_mac_phy_clock_set(struct b43_wldev *dev, bool on); | ||
3347 | |||
3348 | |||
3349 | struct b43_request_fw_context; | ||
3350 | -int b43_do_request_fw(struct b43_request_fw_context *ctx, | ||
3351 | - const char *name, | ||
3352 | - struct b43_firmware_file *fw); | ||
3353 | +int b43_do_request_fw(struct b43_request_fw_context *ctx, const char *name, | ||
3354 | + struct b43_firmware_file *fw, bool async); | ||
3355 | void b43_do_release_fw(struct b43_firmware_file *fw); | ||
3356 | |||
3357 | #endif /* B43_MAIN_H_ */ | ||
3358 | diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c | ||
3359 | index 3533ab8..a73ff8c 100644 | ||
3360 | --- a/drivers/net/wireless/b43/pio.c | ||
3361 | +++ b/drivers/net/wireless/b43/pio.c | ||
3362 | @@ -196,7 +196,7 @@ static void b43_pio_cancel_tx_packets(struct b43_pio_txqueue *q) | ||
3363 | for (i = 0; i < ARRAY_SIZE(q->packets); i++) { | ||
3364 | pack = &(q->packets[i]); | ||
3365 | if (pack->skb) { | ||
3366 | - dev_kfree_skb_any(pack->skb); | ||
3367 | + ieee80211_free_txskb(q->dev->wl->hw, pack->skb); | ||
3368 | pack->skb = NULL; | ||
3369 | } | ||
3370 | } | ||
3371 | @@ -552,7 +552,7 @@ int b43_pio_tx(struct b43_wldev *dev, struct sk_buff *skb) | ||
3372 | if (unlikely(err == -ENOKEY)) { | ||
3373 | /* Drop this packet, as we don't have the encryption key | ||
3374 | * anymore and must not transmit it unencrypted. */ | ||
3375 | - dev_kfree_skb_any(skb); | ||
3376 | + ieee80211_free_txskb(dev->wl->hw, skb); | ||
3377 | err = 0; | ||
3378 | goto out; | ||
3379 | } | ||
3380 | diff --git a/drivers/net/wireless/b43legacy/b43legacy.h b/drivers/net/wireless/b43legacy/b43legacy.h | ||
3381 | index a29da67..482476f 100644 | ||
3382 | --- a/drivers/net/wireless/b43legacy/b43legacy.h | ||
3383 | +++ b/drivers/net/wireless/b43legacy/b43legacy.h | ||
3384 | @@ -13,6 +13,7 @@ | ||
3385 | |||
3386 | #include <linux/ssb/ssb.h> | ||
3387 | #include <linux/ssb/ssb_driver_chipcommon.h> | ||
3388 | +#include <linux/completion.h> | ||
3389 | |||
3390 | #include <net/mac80211.h> | ||
3391 | |||
3392 | @@ -733,6 +734,10 @@ struct b43legacy_wldev { | ||
3393 | |||
3394 | /* Firmware data */ | ||
3395 | struct b43legacy_firmware fw; | ||
3396 | + const struct firmware *fwp; /* needed to pass fw pointer */ | ||
3397 | + | ||
3398 | + /* completion struct for firmware loading */ | ||
3399 | + struct completion fw_load_complete; | ||
3400 | |||
3401 | /* Devicelist in struct b43legacy_wl (all 802.11 cores) */ | ||
3402 | struct list_head list; | ||
3403 | diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c | ||
3404 | index 0ef08e0..aa87fb7 100644 | ||
3405 | --- a/drivers/net/wireless/b43legacy/main.c | ||
3406 | +++ b/drivers/net/wireless/b43legacy/main.c | ||
3407 | @@ -1513,9 +1513,17 @@ static void b43legacy_print_fw_helptext(struct b43legacy_wl *wl) | ||
3408 | "and download the correct firmware (version 3).\n"); | ||
3409 | } | ||
3410 | |||
3411 | +static void b43legacy_fw_cb(const struct firmware *firmware, void *context) | ||
3412 | +{ | ||
3413 | + struct b43legacy_wldev *dev = context; | ||
3414 | + | ||
3415 | + dev->fwp = firmware; | ||
3416 | + complete(&dev->fw_load_complete); | ||
3417 | +} | ||
3418 | + | ||
3419 | static int do_request_fw(struct b43legacy_wldev *dev, | ||
3420 | const char *name, | ||
3421 | - const struct firmware **fw) | ||
3422 | + const struct firmware **fw, bool async) | ||
3423 | { | ||
3424 | char path[sizeof(modparam_fwpostfix) + 32]; | ||
3425 | struct b43legacy_fw_header *hdr; | ||
3426 | @@ -1528,7 +1536,24 @@ static int do_request_fw(struct b43legacy_wldev *dev, | ||
3427 | snprintf(path, ARRAY_SIZE(path), | ||
3428 | "b43legacy%s/%s.fw", | ||
3429 | modparam_fwpostfix, name); | ||
3430 | - err = request_firmware(fw, path, dev->dev->dev); | ||
3431 | + b43legacyinfo(dev->wl, "Loading firmware %s\n", path); | ||
3432 | + if (async) { | ||
3433 | + init_completion(&dev->fw_load_complete); | ||
3434 | + err = request_firmware_nowait(THIS_MODULE, 1, path, | ||
3435 | + dev->dev->dev, GFP_KERNEL, | ||
3436 | + dev, b43legacy_fw_cb); | ||
3437 | + if (err) { | ||
3438 | + b43legacyerr(dev->wl, "Unable to load firmware\n"); | ||
3439 | + return err; | ||
3440 | + } | ||
3441 | + /* stall here until fw ready */ | ||
3442 | + wait_for_completion(&dev->fw_load_complete); | ||
3443 | + if (!dev->fwp) | ||
3444 | + err = -EINVAL; | ||
3445 | + *fw = dev->fwp; | ||
3446 | + } else { | ||
3447 | + err = request_firmware(fw, path, dev->dev->dev); | ||
3448 | + } | ||
3449 | if (err) { | ||
3450 | b43legacyerr(dev->wl, "Firmware file \"%s\" not found " | ||
3451 | "or load failed.\n", path); | ||
3452 | @@ -1580,7 +1605,7 @@ static void b43legacy_request_firmware(struct work_struct *work) | ||
3453 | filename = "ucode4"; | ||
3454 | else | ||
3455 | filename = "ucode5"; | ||
3456 | - err = do_request_fw(dev, filename, &fw->ucode); | ||
3457 | + err = do_request_fw(dev, filename, &fw->ucode, true); | ||
3458 | if (err) | ||
3459 | goto err_load; | ||
3460 | } | ||
3461 | @@ -1589,7 +1614,7 @@ static void b43legacy_request_firmware(struct work_struct *work) | ||
3462 | filename = "pcm4"; | ||
3463 | else | ||
3464 | filename = "pcm5"; | ||
3465 | - err = do_request_fw(dev, filename, &fw->pcm); | ||
3466 | + err = do_request_fw(dev, filename, &fw->pcm, false); | ||
3467 | if (err) | ||
3468 | goto err_load; | ||
3469 | } | ||
3470 | @@ -1607,7 +1632,7 @@ static void b43legacy_request_firmware(struct work_struct *work) | ||
3471 | default: | ||
3472 | goto err_no_initvals; | ||
3473 | } | ||
3474 | - err = do_request_fw(dev, filename, &fw->initvals); | ||
3475 | + err = do_request_fw(dev, filename, &fw->initvals, false); | ||
3476 | if (err) | ||
3477 | goto err_load; | ||
3478 | } | ||
3479 | @@ -1627,7 +1652,7 @@ static void b43legacy_request_firmware(struct work_struct *work) | ||
3480 | default: | ||
3481 | goto err_no_initvals; | ||
3482 | } | ||
3483 | - err = do_request_fw(dev, filename, &fw->initvals_band); | ||
3484 | + err = do_request_fw(dev, filename, &fw->initvals_band, false); | ||
3485 | if (err) | ||
3486 | goto err_load; | ||
3487 | } | ||
3488 | diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c | ||
3489 | index fb21360..8951285 100644 | ||
3490 | --- a/drivers/net/wireless/mwifiex/sta_ioctl.c | ||
3491 | +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c | ||
3492 | @@ -53,7 +53,6 @@ int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist, | ||
3493 | */ | ||
3494 | int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter) | ||
3495 | { | ||
3496 | - bool cancel_flag = false; | ||
3497 | int status; | ||
3498 | struct cmd_ctrl_node *cmd_queued; | ||
3499 | |||
3500 | @@ -67,14 +66,11 @@ int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter) | ||
3501 | atomic_inc(&adapter->cmd_pending); | ||
3502 | |||
3503 | /* Wait for completion */ | ||
3504 | - wait_event_interruptible(adapter->cmd_wait_q.wait, | ||
3505 | - *(cmd_queued->condition)); | ||
3506 | - if (!*(cmd_queued->condition)) | ||
3507 | - cancel_flag = true; | ||
3508 | - | ||
3509 | - if (cancel_flag) { | ||
3510 | - mwifiex_cancel_pending_ioctl(adapter); | ||
3511 | - dev_dbg(adapter->dev, "cmd cancel\n"); | ||
3512 | + status = wait_event_interruptible(adapter->cmd_wait_q.wait, | ||
3513 | + *(cmd_queued->condition)); | ||
3514 | + if (status) { | ||
3515 | + dev_err(adapter->dev, "cmd_wait_q terminated: %d\n", status); | ||
3516 | + return status; | ||
3517 | } | ||
3518 | |||
3519 | status = adapter->cmd_wait_q.status; | ||
3520 | @@ -427,8 +423,11 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter) | ||
3521 | return false; | ||
3522 | } | ||
3523 | |||
3524 | - wait_event_interruptible(adapter->hs_activate_wait_q, | ||
3525 | - adapter->hs_activate_wait_q_woken); | ||
3526 | + if (wait_event_interruptible(adapter->hs_activate_wait_q, | ||
3527 | + adapter->hs_activate_wait_q_woken)) { | ||
3528 | + dev_err(adapter->dev, "hs_activate_wait_q terminated\n"); | ||
3529 | + return false; | ||
3530 | + } | ||
3531 | |||
3532 | return true; | ||
3533 | } | ||
3534 | diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c | ||
3535 | index effb044..4191294 100644 | ||
3536 | --- a/drivers/net/wireless/p54/p54usb.c | ||
3537 | +++ b/drivers/net/wireless/p54/p54usb.c | ||
3538 | @@ -47,6 +47,7 @@ static struct usb_device_id p54u_table[] = { | ||
3539 | {USB_DEVICE(0x0411, 0x0050)}, /* Buffalo WLI2-USB2-G54 */ | ||
3540 | {USB_DEVICE(0x045e, 0x00c2)}, /* Microsoft MN-710 */ | ||
3541 | {USB_DEVICE(0x0506, 0x0a11)}, /* 3COM 3CRWE254G72 */ | ||
3542 | + {USB_DEVICE(0x0675, 0x0530)}, /* DrayTek Vigor 530 */ | ||
3543 | {USB_DEVICE(0x06b9, 0x0120)}, /* Thomson SpeedTouch 120g */ | ||
3544 | {USB_DEVICE(0x0707, 0xee06)}, /* SMC 2862W-G */ | ||
3545 | {USB_DEVICE(0x07aa, 0x001c)}, /* Corega CG-WLUSB2GT */ | ||
3546 | @@ -82,6 +83,8 @@ static struct usb_device_id p54u_table[] = { | ||
3547 | {USB_DEVICE(0x06a9, 0x000e)}, /* Westell 802.11g USB (A90-211WG-01) */ | ||
3548 | {USB_DEVICE(0x06b9, 0x0121)}, /* Thomson SpeedTouch 121g */ | ||
3549 | {USB_DEVICE(0x0707, 0xee13)}, /* SMC 2862W-G version 2 */ | ||
3550 | + {USB_DEVICE(0x0803, 0x4310)}, /* Zoom 4410a */ | ||
3551 | + {USB_DEVICE(0x083a, 0x4503)}, /* T-Com Sinus 154 data II */ | ||
3552 | {USB_DEVICE(0x083a, 0x4521)}, /* Siemens Gigaset USB Adapter 54 version 2 */ | ||
3553 | {USB_DEVICE(0x083a, 0xc501)}, /* Zoom Wireless-G 4410 */ | ||
3554 | {USB_DEVICE(0x083a, 0xf503)}, /* Accton FD7050E ver 1010ec */ | ||
3555 | @@ -101,6 +104,7 @@ static struct usb_device_id p54u_table[] = { | ||
3556 | {USB_DEVICE(0x13B1, 0x000C)}, /* Linksys WUSB54AG */ | ||
3557 | {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */ | ||
3558 | {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ | ||
3559 | + /* {USB_DEVICE(0x15a9, 0x0002)}, * Also SparkLAN WL-682 with 3887 */ | ||
3560 | {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */ | ||
3561 | {USB_DEVICE(0x1740, 0x1000)}, /* Senao NUB-350 */ | ||
3562 | {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ | ||
3563 | diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c | ||
3564 | index aa970fc..8fa144f 100644 | ||
3565 | --- a/drivers/net/wireless/rtlwifi/usb.c | ||
3566 | +++ b/drivers/net/wireless/rtlwifi/usb.c | ||
3567 | @@ -210,17 +210,16 @@ static void _usb_writeN_sync(struct rtl_priv *rtlpriv, u32 addr, void *data, | ||
3568 | u16 index = REALTEK_USB_VENQT_CMD_IDX; | ||
3569 | int pipe = usb_sndctrlpipe(udev, 0); /* write_out */ | ||
3570 | u8 *buffer; | ||
3571 | - dma_addr_t dma_addr; | ||
3572 | |||
3573 | - wvalue = (u16)(addr&0x0000ffff); | ||
3574 | - buffer = usb_alloc_coherent(udev, (size_t)len, GFP_ATOMIC, &dma_addr); | ||
3575 | + wvalue = (u16)(addr & 0x0000ffff); | ||
3576 | + buffer = kmalloc(len, GFP_ATOMIC); | ||
3577 | if (!buffer) | ||
3578 | return; | ||
3579 | memcpy(buffer, data, len); | ||
3580 | usb_control_msg(udev, pipe, request, reqtype, wvalue, | ||
3581 | index, buffer, len, 50); | ||
3582 | |||
3583 | - usb_free_coherent(udev, (size_t)len, buffer, dma_addr); | ||
3584 | + kfree(buffer); | ||
3585 | } | ||
3586 | |||
3587 | static void _rtl_usb_io_handler_init(struct device *dev, | ||
3588 | diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h | ||
3589 | index 26ffd3e..2c113de 100644 | ||
3590 | --- a/drivers/pci/hotplug/pciehp.h | ||
3591 | +++ b/drivers/pci/hotplug/pciehp.h | ||
3592 | @@ -44,7 +44,6 @@ extern bool pciehp_poll_mode; | ||
3593 | extern int pciehp_poll_time; | ||
3594 | extern bool pciehp_debug; | ||
3595 | extern bool pciehp_force; | ||
3596 | -extern struct workqueue_struct *pciehp_wq; | ||
3597 | |||
3598 | #define dbg(format, arg...) \ | ||
3599 | do { \ | ||
3600 | @@ -78,6 +77,7 @@ struct slot { | ||
3601 | struct hotplug_slot *hotplug_slot; | ||
3602 | struct delayed_work work; /* work for button event */ | ||
3603 | struct mutex lock; | ||
3604 | + struct workqueue_struct *wq; | ||
3605 | }; | ||
3606 | |||
3607 | struct event_info { | ||
3608 | diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c | ||
3609 | index 365c6b9..9e39df9 100644 | ||
3610 | --- a/drivers/pci/hotplug/pciehp_core.c | ||
3611 | +++ b/drivers/pci/hotplug/pciehp_core.c | ||
3612 | @@ -42,7 +42,6 @@ bool pciehp_debug; | ||
3613 | bool pciehp_poll_mode; | ||
3614 | int pciehp_poll_time; | ||
3615 | bool pciehp_force; | ||
3616 | -struct workqueue_struct *pciehp_wq; | ||
3617 | |||
3618 | #define DRIVER_VERSION "0.4" | ||
3619 | #define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>" | ||
3620 | @@ -340,18 +339,13 @@ static int __init pcied_init(void) | ||
3621 | { | ||
3622 | int retval = 0; | ||
3623 | |||
3624 | - pciehp_wq = alloc_workqueue("pciehp", 0, 0); | ||
3625 | - if (!pciehp_wq) | ||
3626 | - return -ENOMEM; | ||
3627 | - | ||
3628 | pciehp_firmware_init(); | ||
3629 | retval = pcie_port_service_register(&hpdriver_portdrv); | ||
3630 | dbg("pcie_port_service_register = %d\n", retval); | ||
3631 | info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); | ||
3632 | - if (retval) { | ||
3633 | - destroy_workqueue(pciehp_wq); | ||
3634 | + if (retval) | ||
3635 | dbg("Failure to register service\n"); | ||
3636 | - } | ||
3637 | + | ||
3638 | return retval; | ||
3639 | } | ||
3640 | |||
3641 | @@ -359,7 +353,6 @@ static void __exit pcied_cleanup(void) | ||
3642 | { | ||
3643 | dbg("unload_pciehpd()\n"); | ||
3644 | pcie_port_service_unregister(&hpdriver_portdrv); | ||
3645 | - destroy_workqueue(pciehp_wq); | ||
3646 | info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n"); | ||
3647 | } | ||
3648 | |||
3649 | diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c | ||
3650 | index 27f4429..38f0186 100644 | ||
3651 | --- a/drivers/pci/hotplug/pciehp_ctrl.c | ||
3652 | +++ b/drivers/pci/hotplug/pciehp_ctrl.c | ||
3653 | @@ -49,7 +49,7 @@ static int queue_interrupt_event(struct slot *p_slot, u32 event_type) | ||
3654 | info->p_slot = p_slot; | ||
3655 | INIT_WORK(&info->work, interrupt_event_handler); | ||
3656 | |||
3657 | - queue_work(pciehp_wq, &info->work); | ||
3658 | + queue_work(p_slot->wq, &info->work); | ||
3659 | |||
3660 | return 0; | ||
3661 | } | ||
3662 | @@ -344,7 +344,7 @@ void pciehp_queue_pushbutton_work(struct work_struct *work) | ||
3663 | kfree(info); | ||
3664 | goto out; | ||
3665 | } | ||
3666 | - queue_work(pciehp_wq, &info->work); | ||
3667 | + queue_work(p_slot->wq, &info->work); | ||
3668 | out: | ||
3669 | mutex_unlock(&p_slot->lock); | ||
3670 | } | ||
3671 | @@ -377,7 +377,7 @@ static void handle_button_press_event(struct slot *p_slot) | ||
3672 | if (ATTN_LED(ctrl)) | ||
3673 | pciehp_set_attention_status(p_slot, 0); | ||
3674 | |||
3675 | - queue_delayed_work(pciehp_wq, &p_slot->work, 5*HZ); | ||
3676 | + queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ); | ||
3677 | break; | ||
3678 | case BLINKINGOFF_STATE: | ||
3679 | case BLINKINGON_STATE: | ||
3680 | @@ -439,7 +439,7 @@ static void handle_surprise_event(struct slot *p_slot) | ||
3681 | else | ||
3682 | p_slot->state = POWERON_STATE; | ||
3683 | |||
3684 | - queue_work(pciehp_wq, &info->work); | ||
3685 | + queue_work(p_slot->wq, &info->work); | ||
3686 | } | ||
3687 | |||
3688 | static void interrupt_event_handler(struct work_struct *work) | ||
3689 | diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c | ||
3690 | index 302451e..61632c5 100644 | ||
3691 | --- a/drivers/pci/hotplug/pciehp_hpc.c | ||
3692 | +++ b/drivers/pci/hotplug/pciehp_hpc.c | ||
3693 | @@ -773,23 +773,32 @@ static void pcie_shutdown_notification(struct controller *ctrl) | ||
3694 | static int pcie_init_slot(struct controller *ctrl) | ||
3695 | { | ||
3696 | struct slot *slot; | ||
3697 | + char name[32]; | ||
3698 | |||
3699 | slot = kzalloc(sizeof(*slot), GFP_KERNEL); | ||
3700 | if (!slot) | ||
3701 | return -ENOMEM; | ||
3702 | |||
3703 | + snprintf(name, sizeof(name), "pciehp-%u", PSN(ctrl)); | ||
3704 | + slot->wq = alloc_workqueue(name, 0, 0); | ||
3705 | + if (!slot->wq) | ||
3706 | + goto abort; | ||
3707 | + | ||
3708 | slot->ctrl = ctrl; | ||
3709 | mutex_init(&slot->lock); | ||
3710 | INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work); | ||
3711 | ctrl->slot = slot; | ||
3712 | return 0; | ||
3713 | +abort: | ||
3714 | + kfree(slot); | ||
3715 | + return -ENOMEM; | ||
3716 | } | ||
3717 | |||
3718 | static void pcie_cleanup_slot(struct controller *ctrl) | ||
3719 | { | ||
3720 | struct slot *slot = ctrl->slot; | ||
3721 | cancel_delayed_work(&slot->work); | ||
3722 | - flush_workqueue(pciehp_wq); | ||
3723 | + destroy_workqueue(slot->wq); | ||
3724 | kfree(slot); | ||
3725 | } | ||
3726 | |||
3727 | diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h | ||
3728 | index ca64932..1b69d95 100644 | ||
3729 | --- a/drivers/pci/hotplug/shpchp.h | ||
3730 | +++ b/drivers/pci/hotplug/shpchp.h | ||
3731 | @@ -47,7 +47,6 @@ extern bool shpchp_poll_mode; | ||
3732 | extern int shpchp_poll_time; | ||
3733 | extern bool shpchp_debug; | ||
3734 | extern struct workqueue_struct *shpchp_wq; | ||
3735 | -extern struct workqueue_struct *shpchp_ordered_wq; | ||
3736 | |||
3737 | #define dbg(format, arg...) \ | ||
3738 | do { \ | ||
3739 | diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c | ||
3740 | index b6de307..8c6d645 100644 | ||
3741 | --- a/drivers/pci/hotplug/shpchp_core.c | ||
3742 | +++ b/drivers/pci/hotplug/shpchp_core.c | ||
3743 | @@ -40,7 +40,6 @@ bool shpchp_debug; | ||
3744 | bool shpchp_poll_mode; | ||
3745 | int shpchp_poll_time; | ||
3746 | struct workqueue_struct *shpchp_wq; | ||
3747 | -struct workqueue_struct *shpchp_ordered_wq; | ||
3748 | |||
3749 | #define DRIVER_VERSION "0.4" | ||
3750 | #define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>" | ||
3751 | @@ -181,7 +180,6 @@ void cleanup_slots(struct controller *ctrl) | ||
3752 | list_del(&slot->slot_list); | ||
3753 | cancel_delayed_work(&slot->work); | ||
3754 | flush_workqueue(shpchp_wq); | ||
3755 | - flush_workqueue(shpchp_ordered_wq); | ||
3756 | pci_hp_deregister(slot->hotplug_slot); | ||
3757 | } | ||
3758 | } | ||
3759 | @@ -370,17 +368,10 @@ static int __init shpcd_init(void) | ||
3760 | if (!shpchp_wq) | ||
3761 | return -ENOMEM; | ||
3762 | |||
3763 | - shpchp_ordered_wq = alloc_ordered_workqueue("shpchp_ordered", 0); | ||
3764 | - if (!shpchp_ordered_wq) { | ||
3765 | - destroy_workqueue(shpchp_wq); | ||
3766 | - return -ENOMEM; | ||
3767 | - } | ||
3768 | - | ||
3769 | retval = pci_register_driver(&shpc_driver); | ||
3770 | dbg("%s: pci_register_driver = %d\n", __func__, retval); | ||
3771 | info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); | ||
3772 | if (retval) { | ||
3773 | - destroy_workqueue(shpchp_ordered_wq); | ||
3774 | destroy_workqueue(shpchp_wq); | ||
3775 | } | ||
3776 | return retval; | ||
3777 | @@ -390,7 +381,6 @@ static void __exit shpcd_cleanup(void) | ||
3778 | { | ||
3779 | dbg("unload_shpchpd()\n"); | ||
3780 | pci_unregister_driver(&shpc_driver); | ||
3781 | - destroy_workqueue(shpchp_ordered_wq); | ||
3782 | destroy_workqueue(shpchp_wq); | ||
3783 | info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n"); | ||
3784 | } | ||
3785 | diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c | ||
3786 | index f9b5a52..fd2cae9 100644 | ||
3787 | --- a/drivers/pci/hotplug/shpchp_ctrl.c | ||
3788 | +++ b/drivers/pci/hotplug/shpchp_ctrl.c | ||
3789 | @@ -453,7 +453,7 @@ void shpchp_queue_pushbutton_work(struct work_struct *work) | ||
3790 | kfree(info); | ||
3791 | goto out; | ||
3792 | } | ||
3793 | - queue_work(shpchp_ordered_wq, &info->work); | ||
3794 | + queue_work(shpchp_wq, &info->work); | ||
3795 | out: | ||
3796 | mutex_unlock(&p_slot->lock); | ||
3797 | } | ||
3798 | diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c | ||
3799 | index 1b7d05d..b0c92a5 100644 | ||
3800 | --- a/drivers/pci/pcie/aer/aerdrv_core.c | ||
3801 | +++ b/drivers/pci/pcie/aer/aerdrv_core.c | ||
3802 | @@ -649,6 +649,7 @@ static void aer_recover_work_func(struct work_struct *work) | ||
3803 | continue; | ||
3804 | } | ||
3805 | do_recovery(pdev, entry.severity); | ||
3806 | + pci_dev_put(pdev); | ||
3807 | } | ||
3808 | } | ||
3809 | #endif | ||
3810 | diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c | ||
3811 | index b500840..474f22f 100644 | ||
3812 | --- a/drivers/pci/pcie/aspm.c | ||
3813 | +++ b/drivers/pci/pcie/aspm.c | ||
3814 | @@ -798,6 +798,9 @@ void pcie_clear_aspm(struct pci_bus *bus) | ||
3815 | { | ||
3816 | struct pci_dev *child; | ||
3817 | |||
3818 | + if (aspm_force) | ||
3819 | + return; | ||
3820 | + | ||
3821 | /* | ||
3822 | * Clear any ASPM setup that the firmware has carried out on this bus | ||
3823 | */ | ||
3824 | diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c | ||
3825 | index 5155317..161e7f0 100644 | ||
3826 | --- a/drivers/pci/quirks.c | ||
3827 | +++ b/drivers/pci/quirks.c | ||
3828 | @@ -2686,7 +2686,7 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev) | ||
3829 | if (PCI_FUNC(dev->devfn)) | ||
3830 | return; | ||
3831 | /* | ||
3832 | - * RICOH 0xe823 SD/MMC card reader fails to recognize | ||
3833 | + * RICOH 0xe822 and 0xe823 SD/MMC card readers fail to recognize | ||
3834 | * certain types of SD/MMC cards. Lowering the SD base | ||
3835 | * clock frequency from 200Mhz to 50Mhz fixes this issue. | ||
3836 | * | ||
3837 | @@ -2697,7 +2697,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev) | ||
3838 | * 0xf9 - Key register for 0x150 | ||
3839 | * 0xfc - key register for 0xe1 | ||
3840 | */ | ||
3841 | - if (dev->device == PCI_DEVICE_ID_RICOH_R5CE823) { | ||
3842 | + if (dev->device == PCI_DEVICE_ID_RICOH_R5CE822 || | ||
3843 | + dev->device == PCI_DEVICE_ID_RICOH_R5CE823) { | ||
3844 | pci_write_config_byte(dev, 0xf9, 0xfc); | ||
3845 | pci_write_config_byte(dev, 0x150, 0x10); | ||
3846 | pci_write_config_byte(dev, 0xf9, 0x00); | ||
3847 | @@ -2724,6 +2725,8 @@ static void ricoh_mmc_fixup_r5c832(struct pci_dev *dev) | ||
3848 | } | ||
3849 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); | ||
3850 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5C832, ricoh_mmc_fixup_r5c832); | ||
3851 | +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE822, ricoh_mmc_fixup_r5c832); | ||
3852 | +DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE822, ricoh_mmc_fixup_r5c832); | ||
3853 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832); | ||
3854 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_mmc_fixup_r5c832); | ||
3855 | #endif /*CONFIG_MMC_RICOH_MMC*/ | ||
3856 | diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c | ||
3857 | index dd90d15..71623a2 100644 | ||
3858 | --- a/drivers/platform/x86/samsung-laptop.c | ||
3859 | +++ b/drivers/platform/x86/samsung-laptop.c | ||
3860 | @@ -1523,6 +1523,16 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = { | ||
3861 | }, | ||
3862 | .driver_data = &samsung_broken_acpi_video, | ||
3863 | }, | ||
3864 | + { | ||
3865 | + .callback = samsung_dmi_matched, | ||
3866 | + .ident = "N250P", | ||
3867 | + .matches = { | ||
3868 | + DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), | ||
3869 | + DMI_MATCH(DMI_PRODUCT_NAME, "N250P"), | ||
3870 | + DMI_MATCH(DMI_BOARD_NAME, "N250P"), | ||
3871 | + }, | ||
3872 | + .driver_data = &samsung_broken_acpi_video, | ||
3873 | + }, | ||
3874 | { }, | ||
3875 | }; | ||
3876 | MODULE_DEVICE_TABLE(dmi, samsung_dmi_table); | ||
3877 | diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c | ||
3878 | index e49871d..3c5c353 100644 | ||
3879 | --- a/drivers/pnp/pnpacpi/core.c | ||
3880 | +++ b/drivers/pnp/pnpacpi/core.c | ||
3881 | @@ -58,7 +58,7 @@ static inline int __init is_exclusive_device(struct acpi_device *dev) | ||
3882 | if (!(('0' <= (c) && (c) <= '9') || ('A' <= (c) && (c) <= 'F'))) \ | ||
3883 | return 0 | ||
3884 | #define TEST_ALPHA(c) \ | ||
3885 | - if (!('@' <= (c) || (c) <= 'Z')) \ | ||
3886 | + if (!('A' <= (c) && (c) <= 'Z')) \ | ||
3887 | return 0 | ||
3888 | static int __init ispnpidacpi(const char *id) | ||
3889 | { | ||
3890 | diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c | ||
3891 | index 7413885..d4b9b1e 100644 | ||
3892 | --- a/drivers/regulator/wm831x-dcdc.c | ||
3893 | +++ b/drivers/regulator/wm831x-dcdc.c | ||
3894 | @@ -290,7 +290,7 @@ static int wm831x_buckv_set_voltage_sel(struct regulator_dev *rdev, | ||
3895 | if (vsel > dcdc->dvs_vsel) { | ||
3896 | ret = wm831x_set_bits(wm831x, dvs_reg, | ||
3897 | WM831X_DC1_DVS_VSEL_MASK, | ||
3898 | - dcdc->dvs_vsel); | ||
3899 | + vsel); | ||
3900 | if (ret == 0) | ||
3901 | dcdc->dvs_vsel = vsel; | ||
3902 | else | ||
3903 | diff --git a/drivers/rtc/rtc-vt8500.c b/drivers/rtc/rtc-vt8500.c | ||
3904 | index 9e94fb1..44878da 100644 | ||
3905 | --- a/drivers/rtc/rtc-vt8500.c | ||
3906 | +++ b/drivers/rtc/rtc-vt8500.c | ||
3907 | @@ -69,7 +69,7 @@ | ||
3908 | | ALARM_SEC_BIT) | ||
3909 | |||
3910 | #define VT8500_RTC_CR_ENABLE (1 << 0) /* Enable RTC */ | ||
3911 | -#define VT8500_RTC_CR_24H (1 << 1) /* 24h time format */ | ||
3912 | +#define VT8500_RTC_CR_12H (1 << 1) /* 12h time format */ | ||
3913 | #define VT8500_RTC_CR_SM_ENABLE (1 << 2) /* Enable periodic irqs */ | ||
3914 | #define VT8500_RTC_CR_SM_SEC (1 << 3) /* 0: 1Hz/60, 1: 1Hz */ | ||
3915 | #define VT8500_RTC_CR_CALIB (1 << 4) /* Enable calibration */ | ||
3916 | @@ -118,7 +118,7 @@ static int vt8500_rtc_read_time(struct device *dev, struct rtc_time *tm) | ||
3917 | tm->tm_min = bcd2bin((time & TIME_MIN_MASK) >> TIME_MIN_S); | ||
3918 | tm->tm_hour = bcd2bin((time & TIME_HOUR_MASK) >> TIME_HOUR_S); | ||
3919 | tm->tm_mday = bcd2bin(date & DATE_DAY_MASK); | ||
3920 | - tm->tm_mon = bcd2bin((date & DATE_MONTH_MASK) >> DATE_MONTH_S); | ||
3921 | + tm->tm_mon = bcd2bin((date & DATE_MONTH_MASK) >> DATE_MONTH_S) - 1; | ||
3922 | tm->tm_year = bcd2bin((date & DATE_YEAR_MASK) >> DATE_YEAR_S) | ||
3923 | + ((date >> DATE_CENTURY_S) & 1 ? 200 : 100); | ||
3924 | tm->tm_wday = (time & TIME_DOW_MASK) >> TIME_DOW_S; | ||
3925 | @@ -137,8 +137,9 @@ static int vt8500_rtc_set_time(struct device *dev, struct rtc_time *tm) | ||
3926 | } | ||
3927 | |||
3928 | writel((bin2bcd(tm->tm_year - 100) << DATE_YEAR_S) | ||
3929 | - | (bin2bcd(tm->tm_mon) << DATE_MONTH_S) | ||
3930 | - | (bin2bcd(tm->tm_mday)), | ||
3931 | + | (bin2bcd(tm->tm_mon + 1) << DATE_MONTH_S) | ||
3932 | + | (bin2bcd(tm->tm_mday)) | ||
3933 | + | ((tm->tm_year >= 200) << DATE_CENTURY_S), | ||
3934 | vt8500_rtc->regbase + VT8500_RTC_DS); | ||
3935 | writel((bin2bcd(tm->tm_wday) << TIME_DOW_S) | ||
3936 | | (bin2bcd(tm->tm_hour) << TIME_HOUR_S) | ||
3937 | @@ -248,7 +249,7 @@ static int __devinit vt8500_rtc_probe(struct platform_device *pdev) | ||
3938 | } | ||
3939 | |||
3940 | /* Enable RTC and set it to 24-hour mode */ | ||
3941 | - writel(VT8500_RTC_CR_ENABLE | VT8500_RTC_CR_24H, | ||
3942 | + writel(VT8500_RTC_CR_ENABLE, | ||
3943 | vt8500_rtc->regbase + VT8500_RTC_CR); | ||
3944 | |||
3945 | vt8500_rtc->rtc = rtc_device_register("vt8500-rtc", &pdev->dev, | ||
3946 | diff --git a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c | ||
3947 | index 368368f..908d287 100644 | ||
3948 | --- a/drivers/s390/cio/device_pgid.c | ||
3949 | +++ b/drivers/s390/cio/device_pgid.c | ||
3950 | @@ -234,7 +234,7 @@ static int pgid_cmp(struct pgid *p1, struct pgid *p2) | ||
3951 | * Determine pathgroup state from PGID data. | ||
3952 | */ | ||
3953 | static void pgid_analyze(struct ccw_device *cdev, struct pgid **p, | ||
3954 | - int *mismatch, int *reserved, u8 *reset) | ||
3955 | + int *mismatch, u8 *reserved, u8 *reset) | ||
3956 | { | ||
3957 | struct pgid *pgid = &cdev->private->pgid[0]; | ||
3958 | struct pgid *first = NULL; | ||
3959 | @@ -248,7 +248,7 @@ static void pgid_analyze(struct ccw_device *cdev, struct pgid **p, | ||
3960 | if ((cdev->private->pgid_valid_mask & lpm) == 0) | ||
3961 | continue; | ||
3962 | if (pgid->inf.ps.state2 == SNID_STATE2_RESVD_ELSE) | ||
3963 | - *reserved = 1; | ||
3964 | + *reserved |= lpm; | ||
3965 | if (pgid_is_reset(pgid)) { | ||
3966 | *reset |= lpm; | ||
3967 | continue; | ||
3968 | @@ -316,14 +316,14 @@ static void snid_done(struct ccw_device *cdev, int rc) | ||
3969 | struct subchannel *sch = to_subchannel(cdev->dev.parent); | ||
3970 | struct pgid *pgid; | ||
3971 | int mismatch = 0; | ||
3972 | - int reserved = 0; | ||
3973 | + u8 reserved = 0; | ||
3974 | u8 reset = 0; | ||
3975 | u8 donepm; | ||
3976 | |||
3977 | if (rc) | ||
3978 | goto out; | ||
3979 | pgid_analyze(cdev, &pgid, &mismatch, &reserved, &reset); | ||
3980 | - if (reserved) | ||
3981 | + if (reserved == cdev->private->pgid_valid_mask) | ||
3982 | rc = -EUSERS; | ||
3983 | else if (mismatch) | ||
3984 | rc = -EOPNOTSUPP; | ||
3985 | @@ -336,7 +336,7 @@ static void snid_done(struct ccw_device *cdev, int rc) | ||
3986 | } | ||
3987 | out: | ||
3988 | CIO_MSG_EVENT(2, "snid: device 0.%x.%04x: rc=%d pvm=%02x vpm=%02x " | ||
3989 | - "todo=%02x mism=%d rsvd=%d reset=%02x\n", id->ssid, | ||
3990 | + "todo=%02x mism=%d rsvd=%02x reset=%02x\n", id->ssid, | ||
3991 | id->devno, rc, cdev->private->pgid_valid_mask, sch->vpm, | ||
3992 | cdev->private->pgid_todo_mask, mismatch, reserved, reset); | ||
3993 | switch (rc) { | ||
3994 | diff --git a/drivers/scsi/mvsas/mv_94xx.h b/drivers/scsi/mvsas/mv_94xx.h | ||
3995 | index 8f7eb4f..487aa6f 100644 | ||
3996 | --- a/drivers/scsi/mvsas/mv_94xx.h | ||
3997 | +++ b/drivers/scsi/mvsas/mv_94xx.h | ||
3998 | @@ -258,21 +258,11 @@ enum sas_sata_phy_regs { | ||
3999 | #define SPI_ADDR_VLD_94XX (1U << 1) | ||
4000 | #define SPI_CTRL_SpiStart_94XX (1U << 0) | ||
4001 | |||
4002 | -#define mv_ffc(x) ffz(x) | ||
4003 | - | ||
4004 | static inline int | ||
4005 | mv_ffc64(u64 v) | ||
4006 | { | ||
4007 | - int i; | ||
4008 | - i = mv_ffc((u32)v); | ||
4009 | - if (i >= 0) | ||
4010 | - return i; | ||
4011 | - i = mv_ffc((u32)(v>>32)); | ||
4012 | - | ||
4013 | - if (i != 0) | ||
4014 | - return 32 + i; | ||
4015 | - | ||
4016 | - return -1; | ||
4017 | + u64 x = ~v; | ||
4018 | + return x ? __ffs64(x) : -1; | ||
4019 | } | ||
4020 | |||
4021 | #define r_reg_set_enable(i) \ | ||
4022 | diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c | ||
4023 | index 4539d59..a3776d6 100644 | ||
4024 | --- a/drivers/scsi/mvsas/mv_sas.c | ||
4025 | +++ b/drivers/scsi/mvsas/mv_sas.c | ||
4026 | @@ -1629,7 +1629,7 @@ int mvs_abort_task(struct sas_task *task) | ||
4027 | mv_dprintk("mvs_abort_task() mvi=%p task=%p " | ||
4028 | "slot=%p slot_idx=x%x\n", | ||
4029 | mvi, task, slot, slot_idx); | ||
4030 | - mvs_tmf_timedout((unsigned long)task); | ||
4031 | + task->task_state_flags |= SAS_TASK_STATE_ABORTED; | ||
4032 | mvs_slot_task_free(mvi, task, slot, slot_idx); | ||
4033 | rc = TMF_RESP_FUNC_COMPLETE; | ||
4034 | goto out; | ||
4035 | diff --git a/drivers/scsi/mvsas/mv_sas.h b/drivers/scsi/mvsas/mv_sas.h | ||
4036 | index c04a4f5..da24955 100644 | ||
4037 | --- a/drivers/scsi/mvsas/mv_sas.h | ||
4038 | +++ b/drivers/scsi/mvsas/mv_sas.h | ||
4039 | @@ -69,7 +69,7 @@ extern struct kmem_cache *mvs_task_list_cache; | ||
4040 | #define DEV_IS_EXPANDER(type) \ | ||
4041 | ((type == EDGE_DEV) || (type == FANOUT_DEV)) | ||
4042 | |||
4043 | -#define bit(n) ((u32)1 << n) | ||
4044 | +#define bit(n) ((u64)1 << n) | ||
4045 | |||
4046 | #define for_each_phy(__lseq_mask, __mc, __lseq) \ | ||
4047 | for ((__mc) = (__lseq_mask), (__lseq) = 0; \ | ||
4048 | diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c | ||
4049 | index fb8cd38..0076210 100644 | ||
4050 | --- a/drivers/scsi/qla2xxx/qla_os.c | ||
4051 | +++ b/drivers/scsi/qla2xxx/qla_os.c | ||
4052 | @@ -3801,9 +3801,9 @@ qla2x00_do_dpc(void *data) | ||
4053 | "ISP abort end.\n"); | ||
4054 | } | ||
4055 | |||
4056 | - if (test_bit(FCPORT_UPDATE_NEEDED, &base_vha->dpc_flags)) { | ||
4057 | + if (test_and_clear_bit(FCPORT_UPDATE_NEEDED, | ||
4058 | + &base_vha->dpc_flags)) { | ||
4059 | qla2x00_update_fcports(base_vha); | ||
4060 | - clear_bit(FCPORT_UPDATE_NEEDED, &base_vha->dpc_flags); | ||
4061 | } | ||
4062 | |||
4063 | if (test_bit(SCR_PENDING, &base_vha->dpc_flags)) { | ||
4064 | diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c | ||
4065 | index ce5224c..931a7d9 100644 | ||
4066 | --- a/drivers/scsi/scsi_sysfs.c | ||
4067 | +++ b/drivers/scsi/scsi_sysfs.c | ||
4068 | @@ -247,11 +247,11 @@ show_shost_active_mode(struct device *dev, | ||
4069 | |||
4070 | static DEVICE_ATTR(active_mode, S_IRUGO | S_IWUSR, show_shost_active_mode, NULL); | ||
4071 | |||
4072 | -static int check_reset_type(char *str) | ||
4073 | +static int check_reset_type(const char *str) | ||
4074 | { | ||
4075 | - if (strncmp(str, "adapter", 10) == 0) | ||
4076 | + if (sysfs_streq(str, "adapter")) | ||
4077 | return SCSI_ADAPTER_RESET; | ||
4078 | - else if (strncmp(str, "firmware", 10) == 0) | ||
4079 | + else if (sysfs_streq(str, "firmware")) | ||
4080 | return SCSI_FIRMWARE_RESET; | ||
4081 | else | ||
4082 | return 0; | ||
4083 | @@ -264,12 +264,9 @@ store_host_reset(struct device *dev, struct device_attribute *attr, | ||
4084 | struct Scsi_Host *shost = class_to_shost(dev); | ||
4085 | struct scsi_host_template *sht = shost->hostt; | ||
4086 | int ret = -EINVAL; | ||
4087 | - char str[10]; | ||
4088 | int type; | ||
4089 | |||
4090 | - sscanf(buf, "%s", str); | ||
4091 | - type = check_reset_type(str); | ||
4092 | - | ||
4093 | + type = check_reset_type(buf); | ||
4094 | if (!type) | ||
4095 | goto exit_store_host_reset; | ||
4096 | |||
4097 | diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c | ||
4098 | index 4df73e5..8afedd6 100644 | ||
4099 | --- a/drivers/scsi/sd.c | ||
4100 | +++ b/drivers/scsi/sd.c | ||
4101 | @@ -2926,10 +2926,6 @@ static int __init init_sd(void) | ||
4102 | if (err) | ||
4103 | goto err_out; | ||
4104 | |||
4105 | - err = scsi_register_driver(&sd_template.gendrv); | ||
4106 | - if (err) | ||
4107 | - goto err_out_class; | ||
4108 | - | ||
4109 | sd_cdb_cache = kmem_cache_create("sd_ext_cdb", SD_EXT_CDB_SIZE, | ||
4110 | 0, 0, NULL); | ||
4111 | if (!sd_cdb_cache) { | ||
4112 | @@ -2943,8 +2939,15 @@ static int __init init_sd(void) | ||
4113 | goto err_out_cache; | ||
4114 | } | ||
4115 | |||
4116 | + err = scsi_register_driver(&sd_template.gendrv); | ||
4117 | + if (err) | ||
4118 | + goto err_out_driver; | ||
4119 | + | ||
4120 | return 0; | ||
4121 | |||
4122 | +err_out_driver: | ||
4123 | + mempool_destroy(sd_cdb_pool); | ||
4124 | + | ||
4125 | err_out_cache: | ||
4126 | kmem_cache_destroy(sd_cdb_cache); | ||
4127 | |||
4128 | @@ -2967,10 +2970,10 @@ static void __exit exit_sd(void) | ||
4129 | |||
4130 | SCSI_LOG_HLQUEUE(3, printk("exit_sd: exiting sd driver\n")); | ||
4131 | |||
4132 | + scsi_unregister_driver(&sd_template.gendrv); | ||
4133 | mempool_destroy(sd_cdb_pool); | ||
4134 | kmem_cache_destroy(sd_cdb_cache); | ||
4135 | |||
4136 | - scsi_unregister_driver(&sd_template.gendrv); | ||
4137 | class_unregister(&sd_disk_class); | ||
4138 | |||
4139 | for (i = 0; i < SD_MAJORS; i++) | ||
4140 | diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig | ||
4141 | index 6cee785..2701546 100644 | ||
4142 | --- a/drivers/staging/comedi/Kconfig | ||
4143 | +++ b/drivers/staging/comedi/Kconfig | ||
4144 | @@ -444,6 +444,7 @@ config COMEDI_ADQ12B | ||
4145 | |||
4146 | config COMEDI_NI_AT_A2150 | ||
4147 | tristate "NI AT-A2150 ISA card support" | ||
4148 | + select COMEDI_FC | ||
4149 | depends on VIRT_TO_BUS | ||
4150 | ---help--- | ||
4151 | Enable support for National Instruments AT-A2150 cards | ||
4152 | diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c | ||
4153 | index 41dea18..260441c 100644 | ||
4154 | --- a/drivers/staging/comedi/comedi_fops.c | ||
4155 | +++ b/drivers/staging/comedi/comedi_fops.c | ||
4156 | @@ -1547,6 +1547,9 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd, | ||
4157 | if (cmd == COMEDI_DEVCONFIG) { | ||
4158 | rc = do_devconfig_ioctl(dev, | ||
4159 | (struct comedi_devconfig __user *)arg); | ||
4160 | + if (rc == 0) | ||
4161 | + /* Evade comedi_auto_unconfig(). */ | ||
4162 | + dev_file_info->hardware_device = NULL; | ||
4163 | goto done; | ||
4164 | } | ||
4165 | |||
4166 | diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c | ||
4167 | index 523a809..e38bd64 100644 | ||
4168 | --- a/drivers/staging/comedi/drivers/comedi_test.c | ||
4169 | +++ b/drivers/staging/comedi/drivers/comedi_test.c | ||
4170 | @@ -396,7 +396,7 @@ static int waveform_ai_cancel(struct comedi_device *dev, | ||
4171 | struct comedi_subdevice *s) | ||
4172 | { | ||
4173 | devpriv->timer_running = 0; | ||
4174 | - del_timer(&devpriv->timer); | ||
4175 | + del_timer_sync(&devpriv->timer); | ||
4176 | return 0; | ||
4177 | } | ||
4178 | |||
4179 | diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c | ||
4180 | index 89f4d43..af5007c 100644 | ||
4181 | --- a/drivers/staging/comedi/drivers/ni_pcimio.c | ||
4182 | +++ b/drivers/staging/comedi/drivers/ni_pcimio.c | ||
4183 | @@ -963,7 +963,7 @@ static const struct ni_board_struct ni_boards[] = { | ||
4184 | .ao_range_table = &range_ni_M_625x_ao, | ||
4185 | .reg_type = ni_reg_625x, | ||
4186 | .ao_unipolar = 0, | ||
4187 | - .ao_speed = 357, | ||
4188 | + .ao_speed = 350, | ||
4189 | .num_p0_dio_channels = 8, | ||
4190 | .caldac = {caldac_none}, | ||
4191 | .has_8255 = 0, | ||
4192 | @@ -982,7 +982,7 @@ static const struct ni_board_struct ni_boards[] = { | ||
4193 | .ao_range_table = &range_ni_M_625x_ao, | ||
4194 | .reg_type = ni_reg_625x, | ||
4195 | .ao_unipolar = 0, | ||
4196 | - .ao_speed = 357, | ||
4197 | + .ao_speed = 350, | ||
4198 | .num_p0_dio_channels = 8, | ||
4199 | .caldac = {caldac_none}, | ||
4200 | .has_8255 = 0, | ||
4201 | @@ -1001,7 +1001,7 @@ static const struct ni_board_struct ni_boards[] = { | ||
4202 | .ao_range_table = &range_ni_M_625x_ao, | ||
4203 | .reg_type = ni_reg_625x, | ||
4204 | .ao_unipolar = 0, | ||
4205 | - .ao_speed = 357, | ||
4206 | + .ao_speed = 350, | ||
4207 | .num_p0_dio_channels = 8, | ||
4208 | .caldac = {caldac_none}, | ||
4209 | .has_8255 = 0, | ||
4210 | @@ -1037,7 +1037,7 @@ static const struct ni_board_struct ni_boards[] = { | ||
4211 | .ao_range_table = &range_ni_M_625x_ao, | ||
4212 | .reg_type = ni_reg_625x, | ||
4213 | .ao_unipolar = 0, | ||
4214 | - .ao_speed = 357, | ||
4215 | + .ao_speed = 350, | ||
4216 | .num_p0_dio_channels = 32, | ||
4217 | .caldac = {caldac_none}, | ||
4218 | .has_8255 = 0, | ||
4219 | @@ -1056,7 +1056,7 @@ static const struct ni_board_struct ni_boards[] = { | ||
4220 | .ao_range_table = &range_ni_M_625x_ao, | ||
4221 | .reg_type = ni_reg_625x, | ||
4222 | .ao_unipolar = 0, | ||
4223 | - .ao_speed = 357, | ||
4224 | + .ao_speed = 350, | ||
4225 | .num_p0_dio_channels = 32, | ||
4226 | .caldac = {caldac_none}, | ||
4227 | .has_8255 = 0, | ||
4228 | @@ -1092,7 +1092,7 @@ static const struct ni_board_struct ni_boards[] = { | ||
4229 | .ao_range_table = &range_ni_M_628x_ao, | ||
4230 | .reg_type = ni_reg_628x, | ||
4231 | .ao_unipolar = 1, | ||
4232 | - .ao_speed = 357, | ||
4233 | + .ao_speed = 350, | ||
4234 | .num_p0_dio_channels = 8, | ||
4235 | .caldac = {caldac_none}, | ||
4236 | .has_8255 = 0, | ||
4237 | @@ -1111,7 +1111,7 @@ static const struct ni_board_struct ni_boards[] = { | ||
4238 | .ao_range_table = &range_ni_M_628x_ao, | ||
4239 | .reg_type = ni_reg_628x, | ||
4240 | .ao_unipolar = 1, | ||
4241 | - .ao_speed = 357, | ||
4242 | + .ao_speed = 350, | ||
4243 | .num_p0_dio_channels = 8, | ||
4244 | .caldac = {caldac_none}, | ||
4245 | .has_8255 = 0, | ||
4246 | @@ -1147,7 +1147,7 @@ static const struct ni_board_struct ni_boards[] = { | ||
4247 | .ao_range_table = &range_ni_M_628x_ao, | ||
4248 | .reg_type = ni_reg_628x, | ||
4249 | .ao_unipolar = 1, | ||
4250 | - .ao_speed = 357, | ||
4251 | + .ao_speed = 350, | ||
4252 | .num_p0_dio_channels = 32, | ||
4253 | .caldac = {caldac_none}, | ||
4254 | .has_8255 = 0, | ||
4255 | diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c | ||
4256 | index c758c40..ad53781 100644 | ||
4257 | --- a/drivers/staging/rtl8712/usb_intf.c | ||
4258 | +++ b/drivers/staging/rtl8712/usb_intf.c | ||
4259 | @@ -64,6 +64,8 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = { | ||
4260 | {USB_DEVICE(0x0B05, 0x1791)}, /* 11n mode disable */ | ||
4261 | /* Belkin */ | ||
4262 | {USB_DEVICE(0x050D, 0x945A)}, | ||
4263 | + /* ISY IWL - Belkin clone */ | ||
4264 | + {USB_DEVICE(0x050D, 0x11F1)}, | ||
4265 | /* Corega */ | ||
4266 | {USB_DEVICE(0x07AA, 0x0047)}, | ||
4267 | /* D-Link */ | ||
4268 | diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c | ||
4269 | index df95337..7616f05 100644 | ||
4270 | --- a/drivers/staging/speakup/synth.c | ||
4271 | +++ b/drivers/staging/speakup/synth.c | ||
4272 | @@ -342,7 +342,7 @@ int synth_init(char *synth_name) | ||
4273 | |||
4274 | mutex_lock(&spk_mutex); | ||
4275 | /* First, check if we already have it loaded. */ | ||
4276 | - for (i = 0; synths[i] != NULL && i < MAXSYNTHS; i++) | ||
4277 | + for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++) | ||
4278 | if (strcmp(synths[i]->name, synth_name) == 0) | ||
4279 | synth = synths[i]; | ||
4280 | |||
4281 | @@ -423,7 +423,7 @@ int synth_add(struct spk_synth *in_synth) | ||
4282 | int i; | ||
4283 | int status = 0; | ||
4284 | mutex_lock(&spk_mutex); | ||
4285 | - for (i = 0; synths[i] != NULL && i < MAXSYNTHS; i++) | ||
4286 | + for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++) | ||
4287 | /* synth_remove() is responsible for rotating the array down */ | ||
4288 | if (in_synth == synths[i]) { | ||
4289 | mutex_unlock(&spk_mutex); | ||
4290 | diff --git a/drivers/staging/vt6656/bssdb.h b/drivers/staging/vt6656/bssdb.h | ||
4291 | index 6b2ec39..806cbf7 100644 | ||
4292 | --- a/drivers/staging/vt6656/bssdb.h | ||
4293 | +++ b/drivers/staging/vt6656/bssdb.h | ||
4294 | @@ -90,7 +90,6 @@ typedef struct tagSRSNCapObject { | ||
4295 | } SRSNCapObject, *PSRSNCapObject; | ||
4296 | |||
4297 | // BSS info(AP) | ||
4298 | -#pragma pack(1) | ||
4299 | typedef struct tagKnownBSS { | ||
4300 | // BSS info | ||
4301 | BOOL bActive; | ||
4302 | diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c | ||
4303 | index 3aa895e..a510b29 100644 | ||
4304 | --- a/drivers/staging/vt6656/dpc.c | ||
4305 | +++ b/drivers/staging/vt6656/dpc.c | ||
4306 | @@ -1238,7 +1238,7 @@ static BOOL s_bHandleRxEncryption ( | ||
4307 | |||
4308 | PayloadLen -= (WLAN_HDR_ADDR3_LEN + 8 + 4); // 24 is 802.11 header, 8 is IV&ExtIV, 4 is crc | ||
4309 | *pdwRxTSC47_16 = cpu_to_le32(*(PDWORD)(pbyIV + 4)); | ||
4310 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %lx\n",*pdwRxTSC47_16); | ||
4311 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %x\n", *pdwRxTSC47_16); | ||
4312 | if (byDecMode == KEY_CTL_TKIP) { | ||
4313 | *pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV+2), *pbyIV)); | ||
4314 | } else { | ||
4315 | @@ -1349,7 +1349,7 @@ static BOOL s_bHostWepRxEncryption ( | ||
4316 | |||
4317 | PayloadLen -= (WLAN_HDR_ADDR3_LEN + 8 + 4); // 24 is 802.11 header, 8 is IV&ExtIV, 4 is crc | ||
4318 | *pdwRxTSC47_16 = cpu_to_le32(*(PDWORD)(pbyIV + 4)); | ||
4319 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %lx\n",*pdwRxTSC47_16); | ||
4320 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"ExtIV: %x\n", *pdwRxTSC47_16); | ||
4321 | |||
4322 | if (byDecMode == KEY_CTL_TKIP) { | ||
4323 | *pwRxTSC15_0 = cpu_to_le16(MAKEWORD(*(pbyIV+2), *pbyIV)); | ||
4324 | diff --git a/drivers/staging/vt6656/int.h b/drivers/staging/vt6656/int.h | ||
4325 | index 3734e2c..91ceb77 100644 | ||
4326 | --- a/drivers/staging/vt6656/int.h | ||
4327 | +++ b/drivers/staging/vt6656/int.h | ||
4328 | @@ -34,7 +34,6 @@ | ||
4329 | #include "device.h" | ||
4330 | |||
4331 | /*--------------------- Export Definitions -------------------------*/ | ||
4332 | -#pragma pack(1) | ||
4333 | typedef struct tagSINTData { | ||
4334 | BYTE byTSR0; | ||
4335 | BYTE byPkt0; | ||
4336 | diff --git a/drivers/staging/vt6656/iocmd.h b/drivers/staging/vt6656/iocmd.h | ||
4337 | index 22710ce..ae6e2d2 100644 | ||
4338 | --- a/drivers/staging/vt6656/iocmd.h | ||
4339 | +++ b/drivers/staging/vt6656/iocmd.h | ||
4340 | @@ -95,13 +95,12 @@ typedef enum tagWZONETYPE { | ||
4341 | // Ioctl interface structure | ||
4342 | // Command structure | ||
4343 | // | ||
4344 | -#pragma pack(1) | ||
4345 | typedef struct tagSCmdRequest { | ||
4346 | u8 name[16]; | ||
4347 | void *data; | ||
4348 | u16 wResult; | ||
4349 | u16 wCmdCode; | ||
4350 | -} SCmdRequest, *PSCmdRequest; | ||
4351 | +} __packed SCmdRequest, *PSCmdRequest; | ||
4352 | |||
4353 | // | ||
4354 | // Scan | ||
4355 | @@ -111,7 +110,7 @@ typedef struct tagSCmdScan { | ||
4356 | |||
4357 | u8 ssid[SSID_MAXLEN + 2]; | ||
4358 | |||
4359 | -} SCmdScan, *PSCmdScan; | ||
4360 | +} __packed SCmdScan, *PSCmdScan; | ||
4361 | |||
4362 | // | ||
4363 | // BSS Join | ||
4364 | @@ -126,7 +125,7 @@ typedef struct tagSCmdBSSJoin { | ||
4365 | BOOL bPSEnable; | ||
4366 | BOOL bShareKeyAuth; | ||
4367 | |||
4368 | -} SCmdBSSJoin, *PSCmdBSSJoin; | ||
4369 | +} __packed SCmdBSSJoin, *PSCmdBSSJoin; | ||
4370 | |||
4371 | // | ||
4372 | // Zonetype Setting | ||
4373 | @@ -137,7 +136,7 @@ typedef struct tagSCmdZoneTypeSet { | ||
4374 | BOOL bWrite; | ||
4375 | WZONETYPE ZoneType; | ||
4376 | |||
4377 | -} SCmdZoneTypeSet, *PSCmdZoneTypeSet; | ||
4378 | +} __packed SCmdZoneTypeSet, *PSCmdZoneTypeSet; | ||
4379 | |||
4380 | typedef struct tagSWPAResult { | ||
4381 | char ifname[100]; | ||
4382 | @@ -145,7 +144,7 @@ typedef struct tagSWPAResult { | ||
4383 | u8 key_mgmt; | ||
4384 | u8 eap_type; | ||
4385 | BOOL authenticated; | ||
4386 | -} SWPAResult, *PSWPAResult; | ||
4387 | +} __packed SWPAResult, *PSWPAResult; | ||
4388 | |||
4389 | typedef struct tagSCmdStartAP { | ||
4390 | |||
4391 | @@ -157,7 +156,7 @@ typedef struct tagSCmdStartAP { | ||
4392 | BOOL bShareKeyAuth; | ||
4393 | u8 byBasicRate; | ||
4394 | |||
4395 | -} SCmdStartAP, *PSCmdStartAP; | ||
4396 | +} __packed SCmdStartAP, *PSCmdStartAP; | ||
4397 | |||
4398 | typedef struct tagSCmdSetWEP { | ||
4399 | |||
4400 | @@ -167,7 +166,7 @@ typedef struct tagSCmdSetWEP { | ||
4401 | BOOL bWepKeyAvailable[WEP_NKEYS]; | ||
4402 | u32 auWepKeyLength[WEP_NKEYS]; | ||
4403 | |||
4404 | -} SCmdSetWEP, *PSCmdSetWEP; | ||
4405 | +} __packed SCmdSetWEP, *PSCmdSetWEP; | ||
4406 | |||
4407 | typedef struct tagSBSSIDItem { | ||
4408 | |||
4409 | @@ -180,14 +179,14 @@ typedef struct tagSBSSIDItem { | ||
4410 | BOOL bWEPOn; | ||
4411 | u32 uRSSI; | ||
4412 | |||
4413 | -} SBSSIDItem; | ||
4414 | +} __packed SBSSIDItem; | ||
4415 | |||
4416 | |||
4417 | typedef struct tagSBSSIDList { | ||
4418 | |||
4419 | u32 uItem; | ||
4420 | SBSSIDItem sBSSIDList[0]; | ||
4421 | -} SBSSIDList, *PSBSSIDList; | ||
4422 | +} __packed SBSSIDList, *PSBSSIDList; | ||
4423 | |||
4424 | |||
4425 | typedef struct tagSNodeItem { | ||
4426 | @@ -208,7 +207,7 @@ typedef struct tagSNodeItem { | ||
4427 | u32 uTxAttempts; | ||
4428 | u16 wFailureRatio; | ||
4429 | |||
4430 | -} SNodeItem; | ||
4431 | +} __packed SNodeItem; | ||
4432 | |||
4433 | |||
4434 | typedef struct tagSNodeList { | ||
4435 | @@ -216,7 +215,7 @@ typedef struct tagSNodeList { | ||
4436 | u32 uItem; | ||
4437 | SNodeItem sNodeList[0]; | ||
4438 | |||
4439 | -} SNodeList, *PSNodeList; | ||
4440 | +} __packed SNodeList, *PSNodeList; | ||
4441 | |||
4442 | |||
4443 | typedef struct tagSCmdLinkStatus { | ||
4444 | @@ -229,7 +228,7 @@ typedef struct tagSCmdLinkStatus { | ||
4445 | u32 uChannel; | ||
4446 | u32 uLinkRate; | ||
4447 | |||
4448 | -} SCmdLinkStatus, *PSCmdLinkStatus; | ||
4449 | +} __packed SCmdLinkStatus, *PSCmdLinkStatus; | ||
4450 | |||
4451 | // | ||
4452 | // 802.11 counter | ||
4453 | @@ -247,7 +246,7 @@ typedef struct tagSDot11MIBCount { | ||
4454 | u32 ReceivedFragmentCount; | ||
4455 | u32 MulticastReceivedFrameCount; | ||
4456 | u32 FCSErrorCount; | ||
4457 | -} SDot11MIBCount, *PSDot11MIBCount; | ||
4458 | +} __packed SDot11MIBCount, *PSDot11MIBCount; | ||
4459 | |||
4460 | |||
4461 | |||
4462 | @@ -355,13 +354,13 @@ typedef struct tagSStatMIBCount { | ||
4463 | u32 ullTxBroadcastBytes[2]; | ||
4464 | u32 ullTxMulticastBytes[2]; | ||
4465 | u32 ullTxDirectedBytes[2]; | ||
4466 | -} SStatMIBCount, *PSStatMIBCount; | ||
4467 | +} __packed SStatMIBCount, *PSStatMIBCount; | ||
4468 | |||
4469 | typedef struct tagSCmdValue { | ||
4470 | |||
4471 | u32 dwValue; | ||
4472 | |||
4473 | -} SCmdValue, *PSCmdValue; | ||
4474 | +} __packed SCmdValue, *PSCmdValue; | ||
4475 | |||
4476 | // | ||
4477 | // hostapd & viawget ioctl related | ||
4478 | @@ -431,7 +430,7 @@ struct viawget_hostapd_param { | ||
4479 | u8 ssid[32]; | ||
4480 | } scan_req; | ||
4481 | } u; | ||
4482 | -}; | ||
4483 | +} __packed; | ||
4484 | |||
4485 | /*--------------------- Export Classes ----------------------------*/ | ||
4486 | |||
4487 | diff --git a/drivers/staging/vt6656/iowpa.h b/drivers/staging/vt6656/iowpa.h | ||
4488 | index 959c886..2522dde 100644 | ||
4489 | --- a/drivers/staging/vt6656/iowpa.h | ||
4490 | +++ b/drivers/staging/vt6656/iowpa.h | ||
4491 | @@ -67,12 +67,11 @@ enum { | ||
4492 | |||
4493 | |||
4494 | |||
4495 | -#pragma pack(1) | ||
4496 | typedef struct viawget_wpa_header { | ||
4497 | u8 type; | ||
4498 | u16 req_ie_len; | ||
4499 | u16 resp_ie_len; | ||
4500 | -} viawget_wpa_header; | ||
4501 | +} __packed viawget_wpa_header; | ||
4502 | |||
4503 | struct viawget_wpa_param { | ||
4504 | u32 cmd; | ||
4505 | @@ -113,9 +112,8 @@ struct viawget_wpa_param { | ||
4506 | u8 *buf; | ||
4507 | } scan_results; | ||
4508 | } u; | ||
4509 | -}; | ||
4510 | +} __packed; | ||
4511 | |||
4512 | -#pragma pack(1) | ||
4513 | struct viawget_scan_result { | ||
4514 | u8 bssid[6]; | ||
4515 | u8 ssid[32]; | ||
4516 | @@ -130,7 +128,7 @@ struct viawget_scan_result { | ||
4517 | int noise; | ||
4518 | int level; | ||
4519 | int maxrate; | ||
4520 | -}; | ||
4521 | +} __packed; | ||
4522 | |||
4523 | /*--------------------- Export Classes ----------------------------*/ | ||
4524 | |||
4525 | diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c | ||
4526 | index ee62a06..ba3a561 100644 | ||
4527 | --- a/drivers/staging/vt6656/key.c | ||
4528 | +++ b/drivers/staging/vt6656/key.c | ||
4529 | @@ -223,7 +223,7 @@ BOOL KeybSetKey( | ||
4530 | PSKeyManagement pTable, | ||
4531 | PBYTE pbyBSSID, | ||
4532 | DWORD dwKeyIndex, | ||
4533 | - unsigned long uKeyLength, | ||
4534 | + u32 uKeyLength, | ||
4535 | PQWORD pKeyRSC, | ||
4536 | PBYTE pbyKey, | ||
4537 | BYTE byKeyDecMode | ||
4538 | @@ -235,7 +235,8 @@ BOOL KeybSetKey( | ||
4539 | PSKeyItem pKey; | ||
4540 | unsigned int uKeyIdx; | ||
4541 | |||
4542 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetKey: %lX\n", dwKeyIndex); | ||
4543 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO | ||
4544 | + "Enter KeybSetKey: %X\n", dwKeyIndex); | ||
4545 | |||
4546 | j = (MAX_KEY_TABLE-1); | ||
4547 | for (i=0;i<(MAX_KEY_TABLE-1);i++) { | ||
4548 | @@ -261,7 +262,9 @@ BOOL KeybSetKey( | ||
4549 | if ((dwKeyIndex & TRANSMIT_KEY) != 0) { | ||
4550 | // Group transmit key | ||
4551 | pTable->KeyTable[i].dwGTKeyIndex = dwKeyIndex; | ||
4552 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[i].dwGTKeyIndex, i); | ||
4553 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO | ||
4554 | + "Group transmit key(R)[%X]: %d\n", | ||
4555 | + pTable->KeyTable[i].dwGTKeyIndex, i); | ||
4556 | } | ||
4557 | pTable->KeyTable[i].wKeyCtl &= 0xFF0F; // clear group key control filed | ||
4558 | pTable->KeyTable[i].wKeyCtl |= (byKeyDecMode << 4); | ||
4559 | @@ -302,9 +305,12 @@ BOOL KeybSetKey( | ||
4560 | } | ||
4561 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); | ||
4562 | |||
4563 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %lx\n ", pKey->dwTSC47_16); | ||
4564 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n ", pKey->wTSC15_0); | ||
4565 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %lx\n ", pKey->dwKeyIndex); | ||
4566 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %x\n ", | ||
4567 | + pKey->dwTSC47_16); | ||
4568 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n ", | ||
4569 | + pKey->wTSC15_0); | ||
4570 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %x\n ", | ||
4571 | + pKey->dwKeyIndex); | ||
4572 | |||
4573 | return (TRUE); | ||
4574 | } | ||
4575 | @@ -326,7 +332,9 @@ BOOL KeybSetKey( | ||
4576 | if ((dwKeyIndex & TRANSMIT_KEY) != 0) { | ||
4577 | // Group transmit key | ||
4578 | pTable->KeyTable[j].dwGTKeyIndex = dwKeyIndex; | ||
4579 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(N)[%lX]: %d\n", pTable->KeyTable[j].dwGTKeyIndex, j); | ||
4580 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO | ||
4581 | + "Group transmit key(N)[%X]: %d\n", | ||
4582 | + pTable->KeyTable[j].dwGTKeyIndex, j); | ||
4583 | } | ||
4584 | pTable->KeyTable[j].wKeyCtl &= 0xFF0F; // clear group key control filed | ||
4585 | pTable->KeyTable[j].wKeyCtl |= (byKeyDecMode << 4); | ||
4586 | @@ -367,9 +375,11 @@ BOOL KeybSetKey( | ||
4587 | } | ||
4588 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); | ||
4589 | |||
4590 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %lx\n ", pKey->dwTSC47_16); | ||
4591 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %x\n ", | ||
4592 | + pKey->dwTSC47_16); | ||
4593 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n ", pKey->wTSC15_0); | ||
4594 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %lx\n ", pKey->dwKeyIndex); | ||
4595 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %x\n ", | ||
4596 | + pKey->dwKeyIndex); | ||
4597 | |||
4598 | return (TRUE); | ||
4599 | } | ||
4600 | @@ -597,7 +607,8 @@ BOOL KeybGetTransmitKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyType, | ||
4601 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"%x ", pTable->KeyTable[i].abyBSSID[ii]); | ||
4602 | } | ||
4603 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); | ||
4604 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"dwGTKeyIndex: %lX\n", pTable->KeyTable[i].dwGTKeyIndex); | ||
4605 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"dwGTKeyIndex: %X\n", | ||
4606 | + pTable->KeyTable[i].dwGTKeyIndex); | ||
4607 | |||
4608 | return (TRUE); | ||
4609 | } | ||
4610 | @@ -664,7 +675,7 @@ BOOL KeybSetDefaultKey( | ||
4611 | void *pDeviceHandler, | ||
4612 | PSKeyManagement pTable, | ||
4613 | DWORD dwKeyIndex, | ||
4614 | - unsigned long uKeyLength, | ||
4615 | + u32 uKeyLength, | ||
4616 | PQWORD pKeyRSC, | ||
4617 | PBYTE pbyKey, | ||
4618 | BYTE byKeyDecMode | ||
4619 | @@ -696,7 +707,10 @@ BOOL KeybSetDefaultKey( | ||
4620 | if ((dwKeyIndex & TRANSMIT_KEY) != 0) { | ||
4621 | // Group transmit key | ||
4622 | pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex = dwKeyIndex; | ||
4623 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex, MAX_KEY_TABLE-1); | ||
4624 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO | ||
4625 | + "Group transmit key(R)[%X]: %d\n", | ||
4626 | + pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex, | ||
4627 | + MAX_KEY_TABLE-1); | ||
4628 | |||
4629 | } | ||
4630 | pTable->KeyTable[MAX_KEY_TABLE-1].wKeyCtl &= 0x7F00; // clear all key control filed | ||
4631 | @@ -747,9 +761,11 @@ BOOL KeybSetDefaultKey( | ||
4632 | } | ||
4633 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); | ||
4634 | |||
4635 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %lx\n", pKey->dwTSC47_16); | ||
4636 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwTSC47_16: %x\n", | ||
4637 | + pKey->dwTSC47_16); | ||
4638 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->wTSC15_0: %x\n", pKey->wTSC15_0); | ||
4639 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %lx\n", pKey->dwKeyIndex); | ||
4640 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->dwKeyIndex: %x\n", | ||
4641 | + pKey->dwKeyIndex); | ||
4642 | |||
4643 | return (TRUE); | ||
4644 | } | ||
4645 | @@ -775,7 +791,7 @@ BOOL KeybSetAllGroupKey( | ||
4646 | void *pDeviceHandler, | ||
4647 | PSKeyManagement pTable, | ||
4648 | DWORD dwKeyIndex, | ||
4649 | - unsigned long uKeyLength, | ||
4650 | + u32 uKeyLength, | ||
4651 | PQWORD pKeyRSC, | ||
4652 | PBYTE pbyKey, | ||
4653 | BYTE byKeyDecMode | ||
4654 | @@ -787,7 +803,8 @@ BOOL KeybSetAllGroupKey( | ||
4655 | PSKeyItem pKey; | ||
4656 | unsigned int uKeyIdx; | ||
4657 | |||
4658 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetAllGroupKey: %lX\n", dwKeyIndex); | ||
4659 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetAllGroupKey: %X\n", | ||
4660 | + dwKeyIndex); | ||
4661 | |||
4662 | |||
4663 | if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key | ||
4664 | @@ -804,7 +821,9 @@ BOOL KeybSetAllGroupKey( | ||
4665 | if ((dwKeyIndex & TRANSMIT_KEY) != 0) { | ||
4666 | // Group transmit key | ||
4667 | pTable->KeyTable[i].dwGTKeyIndex = dwKeyIndex; | ||
4668 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Group transmit key(R)[%lX]: %d\n", pTable->KeyTable[i].dwGTKeyIndex, i); | ||
4669 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO | ||
4670 | + "Group transmit key(R)[%X]: %d\n", | ||
4671 | + pTable->KeyTable[i].dwGTKeyIndex, i); | ||
4672 | |||
4673 | } | ||
4674 | pTable->KeyTable[i].wKeyCtl &= 0xFF0F; // clear group key control filed | ||
4675 | diff --git a/drivers/staging/vt6656/key.h b/drivers/staging/vt6656/key.h | ||
4676 | index f749c7a..bd35d39 100644 | ||
4677 | --- a/drivers/staging/vt6656/key.h | ||
4678 | +++ b/drivers/staging/vt6656/key.h | ||
4679 | @@ -58,7 +58,7 @@ | ||
4680 | typedef struct tagSKeyItem | ||
4681 | { | ||
4682 | BOOL bKeyValid; | ||
4683 | - unsigned long uKeyLength; | ||
4684 | + u32 uKeyLength; | ||
4685 | BYTE abyKey[MAX_KEY_LEN]; | ||
4686 | QWORD KeyRSC; | ||
4687 | DWORD dwTSC47_16; | ||
4688 | @@ -107,7 +107,7 @@ BOOL KeybSetKey( | ||
4689 | PSKeyManagement pTable, | ||
4690 | PBYTE pbyBSSID, | ||
4691 | DWORD dwKeyIndex, | ||
4692 | - unsigned long uKeyLength, | ||
4693 | + u32 uKeyLength, | ||
4694 | PQWORD pKeyRSC, | ||
4695 | PBYTE pbyKey, | ||
4696 | BYTE byKeyDecMode | ||
4697 | @@ -146,7 +146,7 @@ BOOL KeybSetDefaultKey( | ||
4698 | void *pDeviceHandler, | ||
4699 | PSKeyManagement pTable, | ||
4700 | DWORD dwKeyIndex, | ||
4701 | - unsigned long uKeyLength, | ||
4702 | + u32 uKeyLength, | ||
4703 | PQWORD pKeyRSC, | ||
4704 | PBYTE pbyKey, | ||
4705 | BYTE byKeyDecMode | ||
4706 | @@ -156,7 +156,7 @@ BOOL KeybSetAllGroupKey( | ||
4707 | void *pDeviceHandler, | ||
4708 | PSKeyManagement pTable, | ||
4709 | DWORD dwKeyIndex, | ||
4710 | - unsigned long uKeyLength, | ||
4711 | + u32 uKeyLength, | ||
4712 | PQWORD pKeyRSC, | ||
4713 | PBYTE pbyKey, | ||
4714 | BYTE byKeyDecMode | ||
4715 | diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c | ||
4716 | index af4a29d..8fddc7b 100644 | ||
4717 | --- a/drivers/staging/vt6656/mac.c | ||
4718 | +++ b/drivers/staging/vt6656/mac.c | ||
4719 | @@ -260,7 +260,8 @@ BYTE pbyData[24]; | ||
4720 | dwData1 <<= 16; | ||
4721 | dwData1 |= MAKEWORD(*(pbyAddr+4), *(pbyAddr+5)); | ||
4722 | |||
4723 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %lX, KeyCtl:%X\n", wOffset, dwData1, wKeyCtl); | ||
4724 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"1. wOffset: %d, Data: %X,"\ | ||
4725 | + " KeyCtl:%X\n", wOffset, dwData1, wKeyCtl); | ||
4726 | |||
4727 | //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); | ||
4728 | //VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); | ||
4729 | @@ -277,7 +278,8 @@ BYTE pbyData[24]; | ||
4730 | dwData2 <<= 8; | ||
4731 | dwData2 |= *(pbyAddr+0); | ||
4732 | |||
4733 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2. wOffset: %d, Data: %lX\n", wOffset, dwData2); | ||
4734 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"2. wOffset: %d, Data: %X\n", | ||
4735 | + wOffset, dwData2); | ||
4736 | |||
4737 | //VNSvOutPortW(dwIoBase + MAC_REG_MISCFFNDEX, wOffset); | ||
4738 | //VNSvOutPortD(dwIoBase + MAC_REG_MISCFFDATA, dwData); | ||
4739 | diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c | ||
4740 | index 3fd0478..8cf0881 100644 | ||
4741 | --- a/drivers/staging/vt6656/rf.c | ||
4742 | +++ b/drivers/staging/vt6656/rf.c | ||
4743 | @@ -769,6 +769,9 @@ BYTE byPwr = pDevice->byCCKPwr; | ||
4744 | return TRUE; | ||
4745 | } | ||
4746 | |||
4747 | + if (uCH == 0) | ||
4748 | + return -EINVAL; | ||
4749 | + | ||
4750 | switch (uRATE) { | ||
4751 | case RATE_1M: | ||
4752 | case RATE_2M: | ||
4753 | diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c | ||
4754 | index b6e04e7..7a56929 100644 | ||
4755 | --- a/drivers/staging/vt6656/rxtx.c | ||
4756 | +++ b/drivers/staging/vt6656/rxtx.c | ||
4757 | @@ -375,7 +375,8 @@ s_vFillTxKey ( | ||
4758 | *(pbyIVHead+3) = (BYTE)(((pDevice->byKeyIndex << 6) & 0xc0) | 0x20); // 0x20 is ExtIV | ||
4759 | // Append IV&ExtIV after Mac Header | ||
4760 | *pdwExtIV = cpu_to_le32(pTransmitKey->dwTSC47_16); | ||
4761 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vFillTxKey()---- pdwExtIV: %lx\n", *pdwExtIV); | ||
4762 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"vFillTxKey()---- pdwExtIV: %x\n", | ||
4763 | + *pdwExtIV); | ||
4764 | |||
4765 | } else if (pTransmitKey->byCipherSuite == KEY_CTL_CCMP) { | ||
4766 | pTransmitKey->wTSC15_0++; | ||
4767 | @@ -1751,7 +1752,8 @@ s_bPacketToWirelessUsb( | ||
4768 | MIC_vAppend((PBYTE)&(psEthHeader->abyDstAddr[0]), 12); | ||
4769 | dwMIC_Priority = 0; | ||
4770 | MIC_vAppend((PBYTE)&dwMIC_Priority, 4); | ||
4771 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC KEY: %lX, %lX\n", dwMICKey0, dwMICKey1); | ||
4772 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC KEY: %X, %X\n", | ||
4773 | + dwMICKey0, dwMICKey1); | ||
4774 | |||
4775 | /////////////////////////////////////////////////////////////////// | ||
4776 | |||
4777 | @@ -2633,7 +2635,8 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) { | ||
4778 | MIC_vAppend((PBYTE)&(sEthHeader.abyDstAddr[0]), 12); | ||
4779 | dwMIC_Priority = 0; | ||
4780 | MIC_vAppend((PBYTE)&dwMIC_Priority, 4); | ||
4781 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"DMA0_tx_8021:MIC KEY: %lX, %lX\n", dwMICKey0, dwMICKey1); | ||
4782 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"DMA0_tx_8021:MIC KEY:"\ | ||
4783 | + " %X, %X\n", dwMICKey0, dwMICKey1); | ||
4784 | |||
4785 | uLength = cbHeaderSize + cbMacHdLen + uPadding + cbIVlen; | ||
4786 | |||
4787 | @@ -2653,7 +2656,8 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) { | ||
4788 | |||
4789 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"uLength: %d, %d\n", uLength, cbFrameBodySize); | ||
4790 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"cbReqCount:%d, %d, %d, %d\n", cbReqCount, cbHeaderSize, uPadding, cbIVlen); | ||
4791 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC:%lx, %lx\n", *pdwMIC_L, *pdwMIC_R); | ||
4792 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC:%x, %x\n", | ||
4793 | + *pdwMIC_L, *pdwMIC_R); | ||
4794 | |||
4795 | } | ||
4796 | |||
4797 | @@ -3027,7 +3031,8 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb) | ||
4798 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"error: KEY is GTK!!~~\n"); | ||
4799 | } | ||
4800 | else { | ||
4801 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%lX]\n", pTransmitKey->dwKeyIndex); | ||
4802 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%X]\n", | ||
4803 | + pTransmitKey->dwKeyIndex); | ||
4804 | bNeedEncryption = TRUE; | ||
4805 | } | ||
4806 | } | ||
4807 | @@ -3041,7 +3046,8 @@ int nsDMA_tx_packet(PSDevice pDevice, unsigned int uDMAIdx, struct sk_buff *skb) | ||
4808 | if (pDevice->bEnableHostWEP) { | ||
4809 | if ((uNodeIndex != 0) && | ||
4810 | (pMgmt->sNodeDBTable[uNodeIndex].dwKeyIndex & PAIRWISE_KEY)) { | ||
4811 | - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%lX]\n", pTransmitKey->dwKeyIndex); | ||
4812 | + DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Find PTK [%X]\n", | ||
4813 | + pTransmitKey->dwKeyIndex); | ||
4814 | bNeedEncryption = TRUE; | ||
4815 | } | ||
4816 | } | ||
4817 | diff --git a/drivers/staging/vt6656/ttype.h b/drivers/staging/vt6656/ttype.h | ||
4818 | index 8e9450e..dfbf747 100644 | ||
4819 | --- a/drivers/staging/vt6656/ttype.h | ||
4820 | +++ b/drivers/staging/vt6656/ttype.h | ||
4821 | @@ -29,6 +29,8 @@ | ||
4822 | #ifndef __TTYPE_H__ | ||
4823 | #define __TTYPE_H__ | ||
4824 | |||
4825 | +#include <linux/types.h> | ||
4826 | + | ||
4827 | /******* Common definitions and typedefs ***********************************/ | ||
4828 | |||
4829 | typedef int BOOL; | ||
4830 | @@ -42,17 +44,17 @@ typedef int BOOL; | ||
4831 | |||
4832 | /****** Simple typedefs ***************************************************/ | ||
4833 | |||
4834 | -typedef unsigned char BYTE; // 8-bit | ||
4835 | -typedef unsigned short WORD; // 16-bit | ||
4836 | -typedef unsigned long DWORD; // 32-bit | ||
4837 | +typedef u8 BYTE; | ||
4838 | +typedef u16 WORD; | ||
4839 | +typedef u32 DWORD; | ||
4840 | |||
4841 | // QWORD is for those situation that we want | ||
4842 | // an 8-byte-aligned 8 byte long structure | ||
4843 | // which is NOT really a floating point number. | ||
4844 | typedef union tagUQuadWord { | ||
4845 | struct { | ||
4846 | - DWORD dwLowDword; | ||
4847 | - DWORD dwHighDword; | ||
4848 | + u32 dwLowDword; | ||
4849 | + u32 dwHighDword; | ||
4850 | } u; | ||
4851 | double DoNotUseThisField; | ||
4852 | } UQuadWord; | ||
4853 | @@ -60,8 +62,8 @@ typedef UQuadWord QWORD; // 64-bit | ||
4854 | |||
4855 | /****** Common pointer types ***********************************************/ | ||
4856 | |||
4857 | -typedef unsigned long ULONG_PTR; // 32-bit | ||
4858 | -typedef unsigned long DWORD_PTR; // 32-bit | ||
4859 | +typedef u32 ULONG_PTR; | ||
4860 | +typedef u32 DWORD_PTR; | ||
4861 | |||
4862 | // boolean pointer | ||
4863 | |||
4864 | diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c | ||
4865 | index 9d2caa8..2225b9e 100644 | ||
4866 | --- a/drivers/staging/vt6656/wcmd.c | ||
4867 | +++ b/drivers/staging/vt6656/wcmd.c | ||
4868 | @@ -316,17 +316,19 @@ s_MgrMakeProbeRequest( | ||
4869 | return pTxPacket; | ||
4870 | } | ||
4871 | |||
4872 | -void vCommandTimerWait(void *hDeviceContext, unsigned int MSecond) | ||
4873 | +void vCommandTimerWait(void *hDeviceContext, unsigned long MSecond) | ||
4874 | { | ||
4875 | - PSDevice pDevice = (PSDevice)hDeviceContext; | ||
4876 | + PSDevice pDevice = (PSDevice)hDeviceContext; | ||
4877 | |||
4878 | - init_timer(&pDevice->sTimerCommand); | ||
4879 | - pDevice->sTimerCommand.data = (unsigned long)pDevice; | ||
4880 | - pDevice->sTimerCommand.function = (TimerFunction)vRunCommand; | ||
4881 | - // RUN_AT :1 msec ~= (HZ/1024) | ||
4882 | - pDevice->sTimerCommand.expires = (unsigned int)RUN_AT((MSecond * HZ) >> 10); | ||
4883 | - add_timer(&pDevice->sTimerCommand); | ||
4884 | - return; | ||
4885 | + init_timer(&pDevice->sTimerCommand); | ||
4886 | + | ||
4887 | + pDevice->sTimerCommand.data = (unsigned long)pDevice; | ||
4888 | + pDevice->sTimerCommand.function = (TimerFunction)vRunCommand; | ||
4889 | + pDevice->sTimerCommand.expires = RUN_AT((MSecond * HZ) / 1000); | ||
4890 | + | ||
4891 | + add_timer(&pDevice->sTimerCommand); | ||
4892 | + | ||
4893 | + return; | ||
4894 | } | ||
4895 | |||
4896 | void vRunCommand(void *hDeviceContext) | ||
4897 | diff --git a/drivers/staging/vt6656/wpa2.h b/drivers/staging/vt6656/wpa2.h | ||
4898 | index 46c2959..c359252 100644 | ||
4899 | --- a/drivers/staging/vt6656/wpa2.h | ||
4900 | +++ b/drivers/staging/vt6656/wpa2.h | ||
4901 | @@ -45,8 +45,8 @@ typedef struct tagsPMKIDInfo { | ||
4902 | } PMKIDInfo, *PPMKIDInfo; | ||
4903 | |||
4904 | typedef struct tagSPMKIDCache { | ||
4905 | - unsigned long BSSIDInfoCount; | ||
4906 | - PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE]; | ||
4907 | + u32 BSSIDInfoCount; | ||
4908 | + PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE]; | ||
4909 | } SPMKIDCache, *PSPMKIDCache; | ||
4910 | |||
4911 | |||
4912 | diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c | ||
4913 | index 4efa9bc..89bfd85 100644 | ||
4914 | --- a/drivers/staging/wlan-ng/prism2mgmt.c | ||
4915 | +++ b/drivers/staging/wlan-ng/prism2mgmt.c | ||
4916 | @@ -406,7 +406,7 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp) | ||
4917 | /* SSID */ | ||
4918 | req->ssid.status = P80211ENUM_msgitem_status_data_ok; | ||
4919 | req->ssid.data.len = le16_to_cpu(item->ssid.len); | ||
4920 | - req->ssid.data.len = min_t(u16, req->ssid.data.len, WLAN_BSSID_LEN); | ||
4921 | + req->ssid.data.len = min_t(u16, req->ssid.data.len, WLAN_SSID_MAXLEN); | ||
4922 | memcpy(req->ssid.data.data, item->ssid.data, req->ssid.data.len); | ||
4923 | |||
4924 | /* supported rates */ | ||
4925 | diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c | ||
4926 | index 6b6f50a..5bafd2d 100644 | ||
4927 | --- a/drivers/target/iscsi/iscsi_target.c | ||
4928 | +++ b/drivers/target/iscsi/iscsi_target.c | ||
4929 | @@ -2384,7 +2384,7 @@ static void iscsit_build_conn_drop_async_message(struct iscsi_conn *conn) | ||
4930 | if (!conn_p) | ||
4931 | return; | ||
4932 | |||
4933 | - cmd = iscsit_allocate_cmd(conn_p, GFP_KERNEL); | ||
4934 | + cmd = iscsit_allocate_cmd(conn_p, GFP_ATOMIC); | ||
4935 | if (!cmd) { | ||
4936 | iscsit_dec_conn_usage_count(conn_p); | ||
4937 | return; | ||
4938 | diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c | ||
4939 | index 68d4c10..f141b4f 100644 | ||
4940 | --- a/drivers/target/target_core_device.c | ||
4941 | +++ b/drivers/target/target_core_device.c | ||
4942 | @@ -1622,6 +1622,7 @@ int core_dev_setup_virtual_lun0(void) | ||
4943 | ret = PTR_ERR(dev); | ||
4944 | goto out; | ||
4945 | } | ||
4946 | + dev->dev_link_magic = SE_DEV_LINK_MAGIC; | ||
4947 | se_dev->se_dev_ptr = dev; | ||
4948 | g_lun0_dev = dev; | ||
4949 | |||
4950 | diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c | ||
4951 | index ea479e5..0bbcd35 100644 | ||
4952 | --- a/drivers/target/target_core_fabric_configfs.c | ||
4953 | +++ b/drivers/target/target_core_fabric_configfs.c | ||
4954 | @@ -72,6 +72,12 @@ static int target_fabric_mappedlun_link( | ||
4955 | struct se_portal_group *se_tpg; | ||
4956 | struct config_item *nacl_ci, *tpg_ci, *tpg_ci_s, *wwn_ci, *wwn_ci_s; | ||
4957 | int ret = 0, lun_access; | ||
4958 | + | ||
4959 | + if (lun->lun_link_magic != SE_LUN_LINK_MAGIC) { | ||
4960 | + pr_err("Bad lun->lun_link_magic, not a valid lun_ci pointer:" | ||
4961 | + " %p to struct lun: %p\n", lun_ci, lun); | ||
4962 | + return -EFAULT; | ||
4963 | + } | ||
4964 | /* | ||
4965 | * Ensure that the source port exists | ||
4966 | */ | ||
4967 | @@ -746,6 +752,12 @@ static int target_fabric_port_link( | ||
4968 | struct target_fabric_configfs *tf; | ||
4969 | int ret; | ||
4970 | |||
4971 | + if (dev->dev_link_magic != SE_DEV_LINK_MAGIC) { | ||
4972 | + pr_err("Bad dev->dev_link_magic, not a valid se_dev_ci pointer:" | ||
4973 | + " %p to struct se_device: %p\n", se_dev_ci, dev); | ||
4974 | + return -EFAULT; | ||
4975 | + } | ||
4976 | + | ||
4977 | tpg_ci = &lun_ci->ci_parent->ci_group->cg_item; | ||
4978 | se_tpg = container_of(to_config_group(tpg_ci), | ||
4979 | struct se_portal_group, tpg_group); | ||
4980 | diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c | ||
4981 | index b8628a5..8dfe6f5 100644 | ||
4982 | --- a/drivers/target/target_core_tpg.c | ||
4983 | +++ b/drivers/target/target_core_tpg.c | ||
4984 | @@ -672,6 +672,7 @@ int core_tpg_register( | ||
4985 | for (i = 0; i < TRANSPORT_MAX_LUNS_PER_TPG; i++) { | ||
4986 | lun = se_tpg->tpg_lun_list[i]; | ||
4987 | lun->unpacked_lun = i; | ||
4988 | + lun->lun_link_magic = SE_LUN_LINK_MAGIC; | ||
4989 | lun->lun_status = TRANSPORT_LUN_STATUS_FREE; | ||
4990 | atomic_set(&lun->lun_acl_count, 0); | ||
4991 | init_completion(&lun->lun_shutdown_comp); | ||
4992 | diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c | ||
4993 | index c87ef74..65e6320 100644 | ||
4994 | --- a/drivers/target/target_core_transport.c | ||
4995 | +++ b/drivers/target/target_core_transport.c | ||
4996 | @@ -1085,6 +1085,7 @@ struct se_device *transport_add_device_to_core_hba( | ||
4997 | dev->se_hba = hba; | ||
4998 | dev->se_sub_dev = se_dev; | ||
4999 | dev->transport = transport; | ||
5000 | + dev->dev_link_magic = SE_DEV_LINK_MAGIC; | ||
5001 | INIT_LIST_HEAD(&dev->dev_list); | ||
5002 | INIT_LIST_HEAD(&dev->dev_sep_list); | ||
5003 | INIT_LIST_HEAD(&dev->dev_tmr_list); | ||
5004 | @@ -1553,6 +1554,8 @@ static void target_complete_tmr_failure(struct work_struct *work) | ||
5005 | |||
5006 | se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST; | ||
5007 | se_cmd->se_tfo->queue_tm_rsp(se_cmd); | ||
5008 | + | ||
5009 | + transport_cmd_check_stop_to_fabric(se_cmd); | ||
5010 | } | ||
5011 | |||
5012 | /** | ||
5013 | diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c | ||
5014 | index 3c9e5b5..230d8ec 100644 | ||
5015 | --- a/drivers/target/tcm_fc/tfc_sess.c | ||
5016 | +++ b/drivers/target/tcm_fc/tfc_sess.c | ||
5017 | @@ -356,11 +356,11 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len, | ||
5018 | |||
5019 | tport = ft_tport_create(rdata->local_port); | ||
5020 | if (!tport) | ||
5021 | - return 0; /* not a target for this local port */ | ||
5022 | + goto not_target; /* not a target for this local port */ | ||
5023 | |||
5024 | acl = ft_acl_get(tport->tpg, rdata); | ||
5025 | if (!acl) | ||
5026 | - return 0; | ||
5027 | + goto not_target; /* no target for this remote */ | ||
5028 | |||
5029 | if (!rspp) | ||
5030 | goto fill; | ||
5031 | @@ -397,12 +397,18 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len, | ||
5032 | |||
5033 | /* | ||
5034 | * OR in our service parameters with other provider (initiator), if any. | ||
5035 | - * TBD XXX - indicate RETRY capability? | ||
5036 | */ | ||
5037 | fill: | ||
5038 | fcp_parm = ntohl(spp->spp_params); | ||
5039 | + fcp_parm &= ~FCP_SPPF_RETRY; | ||
5040 | spp->spp_params = htonl(fcp_parm | FCP_SPPF_TARG_FCN); | ||
5041 | return FC_SPP_RESP_ACK; | ||
5042 | + | ||
5043 | +not_target: | ||
5044 | + fcp_parm = ntohl(spp->spp_params); | ||
5045 | + fcp_parm &= ~FCP_SPPF_TARG_FCN; | ||
5046 | + spp->spp_params = htonl(fcp_parm); | ||
5047 | + return 0; | ||
5048 | } | ||
5049 | |||
5050 | /** | ||
5051 | @@ -431,7 +437,6 @@ static void ft_sess_rcu_free(struct rcu_head *rcu) | ||
5052 | { | ||
5053 | struct ft_sess *sess = container_of(rcu, struct ft_sess, rcu); | ||
5054 | |||
5055 | - transport_deregister_session(sess->se_sess); | ||
5056 | kfree(sess); | ||
5057 | } | ||
5058 | |||
5059 | @@ -439,6 +444,7 @@ static void ft_sess_free(struct kref *kref) | ||
5060 | { | ||
5061 | struct ft_sess *sess = container_of(kref, struct ft_sess, kref); | ||
5062 | |||
5063 | + transport_deregister_session(sess->se_sess); | ||
5064 | call_rcu(&sess->rcu, ft_sess_rcu_free); | ||
5065 | } | ||
5066 | |||
5067 | diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c | ||
5068 | index f574eef..b6dc908 100644 | ||
5069 | --- a/drivers/tty/serial/8250/8250_dw.c | ||
5070 | +++ b/drivers/tty/serial/8250/8250_dw.c | ||
5071 | @@ -79,7 +79,7 @@ static int dw8250_handle_irq(struct uart_port *p) | ||
5072 | } else if ((iir & UART_IIR_BUSY) == UART_IIR_BUSY) { | ||
5073 | /* Clear the USR and write the LCR again. */ | ||
5074 | (void)p->serial_in(p, UART_USR); | ||
5075 | - p->serial_out(p, d->last_lcr, UART_LCR); | ||
5076 | + p->serial_out(p, UART_LCR, d->last_lcr); | ||
5077 | |||
5078 | return 1; | ||
5079 | } | ||
5080 | diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c | ||
5081 | index 3ad079f..f43156f 100644 | ||
5082 | --- a/drivers/tty/serial/ifx6x60.c | ||
5083 | +++ b/drivers/tty/serial/ifx6x60.c | ||
5084 | @@ -552,6 +552,7 @@ static void ifx_port_shutdown(struct tty_port *port) | ||
5085 | container_of(port, struct ifx_spi_device, tty_port); | ||
5086 | |||
5087 | mrdy_set_low(ifx_dev); | ||
5088 | + del_timer(&ifx_dev->spi_timer); | ||
5089 | clear_bit(IFX_SPI_STATE_TIMER_PENDING, &ifx_dev->flags); | ||
5090 | tasklet_kill(&ifx_dev->io_work_tasklet); | ||
5091 | } | ||
5092 | diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c | ||
5093 | index 89c752a..d775bc9 100644 | ||
5094 | --- a/drivers/usb/class/cdc-acm.c | ||
5095 | +++ b/drivers/usb/class/cdc-acm.c | ||
5096 | @@ -1602,6 +1602,9 @@ static const struct usb_device_id acm_ids[] = { | ||
5097 | { USB_DEVICE(0x0572, 0x1340), /* Conexant CX93010-2x UCMxx */ | ||
5098 | .driver_info = NO_UNION_NORMAL, | ||
5099 | }, | ||
5100 | + { USB_DEVICE(0x05f9, 0x4002), /* PSC Scanning, Magellan 800i */ | ||
5101 | + .driver_info = NO_UNION_NORMAL, | ||
5102 | + }, | ||
5103 | { USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */ | ||
5104 | .driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */ | ||
5105 | }, | ||
5106 | diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c | ||
5107 | index fe7faf0..3736c65 100644 | ||
5108 | --- a/drivers/usb/core/hub.c | ||
5109 | +++ b/drivers/usb/core/hub.c | ||
5110 | @@ -867,6 +867,60 @@ static int hub_hub_status(struct usb_hub *hub, | ||
5111 | return ret; | ||
5112 | } | ||
5113 | |||
5114 | +static int hub_set_port_link_state(struct usb_hub *hub, int port1, | ||
5115 | + unsigned int link_status) | ||
5116 | +{ | ||
5117 | + return set_port_feature(hub->hdev, | ||
5118 | + port1 | (link_status << 3), | ||
5119 | + USB_PORT_FEAT_LINK_STATE); | ||
5120 | +} | ||
5121 | + | ||
5122 | +/* | ||
5123 | + * If USB 3.0 ports are placed into the Disabled state, they will no longer | ||
5124 | + * detect any device connects or disconnects. This is generally not what the | ||
5125 | + * USB core wants, since it expects a disabled port to produce a port status | ||
5126 | + * change event when a new device connects. | ||
5127 | + * | ||
5128 | + * Instead, set the link state to Disabled, wait for the link to settle into | ||
5129 | + * that state, clear any change bits, and then put the port into the RxDetect | ||
5130 | + * state. | ||
5131 | + */ | ||
5132 | +static int hub_usb3_port_disable(struct usb_hub *hub, int port1) | ||
5133 | +{ | ||
5134 | + int ret; | ||
5135 | + int total_time; | ||
5136 | + u16 portchange, portstatus; | ||
5137 | + | ||
5138 | + if (!hub_is_superspeed(hub->hdev)) | ||
5139 | + return -EINVAL; | ||
5140 | + | ||
5141 | + ret = hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_SS_DISABLED); | ||
5142 | + if (ret) { | ||
5143 | + dev_err(hub->intfdev, "cannot disable port %d (err = %d)\n", | ||
5144 | + port1, ret); | ||
5145 | + return ret; | ||
5146 | + } | ||
5147 | + | ||
5148 | + /* Wait for the link to enter the disabled state. */ | ||
5149 | + for (total_time = 0; ; total_time += HUB_DEBOUNCE_STEP) { | ||
5150 | + ret = hub_port_status(hub, port1, &portstatus, &portchange); | ||
5151 | + if (ret < 0) | ||
5152 | + return ret; | ||
5153 | + | ||
5154 | + if ((portstatus & USB_PORT_STAT_LINK_STATE) == | ||
5155 | + USB_SS_PORT_LS_SS_DISABLED) | ||
5156 | + break; | ||
5157 | + if (total_time >= HUB_DEBOUNCE_TIMEOUT) | ||
5158 | + break; | ||
5159 | + msleep(HUB_DEBOUNCE_STEP); | ||
5160 | + } | ||
5161 | + if (total_time >= HUB_DEBOUNCE_TIMEOUT) | ||
5162 | + dev_warn(hub->intfdev, "Could not disable port %d after %d ms\n", | ||
5163 | + port1, total_time); | ||
5164 | + | ||
5165 | + return hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_RX_DETECT); | ||
5166 | +} | ||
5167 | + | ||
5168 | static int hub_port_disable(struct usb_hub *hub, int port1, int set_state) | ||
5169 | { | ||
5170 | struct usb_device *hdev = hub->hdev; | ||
5171 | @@ -875,8 +929,13 @@ static int hub_port_disable(struct usb_hub *hub, int port1, int set_state) | ||
5172 | if (hdev->children[port1-1] && set_state) | ||
5173 | usb_set_device_state(hdev->children[port1-1], | ||
5174 | USB_STATE_NOTATTACHED); | ||
5175 | - if (!hub->error && !hub_is_superspeed(hub->hdev)) | ||
5176 | - ret = clear_port_feature(hdev, port1, USB_PORT_FEAT_ENABLE); | ||
5177 | + if (!hub->error) { | ||
5178 | + if (hub_is_superspeed(hub->hdev)) | ||
5179 | + ret = hub_usb3_port_disable(hub, port1); | ||
5180 | + else | ||
5181 | + ret = clear_port_feature(hdev, port1, | ||
5182 | + USB_PORT_FEAT_ENABLE); | ||
5183 | + } | ||
5184 | if (ret) | ||
5185 | dev_err(hub->intfdev, "cannot disable port %d (err = %d)\n", | ||
5186 | port1, ret); | ||
5187 | @@ -2339,7 +2398,7 @@ static unsigned hub_is_wusb(struct usb_hub *hub) | ||
5188 | #define HUB_SHORT_RESET_TIME 10 | ||
5189 | #define HUB_BH_RESET_TIME 50 | ||
5190 | #define HUB_LONG_RESET_TIME 200 | ||
5191 | -#define HUB_RESET_TIMEOUT 500 | ||
5192 | +#define HUB_RESET_TIMEOUT 800 | ||
5193 | |||
5194 | static int hub_port_reset(struct usb_hub *hub, int port1, | ||
5195 | struct usb_device *udev, unsigned int delay, bool warm); | ||
5196 | @@ -2374,6 +2433,10 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, | ||
5197 | if (ret < 0) | ||
5198 | return ret; | ||
5199 | |||
5200 | + /* The port state is unknown until the reset completes. */ | ||
5201 | + if ((portstatus & USB_PORT_STAT_RESET)) | ||
5202 | + goto delay; | ||
5203 | + | ||
5204 | /* | ||
5205 | * Some buggy devices require a warm reset to be issued even | ||
5206 | * when the port appears not to be connected. | ||
5207 | @@ -2419,11 +2482,7 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, | ||
5208 | if ((portchange & USB_PORT_STAT_C_CONNECTION)) | ||
5209 | return -ENOTCONN; | ||
5210 | |||
5211 | - /* if we`ve finished resetting, then break out of | ||
5212 | - * the loop | ||
5213 | - */ | ||
5214 | - if (!(portstatus & USB_PORT_STAT_RESET) && | ||
5215 | - (portstatus & USB_PORT_STAT_ENABLE)) { | ||
5216 | + if ((portstatus & USB_PORT_STAT_ENABLE)) { | ||
5217 | if (hub_is_wusb(hub)) | ||
5218 | udev->speed = USB_SPEED_WIRELESS; | ||
5219 | else if (hub_is_superspeed(hub->hdev)) | ||
5220 | @@ -2437,10 +2496,15 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1, | ||
5221 | return 0; | ||
5222 | } | ||
5223 | } else { | ||
5224 | - if (portchange & USB_PORT_STAT_C_BH_RESET) | ||
5225 | - return 0; | ||
5226 | + if (!(portstatus & USB_PORT_STAT_CONNECTION) || | ||
5227 | + hub_port_warm_reset_required(hub, | ||
5228 | + portstatus)) | ||
5229 | + return -ENOTCONN; | ||
5230 | + | ||
5231 | + return 0; | ||
5232 | } | ||
5233 | |||
5234 | +delay: | ||
5235 | /* switch to the long delay after two short delay failures */ | ||
5236 | if (delay_time >= 2 * HUB_SHORT_RESET_TIME) | ||
5237 | delay = HUB_LONG_RESET_TIME; | ||
5238 | @@ -2464,14 +2528,11 @@ static void hub_port_finish_reset(struct usb_hub *hub, int port1, | ||
5239 | msleep(10 + 40); | ||
5240 | update_devnum(udev, 0); | ||
5241 | hcd = bus_to_hcd(udev->bus); | ||
5242 | - if (hcd->driver->reset_device) { | ||
5243 | - *status = hcd->driver->reset_device(hcd, udev); | ||
5244 | - if (*status < 0) { | ||
5245 | - dev_err(&udev->dev, "Cannot reset " | ||
5246 | - "HCD device state\n"); | ||
5247 | - break; | ||
5248 | - } | ||
5249 | - } | ||
5250 | + /* The xHC may think the device is already reset, | ||
5251 | + * so ignore the status. | ||
5252 | + */ | ||
5253 | + if (hcd->driver->reset_device) | ||
5254 | + hcd->driver->reset_device(hcd, udev); | ||
5255 | } | ||
5256 | /* FALL THROUGH */ | ||
5257 | case -ENOTCONN: | ||
5258 | @@ -2479,16 +2540,16 @@ static void hub_port_finish_reset(struct usb_hub *hub, int port1, | ||
5259 | clear_port_feature(hub->hdev, | ||
5260 | port1, USB_PORT_FEAT_C_RESET); | ||
5261 | /* FIXME need disconnect() for NOTATTACHED device */ | ||
5262 | - if (warm) { | ||
5263 | + if (hub_is_superspeed(hub->hdev)) { | ||
5264 | clear_port_feature(hub->hdev, port1, | ||
5265 | USB_PORT_FEAT_C_BH_PORT_RESET); | ||
5266 | clear_port_feature(hub->hdev, port1, | ||
5267 | USB_PORT_FEAT_C_PORT_LINK_STATE); | ||
5268 | - } else { | ||
5269 | + } | ||
5270 | + if (!warm) | ||
5271 | usb_set_device_state(udev, *status | ||
5272 | ? USB_STATE_NOTATTACHED | ||
5273 | : USB_STATE_DEFAULT); | ||
5274 | - } | ||
5275 | break; | ||
5276 | } | ||
5277 | } | ||
5278 | @@ -2837,7 +2898,7 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg) | ||
5279 | static int finish_port_resume(struct usb_device *udev) | ||
5280 | { | ||
5281 | int status = 0; | ||
5282 | - u16 devstatus; | ||
5283 | + u16 devstatus = 0; | ||
5284 | |||
5285 | /* caller owns the udev device lock */ | ||
5286 | dev_dbg(&udev->dev, "%s\n", | ||
5287 | @@ -2882,7 +2943,13 @@ static int finish_port_resume(struct usb_device *udev) | ||
5288 | if (status) { | ||
5289 | dev_dbg(&udev->dev, "gone after usb resume? status %d\n", | ||
5290 | status); | ||
5291 | - } else if (udev->actconfig) { | ||
5292 | + /* | ||
5293 | + * There are a few quirky devices which violate the standard | ||
5294 | + * by claiming to have remote wakeup enabled after a reset, | ||
5295 | + * which crash if the feature is cleared, hence check for | ||
5296 | + * udev->reset_resume | ||
5297 | + */ | ||
5298 | + } else if (udev->actconfig && !udev->reset_resume) { | ||
5299 | le16_to_cpus(&devstatus); | ||
5300 | if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) { | ||
5301 | status = usb_control_msg(udev, | ||
5302 | @@ -4511,9 +4578,14 @@ static void hub_events(void) | ||
5303 | * SS.Inactive state. | ||
5304 | */ | ||
5305 | if (hub_port_warm_reset_required(hub, portstatus)) { | ||
5306 | + int status; | ||
5307 | + | ||
5308 | dev_dbg(hub_dev, "warm reset port %d\n", i); | ||
5309 | - hub_port_reset(hub, i, NULL, | ||
5310 | + status = hub_port_reset(hub, i, NULL, | ||
5311 | HUB_BH_RESET_TIME, true); | ||
5312 | + if (status < 0) | ||
5313 | + hub_port_disable(hub, i, 1); | ||
5314 | + connect_change = 0; | ||
5315 | } | ||
5316 | |||
5317 | if (connect_change) | ||
5318 | diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c | ||
5319 | index 0ab7da2..583150b 100644 | ||
5320 | --- a/drivers/usb/core/message.c | ||
5321 | +++ b/drivers/usb/core/message.c | ||
5322 | @@ -1808,29 +1808,8 @@ free_interfaces: | ||
5323 | goto free_interfaces; | ||
5324 | } | ||
5325 | |||
5326 | - ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | ||
5327 | - USB_REQ_SET_CONFIGURATION, 0, configuration, 0, | ||
5328 | - NULL, 0, USB_CTRL_SET_TIMEOUT); | ||
5329 | - if (ret < 0) { | ||
5330 | - /* All the old state is gone, so what else can we do? | ||
5331 | - * The device is probably useless now anyway. | ||
5332 | - */ | ||
5333 | - cp = NULL; | ||
5334 | - } | ||
5335 | - | ||
5336 | - dev->actconfig = cp; | ||
5337 | - if (!cp) { | ||
5338 | - usb_set_device_state(dev, USB_STATE_ADDRESS); | ||
5339 | - usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); | ||
5340 | - /* Leave LPM disabled while the device is unconfigured. */ | ||
5341 | - mutex_unlock(hcd->bandwidth_mutex); | ||
5342 | - usb_autosuspend_device(dev); | ||
5343 | - goto free_interfaces; | ||
5344 | - } | ||
5345 | - mutex_unlock(hcd->bandwidth_mutex); | ||
5346 | - usb_set_device_state(dev, USB_STATE_CONFIGURED); | ||
5347 | - | ||
5348 | - /* Initialize the new interface structures and the | ||
5349 | + /* | ||
5350 | + * Initialize the new interface structures and the | ||
5351 | * hc/hcd/usbcore interface/endpoint state. | ||
5352 | */ | ||
5353 | for (i = 0; i < nintf; ++i) { | ||
5354 | @@ -1874,6 +1853,35 @@ free_interfaces: | ||
5355 | } | ||
5356 | kfree(new_interfaces); | ||
5357 | |||
5358 | + ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | ||
5359 | + USB_REQ_SET_CONFIGURATION, 0, configuration, 0, | ||
5360 | + NULL, 0, USB_CTRL_SET_TIMEOUT); | ||
5361 | + if (ret < 0 && cp) { | ||
5362 | + /* | ||
5363 | + * All the old state is gone, so what else can we do? | ||
5364 | + * The device is probably useless now anyway. | ||
5365 | + */ | ||
5366 | + usb_hcd_alloc_bandwidth(dev, NULL, NULL, NULL); | ||
5367 | + for (i = 0; i < nintf; ++i) { | ||
5368 | + usb_disable_interface(dev, cp->interface[i], true); | ||
5369 | + put_device(&cp->interface[i]->dev); | ||
5370 | + cp->interface[i] = NULL; | ||
5371 | + } | ||
5372 | + cp = NULL; | ||
5373 | + } | ||
5374 | + | ||
5375 | + dev->actconfig = cp; | ||
5376 | + mutex_unlock(hcd->bandwidth_mutex); | ||
5377 | + | ||
5378 | + if (!cp) { | ||
5379 | + usb_set_device_state(dev, USB_STATE_ADDRESS); | ||
5380 | + | ||
5381 | + /* Leave LPM disabled while the device is unconfigured. */ | ||
5382 | + usb_autosuspend_device(dev); | ||
5383 | + return ret; | ||
5384 | + } | ||
5385 | + usb_set_device_state(dev, USB_STATE_CONFIGURED); | ||
5386 | + | ||
5387 | if (cp->string == NULL && | ||
5388 | !(dev->quirks & USB_QUIRK_CONFIG_INTF_STRINGS)) | ||
5389 | cp->string = usb_cache_string(dev, cp->desc.iConfiguration); | ||
5390 | diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c | ||
5391 | index eb0fd10..b6c4084 100644 | ||
5392 | --- a/drivers/usb/dwc3/gadget.c | ||
5393 | +++ b/drivers/usb/dwc3/gadget.c | ||
5394 | @@ -1619,6 +1619,7 @@ static int __devinit dwc3_gadget_init_endpoints(struct dwc3 *dwc) | ||
5395 | |||
5396 | if (epnum == 0 || epnum == 1) { | ||
5397 | dep->endpoint.maxpacket = 512; | ||
5398 | + dep->endpoint.maxburst = 1; | ||
5399 | dep->endpoint.ops = &dwc3_gadget_ep0_ops; | ||
5400 | if (!epnum) | ||
5401 | dwc->gadget.ep0 = &dep->endpoint; | ||
5402 | diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c | ||
5403 | index afdbb1c..4ad1f1c 100644 | ||
5404 | --- a/drivers/usb/gadget/dummy_hcd.c | ||
5405 | +++ b/drivers/usb/gadget/dummy_hcd.c | ||
5406 | @@ -126,10 +126,7 @@ static const char ep0name[] = "ep0"; | ||
5407 | static const char *const ep_name[] = { | ||
5408 | ep0name, /* everyone has ep0 */ | ||
5409 | |||
5410 | - /* act like a net2280: high speed, six configurable endpoints */ | ||
5411 | - "ep-a", "ep-b", "ep-c", "ep-d", "ep-e", "ep-f", | ||
5412 | - | ||
5413 | - /* or like pxa250: fifteen fixed function endpoints */ | ||
5414 | + /* act like a pxa250: fifteen fixed function endpoints */ | ||
5415 | "ep1in-bulk", "ep2out-bulk", "ep3in-iso", "ep4out-iso", "ep5in-int", | ||
5416 | "ep6in-bulk", "ep7out-bulk", "ep8in-iso", "ep9out-iso", "ep10in-int", | ||
5417 | "ep11in-bulk", "ep12out-bulk", "ep13in-iso", "ep14out-iso", | ||
5418 | @@ -137,6 +134,10 @@ static const char *const ep_name[] = { | ||
5419 | |||
5420 | /* or like sa1100: two fixed function endpoints */ | ||
5421 | "ep1out-bulk", "ep2in-bulk", | ||
5422 | + | ||
5423 | + /* and now some generic EPs so we have enough in multi config */ | ||
5424 | + "ep3out", "ep4in", "ep5out", "ep6out", "ep7in", "ep8out", "ep9in", | ||
5425 | + "ep10out", "ep11out", "ep12in", "ep13out", "ep14in", "ep15out", | ||
5426 | }; | ||
5427 | #define DUMMY_ENDPOINTS ARRAY_SIZE(ep_name) | ||
5428 | |||
5429 | diff --git a/drivers/usb/gadget/f_ecm.c b/drivers/usb/gadget/f_ecm.c | ||
5430 | index 30b908f..672c66a 100644 | ||
5431 | --- a/drivers/usb/gadget/f_ecm.c | ||
5432 | +++ b/drivers/usb/gadget/f_ecm.c | ||
5433 | @@ -808,9 +808,9 @@ fail: | ||
5434 | /* we might as well release our claims on endpoints */ | ||
5435 | if (ecm->notify) | ||
5436 | ecm->notify->driver_data = NULL; | ||
5437 | - if (ecm->port.out_ep->desc) | ||
5438 | + if (ecm->port.out_ep) | ||
5439 | ecm->port.out_ep->driver_data = NULL; | ||
5440 | - if (ecm->port.in_ep->desc) | ||
5441 | + if (ecm->port.in_ep) | ||
5442 | ecm->port.in_ep->driver_data = NULL; | ||
5443 | |||
5444 | ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); | ||
5445 | diff --git a/drivers/usb/gadget/f_eem.c b/drivers/usb/gadget/f_eem.c | ||
5446 | index 1a7b2dd..a9cf2052 100644 | ||
5447 | --- a/drivers/usb/gadget/f_eem.c | ||
5448 | +++ b/drivers/usb/gadget/f_eem.c | ||
5449 | @@ -319,10 +319,9 @@ fail: | ||
5450 | if (f->hs_descriptors) | ||
5451 | usb_free_descriptors(f->hs_descriptors); | ||
5452 | |||
5453 | - /* we might as well release our claims on endpoints */ | ||
5454 | - if (eem->port.out_ep->desc) | ||
5455 | + if (eem->port.out_ep) | ||
5456 | eem->port.out_ep->driver_data = NULL; | ||
5457 | - if (eem->port.in_ep->desc) | ||
5458 | + if (eem->port.in_ep) | ||
5459 | eem->port.in_ep->driver_data = NULL; | ||
5460 | |||
5461 | ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); | ||
5462 | diff --git a/drivers/usb/gadget/f_midi.c b/drivers/usb/gadget/f_midi.c | ||
5463 | index 2f7e8f2..1bf9596 100644 | ||
5464 | --- a/drivers/usb/gadget/f_midi.c | ||
5465 | +++ b/drivers/usb/gadget/f_midi.c | ||
5466 | @@ -416,6 +416,7 @@ static void f_midi_unbind(struct usb_configuration *c, struct usb_function *f) | ||
5467 | midi->id = NULL; | ||
5468 | |||
5469 | usb_free_descriptors(f->descriptors); | ||
5470 | + usb_free_descriptors(f->hs_descriptors); | ||
5471 | kfree(midi); | ||
5472 | } | ||
5473 | |||
5474 | diff --git a/drivers/usb/gadget/f_ncm.c b/drivers/usb/gadget/f_ncm.c | ||
5475 | index aab8ede..d7811ae 100644 | ||
5476 | --- a/drivers/usb/gadget/f_ncm.c | ||
5477 | +++ b/drivers/usb/gadget/f_ncm.c | ||
5478 | @@ -1259,9 +1259,9 @@ fail: | ||
5479 | /* we might as well release our claims on endpoints */ | ||
5480 | if (ncm->notify) | ||
5481 | ncm->notify->driver_data = NULL; | ||
5482 | - if (ncm->port.out_ep->desc) | ||
5483 | + if (ncm->port.out_ep) | ||
5484 | ncm->port.out_ep->driver_data = NULL; | ||
5485 | - if (ncm->port.in_ep->desc) | ||
5486 | + if (ncm->port.in_ep) | ||
5487 | ncm->port.in_ep->driver_data = NULL; | ||
5488 | |||
5489 | ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); | ||
5490 | diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c | ||
5491 | index 8ee9268..a6c19a4 100644 | ||
5492 | --- a/drivers/usb/gadget/f_phonet.c | ||
5493 | +++ b/drivers/usb/gadget/f_phonet.c | ||
5494 | @@ -531,7 +531,7 @@ int pn_bind(struct usb_configuration *c, struct usb_function *f) | ||
5495 | |||
5496 | req = usb_ep_alloc_request(fp->out_ep, GFP_KERNEL); | ||
5497 | if (!req) | ||
5498 | - goto err; | ||
5499 | + goto err_req; | ||
5500 | |||
5501 | req->complete = pn_rx_complete; | ||
5502 | fp->out_reqv[i] = req; | ||
5503 | @@ -540,14 +540,18 @@ int pn_bind(struct usb_configuration *c, struct usb_function *f) | ||
5504 | /* Outgoing USB requests */ | ||
5505 | fp->in_req = usb_ep_alloc_request(fp->in_ep, GFP_KERNEL); | ||
5506 | if (!fp->in_req) | ||
5507 | - goto err; | ||
5508 | + goto err_req; | ||
5509 | |||
5510 | INFO(cdev, "USB CDC Phonet function\n"); | ||
5511 | INFO(cdev, "using %s, OUT %s, IN %s\n", cdev->gadget->name, | ||
5512 | fp->out_ep->name, fp->in_ep->name); | ||
5513 | return 0; | ||
5514 | |||
5515 | +err_req: | ||
5516 | + for (i = 0; i < phonet_rxq_size && fp->out_reqv[i]; i++) | ||
5517 | + usb_ep_free_request(fp->out_ep, fp->out_reqv[i]); | ||
5518 | err: | ||
5519 | + | ||
5520 | if (fp->out_ep) | ||
5521 | fp->out_ep->driver_data = NULL; | ||
5522 | if (fp->in_ep) | ||
5523 | diff --git a/drivers/usb/gadget/f_rndis.c b/drivers/usb/gadget/f_rndis.c | ||
5524 | index b1681e4..47953fe 100644 | ||
5525 | --- a/drivers/usb/gadget/f_rndis.c | ||
5526 | +++ b/drivers/usb/gadget/f_rndis.c | ||
5527 | @@ -803,9 +803,9 @@ fail: | ||
5528 | /* we might as well release our claims on endpoints */ | ||
5529 | if (rndis->notify) | ||
5530 | rndis->notify->driver_data = NULL; | ||
5531 | - if (rndis->port.out_ep->desc) | ||
5532 | + if (rndis->port.out_ep) | ||
5533 | rndis->port.out_ep->driver_data = NULL; | ||
5534 | - if (rndis->port.in_ep->desc) | ||
5535 | + if (rndis->port.in_ep) | ||
5536 | rndis->port.in_ep->driver_data = NULL; | ||
5537 | |||
5538 | ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); | ||
5539 | diff --git a/drivers/usb/gadget/f_subset.c b/drivers/usb/gadget/f_subset.c | ||
5540 | index 21ab474..e5bb966 100644 | ||
5541 | --- a/drivers/usb/gadget/f_subset.c | ||
5542 | +++ b/drivers/usb/gadget/f_subset.c | ||
5543 | @@ -370,9 +370,9 @@ fail: | ||
5544 | usb_free_descriptors(f->hs_descriptors); | ||
5545 | |||
5546 | /* we might as well release our claims on endpoints */ | ||
5547 | - if (geth->port.out_ep->desc) | ||
5548 | + if (geth->port.out_ep) | ||
5549 | geth->port.out_ep->driver_data = NULL; | ||
5550 | - if (geth->port.in_ep->desc) | ||
5551 | + if (geth->port.in_ep) | ||
5552 | geth->port.in_ep->driver_data = NULL; | ||
5553 | |||
5554 | ERROR(cdev, "%s: can't bind, err %d\n", f->name, status); | ||
5555 | diff --git a/drivers/usb/gadget/f_uvc.c b/drivers/usb/gadget/f_uvc.c | ||
5556 | index 2a8bf06..10f13c1 100644 | ||
5557 | --- a/drivers/usb/gadget/f_uvc.c | ||
5558 | +++ b/drivers/usb/gadget/f_uvc.c | ||
5559 | @@ -417,7 +417,6 @@ uvc_register_video(struct uvc_device *uvc) | ||
5560 | return -ENOMEM; | ||
5561 | |||
5562 | video->parent = &cdev->gadget->dev; | ||
5563 | - video->minor = -1; | ||
5564 | video->fops = &uvc_v4l2_fops; | ||
5565 | video->release = video_device_release; | ||
5566 | strncpy(video->name, cdev->gadget->name, sizeof(video->name)); | ||
5567 | @@ -577,23 +576,12 @@ uvc_function_unbind(struct usb_configuration *c, struct usb_function *f) | ||
5568 | |||
5569 | INFO(cdev, "uvc_function_unbind\n"); | ||
5570 | |||
5571 | - if (uvc->vdev) { | ||
5572 | - if (uvc->vdev->minor == -1) | ||
5573 | - video_device_release(uvc->vdev); | ||
5574 | - else | ||
5575 | - video_unregister_device(uvc->vdev); | ||
5576 | - uvc->vdev = NULL; | ||
5577 | - } | ||
5578 | - | ||
5579 | - if (uvc->control_ep) | ||
5580 | - uvc->control_ep->driver_data = NULL; | ||
5581 | - if (uvc->video.ep) | ||
5582 | - uvc->video.ep->driver_data = NULL; | ||
5583 | + video_unregister_device(uvc->vdev); | ||
5584 | + uvc->control_ep->driver_data = NULL; | ||
5585 | + uvc->video.ep->driver_data = NULL; | ||
5586 | |||
5587 | - if (uvc->control_req) { | ||
5588 | - usb_ep_free_request(cdev->gadget->ep0, uvc->control_req); | ||
5589 | - kfree(uvc->control_buf); | ||
5590 | - } | ||
5591 | + usb_ep_free_request(cdev->gadget->ep0, uvc->control_req); | ||
5592 | + kfree(uvc->control_buf); | ||
5593 | |||
5594 | kfree(f->descriptors); | ||
5595 | kfree(f->hs_descriptors); | ||
5596 | @@ -740,7 +728,22 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f) | ||
5597 | return 0; | ||
5598 | |||
5599 | error: | ||
5600 | - uvc_function_unbind(c, f); | ||
5601 | + if (uvc->vdev) | ||
5602 | + video_device_release(uvc->vdev); | ||
5603 | + | ||
5604 | + if (uvc->control_ep) | ||
5605 | + uvc->control_ep->driver_data = NULL; | ||
5606 | + if (uvc->video.ep) | ||
5607 | + uvc->video.ep->driver_data = NULL; | ||
5608 | + | ||
5609 | + if (uvc->control_req) { | ||
5610 | + usb_ep_free_request(cdev->gadget->ep0, uvc->control_req); | ||
5611 | + kfree(uvc->control_buf); | ||
5612 | + } | ||
5613 | + | ||
5614 | + kfree(f->descriptors); | ||
5615 | + kfree(f->hs_descriptors); | ||
5616 | + kfree(f->ss_descriptors); | ||
5617 | return ret; | ||
5618 | } | ||
5619 | |||
5620 | diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c | ||
5621 | index 2cb7d37..f42b68e 100644 | ||
5622 | --- a/drivers/usb/host/ehci-pci.c | ||
5623 | +++ b/drivers/usb/host/ehci-pci.c | ||
5624 | @@ -334,7 +334,8 @@ static bool usb_is_intel_switchable_ehci(struct pci_dev *pdev) | ||
5625 | pdev->vendor == PCI_VENDOR_ID_INTEL && | ||
5626 | (pdev->device == 0x1E26 || | ||
5627 | pdev->device == 0x8C2D || | ||
5628 | - pdev->device == 0x8C26); | ||
5629 | + pdev->device == 0x8C26 || | ||
5630 | + pdev->device == 0x9C26); | ||
5631 | } | ||
5632 | |||
5633 | static void ehci_enable_xhci_companion(void) | ||
5634 | diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c | ||
5635 | index 39f9e4a..eb5563a 100644 | ||
5636 | --- a/drivers/usb/host/pci-quirks.c | ||
5637 | +++ b/drivers/usb/host/pci-quirks.c | ||
5638 | @@ -723,6 +723,7 @@ static int handshake(void __iomem *ptr, u32 mask, u32 done, | ||
5639 | } | ||
5640 | |||
5641 | #define PCI_DEVICE_ID_INTEL_LYNX_POINT_XHCI 0x8C31 | ||
5642 | +#define PCI_DEVICE_ID_INTEL_LYNX_POINT_LP_XHCI 0x9C31 | ||
5643 | |||
5644 | bool usb_is_intel_ppt_switchable_xhci(struct pci_dev *pdev) | ||
5645 | { | ||
5646 | @@ -736,7 +737,8 @@ bool usb_is_intel_lpt_switchable_xhci(struct pci_dev *pdev) | ||
5647 | { | ||
5648 | return pdev->class == PCI_CLASS_SERIAL_USB_XHCI && | ||
5649 | pdev->vendor == PCI_VENDOR_ID_INTEL && | ||
5650 | - pdev->device == PCI_DEVICE_ID_INTEL_LYNX_POINT_XHCI; | ||
5651 | + (pdev->device == PCI_DEVICE_ID_INTEL_LYNX_POINT_XHCI || | ||
5652 | + pdev->device == PCI_DEVICE_ID_INTEL_LYNX_POINT_LP_XHCI); | ||
5653 | } | ||
5654 | |||
5655 | bool usb_is_intel_switchable_xhci(struct pci_dev *pdev) | ||
5656 | diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c | ||
5657 | index e4db350..3fe069f 100644 | ||
5658 | --- a/drivers/usb/host/uhci-hcd.c | ||
5659 | +++ b/drivers/usb/host/uhci-hcd.c | ||
5660 | @@ -447,6 +447,10 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd) | ||
5661 | return IRQ_NONE; | ||
5662 | uhci_writew(uhci, status, USBSTS); /* Clear it */ | ||
5663 | |||
5664 | + spin_lock(&uhci->lock); | ||
5665 | + if (unlikely(!uhci->is_initialized)) /* not yet configured */ | ||
5666 | + goto done; | ||
5667 | + | ||
5668 | if (status & ~(USBSTS_USBINT | USBSTS_ERROR | USBSTS_RD)) { | ||
5669 | if (status & USBSTS_HSE) | ||
5670 | dev_err(uhci_dev(uhci), "host system error, " | ||
5671 | @@ -455,7 +459,6 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd) | ||
5672 | dev_err(uhci_dev(uhci), "host controller process " | ||
5673 | "error, something bad happened!\n"); | ||
5674 | if (status & USBSTS_HCH) { | ||
5675 | - spin_lock(&uhci->lock); | ||
5676 | if (uhci->rh_state >= UHCI_RH_RUNNING) { | ||
5677 | dev_err(uhci_dev(uhci), | ||
5678 | "host controller halted, " | ||
5679 | @@ -473,15 +476,15 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd) | ||
5680 | * pending unlinks */ | ||
5681 | mod_timer(&hcd->rh_timer, jiffies); | ||
5682 | } | ||
5683 | - spin_unlock(&uhci->lock); | ||
5684 | } | ||
5685 | } | ||
5686 | |||
5687 | - if (status & USBSTS_RD) | ||
5688 | + if (status & USBSTS_RD) { | ||
5689 | + spin_unlock(&uhci->lock); | ||
5690 | usb_hcd_poll_rh_status(hcd); | ||
5691 | - else { | ||
5692 | - spin_lock(&uhci->lock); | ||
5693 | + } else { | ||
5694 | uhci_scan_schedule(uhci); | ||
5695 | + done: | ||
5696 | spin_unlock(&uhci->lock); | ||
5697 | } | ||
5698 | |||
5699 | @@ -662,9 +665,9 @@ static int uhci_start(struct usb_hcd *hcd) | ||
5700 | */ | ||
5701 | mb(); | ||
5702 | |||
5703 | + spin_lock_irq(&uhci->lock); | ||
5704 | configure_hc(uhci); | ||
5705 | uhci->is_initialized = 1; | ||
5706 | - spin_lock_irq(&uhci->lock); | ||
5707 | start_rh(uhci); | ||
5708 | spin_unlock_irq(&uhci->lock); | ||
5709 | return 0; | ||
5710 | diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c | ||
5711 | index d5eb357..abb9772 100644 | ||
5712 | --- a/drivers/usb/host/xhci-hub.c | ||
5713 | +++ b/drivers/usb/host/xhci-hub.c | ||
5714 | @@ -762,12 +762,39 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | ||
5715 | break; | ||
5716 | case USB_PORT_FEAT_LINK_STATE: | ||
5717 | temp = xhci_readl(xhci, port_array[wIndex]); | ||
5718 | + | ||
5719 | + /* Disable port */ | ||
5720 | + if (link_state == USB_SS_PORT_LS_SS_DISABLED) { | ||
5721 | + xhci_dbg(xhci, "Disable port %d\n", wIndex); | ||
5722 | + temp = xhci_port_state_to_neutral(temp); | ||
5723 | + /* | ||
5724 | + * Clear all change bits, so that we get a new | ||
5725 | + * connection event. | ||
5726 | + */ | ||
5727 | + temp |= PORT_CSC | PORT_PEC | PORT_WRC | | ||
5728 | + PORT_OCC | PORT_RC | PORT_PLC | | ||
5729 | + PORT_CEC; | ||
5730 | + xhci_writel(xhci, temp | PORT_PE, | ||
5731 | + port_array[wIndex]); | ||
5732 | + temp = xhci_readl(xhci, port_array[wIndex]); | ||
5733 | + break; | ||
5734 | + } | ||
5735 | + | ||
5736 | + /* Put link in RxDetect (enable port) */ | ||
5737 | + if (link_state == USB_SS_PORT_LS_RX_DETECT) { | ||
5738 | + xhci_dbg(xhci, "Enable port %d\n", wIndex); | ||
5739 | + xhci_set_link_state(xhci, port_array, wIndex, | ||
5740 | + link_state); | ||
5741 | + temp = xhci_readl(xhci, port_array[wIndex]); | ||
5742 | + break; | ||
5743 | + } | ||
5744 | + | ||
5745 | /* Software should not attempt to set | ||
5746 | - * port link state above '5' (Rx.Detect) and the port | ||
5747 | + * port link state above '3' (U3) and the port | ||
5748 | * must be enabled. | ||
5749 | */ | ||
5750 | if ((temp & PORT_PE) == 0 || | ||
5751 | - (link_state > USB_SS_PORT_LS_RX_DETECT)) { | ||
5752 | + (link_state > USB_SS_PORT_LS_U3)) { | ||
5753 | xhci_warn(xhci, "Cannot set link state.\n"); | ||
5754 | goto error; | ||
5755 | } | ||
5756 | @@ -938,6 +965,7 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf) | ||
5757 | int max_ports; | ||
5758 | __le32 __iomem **port_array; | ||
5759 | struct xhci_bus_state *bus_state; | ||
5760 | + bool reset_change = false; | ||
5761 | |||
5762 | max_ports = xhci_get_ports(hcd, &port_array); | ||
5763 | bus_state = &xhci->bus_state[hcd_index(hcd)]; | ||
5764 | @@ -969,6 +997,12 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf) | ||
5765 | buf[(i + 1) / 8] |= 1 << (i + 1) % 8; | ||
5766 | status = 1; | ||
5767 | } | ||
5768 | + if ((temp & PORT_RC)) | ||
5769 | + reset_change = true; | ||
5770 | + } | ||
5771 | + if (!status && !reset_change) { | ||
5772 | + xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); | ||
5773 | + clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); | ||
5774 | } | ||
5775 | spin_unlock_irqrestore(&xhci->lock, flags); | ||
5776 | return status ? retval : 0; | ||
5777 | diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c | ||
5778 | index 487bc08..35616ff 100644 | ||
5779 | --- a/drivers/usb/host/xhci-mem.c | ||
5780 | +++ b/drivers/usb/host/xhci-mem.c | ||
5781 | @@ -205,7 +205,12 @@ static int xhci_alloc_segments_for_ring(struct xhci_hcd *xhci, | ||
5782 | |||
5783 | next = xhci_segment_alloc(xhci, cycle_state, flags); | ||
5784 | if (!next) { | ||
5785 | - xhci_free_segments_for_ring(xhci, *first); | ||
5786 | + prev = *first; | ||
5787 | + while (prev) { | ||
5788 | + next = prev->next; | ||
5789 | + xhci_segment_free(xhci, prev); | ||
5790 | + prev = next; | ||
5791 | + } | ||
5792 | return -ENOMEM; | ||
5793 | } | ||
5794 | xhci_link_segments(xhci, prev, next, type); | ||
5795 | @@ -258,7 +263,7 @@ static struct xhci_ring *xhci_ring_alloc(struct xhci_hcd *xhci, | ||
5796 | return ring; | ||
5797 | |||
5798 | fail: | ||
5799 | - xhci_ring_free(xhci, ring); | ||
5800 | + kfree(ring); | ||
5801 | return NULL; | ||
5802 | } | ||
5803 | |||
5804 | @@ -1245,6 +1250,8 @@ static unsigned int xhci_microframes_to_exponent(struct usb_device *udev, | ||
5805 | static unsigned int xhci_parse_microframe_interval(struct usb_device *udev, | ||
5806 | struct usb_host_endpoint *ep) | ||
5807 | { | ||
5808 | + if (ep->desc.bInterval == 0) | ||
5809 | + return 0; | ||
5810 | return xhci_microframes_to_exponent(udev, ep, | ||
5811 | ep->desc.bInterval, 0, 15); | ||
5812 | } | ||
5813 | diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c | ||
5814 | index 4f1e265..7024536 100644 | ||
5815 | --- a/drivers/usb/host/xhci-ring.c | ||
5816 | +++ b/drivers/usb/host/xhci-ring.c | ||
5817 | @@ -1725,6 +1725,15 @@ cleanup: | ||
5818 | if (bogus_port_status) | ||
5819 | return; | ||
5820 | |||
5821 | + /* | ||
5822 | + * xHCI port-status-change events occur when the "or" of all the | ||
5823 | + * status-change bits in the portsc register changes from 0 to 1. | ||
5824 | + * New status changes won't cause an event if any other change | ||
5825 | + * bits are still set. When an event occurs, switch over to | ||
5826 | + * polling to avoid losing status changes. | ||
5827 | + */ | ||
5828 | + xhci_dbg(xhci, "%s: starting port polling.\n", __func__); | ||
5829 | + set_bit(HCD_FLAG_POLL_RH, &hcd->flags); | ||
5830 | spin_unlock(&xhci->lock); | ||
5831 | /* Pass this up to the core */ | ||
5832 | usb_hcd_poll_rh_status(hcd); | ||
5833 | @@ -3069,11 +3078,11 @@ static u32 xhci_td_remainder(unsigned int remainder) | ||
5834 | } | ||
5835 | |||
5836 | /* | ||
5837 | - * For xHCI 1.0 host controllers, TD size is the number of packets remaining in | ||
5838 | - * the TD (*not* including this TRB). | ||
5839 | + * For xHCI 1.0 host controllers, TD size is the number of max packet sized | ||
5840 | + * packets remaining in the TD (*not* including this TRB). | ||
5841 | * | ||
5842 | * Total TD packet count = total_packet_count = | ||
5843 | - * roundup(TD size in bytes / wMaxPacketSize) | ||
5844 | + * DIV_ROUND_UP(TD size in bytes / wMaxPacketSize) | ||
5845 | * | ||
5846 | * Packets transferred up to and including this TRB = packets_transferred = | ||
5847 | * rounddown(total bytes transferred including this TRB / wMaxPacketSize) | ||
5848 | @@ -3081,15 +3090,16 @@ static u32 xhci_td_remainder(unsigned int remainder) | ||
5849 | * TD size = total_packet_count - packets_transferred | ||
5850 | * | ||
5851 | * It must fit in bits 21:17, so it can't be bigger than 31. | ||
5852 | + * The last TRB in a TD must have the TD size set to zero. | ||
5853 | */ | ||
5854 | - | ||
5855 | static u32 xhci_v1_0_td_remainder(int running_total, int trb_buff_len, | ||
5856 | - unsigned int total_packet_count, struct urb *urb) | ||
5857 | + unsigned int total_packet_count, struct urb *urb, | ||
5858 | + unsigned int num_trbs_left) | ||
5859 | { | ||
5860 | int packets_transferred; | ||
5861 | |||
5862 | /* One TRB with a zero-length data packet. */ | ||
5863 | - if (running_total == 0 && trb_buff_len == 0) | ||
5864 | + if (num_trbs_left == 0 || (running_total == 0 && trb_buff_len == 0)) | ||
5865 | return 0; | ||
5866 | |||
5867 | /* All the TRB queueing functions don't count the current TRB in | ||
5868 | @@ -3098,7 +3108,9 @@ static u32 xhci_v1_0_td_remainder(int running_total, int trb_buff_len, | ||
5869 | packets_transferred = (running_total + trb_buff_len) / | ||
5870 | usb_endpoint_maxp(&urb->ep->desc); | ||
5871 | |||
5872 | - return xhci_td_remainder(total_packet_count - packets_transferred); | ||
5873 | + if ((total_packet_count - packets_transferred) > 31) | ||
5874 | + return 31 << 17; | ||
5875 | + return (total_packet_count - packets_transferred) << 17; | ||
5876 | } | ||
5877 | |||
5878 | static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | ||
5879 | @@ -3125,7 +3137,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | ||
5880 | |||
5881 | num_trbs = count_sg_trbs_needed(xhci, urb); | ||
5882 | num_sgs = urb->num_mapped_sgs; | ||
5883 | - total_packet_count = roundup(urb->transfer_buffer_length, | ||
5884 | + total_packet_count = DIV_ROUND_UP(urb->transfer_buffer_length, | ||
5885 | usb_endpoint_maxp(&urb->ep->desc)); | ||
5886 | |||
5887 | trb_buff_len = prepare_transfer(xhci, xhci->devs[slot_id], | ||
5888 | @@ -3208,7 +3220,8 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | ||
5889 | running_total); | ||
5890 | } else { | ||
5891 | remainder = xhci_v1_0_td_remainder(running_total, | ||
5892 | - trb_buff_len, total_packet_count, urb); | ||
5893 | + trb_buff_len, total_packet_count, urb, | ||
5894 | + num_trbs - 1); | ||
5895 | } | ||
5896 | length_field = TRB_LEN(trb_buff_len) | | ||
5897 | remainder | | ||
5898 | @@ -3316,7 +3329,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | ||
5899 | start_cycle = ep_ring->cycle_state; | ||
5900 | |||
5901 | running_total = 0; | ||
5902 | - total_packet_count = roundup(urb->transfer_buffer_length, | ||
5903 | + total_packet_count = DIV_ROUND_UP(urb->transfer_buffer_length, | ||
5904 | usb_endpoint_maxp(&urb->ep->desc)); | ||
5905 | /* How much data is in the first TRB? */ | ||
5906 | addr = (u64) urb->transfer_dma; | ||
5907 | @@ -3362,7 +3375,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | ||
5908 | running_total); | ||
5909 | } else { | ||
5910 | remainder = xhci_v1_0_td_remainder(running_total, | ||
5911 | - trb_buff_len, total_packet_count, urb); | ||
5912 | + trb_buff_len, total_packet_count, urb, | ||
5913 | + num_trbs - 1); | ||
5914 | } | ||
5915 | length_field = TRB_LEN(trb_buff_len) | | ||
5916 | remainder | | ||
5917 | @@ -3625,7 +3639,7 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | ||
5918 | addr = start_addr + urb->iso_frame_desc[i].offset; | ||
5919 | td_len = urb->iso_frame_desc[i].length; | ||
5920 | td_remain_len = td_len; | ||
5921 | - total_packet_count = roundup(td_len, | ||
5922 | + total_packet_count = DIV_ROUND_UP(td_len, | ||
5923 | usb_endpoint_maxp(&urb->ep->desc)); | ||
5924 | /* A zero-length transfer still involves at least one packet. */ | ||
5925 | if (total_packet_count == 0) | ||
5926 | @@ -3704,7 +3718,8 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | ||
5927 | } else { | ||
5928 | remainder = xhci_v1_0_td_remainder( | ||
5929 | running_total, trb_buff_len, | ||
5930 | - total_packet_count, urb); | ||
5931 | + total_packet_count, urb, | ||
5932 | + (trbs_per_td - j - 1)); | ||
5933 | } | ||
5934 | length_field = TRB_LEN(trb_buff_len) | | ||
5935 | remainder | | ||
5936 | diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c | ||
5937 | index a6e910b..b6586e3 100644 | ||
5938 | --- a/drivers/usb/host/xhci.c | ||
5939 | +++ b/drivers/usb/host/xhci.c | ||
5940 | @@ -480,7 +480,7 @@ static bool compliance_mode_recovery_timer_quirk_check(void) | ||
5941 | if (strstr(dmi_product_name, "Z420") || | ||
5942 | strstr(dmi_product_name, "Z620") || | ||
5943 | strstr(dmi_product_name, "Z820") || | ||
5944 | - strstr(dmi_product_name, "Z1")) | ||
5945 | + strstr(dmi_product_name, "Z1 Workstation")) | ||
5946 | return true; | ||
5947 | |||
5948 | return false; | ||
5949 | @@ -880,6 +880,11 @@ int xhci_suspend(struct xhci_hcd *xhci) | ||
5950 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | ||
5951 | u32 command; | ||
5952 | |||
5953 | + /* Don't poll the roothubs on bus suspend. */ | ||
5954 | + xhci_dbg(xhci, "%s: stopping port polling.\n", __func__); | ||
5955 | + clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); | ||
5956 | + del_timer_sync(&hcd->rh_timer); | ||
5957 | + | ||
5958 | spin_lock_irq(&xhci->lock); | ||
5959 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
5960 | clear_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags); | ||
5961 | @@ -1064,6 +1069,11 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | ||
5962 | if (xhci->quirks & XHCI_COMP_MODE_QUIRK) | ||
5963 | compliance_mode_recovery_timer_init(xhci); | ||
5964 | |||
5965 | + /* Re-enable port polling. */ | ||
5966 | + xhci_dbg(xhci, "%s: starting port polling.\n", __func__); | ||
5967 | + set_bit(HCD_FLAG_POLL_RH, &hcd->flags); | ||
5968 | + usb_hcd_poll_rh_status(hcd); | ||
5969 | + | ||
5970 | return retval; | ||
5971 | } | ||
5972 | #endif /* CONFIG_PM */ | ||
5973 | @@ -2253,7 +2263,7 @@ static bool xhci_is_async_ep(unsigned int ep_type) | ||
5974 | |||
5975 | static bool xhci_is_sync_in_ep(unsigned int ep_type) | ||
5976 | { | ||
5977 | - return (ep_type == ISOC_IN_EP || ep_type != INT_IN_EP); | ||
5978 | + return (ep_type == ISOC_IN_EP || ep_type == INT_IN_EP); | ||
5979 | } | ||
5980 | |||
5981 | static unsigned int xhci_get_ss_bw_consumed(struct xhci_bw_info *ep_bw) | ||
5982 | diff --git a/drivers/usb/musb/cppi_dma.c b/drivers/usb/musb/cppi_dma.c | ||
5983 | index 8637c1f..c5835e8 100644 | ||
5984 | --- a/drivers/usb/musb/cppi_dma.c | ||
5985 | +++ b/drivers/usb/musb/cppi_dma.c | ||
5986 | @@ -1314,6 +1314,7 @@ irqreturn_t cppi_interrupt(int irq, void *dev_id) | ||
5987 | |||
5988 | return IRQ_HANDLED; | ||
5989 | } | ||
5990 | +EXPORT_SYMBOL_GPL(cppi_interrupt); | ||
5991 | |||
5992 | /* Instantiate a software object representing a DMA controller. */ | ||
5993 | struct dma_controller *__init | ||
5994 | diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c | ||
5995 | index 26f1bef..c5630c2 100644 | ||
5996 | --- a/drivers/usb/musb/musb_core.c | ||
5997 | +++ b/drivers/usb/musb/musb_core.c | ||
5998 | @@ -2402,10 +2402,7 @@ static int __init musb_init(void) | ||
5999 | if (usb_disabled()) | ||
6000 | return 0; | ||
6001 | |||
6002 | - pr_info("%s: version " MUSB_VERSION ", " | ||
6003 | - "?dma?" | ||
6004 | - ", " | ||
6005 | - "otg (peripheral+host)", | ||
6006 | + pr_info("%s: version " MUSB_VERSION ", ?dma?, otg (peripheral+host)\n", | ||
6007 | musb_driver_name); | ||
6008 | return platform_driver_register(&musb_driver); | ||
6009 | } | ||
6010 | diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c | ||
6011 | index 360bdeb..653139b 100644 | ||
6012 | --- a/drivers/usb/serial/ftdi_sio.c | ||
6013 | +++ b/drivers/usb/serial/ftdi_sio.c | ||
6014 | @@ -881,6 +881,8 @@ static struct usb_device_id id_table_combined [] = { | ||
6015 | { USB_DEVICE(FTDI_VID, FTDI_DISTORTEC_JTAG_LOCK_PICK_PID), | ||
6016 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
6017 | { USB_DEVICE(FTDI_VID, FTDI_LUMEL_PD12_PID) }, | ||
6018 | + /* Crucible Devices */ | ||
6019 | + { USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) }, | ||
6020 | { }, /* Optional parameter entry */ | ||
6021 | { } /* Terminating entry */ | ||
6022 | }; | ||
6023 | diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h | ||
6024 | index 049b6e7..fa5d560 100644 | ||
6025 | --- a/drivers/usb/serial/ftdi_sio_ids.h | ||
6026 | +++ b/drivers/usb/serial/ftdi_sio_ids.h | ||
6027 | @@ -1259,3 +1259,9 @@ | ||
6028 | * ATI command output: Cinterion MC55i | ||
6029 | */ | ||
6030 | #define FTDI_CINTERION_MC55I_PID 0xA951 | ||
6031 | + | ||
6032 | +/* | ||
6033 | + * Product: Comet Caller ID decoder | ||
6034 | + * Manufacturer: Crucible Technologies | ||
6035 | + */ | ||
6036 | +#define FTDI_CT_COMET_PID 0x8e08 | ||
6037 | diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c | ||
6038 | index 56fed62..a3eac65 100644 | ||
6039 | --- a/drivers/usb/serial/option.c | ||
6040 | +++ b/drivers/usb/serial/option.c | ||
6041 | @@ -289,6 +289,7 @@ static void option_instat_callback(struct urb *urb); | ||
6042 | #define ALCATEL_VENDOR_ID 0x1bbb | ||
6043 | #define ALCATEL_PRODUCT_X060S_X200 0x0000 | ||
6044 | #define ALCATEL_PRODUCT_X220_X500D 0x0017 | ||
6045 | +#define ALCATEL_PRODUCT_L100V 0x011e | ||
6046 | |||
6047 | #define PIRELLI_VENDOR_ID 0x1266 | ||
6048 | #define PIRELLI_PRODUCT_C100_1 0x1002 | ||
6049 | @@ -430,9 +431,12 @@ static void option_instat_callback(struct urb *urb); | ||
6050 | #define MEDIATEK_VENDOR_ID 0x0e8d | ||
6051 | #define MEDIATEK_PRODUCT_DC_1COM 0x00a0 | ||
6052 | #define MEDIATEK_PRODUCT_DC_4COM 0x00a5 | ||
6053 | +#define MEDIATEK_PRODUCT_DC_4COM2 0x00a7 | ||
6054 | #define MEDIATEK_PRODUCT_DC_5COM 0x00a4 | ||
6055 | #define MEDIATEK_PRODUCT_7208_1COM 0x7101 | ||
6056 | #define MEDIATEK_PRODUCT_7208_2COM 0x7102 | ||
6057 | +#define MEDIATEK_PRODUCT_7103_2COM 0x7103 | ||
6058 | +#define MEDIATEK_PRODUCT_7106_2COM 0x7106 | ||
6059 | #define MEDIATEK_PRODUCT_FP_1COM 0x0003 | ||
6060 | #define MEDIATEK_PRODUCT_FP_2COM 0x0023 | ||
6061 | #define MEDIATEK_PRODUCT_FPDC_1COM 0x0043 | ||
6062 | @@ -442,6 +446,14 @@ static void option_instat_callback(struct urb *urb); | ||
6063 | #define CELLIENT_VENDOR_ID 0x2692 | ||
6064 | #define CELLIENT_PRODUCT_MEN200 0x9005 | ||
6065 | |||
6066 | +/* Hyundai Petatel Inc. products */ | ||
6067 | +#define PETATEL_VENDOR_ID 0x1ff4 | ||
6068 | +#define PETATEL_PRODUCT_NP10T 0x600e | ||
6069 | + | ||
6070 | +/* TP-LINK Incorporated products */ | ||
6071 | +#define TPLINK_VENDOR_ID 0x2357 | ||
6072 | +#define TPLINK_PRODUCT_MA180 0x0201 | ||
6073 | + | ||
6074 | /* some devices interfaces need special handling due to a number of reasons */ | ||
6075 | enum option_blacklist_reason { | ||
6076 | OPTION_BLACKLIST_NONE = 0, | ||
6077 | @@ -923,8 +935,10 @@ static const struct usb_device_id option_ids[] = { | ||
6078 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0254, 0xff, 0xff, 0xff) }, | ||
6079 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0257, 0xff, 0xff, 0xff), /* ZTE MF821 */ | ||
6080 | .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, | ||
6081 | - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0265, 0xff, 0xff, 0xff) }, | ||
6082 | - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0284, 0xff, 0xff, 0xff) }, | ||
6083 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0265, 0xff, 0xff, 0xff), /* ONDA MT8205 */ | ||
6084 | + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
6085 | + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0284, 0xff, 0xff, 0xff), /* ZTE MF880 */ | ||
6086 | + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
6087 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0317, 0xff, 0xff, 0xff) }, | ||
6088 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 0xff), | ||
6089 | .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
6090 | @@ -1191,6 +1205,8 @@ static const struct usb_device_id option_ids[] = { | ||
6091 | .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist | ||
6092 | }, | ||
6093 | { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D) }, | ||
6094 | + { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_L100V), | ||
6095 | + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
6096 | { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) }, | ||
6097 | { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) }, | ||
6098 | { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14), | ||
6099 | @@ -1295,7 +1311,14 @@ static const struct usb_device_id option_ids[] = { | ||
6100 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FP_2COM, 0x0a, 0x00, 0x00) }, | ||
6101 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_1COM, 0x0a, 0x00, 0x00) }, | ||
6102 | { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_2COM, 0x0a, 0x00, 0x00) }, | ||
6103 | + { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7103_2COM, 0xff, 0x00, 0x00) }, | ||
6104 | + { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7106_2COM, 0x02, 0x02, 0x01) }, | ||
6105 | + { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x02, 0x01) }, | ||
6106 | + { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x00, 0x00) }, | ||
6107 | { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) }, | ||
6108 | + { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T) }, | ||
6109 | + { USB_DEVICE(TPLINK_VENDOR_ID, TPLINK_PRODUCT_MA180), | ||
6110 | + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, | ||
6111 | { } /* Terminating entry */ | ||
6112 | }; | ||
6113 | MODULE_DEVICE_TABLE(usb, option_ids); | ||
6114 | diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c | ||
6115 | index 49619b4..f2a49ef 100644 | ||
6116 | --- a/drivers/video/mxsfb.c | ||
6117 | +++ b/drivers/video/mxsfb.c | ||
6118 | @@ -369,7 +369,8 @@ static void mxsfb_disable_controller(struct fb_info *fb_info) | ||
6119 | loop--; | ||
6120 | } | ||
6121 | |||
6122 | - writel(VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4 + REG_CLR); | ||
6123 | + reg = readl(host->base + LCDC_VDCTRL4); | ||
6124 | + writel(reg & ~VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4); | ||
6125 | |||
6126 | clk_disable_unprepare(host->clk); | ||
6127 | |||
6128 | diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c | ||
6129 | index 5aa43c3..52bfd07 100644 | ||
6130 | --- a/drivers/virtio/virtio_ring.c | ||
6131 | +++ b/drivers/virtio/virtio_ring.c | ||
6132 | @@ -132,6 +132,13 @@ static int vring_add_indirect(struct vring_virtqueue *vq, | ||
6133 | unsigned head; | ||
6134 | int i; | ||
6135 | |||
6136 | + /* | ||
6137 | + * We require lowmem mappings for the descriptors because | ||
6138 | + * otherwise virt_to_phys will give us bogus addresses in the | ||
6139 | + * virtqueue. | ||
6140 | + */ | ||
6141 | + gfp &= ~(__GFP_HIGHMEM | __GFP_HIGH); | ||
6142 | + | ||
6143 | desc = kmalloc((out + in) * sizeof(struct vring_desc), gfp); | ||
6144 | if (!desc) | ||
6145 | return -ENOMEM; | ||
6146 | diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c | ||
6147 | index 0067266..22be735 100644 | ||
6148 | --- a/drivers/xen/grant-table.c | ||
6149 | +++ b/drivers/xen/grant-table.c | ||
6150 | @@ -54,10 +54,6 @@ | ||
6151 | /* External tools reserve first few grant table entries. */ | ||
6152 | #define NR_RESERVED_ENTRIES 8 | ||
6153 | #define GNTTAB_LIST_END 0xffffffff | ||
6154 | -#define GREFS_PER_GRANT_FRAME \ | ||
6155 | -(grant_table_version == 1 ? \ | ||
6156 | -(PAGE_SIZE / sizeof(struct grant_entry_v1)) : \ | ||
6157 | -(PAGE_SIZE / sizeof(union grant_entry_v2))) | ||
6158 | |||
6159 | static grant_ref_t **gnttab_list; | ||
6160 | static unsigned int nr_grant_frames; | ||
6161 | @@ -152,6 +148,7 @@ static struct gnttab_ops *gnttab_interface; | ||
6162 | static grant_status_t *grstatus; | ||
6163 | |||
6164 | static int grant_table_version; | ||
6165 | +static int grefs_per_grant_frame; | ||
6166 | |||
6167 | static struct gnttab_free_callback *gnttab_free_callback_list; | ||
6168 | |||
6169 | @@ -766,12 +763,14 @@ static int grow_gnttab_list(unsigned int more_frames) | ||
6170 | unsigned int new_nr_grant_frames, extra_entries, i; | ||
6171 | unsigned int nr_glist_frames, new_nr_glist_frames; | ||
6172 | |||
6173 | + BUG_ON(grefs_per_grant_frame == 0); | ||
6174 | + | ||
6175 | new_nr_grant_frames = nr_grant_frames + more_frames; | ||
6176 | - extra_entries = more_frames * GREFS_PER_GRANT_FRAME; | ||
6177 | + extra_entries = more_frames * grefs_per_grant_frame; | ||
6178 | |||
6179 | - nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; | ||
6180 | + nr_glist_frames = (nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP; | ||
6181 | new_nr_glist_frames = | ||
6182 | - (new_nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; | ||
6183 | + (new_nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP; | ||
6184 | for (i = nr_glist_frames; i < new_nr_glist_frames; i++) { | ||
6185 | gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_ATOMIC); | ||
6186 | if (!gnttab_list[i]) | ||
6187 | @@ -779,12 +778,12 @@ static int grow_gnttab_list(unsigned int more_frames) | ||
6188 | } | ||
6189 | |||
6190 | |||
6191 | - for (i = GREFS_PER_GRANT_FRAME * nr_grant_frames; | ||
6192 | - i < GREFS_PER_GRANT_FRAME * new_nr_grant_frames - 1; i++) | ||
6193 | + for (i = grefs_per_grant_frame * nr_grant_frames; | ||
6194 | + i < grefs_per_grant_frame * new_nr_grant_frames - 1; i++) | ||
6195 | gnttab_entry(i) = i + 1; | ||
6196 | |||
6197 | gnttab_entry(i) = gnttab_free_head; | ||
6198 | - gnttab_free_head = GREFS_PER_GRANT_FRAME * nr_grant_frames; | ||
6199 | + gnttab_free_head = grefs_per_grant_frame * nr_grant_frames; | ||
6200 | gnttab_free_count += extra_entries; | ||
6201 | |||
6202 | nr_grant_frames = new_nr_grant_frames; | ||
6203 | @@ -904,7 +903,8 @@ EXPORT_SYMBOL_GPL(gnttab_unmap_refs); | ||
6204 | |||
6205 | static unsigned nr_status_frames(unsigned nr_grant_frames) | ||
6206 | { | ||
6207 | - return (nr_grant_frames * GREFS_PER_GRANT_FRAME + SPP - 1) / SPP; | ||
6208 | + BUG_ON(grefs_per_grant_frame == 0); | ||
6209 | + return (nr_grant_frames * grefs_per_grant_frame + SPP - 1) / SPP; | ||
6210 | } | ||
6211 | |||
6212 | static int gnttab_map_frames_v1(unsigned long *frames, unsigned int nr_gframes) | ||
6213 | @@ -1062,6 +1062,7 @@ static void gnttab_request_version(void) | ||
6214 | rc = HYPERVISOR_grant_table_op(GNTTABOP_set_version, &gsv, 1); | ||
6215 | if (rc == 0 && gsv.version == 2) { | ||
6216 | grant_table_version = 2; | ||
6217 | + grefs_per_grant_frame = PAGE_SIZE / sizeof(union grant_entry_v2); | ||
6218 | gnttab_interface = &gnttab_v2_ops; | ||
6219 | } else if (grant_table_version == 2) { | ||
6220 | /* | ||
6221 | @@ -1074,17 +1075,17 @@ static void gnttab_request_version(void) | ||
6222 | panic("we need grant tables version 2, but only version 1 is available"); | ||
6223 | } else { | ||
6224 | grant_table_version = 1; | ||
6225 | + grefs_per_grant_frame = PAGE_SIZE / sizeof(struct grant_entry_v1); | ||
6226 | gnttab_interface = &gnttab_v1_ops; | ||
6227 | } | ||
6228 | printk(KERN_INFO "Grant tables using version %d layout.\n", | ||
6229 | grant_table_version); | ||
6230 | } | ||
6231 | |||
6232 | -int gnttab_resume(void) | ||
6233 | +static int gnttab_setup(void) | ||
6234 | { | ||
6235 | unsigned int max_nr_gframes; | ||
6236 | |||
6237 | - gnttab_request_version(); | ||
6238 | max_nr_gframes = gnttab_max_grant_frames(); | ||
6239 | if (max_nr_gframes < nr_grant_frames) | ||
6240 | return -ENOSYS; | ||
6241 | @@ -1107,6 +1108,12 @@ int gnttab_resume(void) | ||
6242 | return 0; | ||
6243 | } | ||
6244 | |||
6245 | +int gnttab_resume(void) | ||
6246 | +{ | ||
6247 | + gnttab_request_version(); | ||
6248 | + return gnttab_setup(); | ||
6249 | +} | ||
6250 | + | ||
6251 | int gnttab_suspend(void) | ||
6252 | { | ||
6253 | gnttab_interface->unmap_frames(); | ||
6254 | @@ -1118,9 +1125,10 @@ static int gnttab_expand(unsigned int req_entries) | ||
6255 | int rc; | ||
6256 | unsigned int cur, extra; | ||
6257 | |||
6258 | + BUG_ON(grefs_per_grant_frame == 0); | ||
6259 | cur = nr_grant_frames; | ||
6260 | - extra = ((req_entries + (GREFS_PER_GRANT_FRAME-1)) / | ||
6261 | - GREFS_PER_GRANT_FRAME); | ||
6262 | + extra = ((req_entries + (grefs_per_grant_frame-1)) / | ||
6263 | + grefs_per_grant_frame); | ||
6264 | if (cur + extra > gnttab_max_grant_frames()) | ||
6265 | return -ENOSPC; | ||
6266 | |||
6267 | @@ -1138,21 +1146,23 @@ int gnttab_init(void) | ||
6268 | unsigned int nr_init_grefs; | ||
6269 | int ret; | ||
6270 | |||
6271 | + gnttab_request_version(); | ||
6272 | nr_grant_frames = 1; | ||
6273 | boot_max_nr_grant_frames = __max_nr_grant_frames(); | ||
6274 | |||
6275 | /* Determine the maximum number of frames required for the | ||
6276 | * grant reference free list on the current hypervisor. | ||
6277 | */ | ||
6278 | + BUG_ON(grefs_per_grant_frame == 0); | ||
6279 | max_nr_glist_frames = (boot_max_nr_grant_frames * | ||
6280 | - GREFS_PER_GRANT_FRAME / RPP); | ||
6281 | + grefs_per_grant_frame / RPP); | ||
6282 | |||
6283 | gnttab_list = kmalloc(max_nr_glist_frames * sizeof(grant_ref_t *), | ||
6284 | GFP_KERNEL); | ||
6285 | if (gnttab_list == NULL) | ||
6286 | return -ENOMEM; | ||
6287 | |||
6288 | - nr_glist_frames = (nr_grant_frames * GREFS_PER_GRANT_FRAME + RPP - 1) / RPP; | ||
6289 | + nr_glist_frames = (nr_grant_frames * grefs_per_grant_frame + RPP - 1) / RPP; | ||
6290 | for (i = 0; i < nr_glist_frames; i++) { | ||
6291 | gnttab_list[i] = (grant_ref_t *)__get_free_page(GFP_KERNEL); | ||
6292 | if (gnttab_list[i] == NULL) { | ||
6293 | @@ -1161,12 +1171,12 @@ int gnttab_init(void) | ||
6294 | } | ||
6295 | } | ||
6296 | |||
6297 | - if (gnttab_resume() < 0) { | ||
6298 | + if (gnttab_setup() < 0) { | ||
6299 | ret = -ENODEV; | ||
6300 | goto ini_nomem; | ||
6301 | } | ||
6302 | |||
6303 | - nr_init_grefs = nr_grant_frames * GREFS_PER_GRANT_FRAME; | ||
6304 | + nr_init_grefs = nr_grant_frames * grefs_per_grant_frame; | ||
6305 | |||
6306 | for (i = NR_RESERVED_ENTRIES; i < nr_init_grefs - 1; i++) | ||
6307 | gnttab_entry(i) = i + 1; | ||
6308 | diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c | ||
6309 | index 790b3cd..772428d 100644 | ||
6310 | --- a/fs/binfmt_misc.c | ||
6311 | +++ b/fs/binfmt_misc.c | ||
6312 | @@ -176,7 +176,10 @@ static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs) | ||
6313 | goto _error; | ||
6314 | bprm->argc ++; | ||
6315 | |||
6316 | - bprm->interp = iname; /* for binfmt_script */ | ||
6317 | + /* Update interp in case binfmt_script needs it. */ | ||
6318 | + retval = bprm_change_interp(iname, bprm); | ||
6319 | + if (retval < 0) | ||
6320 | + goto _error; | ||
6321 | |||
6322 | interp_file = open_exec (iname); | ||
6323 | retval = PTR_ERR (interp_file); | ||
6324 | diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c | ||
6325 | index d3b8c1f..df49d48 100644 | ||
6326 | --- a/fs/binfmt_script.c | ||
6327 | +++ b/fs/binfmt_script.c | ||
6328 | @@ -82,7 +82,9 @@ static int load_script(struct linux_binprm *bprm,struct pt_regs *regs) | ||
6329 | retval = copy_strings_kernel(1, &i_name, bprm); | ||
6330 | if (retval) return retval; | ||
6331 | bprm->argc++; | ||
6332 | - bprm->interp = interp; | ||
6333 | + retval = bprm_change_interp(interp, bprm); | ||
6334 | + if (retval < 0) | ||
6335 | + return retval; | ||
6336 | |||
6337 | /* | ||
6338 | * OK, now restart the process with the interpreter's dentry. | ||
6339 | diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c | ||
6340 | index 1ced2d8..a2e0b94 100644 | ||
6341 | --- a/fs/ceph/addr.c | ||
6342 | +++ b/fs/ceph/addr.c | ||
6343 | @@ -267,6 +267,14 @@ static void finish_read(struct ceph_osd_request *req, struct ceph_msg *msg) | ||
6344 | kfree(req->r_pages); | ||
6345 | } | ||
6346 | |||
6347 | +static void ceph_unlock_page_vector(struct page **pages, int num_pages) | ||
6348 | +{ | ||
6349 | + int i; | ||
6350 | + | ||
6351 | + for (i = 0; i < num_pages; i++) | ||
6352 | + unlock_page(pages[i]); | ||
6353 | +} | ||
6354 | + | ||
6355 | /* | ||
6356 | * start an async read(ahead) operation. return nr_pages we submitted | ||
6357 | * a read for on success, or negative error code. | ||
6358 | @@ -308,8 +316,8 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max) | ||
6359 | NULL, 0, | ||
6360 | ci->i_truncate_seq, ci->i_truncate_size, | ||
6361 | NULL, false, 1, 0); | ||
6362 | - if (!req) | ||
6363 | - return -ENOMEM; | ||
6364 | + if (IS_ERR(req)) | ||
6365 | + return PTR_ERR(req); | ||
6366 | |||
6367 | /* build page vector */ | ||
6368 | nr_pages = len >> PAGE_CACHE_SHIFT; | ||
6369 | @@ -347,6 +355,7 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max) | ||
6370 | return nr_pages; | ||
6371 | |||
6372 | out_pages: | ||
6373 | + ceph_unlock_page_vector(pages, nr_pages); | ||
6374 | ceph_release_page_vector(pages, nr_pages); | ||
6375 | out: | ||
6376 | ceph_osdc_put_request(req); | ||
6377 | @@ -831,8 +840,8 @@ get_more_pages: | ||
6378 | ci->i_truncate_size, | ||
6379 | &inode->i_mtime, true, 1, 0); | ||
6380 | |||
6381 | - if (!req) { | ||
6382 | - rc = -ENOMEM; | ||
6383 | + if (IS_ERR(req)) { | ||
6384 | + rc = PTR_ERR(req); | ||
6385 | unlock_page(page); | ||
6386 | break; | ||
6387 | } | ||
6388 | diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c | ||
6389 | index 620daad..e7d4077 100644 | ||
6390 | --- a/fs/ceph/caps.c | ||
6391 | +++ b/fs/ceph/caps.c | ||
6392 | @@ -1349,11 +1349,15 @@ int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask) | ||
6393 | if (!ci->i_head_snapc) | ||
6394 | ci->i_head_snapc = ceph_get_snap_context( | ||
6395 | ci->i_snap_realm->cached_context); | ||
6396 | - dout(" inode %p now dirty snapc %p\n", &ci->vfs_inode, | ||
6397 | - ci->i_head_snapc); | ||
6398 | + dout(" inode %p now dirty snapc %p auth cap %p\n", | ||
6399 | + &ci->vfs_inode, ci->i_head_snapc, ci->i_auth_cap); | ||
6400 | BUG_ON(!list_empty(&ci->i_dirty_item)); | ||
6401 | spin_lock(&mdsc->cap_dirty_lock); | ||
6402 | - list_add(&ci->i_dirty_item, &mdsc->cap_dirty); | ||
6403 | + if (ci->i_auth_cap) | ||
6404 | + list_add(&ci->i_dirty_item, &mdsc->cap_dirty); | ||
6405 | + else | ||
6406 | + list_add(&ci->i_dirty_item, | ||
6407 | + &mdsc->cap_dirty_migrating); | ||
6408 | spin_unlock(&mdsc->cap_dirty_lock); | ||
6409 | if (ci->i_flushing_caps == 0) { | ||
6410 | ihold(inode); | ||
6411 | @@ -2388,7 +2392,7 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant, | ||
6412 | &atime); | ||
6413 | |||
6414 | /* max size increase? */ | ||
6415 | - if (max_size != ci->i_max_size) { | ||
6416 | + if (ci->i_auth_cap == cap && max_size != ci->i_max_size) { | ||
6417 | dout("max_size %lld -> %llu\n", ci->i_max_size, max_size); | ||
6418 | ci->i_max_size = max_size; | ||
6419 | if (max_size >= ci->i_wanted_max_size) { | ||
6420 | @@ -2745,6 +2749,7 @@ static void handle_cap_import(struct ceph_mds_client *mdsc, | ||
6421 | |||
6422 | /* make sure we re-request max_size, if necessary */ | ||
6423 | spin_lock(&ci->i_ceph_lock); | ||
6424 | + ci->i_wanted_max_size = 0; /* reset */ | ||
6425 | ci->i_requested_max_size = 0; | ||
6426 | spin_unlock(&ci->i_ceph_lock); | ||
6427 | } | ||
6428 | @@ -2840,8 +2845,6 @@ void ceph_handle_caps(struct ceph_mds_session *session, | ||
6429 | case CEPH_CAP_OP_IMPORT: | ||
6430 | handle_cap_import(mdsc, inode, h, session, | ||
6431 | snaptrace, snaptrace_len); | ||
6432 | - ceph_check_caps(ceph_inode(inode), 0, session); | ||
6433 | - goto done_unlocked; | ||
6434 | } | ||
6435 | |||
6436 | /* the rest require a cap */ | ||
6437 | @@ -2858,6 +2861,7 @@ void ceph_handle_caps(struct ceph_mds_session *session, | ||
6438 | switch (op) { | ||
6439 | case CEPH_CAP_OP_REVOKE: | ||
6440 | case CEPH_CAP_OP_GRANT: | ||
6441 | + case CEPH_CAP_OP_IMPORT: | ||
6442 | handle_cap_grant(inode, h, session, cap, msg->middle); | ||
6443 | goto done_unlocked; | ||
6444 | |||
6445 | diff --git a/fs/ceph/file.c b/fs/ceph/file.c | ||
6446 | index ecebbc0..5840d2a 100644 | ||
6447 | --- a/fs/ceph/file.c | ||
6448 | +++ b/fs/ceph/file.c | ||
6449 | @@ -536,8 +536,8 @@ more: | ||
6450 | do_sync, | ||
6451 | ci->i_truncate_seq, ci->i_truncate_size, | ||
6452 | &mtime, false, 2, page_align); | ||
6453 | - if (!req) | ||
6454 | - return -ENOMEM; | ||
6455 | + if (IS_ERR(req)) | ||
6456 | + return PTR_ERR(req); | ||
6457 | |||
6458 | if (file->f_flags & O_DIRECT) { | ||
6459 | pages = ceph_get_direct_page_vector(data, num_pages, false); | ||
6460 | diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c | ||
6461 | index 4b5762e..81613bc 100644 | ||
6462 | --- a/fs/ceph/inode.c | ||
6463 | +++ b/fs/ceph/inode.c | ||
6464 | @@ -1466,7 +1466,7 @@ void __ceph_do_pending_vmtruncate(struct inode *inode) | ||
6465 | { | ||
6466 | struct ceph_inode_info *ci = ceph_inode(inode); | ||
6467 | u64 to; | ||
6468 | - int wrbuffer_refs, wake = 0; | ||
6469 | + int wrbuffer_refs, finish = 0; | ||
6470 | |||
6471 | retry: | ||
6472 | spin_lock(&ci->i_ceph_lock); | ||
6473 | @@ -1498,15 +1498,18 @@ retry: | ||
6474 | truncate_inode_pages(inode->i_mapping, to); | ||
6475 | |||
6476 | spin_lock(&ci->i_ceph_lock); | ||
6477 | - ci->i_truncate_pending--; | ||
6478 | - if (ci->i_truncate_pending == 0) | ||
6479 | - wake = 1; | ||
6480 | + if (to == ci->i_truncate_size) { | ||
6481 | + ci->i_truncate_pending = 0; | ||
6482 | + finish = 1; | ||
6483 | + } | ||
6484 | spin_unlock(&ci->i_ceph_lock); | ||
6485 | + if (!finish) | ||
6486 | + goto retry; | ||
6487 | |||
6488 | if (wrbuffer_refs == 0) | ||
6489 | ceph_check_caps(ci, CHECK_CAPS_AUTHONLY, NULL); | ||
6490 | - if (wake) | ||
6491 | - wake_up_all(&ci->i_cap_wq); | ||
6492 | + | ||
6493 | + wake_up_all(&ci->i_cap_wq); | ||
6494 | } | ||
6495 | |||
6496 | |||
6497 | diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c | ||
6498 | index 1bcf712..0d9864f 100644 | ||
6499 | --- a/fs/ceph/mds_client.c | ||
6500 | +++ b/fs/ceph/mds_client.c | ||
6501 | @@ -1876,9 +1876,14 @@ finish: | ||
6502 | static void __wake_requests(struct ceph_mds_client *mdsc, | ||
6503 | struct list_head *head) | ||
6504 | { | ||
6505 | - struct ceph_mds_request *req, *nreq; | ||
6506 | + struct ceph_mds_request *req; | ||
6507 | + LIST_HEAD(tmp_list); | ||
6508 | + | ||
6509 | + list_splice_init(head, &tmp_list); | ||
6510 | |||
6511 | - list_for_each_entry_safe(req, nreq, head, r_wait) { | ||
6512 | + while (!list_empty(&tmp_list)) { | ||
6513 | + req = list_entry(tmp_list.next, | ||
6514 | + struct ceph_mds_request, r_wait); | ||
6515 | list_del_init(&req->r_wait); | ||
6516 | __do_request(mdsc, req); | ||
6517 | } | ||
6518 | diff --git a/fs/ceph/super.c b/fs/ceph/super.c | ||
6519 | index b982239..2f6212e 100644 | ||
6520 | --- a/fs/ceph/super.c | ||
6521 | +++ b/fs/ceph/super.c | ||
6522 | @@ -388,8 +388,6 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root) | ||
6523 | seq_printf(m, ",mount_timeout=%d", opt->mount_timeout); | ||
6524 | if (opt->osd_idle_ttl != CEPH_OSD_IDLE_TTL_DEFAULT) | ||
6525 | seq_printf(m, ",osd_idle_ttl=%d", opt->osd_idle_ttl); | ||
6526 | - if (opt->osd_timeout != CEPH_OSD_TIMEOUT_DEFAULT) | ||
6527 | - seq_printf(m, ",osdtimeout=%d", opt->osd_timeout); | ||
6528 | if (opt->osd_keepalive_timeout != CEPH_OSD_KEEPALIVE_DEFAULT) | ||
6529 | seq_printf(m, ",osdkeepalivetimeout=%d", | ||
6530 | opt->osd_keepalive_timeout); | ||
6531 | diff --git a/fs/eventpoll.c b/fs/eventpoll.c | ||
6532 | index eedec84..3b032dd 100644 | ||
6533 | --- a/fs/eventpoll.c | ||
6534 | +++ b/fs/eventpoll.c | ||
6535 | @@ -1285,7 +1285,7 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even | ||
6536 | * otherwise we might miss an event that happens between the | ||
6537 | * f_op->poll() call and the new event set registering. | ||
6538 | */ | ||
6539 | - epi->event.events = event->events; | ||
6540 | + epi->event.events = event->events; /* need barrier below */ | ||
6541 | pt._key = event->events; | ||
6542 | epi->event.data = event->data; /* protected by mtx */ | ||
6543 | if (epi->event.events & EPOLLWAKEUP) { | ||
6544 | @@ -1296,6 +1296,26 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, struct epoll_even | ||
6545 | } | ||
6546 | |||
6547 | /* | ||
6548 | + * The following barrier has two effects: | ||
6549 | + * | ||
6550 | + * 1) Flush epi changes above to other CPUs. This ensures | ||
6551 | + * we do not miss events from ep_poll_callback if an | ||
6552 | + * event occurs immediately after we call f_op->poll(). | ||
6553 | + * We need this because we did not take ep->lock while | ||
6554 | + * changing epi above (but ep_poll_callback does take | ||
6555 | + * ep->lock). | ||
6556 | + * | ||
6557 | + * 2) We also need to ensure we do not miss _past_ events | ||
6558 | + * when calling f_op->poll(). This barrier also | ||
6559 | + * pairs with the barrier in wq_has_sleeper (see | ||
6560 | + * comments for wq_has_sleeper). | ||
6561 | + * | ||
6562 | + * This barrier will now guarantee ep_poll_callback or f_op->poll | ||
6563 | + * (or both) will notice the readiness of an item. | ||
6564 | + */ | ||
6565 | + smp_mb(); | ||
6566 | + | ||
6567 | + /* | ||
6568 | * Get current event bits. We can safely use the file* here because | ||
6569 | * its usage count has been increased by the caller of this function. | ||
6570 | */ | ||
6571 | diff --git a/fs/exec.c b/fs/exec.c | ||
6572 | index fab2c6d..59896ae 100644 | ||
6573 | --- a/fs/exec.c | ||
6574 | +++ b/fs/exec.c | ||
6575 | @@ -1202,9 +1202,24 @@ void free_bprm(struct linux_binprm *bprm) | ||
6576 | mutex_unlock(¤t->signal->cred_guard_mutex); | ||
6577 | abort_creds(bprm->cred); | ||
6578 | } | ||
6579 | + /* If a binfmt changed the interp, free it. */ | ||
6580 | + if (bprm->interp != bprm->filename) | ||
6581 | + kfree(bprm->interp); | ||
6582 | kfree(bprm); | ||
6583 | } | ||
6584 | |||
6585 | +int bprm_change_interp(char *interp, struct linux_binprm *bprm) | ||
6586 | +{ | ||
6587 | + /* If a binfmt changed the interp, free it first. */ | ||
6588 | + if (bprm->interp != bprm->filename) | ||
6589 | + kfree(bprm->interp); | ||
6590 | + bprm->interp = kstrdup(interp, GFP_KERNEL); | ||
6591 | + if (!bprm->interp) | ||
6592 | + return -ENOMEM; | ||
6593 | + return 0; | ||
6594 | +} | ||
6595 | +EXPORT_SYMBOL(bprm_change_interp); | ||
6596 | + | ||
6597 | /* | ||
6598 | * install the new credentials for this executable | ||
6599 | */ | ||
6600 | diff --git a/fs/ext4/acl.c b/fs/ext4/acl.c | ||
6601 | index a5c29bb..8535c45 100644 | ||
6602 | --- a/fs/ext4/acl.c | ||
6603 | +++ b/fs/ext4/acl.c | ||
6604 | @@ -410,8 +410,10 @@ ext4_xattr_set_acl(struct dentry *dentry, const char *name, const void *value, | ||
6605 | |||
6606 | retry: | ||
6607 | handle = ext4_journal_start(inode, EXT4_DATA_TRANS_BLOCKS(inode->i_sb)); | ||
6608 | - if (IS_ERR(handle)) | ||
6609 | - return PTR_ERR(handle); | ||
6610 | + if (IS_ERR(handle)) { | ||
6611 | + error = PTR_ERR(handle); | ||
6612 | + goto release_and_out; | ||
6613 | + } | ||
6614 | error = ext4_set_acl(handle, inode, type, acl); | ||
6615 | ext4_journal_stop(handle); | ||
6616 | if (error == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) | ||
6617 | diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c | ||
6618 | index 741bb94..31be24d 100644 | ||
6619 | --- a/fs/ext4/extents.c | ||
6620 | +++ b/fs/ext4/extents.c | ||
6621 | @@ -2176,13 +2176,14 @@ ext4_ext_in_cache(struct inode *inode, ext4_lblk_t block, | ||
6622 | * removes index from the index block. | ||
6623 | */ | ||
6624 | static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode, | ||
6625 | - struct ext4_ext_path *path) | ||
6626 | + struct ext4_ext_path *path, int depth) | ||
6627 | { | ||
6628 | int err; | ||
6629 | ext4_fsblk_t leaf; | ||
6630 | |||
6631 | /* free index block */ | ||
6632 | - path--; | ||
6633 | + depth--; | ||
6634 | + path = path + depth; | ||
6635 | leaf = ext4_idx_pblock(path->p_idx); | ||
6636 | if (unlikely(path->p_hdr->eh_entries == 0)) { | ||
6637 | EXT4_ERROR_INODE(inode, "path->p_hdr->eh_entries == 0"); | ||
6638 | @@ -2207,6 +2208,19 @@ static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode, | ||
6639 | |||
6640 | ext4_free_blocks(handle, inode, NULL, leaf, 1, | ||
6641 | EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET); | ||
6642 | + | ||
6643 | + while (--depth >= 0) { | ||
6644 | + if (path->p_idx != EXT_FIRST_INDEX(path->p_hdr)) | ||
6645 | + break; | ||
6646 | + path--; | ||
6647 | + err = ext4_ext_get_access(handle, inode, path); | ||
6648 | + if (err) | ||
6649 | + break; | ||
6650 | + path->p_idx->ei_block = (path+1)->p_idx->ei_block; | ||
6651 | + err = ext4_ext_dirty(handle, inode, path); | ||
6652 | + if (err) | ||
6653 | + break; | ||
6654 | + } | ||
6655 | return err; | ||
6656 | } | ||
6657 | |||
6658 | @@ -2540,7 +2554,7 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode, | ||
6659 | /* if this leaf is free, then we should | ||
6660 | * remove it from index block above */ | ||
6661 | if (err == 0 && eh->eh_entries == 0 && path[depth].p_bh != NULL) | ||
6662 | - err = ext4_ext_rm_idx(handle, inode, path + depth); | ||
6663 | + err = ext4_ext_rm_idx(handle, inode, path, depth); | ||
6664 | |||
6665 | out: | ||
6666 | return err; | ||
6667 | @@ -2741,7 +2755,7 @@ cont: | ||
6668 | /* index is empty, remove it; | ||
6669 | * handle must be already prepared by the | ||
6670 | * truncatei_leaf() */ | ||
6671 | - err = ext4_ext_rm_idx(handle, inode, path + i); | ||
6672 | + err = ext4_ext_rm_idx(handle, inode, path, i); | ||
6673 | } | ||
6674 | /* root level has p_bh == NULL, brelse() eats this */ | ||
6675 | brelse(path[i].p_bh); | ||
6676 | diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c | ||
6677 | index cc2d77c..c7c6e09 100644 | ||
6678 | --- a/fs/ext4/ialloc.c | ||
6679 | +++ b/fs/ext4/ialloc.c | ||
6680 | @@ -753,7 +753,6 @@ got: | ||
6681 | |||
6682 | BUFFER_TRACE(block_bitmap_bh, "dirty block bitmap"); | ||
6683 | err = ext4_handle_dirty_metadata(handle, NULL, block_bitmap_bh); | ||
6684 | - brelse(block_bitmap_bh); | ||
6685 | |||
6686 | /* recheck and clear flag under lock if we still need to */ | ||
6687 | ext4_lock_group(sb, group); | ||
6688 | @@ -766,6 +765,7 @@ got: | ||
6689 | ext4_group_desc_csum_set(sb, group, gdp); | ||
6690 | } | ||
6691 | ext4_unlock_group(sb, group); | ||
6692 | + brelse(block_bitmap_bh); | ||
6693 | |||
6694 | if (err) | ||
6695 | goto fail; | ||
6696 | diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c | ||
6697 | index 2ce16af..7e424eb 100644 | ||
6698 | --- a/fs/ext4/inode.c | ||
6699 | +++ b/fs/ext4/inode.c | ||
6700 | @@ -1501,6 +1501,8 @@ static void ext4_da_block_invalidatepages(struct mpage_da_data *mpd) | ||
6701 | |||
6702 | index = mpd->first_page; | ||
6703 | end = mpd->next_page - 1; | ||
6704 | + | ||
6705 | + pagevec_init(&pvec, 0); | ||
6706 | while (index <= end) { | ||
6707 | nr_pages = pagevec_lookup(&pvec, mapping, index, PAGEVEC_SIZE); | ||
6708 | if (nr_pages == 0) | ||
6709 | diff --git a/fs/ext4/super.c b/fs/ext4/super.c | ||
6710 | index 2b5fb60..f4665ec 100644 | ||
6711 | --- a/fs/ext4/super.c | ||
6712 | +++ b/fs/ext4/super.c | ||
6713 | @@ -1643,9 +1643,7 @@ static int parse_options(char *options, struct super_block *sb, | ||
6714 | unsigned int *journal_ioprio, | ||
6715 | int is_remount) | ||
6716 | { | ||
6717 | -#ifdef CONFIG_QUOTA | ||
6718 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
6719 | -#endif | ||
6720 | char *p; | ||
6721 | substring_t args[MAX_OPT_ARGS]; | ||
6722 | int token; | ||
6723 | @@ -1694,6 +1692,16 @@ static int parse_options(char *options, struct super_block *sb, | ||
6724 | } | ||
6725 | } | ||
6726 | #endif | ||
6727 | + if (test_opt(sb, DIOREAD_NOLOCK)) { | ||
6728 | + int blocksize = | ||
6729 | + BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size); | ||
6730 | + | ||
6731 | + if (blocksize < PAGE_CACHE_SIZE) { | ||
6732 | + ext4_msg(sb, KERN_ERR, "can't mount with " | ||
6733 | + "dioread_nolock if block size != PAGE_SIZE"); | ||
6734 | + return 0; | ||
6735 | + } | ||
6736 | + } | ||
6737 | return 1; | ||
6738 | } | ||
6739 | |||
6740 | @@ -2184,7 +2192,9 @@ static void ext4_orphan_cleanup(struct super_block *sb, | ||
6741 | __func__, inode->i_ino, inode->i_size); | ||
6742 | jbd_debug(2, "truncating inode %lu to %lld bytes\n", | ||
6743 | inode->i_ino, inode->i_size); | ||
6744 | + mutex_lock(&inode->i_mutex); | ||
6745 | ext4_truncate(inode); | ||
6746 | + mutex_unlock(&inode->i_mutex); | ||
6747 | nr_truncates++; | ||
6748 | } else { | ||
6749 | ext4_msg(sb, KERN_DEBUG, | ||
6750 | @@ -3409,15 +3419,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | ||
6751 | clear_opt(sb, DELALLOC); | ||
6752 | } | ||
6753 | |||
6754 | - blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); | ||
6755 | - if (test_opt(sb, DIOREAD_NOLOCK)) { | ||
6756 | - if (blocksize < PAGE_SIZE) { | ||
6757 | - ext4_msg(sb, KERN_ERR, "can't mount with " | ||
6758 | - "dioread_nolock if block size != PAGE_SIZE"); | ||
6759 | - goto failed_mount; | ||
6760 | - } | ||
6761 | - } | ||
6762 | - | ||
6763 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | | ||
6764 | (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0); | ||
6765 | |||
6766 | @@ -3459,6 +3460,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | ||
6767 | if (!ext4_feature_set_ok(sb, (sb->s_flags & MS_RDONLY))) | ||
6768 | goto failed_mount; | ||
6769 | |||
6770 | + blocksize = BLOCK_SIZE << le32_to_cpu(es->s_log_block_size); | ||
6771 | if (blocksize < EXT4_MIN_BLOCK_SIZE || | ||
6772 | blocksize > EXT4_MAX_BLOCK_SIZE) { | ||
6773 | ext4_msg(sb, KERN_ERR, | ||
6774 | @@ -4694,7 +4696,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | ||
6775 | } | ||
6776 | |||
6777 | ext4_setup_system_zone(sb); | ||
6778 | - if (sbi->s_journal == NULL) | ||
6779 | + if (sbi->s_journal == NULL && !(old_sb_flags & MS_RDONLY)) | ||
6780 | ext4_commit_super(sb, 1); | ||
6781 | |||
6782 | unlock_super(sb); | ||
6783 | diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c | ||
6784 | index fb1ab953..2fb20f5 100644 | ||
6785 | --- a/fs/jbd2/transaction.c | ||
6786 | +++ b/fs/jbd2/transaction.c | ||
6787 | @@ -209,7 +209,8 @@ repeat: | ||
6788 | if (!new_transaction) | ||
6789 | goto alloc_transaction; | ||
6790 | write_lock(&journal->j_state_lock); | ||
6791 | - if (!journal->j_running_transaction) { | ||
6792 | + if (!journal->j_running_transaction && | ||
6793 | + !journal->j_barrier_count) { | ||
6794 | jbd2_get_transaction(journal, new_transaction); | ||
6795 | new_transaction = NULL; | ||
6796 | } | ||
6797 | diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c | ||
6798 | index 0c96eb5..0331072 100644 | ||
6799 | --- a/fs/jffs2/nodemgmt.c | ||
6800 | +++ b/fs/jffs2/nodemgmt.c | ||
6801 | @@ -417,14 +417,16 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, | ||
6802 | spin_unlock(&c->erase_completion_lock); | ||
6803 | |||
6804 | ret = jffs2_prealloc_raw_node_refs(c, jeb, 1); | ||
6805 | - if (ret) | ||
6806 | - return ret; | ||
6807 | + | ||
6808 | /* Just lock it again and continue. Nothing much can change because | ||
6809 | we hold c->alloc_sem anyway. In fact, it's not entirely clear why | ||
6810 | we hold c->erase_completion_lock in the majority of this function... | ||
6811 | but that's a question for another (more caffeine-rich) day. */ | ||
6812 | spin_lock(&c->erase_completion_lock); | ||
6813 | |||
6814 | + if (ret) | ||
6815 | + return ret; | ||
6816 | + | ||
6817 | waste = jeb->free_size; | ||
6818 | jffs2_link_node_ref(c, jeb, | ||
6819 | (jeb->offset + c->sector_size - waste) | REF_OBSOLETE, | ||
6820 | diff --git a/fs/nfs/client.c b/fs/nfs/client.c | ||
6821 | index 0e7cd89..b59f1d8 100644 | ||
6822 | --- a/fs/nfs/client.c | ||
6823 | +++ b/fs/nfs/client.c | ||
6824 | @@ -614,8 +614,7 @@ EXPORT_SYMBOL_GPL(nfs_create_rpc_client); | ||
6825 | */ | ||
6826 | static void nfs_destroy_server(struct nfs_server *server) | ||
6827 | { | ||
6828 | - if (!(server->flags & NFS_MOUNT_LOCAL_FLOCK) || | ||
6829 | - !(server->flags & NFS_MOUNT_LOCAL_FCNTL)) | ||
6830 | + if (server->nlm_host) | ||
6831 | nlmclnt_done(server->nlm_host); | ||
6832 | } | ||
6833 | |||
6834 | diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c | ||
6835 | index 627f108..e210a66 100644 | ||
6836 | --- a/fs/nfs/dir.c | ||
6837 | +++ b/fs/nfs/dir.c | ||
6838 | @@ -1155,11 +1155,14 @@ static int nfs_dentry_delete(const struct dentry *dentry) | ||
6839 | |||
6840 | } | ||
6841 | |||
6842 | +/* Ensure that we revalidate inode->i_nlink */ | ||
6843 | static void nfs_drop_nlink(struct inode *inode) | ||
6844 | { | ||
6845 | spin_lock(&inode->i_lock); | ||
6846 | - if (inode->i_nlink > 0) | ||
6847 | - drop_nlink(inode); | ||
6848 | + /* drop the inode if we're reasonably sure this is the last link */ | ||
6849 | + if (inode->i_nlink == 1) | ||
6850 | + clear_nlink(inode); | ||
6851 | + NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ATTR; | ||
6852 | spin_unlock(&inode->i_lock); | ||
6853 | } | ||
6854 | |||
6855 | @@ -1174,8 +1177,8 @@ static void nfs_dentry_iput(struct dentry *dentry, struct inode *inode) | ||
6856 | NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA; | ||
6857 | |||
6858 | if (dentry->d_flags & DCACHE_NFSFS_RENAMED) { | ||
6859 | - drop_nlink(inode); | ||
6860 | nfs_complete_unlink(dentry, inode); | ||
6861 | + nfs_drop_nlink(inode); | ||
6862 | } | ||
6863 | iput(inode); | ||
6864 | } | ||
6865 | @@ -1646,10 +1649,8 @@ static int nfs_safe_remove(struct dentry *dentry) | ||
6866 | if (inode != NULL) { | ||
6867 | NFS_PROTO(inode)->return_delegation(inode); | ||
6868 | error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); | ||
6869 | - /* The VFS may want to delete this inode */ | ||
6870 | if (error == 0) | ||
6871 | nfs_drop_nlink(inode); | ||
6872 | - nfs_mark_for_revalidate(inode); | ||
6873 | } else | ||
6874 | error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); | ||
6875 | if (error == -ENOENT) | ||
6876 | diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c | ||
6877 | index 7bff871..5e61aac 100644 | ||
6878 | --- a/fs/nfs/nfs4proc.c | ||
6879 | +++ b/fs/nfs/nfs4proc.c | ||
6880 | @@ -5999,13 +5999,26 @@ static void nfs41_sequence_prepare(struct rpc_task *task, void *data) | ||
6881 | rpc_call_start(task); | ||
6882 | } | ||
6883 | |||
6884 | +static void nfs41_sequence_prepare_privileged(struct rpc_task *task, void *data) | ||
6885 | +{ | ||
6886 | + rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED); | ||
6887 | + nfs41_sequence_prepare(task, data); | ||
6888 | +} | ||
6889 | + | ||
6890 | static const struct rpc_call_ops nfs41_sequence_ops = { | ||
6891 | .rpc_call_done = nfs41_sequence_call_done, | ||
6892 | .rpc_call_prepare = nfs41_sequence_prepare, | ||
6893 | .rpc_release = nfs41_sequence_release, | ||
6894 | }; | ||
6895 | |||
6896 | -static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp, struct rpc_cred *cred) | ||
6897 | +static const struct rpc_call_ops nfs41_sequence_privileged_ops = { | ||
6898 | + .rpc_call_done = nfs41_sequence_call_done, | ||
6899 | + .rpc_call_prepare = nfs41_sequence_prepare_privileged, | ||
6900 | + .rpc_release = nfs41_sequence_release, | ||
6901 | +}; | ||
6902 | + | ||
6903 | +static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp, struct rpc_cred *cred, | ||
6904 | + const struct rpc_call_ops *seq_ops) | ||
6905 | { | ||
6906 | struct nfs4_sequence_data *calldata; | ||
6907 | struct rpc_message msg = { | ||
6908 | @@ -6015,7 +6028,7 @@ static struct rpc_task *_nfs41_proc_sequence(struct nfs_client *clp, struct rpc_ | ||
6909 | struct rpc_task_setup task_setup_data = { | ||
6910 | .rpc_client = clp->cl_rpcclient, | ||
6911 | .rpc_message = &msg, | ||
6912 | - .callback_ops = &nfs41_sequence_ops, | ||
6913 | + .callback_ops = seq_ops, | ||
6914 | .flags = RPC_TASK_ASYNC | RPC_TASK_SOFT, | ||
6915 | }; | ||
6916 | |||
6917 | @@ -6042,7 +6055,7 @@ static int nfs41_proc_async_sequence(struct nfs_client *clp, struct rpc_cred *cr | ||
6918 | |||
6919 | if ((renew_flags & NFS4_RENEW_TIMEOUT) == 0) | ||
6920 | return 0; | ||
6921 | - task = _nfs41_proc_sequence(clp, cred); | ||
6922 | + task = _nfs41_proc_sequence(clp, cred, &nfs41_sequence_ops); | ||
6923 | if (IS_ERR(task)) | ||
6924 | ret = PTR_ERR(task); | ||
6925 | else | ||
6926 | @@ -6056,7 +6069,7 @@ static int nfs4_proc_sequence(struct nfs_client *clp, struct rpc_cred *cred) | ||
6927 | struct rpc_task *task; | ||
6928 | int ret; | ||
6929 | |||
6930 | - task = _nfs41_proc_sequence(clp, cred); | ||
6931 | + task = _nfs41_proc_sequence(clp, cred, &nfs41_sequence_privileged_ops); | ||
6932 | if (IS_ERR(task)) { | ||
6933 | ret = PTR_ERR(task); | ||
6934 | goto out; | ||
6935 | diff --git a/fs/nfs/super.c b/fs/nfs/super.c | ||
6936 | index d8d7396..2a31c7f 100644 | ||
6937 | --- a/fs/nfs/super.c | ||
6938 | +++ b/fs/nfs/super.c | ||
6939 | @@ -1095,7 +1095,7 @@ static int nfs_get_option_str(substring_t args[], char **option) | ||
6940 | { | ||
6941 | kfree(*option); | ||
6942 | *option = match_strdup(args); | ||
6943 | - return !option; | ||
6944 | + return !*option; | ||
6945 | } | ||
6946 | |||
6947 | static int nfs_get_option_ul(substring_t args[], unsigned long *option) | ||
6948 | diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c | ||
6949 | index c9c1c0a..ac784eb 100644 | ||
6950 | --- a/fs/nfsd/nfs4proc.c | ||
6951 | +++ b/fs/nfsd/nfs4proc.c | ||
6952 | @@ -194,6 +194,7 @@ static __be32 | ||
6953 | do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) | ||
6954 | { | ||
6955 | struct svc_fh *resfh; | ||
6956 | + int accmode; | ||
6957 | __be32 status; | ||
6958 | |||
6959 | resfh = kmalloc(sizeof(struct svc_fh), GFP_KERNEL); | ||
6960 | @@ -253,9 +254,10 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o | ||
6961 | /* set reply cache */ | ||
6962 | fh_copy_shallow(&open->op_openowner->oo_owner.so_replay.rp_openfh, | ||
6963 | &resfh->fh_handle); | ||
6964 | - if (!open->op_created) | ||
6965 | - status = do_open_permission(rqstp, resfh, open, | ||
6966 | - NFSD_MAY_NOP); | ||
6967 | + accmode = NFSD_MAY_NOP; | ||
6968 | + if (open->op_created) | ||
6969 | + accmode |= NFSD_MAY_OWNER_OVERRIDE; | ||
6970 | + status = do_open_permission(rqstp, resfh, open, accmode); | ||
6971 | set_change_info(&open->op_cinfo, current_fh); | ||
6972 | fh_dup2(current_fh, resfh); | ||
6973 | out: | ||
6974 | diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c | ||
6975 | index 5b3224c..0953c6c 100644 | ||
6976 | --- a/fs/nfsd/nfs4state.c | ||
6977 | +++ b/fs/nfsd/nfs4state.c | ||
6978 | @@ -2341,7 +2341,7 @@ nfsd4_init_slabs(void) | ||
6979 | if (openowner_slab == NULL) | ||
6980 | goto out_nomem; | ||
6981 | lockowner_slab = kmem_cache_create("nfsd4_lockowners", | ||
6982 | - sizeof(struct nfs4_openowner), 0, 0, NULL); | ||
6983 | + sizeof(struct nfs4_lockowner), 0, 0, NULL); | ||
6984 | if (lockowner_slab == NULL) | ||
6985 | goto out_nomem; | ||
6986 | file_slab = kmem_cache_create("nfsd4_files", | ||
6987 | diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c | ||
6988 | index 6322df3..1e83186 100644 | ||
6989 | --- a/fs/nfsd/nfs4xdr.c | ||
6990 | +++ b/fs/nfsd/nfs4xdr.c | ||
6991 | @@ -2946,11 +2946,16 @@ nfsd4_encode_read(struct nfsd4_compoundres *resp, __be32 nfserr, | ||
6992 | len = maxcount; | ||
6993 | v = 0; | ||
6994 | while (len > 0) { | ||
6995 | - pn = resp->rqstp->rq_resused++; | ||
6996 | + pn = resp->rqstp->rq_resused; | ||
6997 | + if (!resp->rqstp->rq_respages[pn]) { /* ran out of pages */ | ||
6998 | + maxcount -= len; | ||
6999 | + break; | ||
7000 | + } | ||
7001 | resp->rqstp->rq_vec[v].iov_base = | ||
7002 | page_address(resp->rqstp->rq_respages[pn]); | ||
7003 | resp->rqstp->rq_vec[v].iov_len = | ||
7004 | len < PAGE_SIZE ? len : PAGE_SIZE; | ||
7005 | + resp->rqstp->rq_resused++; | ||
7006 | v++; | ||
7007 | len -= PAGE_SIZE; | ||
7008 | } | ||
7009 | @@ -2996,6 +3001,8 @@ nfsd4_encode_readlink(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd | ||
7010 | return nfserr; | ||
7011 | if (resp->xbuf->page_len) | ||
7012 | return nfserr_resource; | ||
7013 | + if (!resp->rqstp->rq_respages[resp->rqstp->rq_resused]) | ||
7014 | + return nfserr_resource; | ||
7015 | |||
7016 | page = page_address(resp->rqstp->rq_respages[resp->rqstp->rq_resused++]); | ||
7017 | |||
7018 | @@ -3045,6 +3052,8 @@ nfsd4_encode_readdir(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4 | ||
7019 | return nfserr; | ||
7020 | if (resp->xbuf->page_len) | ||
7021 | return nfserr_resource; | ||
7022 | + if (!resp->rqstp->rq_respages[resp->rqstp->rq_resused]) | ||
7023 | + return nfserr_resource; | ||
7024 | |||
7025 | RESERVE_SPACE(NFS4_VERIFIER_SIZE); | ||
7026 | savep = p; | ||
7027 | diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c | ||
7028 | index 240473c..0d5e021 100644 | ||
7029 | --- a/fs/nfsd/nfssvc.c | ||
7030 | +++ b/fs/nfsd/nfssvc.c | ||
7031 | @@ -650,7 +650,7 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp) | ||
7032 | } | ||
7033 | |||
7034 | /* Store reply in cache. */ | ||
7035 | - nfsd_cache_update(rqstp, proc->pc_cachetype, statp + 1); | ||
7036 | + nfsd_cache_update(rqstp, rqstp->rq_cachetype, statp + 1); | ||
7037 | return 1; | ||
7038 | } | ||
7039 | |||
7040 | diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c | ||
7041 | index a9269f1..e1b40c7 100644 | ||
7042 | --- a/fs/nfsd/vfs.c | ||
7043 | +++ b/fs/nfsd/vfs.c | ||
7044 | @@ -1485,13 +1485,19 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | ||
7045 | case NFS3_CREATE_EXCLUSIVE: | ||
7046 | if ( dchild->d_inode->i_mtime.tv_sec == v_mtime | ||
7047 | && dchild->d_inode->i_atime.tv_sec == v_atime | ||
7048 | - && dchild->d_inode->i_size == 0 ) | ||
7049 | + && dchild->d_inode->i_size == 0 ) { | ||
7050 | + if (created) | ||
7051 | + *created = 1; | ||
7052 | break; | ||
7053 | + } | ||
7054 | case NFS4_CREATE_EXCLUSIVE4_1: | ||
7055 | if ( dchild->d_inode->i_mtime.tv_sec == v_mtime | ||
7056 | && dchild->d_inode->i_atime.tv_sec == v_atime | ||
7057 | - && dchild->d_inode->i_size == 0 ) | ||
7058 | + && dchild->d_inode->i_size == 0 ) { | ||
7059 | + if (created) | ||
7060 | + *created = 1; | ||
7061 | goto set_attr; | ||
7062 | + } | ||
7063 | /* fallthru */ | ||
7064 | case NFS3_CREATE_GUARDED: | ||
7065 | err = nfserr_exist; | ||
7066 | diff --git a/fs/splice.c b/fs/splice.c | ||
7067 | index 41514dd..c69fbb7 100644 | ||
7068 | --- a/fs/splice.c | ||
7069 | +++ b/fs/splice.c | ||
7070 | @@ -696,8 +696,10 @@ static int pipe_to_sendpage(struct pipe_inode_info *pipe, | ||
7071 | return -EINVAL; | ||
7072 | |||
7073 | more = (sd->flags & SPLICE_F_MORE) ? MSG_MORE : 0; | ||
7074 | - if (sd->len < sd->total_len) | ||
7075 | + | ||
7076 | + if (sd->len < sd->total_len && pipe->nrbufs > 1) | ||
7077 | more |= MSG_SENDPAGE_NOTLAST; | ||
7078 | + | ||
7079 | return file->f_op->sendpage(file, buf->page, buf->offset, | ||
7080 | sd->len, &pos, more); | ||
7081 | } | ||
7082 | diff --git a/fs/udf/inode.c b/fs/udf/inode.c | ||
7083 | index aa23346..585ee1c 100644 | ||
7084 | --- a/fs/udf/inode.c | ||
7085 | +++ b/fs/udf/inode.c | ||
7086 | @@ -574,6 +574,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, | ||
7087 | struct udf_inode_info *iinfo = UDF_I(inode); | ||
7088 | int goal = 0, pgoal = iinfo->i_location.logicalBlockNum; | ||
7089 | int lastblock = 0; | ||
7090 | + bool isBeyondEOF; | ||
7091 | |||
7092 | *err = 0; | ||
7093 | *new = 0; | ||
7094 | @@ -653,7 +654,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, | ||
7095 | /* Are we beyond EOF? */ | ||
7096 | if (etype == -1) { | ||
7097 | int ret; | ||
7098 | - | ||
7099 | + isBeyondEOF = 1; | ||
7100 | if (count) { | ||
7101 | if (c) | ||
7102 | laarr[0] = laarr[1]; | ||
7103 | @@ -696,6 +697,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, | ||
7104 | endnum = c + 1; | ||
7105 | lastblock = 1; | ||
7106 | } else { | ||
7107 | + isBeyondEOF = 0; | ||
7108 | endnum = startnum = ((count > 2) ? 2 : count); | ||
7109 | |||
7110 | /* if the current extent is in position 0, | ||
7111 | @@ -738,10 +740,13 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, | ||
7112 | goal, err); | ||
7113 | if (!newblocknum) { | ||
7114 | brelse(prev_epos.bh); | ||
7115 | + brelse(cur_epos.bh); | ||
7116 | + brelse(next_epos.bh); | ||
7117 | *err = -ENOSPC; | ||
7118 | return 0; | ||
7119 | } | ||
7120 | - iinfo->i_lenExtents += inode->i_sb->s_blocksize; | ||
7121 | + if (isBeyondEOF) | ||
7122 | + iinfo->i_lenExtents += inode->i_sb->s_blocksize; | ||
7123 | } | ||
7124 | |||
7125 | /* if the extent the requsted block is located in contains multiple | ||
7126 | @@ -768,6 +773,8 @@ static sector_t inode_getblk(struct inode *inode, sector_t block, | ||
7127 | udf_update_extents(inode, laarr, startnum, endnum, &prev_epos); | ||
7128 | |||
7129 | brelse(prev_epos.bh); | ||
7130 | + brelse(cur_epos.bh); | ||
7131 | + brelse(next_epos.bh); | ||
7132 | |||
7133 | newblock = udf_get_pblock(inode->i_sb, newblocknum, | ||
7134 | iinfo->i_location.partitionReferenceNum, 0); | ||
7135 | diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h | ||
7136 | index ed6642a..25f01d0 100644 | ||
7137 | --- a/include/asm-generic/tlb.h | ||
7138 | +++ b/include/asm-generic/tlb.h | ||
7139 | @@ -78,6 +78,14 @@ struct mmu_gather_batch { | ||
7140 | #define MAX_GATHER_BATCH \ | ||
7141 | ((PAGE_SIZE - sizeof(struct mmu_gather_batch)) / sizeof(void *)) | ||
7142 | |||
7143 | +/* | ||
7144 | + * Limit the maximum number of mmu_gather batches to reduce a risk of soft | ||
7145 | + * lockups for non-preemptible kernels on huge machines when a lot of memory | ||
7146 | + * is zapped during unmapping. | ||
7147 | + * 10K pages freed at once should be safe even without a preemption point. | ||
7148 | + */ | ||
7149 | +#define MAX_GATHER_BATCH_COUNT (10000UL/MAX_GATHER_BATCH) | ||
7150 | + | ||
7151 | /* struct mmu_gather is an opaque type used by the mm code for passing around | ||
7152 | * any data needed by arch specific code for tlb_remove_page. | ||
7153 | */ | ||
7154 | @@ -96,6 +104,7 @@ struct mmu_gather { | ||
7155 | struct mmu_gather_batch *active; | ||
7156 | struct mmu_gather_batch local; | ||
7157 | struct page *__pages[MMU_GATHER_BUNDLE]; | ||
7158 | + unsigned int batch_count; | ||
7159 | }; | ||
7160 | |||
7161 | #define HAVE_GENERIC_MMU_GATHER | ||
7162 | diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h | ||
7163 | index 366422b..eb53e15 100644 | ||
7164 | --- a/include/linux/binfmts.h | ||
7165 | +++ b/include/linux/binfmts.h | ||
7166 | @@ -128,6 +128,7 @@ extern int setup_arg_pages(struct linux_binprm * bprm, | ||
7167 | unsigned long stack_top, | ||
7168 | int executable_stack); | ||
7169 | extern int bprm_mm_init(struct linux_binprm *bprm); | ||
7170 | +extern int bprm_change_interp(char *interp, struct linux_binprm *bprm); | ||
7171 | extern int copy_strings_kernel(int argc, const char *const *argv, | ||
7172 | struct linux_binprm *bprm); | ||
7173 | extern int prepare_bprm_creds(struct linux_binprm *bprm); | ||
7174 | diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h | ||
7175 | index 4262478..317aff8 100644 | ||
7176 | --- a/include/linux/ceph/libceph.h | ||
7177 | +++ b/include/linux/ceph/libceph.h | ||
7178 | @@ -43,7 +43,6 @@ struct ceph_options { | ||
7179 | struct ceph_entity_addr my_addr; | ||
7180 | int mount_timeout; | ||
7181 | int osd_idle_ttl; | ||
7182 | - int osd_timeout; | ||
7183 | int osd_keepalive_timeout; | ||
7184 | |||
7185 | /* | ||
7186 | @@ -63,7 +62,6 @@ struct ceph_options { | ||
7187 | * defaults | ||
7188 | */ | ||
7189 | #define CEPH_MOUNT_TIMEOUT_DEFAULT 60 | ||
7190 | -#define CEPH_OSD_TIMEOUT_DEFAULT 60 /* seconds */ | ||
7191 | #define CEPH_OSD_KEEPALIVE_DEFAULT 5 | ||
7192 | #define CEPH_OSD_IDLE_TTL_DEFAULT 60 | ||
7193 | |||
7194 | diff --git a/include/linux/freezer.h b/include/linux/freezer.h | ||
7195 | index d09af4b..ee89932 100644 | ||
7196 | --- a/include/linux/freezer.h | ||
7197 | +++ b/include/linux/freezer.h | ||
7198 | @@ -75,28 +75,62 @@ static inline bool cgroup_freezing(struct task_struct *task) | ||
7199 | */ | ||
7200 | |||
7201 | |||
7202 | -/* Tell the freezer not to count the current task as freezable. */ | ||
7203 | +/** | ||
7204 | + * freezer_do_not_count - tell freezer to ignore %current | ||
7205 | + * | ||
7206 | + * Tell freezers to ignore the current task when determining whether the | ||
7207 | + * target frozen state is reached. IOW, the current task will be | ||
7208 | + * considered frozen enough by freezers. | ||
7209 | + * | ||
7210 | + * The caller shouldn't do anything which isn't allowed for a frozen task | ||
7211 | + * until freezer_cont() is called. Usually, freezer[_do_not]_count() pair | ||
7212 | + * wrap a scheduling operation and nothing much else. | ||
7213 | + */ | ||
7214 | static inline void freezer_do_not_count(void) | ||
7215 | { | ||
7216 | current->flags |= PF_FREEZER_SKIP; | ||
7217 | } | ||
7218 | |||
7219 | -/* | ||
7220 | - * Tell the freezer to count the current task as freezable again and try to | ||
7221 | - * freeze it. | ||
7222 | +/** | ||
7223 | + * freezer_count - tell freezer to stop ignoring %current | ||
7224 | + * | ||
7225 | + * Undo freezer_do_not_count(). It tells freezers that %current should be | ||
7226 | + * considered again and tries to freeze if freezing condition is already in | ||
7227 | + * effect. | ||
7228 | */ | ||
7229 | static inline void freezer_count(void) | ||
7230 | { | ||
7231 | current->flags &= ~PF_FREEZER_SKIP; | ||
7232 | + /* | ||
7233 | + * If freezing is in progress, the following paired with smp_mb() | ||
7234 | + * in freezer_should_skip() ensures that either we see %true | ||
7235 | + * freezing() or freezer_should_skip() sees !PF_FREEZER_SKIP. | ||
7236 | + */ | ||
7237 | + smp_mb(); | ||
7238 | try_to_freeze(); | ||
7239 | } | ||
7240 | |||
7241 | -/* | ||
7242 | - * Check if the task should be counted as freezable by the freezer | ||
7243 | +/** | ||
7244 | + * freezer_should_skip - whether to skip a task when determining frozen | ||
7245 | + * state is reached | ||
7246 | + * @p: task in quesion | ||
7247 | + * | ||
7248 | + * This function is used by freezers after establishing %true freezing() to | ||
7249 | + * test whether a task should be skipped when determining the target frozen | ||
7250 | + * state is reached. IOW, if this function returns %true, @p is considered | ||
7251 | + * frozen enough. | ||
7252 | */ | ||
7253 | -static inline int freezer_should_skip(struct task_struct *p) | ||
7254 | +static inline bool freezer_should_skip(struct task_struct *p) | ||
7255 | { | ||
7256 | - return !!(p->flags & PF_FREEZER_SKIP); | ||
7257 | + /* | ||
7258 | + * The following smp_mb() paired with the one in freezer_count() | ||
7259 | + * ensures that either freezer_count() sees %true freezing() or we | ||
7260 | + * see cleared %PF_FREEZER_SKIP and return %false. This makes it | ||
7261 | + * impossible for a task to slip frozen state testing after | ||
7262 | + * clearing %PF_FREEZER_SKIP. | ||
7263 | + */ | ||
7264 | + smp_mb(); | ||
7265 | + return p->flags & PF_FREEZER_SKIP; | ||
7266 | } | ||
7267 | |||
7268 | /* | ||
7269 | diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h | ||
7270 | index b5d1384..70473da 100644 | ||
7271 | --- a/include/linux/page-flags.h | ||
7272 | +++ b/include/linux/page-flags.h | ||
7273 | @@ -362,7 +362,7 @@ static inline void ClearPageCompound(struct page *page) | ||
7274 | * pages on the LRU and/or pagecache. | ||
7275 | */ | ||
7276 | TESTPAGEFLAG(Compound, compound) | ||
7277 | -__PAGEFLAG(Head, compound) | ||
7278 | +__SETPAGEFLAG(Head, compound) __CLEARPAGEFLAG(Head, compound) | ||
7279 | |||
7280 | /* | ||
7281 | * PG_reclaim is used in combination with PG_compound to mark the | ||
7282 | @@ -374,8 +374,14 @@ __PAGEFLAG(Head, compound) | ||
7283 | * PG_compound & PG_reclaim => Tail page | ||
7284 | * PG_compound & ~PG_reclaim => Head page | ||
7285 | */ | ||
7286 | +#define PG_head_mask ((1L << PG_compound)) | ||
7287 | #define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim)) | ||
7288 | |||
7289 | +static inline int PageHead(struct page *page) | ||
7290 | +{ | ||
7291 | + return ((page->flags & PG_head_tail_mask) == PG_head_mask); | ||
7292 | +} | ||
7293 | + | ||
7294 | static inline int PageTail(struct page *page) | ||
7295 | { | ||
7296 | return ((page->flags & PG_head_tail_mask) == PG_head_tail_mask); | ||
7297 | diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h | ||
7298 | index 8d3c427..50a6cbe 100644 | ||
7299 | --- a/include/linux/pci_ids.h | ||
7300 | +++ b/include/linux/pci_ids.h | ||
7301 | @@ -1566,6 +1566,7 @@ | ||
7302 | #define PCI_DEVICE_ID_RICOH_RL5C476 0x0476 | ||
7303 | #define PCI_DEVICE_ID_RICOH_RL5C478 0x0478 | ||
7304 | #define PCI_DEVICE_ID_RICOH_R5C822 0x0822 | ||
7305 | +#define PCI_DEVICE_ID_RICOH_R5CE822 0xe822 | ||
7306 | #define PCI_DEVICE_ID_RICOH_R5CE823 0xe823 | ||
7307 | #define PCI_DEVICE_ID_RICOH_R5C832 0x0832 | ||
7308 | #define PCI_DEVICE_ID_RICOH_R5C843 0x0843 | ||
7309 | diff --git a/include/linux/sched.h b/include/linux/sched.h | ||
7310 | index 23bddac..d2bbc12 100644 | ||
7311 | --- a/include/linux/sched.h | ||
7312 | +++ b/include/linux/sched.h | ||
7313 | @@ -2684,7 +2684,16 @@ static inline void thread_group_cputime_init(struct signal_struct *sig) | ||
7314 | extern void recalc_sigpending_and_wake(struct task_struct *t); | ||
7315 | extern void recalc_sigpending(void); | ||
7316 | |||
7317 | -extern void signal_wake_up(struct task_struct *t, int resume_stopped); | ||
7318 | +extern void signal_wake_up_state(struct task_struct *t, unsigned int state); | ||
7319 | + | ||
7320 | +static inline void signal_wake_up(struct task_struct *t, bool resume) | ||
7321 | +{ | ||
7322 | + signal_wake_up_state(t, resume ? TASK_WAKEKILL : 0); | ||
7323 | +} | ||
7324 | +static inline void ptrace_signal_wake_up(struct task_struct *t, bool resume) | ||
7325 | +{ | ||
7326 | + signal_wake_up_state(t, resume ? __TASK_TRACED : 0); | ||
7327 | +} | ||
7328 | |||
7329 | /* | ||
7330 | * Wrappers for p->thread_info->cpu access. No-op on UP. | ||
7331 | diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h | ||
7332 | index ba1d361..1832927 100644 | ||
7333 | --- a/include/net/inet_connection_sock.h | ||
7334 | +++ b/include/net/inet_connection_sock.h | ||
7335 | @@ -318,6 +318,7 @@ extern void inet_csk_reqsk_queue_prune(struct sock *parent, | ||
7336 | const unsigned long max_rto); | ||
7337 | |||
7338 | extern void inet_csk_destroy_sock(struct sock *sk); | ||
7339 | +extern void inet_csk_prepare_forced_close(struct sock *sk); | ||
7340 | |||
7341 | /* | ||
7342 | * LISTEN is a special case for poll.. | ||
7343 | diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h | ||
7344 | index 5be8937..fca8bbe 100644 | ||
7345 | --- a/include/target/target_core_base.h | ||
7346 | +++ b/include/target/target_core_base.h | ||
7347 | @@ -734,6 +734,8 @@ struct se_subsystem_dev { | ||
7348 | }; | ||
7349 | |||
7350 | struct se_device { | ||
7351 | +#define SE_DEV_LINK_MAGIC 0xfeeddeef | ||
7352 | + u32 dev_link_magic; | ||
7353 | /* RELATIVE TARGET PORT IDENTIFER Counter */ | ||
7354 | u16 dev_rpti_counter; | ||
7355 | /* Used for SAM Task Attribute ordering */ | ||
7356 | @@ -820,6 +822,8 @@ struct se_port_stat_grps { | ||
7357 | }; | ||
7358 | |||
7359 | struct se_lun { | ||
7360 | +#define SE_LUN_LINK_MAGIC 0xffff7771 | ||
7361 | + u32 lun_link_magic; | ||
7362 | /* See transport_lun_status_table */ | ||
7363 | enum transport_lun_status_table lun_status; | ||
7364 | u32 lun_access; | ||
7365 | diff --git a/kernel/cgroup.c b/kernel/cgroup.c | ||
7366 | index ff2bce5..2c0d5d0 100644 | ||
7367 | --- a/kernel/cgroup.c | ||
7368 | +++ b/kernel/cgroup.c | ||
7369 | @@ -2635,9 +2635,7 @@ static int cgroup_create_dir(struct cgroup *cgrp, struct dentry *dentry, | ||
7370 | dentry->d_fsdata = cgrp; | ||
7371 | inc_nlink(parent->d_inode); | ||
7372 | rcu_assign_pointer(cgrp->dentry, dentry); | ||
7373 | - dget(dentry); | ||
7374 | } | ||
7375 | - dput(dentry); | ||
7376 | |||
7377 | return error; | ||
7378 | } | ||
7379 | diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c | ||
7380 | index 4c69326..e48caf8 100644 | ||
7381 | --- a/kernel/irq/manage.c | ||
7382 | +++ b/kernel/irq/manage.c | ||
7383 | @@ -716,6 +716,7 @@ static void | ||
7384 | irq_thread_check_affinity(struct irq_desc *desc, struct irqaction *action) | ||
7385 | { | ||
7386 | cpumask_var_t mask; | ||
7387 | + bool valid = true; | ||
7388 | |||
7389 | if (!test_and_clear_bit(IRQTF_AFFINITY, &action->thread_flags)) | ||
7390 | return; | ||
7391 | @@ -730,10 +731,18 @@ irq_thread_check_affinity(struct irq_desc *desc, struct irqaction *action) | ||
7392 | } | ||
7393 | |||
7394 | raw_spin_lock_irq(&desc->lock); | ||
7395 | - cpumask_copy(mask, desc->irq_data.affinity); | ||
7396 | + /* | ||
7397 | + * This code is triggered unconditionally. Check the affinity | ||
7398 | + * mask pointer. For CPU_MASK_OFFSTACK=n this is optimized out. | ||
7399 | + */ | ||
7400 | + if (desc->irq_data.affinity) | ||
7401 | + cpumask_copy(mask, desc->irq_data.affinity); | ||
7402 | + else | ||
7403 | + valid = false; | ||
7404 | raw_spin_unlock_irq(&desc->lock); | ||
7405 | |||
7406 | - set_cpus_allowed_ptr(current, mask); | ||
7407 | + if (valid) | ||
7408 | + set_cpus_allowed_ptr(current, mask); | ||
7409 | free_cpumask_var(mask); | ||
7410 | } | ||
7411 | #else | ||
7412 | @@ -936,6 +945,16 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new) | ||
7413 | */ | ||
7414 | get_task_struct(t); | ||
7415 | new->thread = t; | ||
7416 | + /* | ||
7417 | + * Tell the thread to set its affinity. This is | ||
7418 | + * important for shared interrupt handlers as we do | ||
7419 | + * not invoke setup_affinity() for the secondary | ||
7420 | + * handlers as everything is already set up. Even for | ||
7421 | + * interrupts marked with IRQF_NO_BALANCE this is | ||
7422 | + * correct as we want the thread to move to the cpu(s) | ||
7423 | + * on which the requesting code placed the interrupt. | ||
7424 | + */ | ||
7425 | + set_bit(IRQTF_AFFINITY, &new->thread_flags); | ||
7426 | } | ||
7427 | |||
7428 | if (!alloc_cpumask_var(&mask, GFP_KERNEL)) { | ||
7429 | diff --git a/kernel/ptrace.c b/kernel/ptrace.c | ||
7430 | index a232bb5..b96de86b4 100644 | ||
7431 | --- a/kernel/ptrace.c | ||
7432 | +++ b/kernel/ptrace.c | ||
7433 | @@ -117,11 +117,45 @@ void __ptrace_unlink(struct task_struct *child) | ||
7434 | * TASK_KILLABLE sleeps. | ||
7435 | */ | ||
7436 | if (child->jobctl & JOBCTL_STOP_PENDING || task_is_traced(child)) | ||
7437 | - signal_wake_up(child, task_is_traced(child)); | ||
7438 | + ptrace_signal_wake_up(child, true); | ||
7439 | |||
7440 | spin_unlock(&child->sighand->siglock); | ||
7441 | } | ||
7442 | |||
7443 | +/* Ensure that nothing can wake it up, even SIGKILL */ | ||
7444 | +static bool ptrace_freeze_traced(struct task_struct *task) | ||
7445 | +{ | ||
7446 | + bool ret = false; | ||
7447 | + | ||
7448 | + /* Lockless, nobody but us can set this flag */ | ||
7449 | + if (task->jobctl & JOBCTL_LISTENING) | ||
7450 | + return ret; | ||
7451 | + | ||
7452 | + spin_lock_irq(&task->sighand->siglock); | ||
7453 | + if (task_is_traced(task) && !__fatal_signal_pending(task)) { | ||
7454 | + task->state = __TASK_TRACED; | ||
7455 | + ret = true; | ||
7456 | + } | ||
7457 | + spin_unlock_irq(&task->sighand->siglock); | ||
7458 | + | ||
7459 | + return ret; | ||
7460 | +} | ||
7461 | + | ||
7462 | +static void ptrace_unfreeze_traced(struct task_struct *task) | ||
7463 | +{ | ||
7464 | + if (task->state != __TASK_TRACED) | ||
7465 | + return; | ||
7466 | + | ||
7467 | + WARN_ON(!task->ptrace || task->parent != current); | ||
7468 | + | ||
7469 | + spin_lock_irq(&task->sighand->siglock); | ||
7470 | + if (__fatal_signal_pending(task)) | ||
7471 | + wake_up_state(task, __TASK_TRACED); | ||
7472 | + else | ||
7473 | + task->state = TASK_TRACED; | ||
7474 | + spin_unlock_irq(&task->sighand->siglock); | ||
7475 | +} | ||
7476 | + | ||
7477 | /** | ||
7478 | * ptrace_check_attach - check whether ptracee is ready for ptrace operation | ||
7479 | * @child: ptracee to check for | ||
7480 | @@ -151,24 +185,29 @@ int ptrace_check_attach(struct task_struct *child, bool ignore_state) | ||
7481 | * be changed by us so it's not changing right after this. | ||
7482 | */ | ||
7483 | read_lock(&tasklist_lock); | ||
7484 | - if ((child->ptrace & PT_PTRACED) && child->parent == current) { | ||
7485 | + if (child->ptrace && child->parent == current) { | ||
7486 | + WARN_ON(child->state == __TASK_TRACED); | ||
7487 | /* | ||
7488 | * child->sighand can't be NULL, release_task() | ||
7489 | * does ptrace_unlink() before __exit_signal(). | ||
7490 | */ | ||
7491 | - spin_lock_irq(&child->sighand->siglock); | ||
7492 | - WARN_ON_ONCE(task_is_stopped(child)); | ||
7493 | - if (ignore_state || (task_is_traced(child) && | ||
7494 | - !(child->jobctl & JOBCTL_LISTENING))) | ||
7495 | + if (ignore_state || ptrace_freeze_traced(child)) | ||
7496 | ret = 0; | ||
7497 | - spin_unlock_irq(&child->sighand->siglock); | ||
7498 | } | ||
7499 | read_unlock(&tasklist_lock); | ||
7500 | |||
7501 | - if (!ret && !ignore_state) | ||
7502 | - ret = wait_task_inactive(child, TASK_TRACED) ? 0 : -ESRCH; | ||
7503 | + if (!ret && !ignore_state) { | ||
7504 | + if (!wait_task_inactive(child, __TASK_TRACED)) { | ||
7505 | + /* | ||
7506 | + * This can only happen if may_ptrace_stop() fails and | ||
7507 | + * ptrace_stop() changes ->state back to TASK_RUNNING, | ||
7508 | + * so we should not worry about leaking __TASK_TRACED. | ||
7509 | + */ | ||
7510 | + WARN_ON(child->state == __TASK_TRACED); | ||
7511 | + ret = -ESRCH; | ||
7512 | + } | ||
7513 | + } | ||
7514 | |||
7515 | - /* All systems go.. */ | ||
7516 | return ret; | ||
7517 | } | ||
7518 | |||
7519 | @@ -310,7 +349,7 @@ static int ptrace_attach(struct task_struct *task, long request, | ||
7520 | */ | ||
7521 | if (task_is_stopped(task) && | ||
7522 | task_set_jobctl_pending(task, JOBCTL_TRAP_STOP | JOBCTL_TRAPPING)) | ||
7523 | - signal_wake_up(task, 1); | ||
7524 | + signal_wake_up_state(task, __TASK_STOPPED); | ||
7525 | |||
7526 | spin_unlock(&task->sighand->siglock); | ||
7527 | |||
7528 | @@ -727,7 +766,7 @@ int ptrace_request(struct task_struct *child, long request, | ||
7529 | * tracee into STOP. | ||
7530 | */ | ||
7531 | if (likely(task_set_jobctl_pending(child, JOBCTL_TRAP_STOP))) | ||
7532 | - signal_wake_up(child, child->jobctl & JOBCTL_LISTENING); | ||
7533 | + ptrace_signal_wake_up(child, child->jobctl & JOBCTL_LISTENING); | ||
7534 | |||
7535 | unlock_task_sighand(child, &flags); | ||
7536 | ret = 0; | ||
7537 | @@ -753,7 +792,7 @@ int ptrace_request(struct task_struct *child, long request, | ||
7538 | * start of this trap and now. Trigger re-trap. | ||
7539 | */ | ||
7540 | if (child->jobctl & JOBCTL_TRAP_NOTIFY) | ||
7541 | - signal_wake_up(child, true); | ||
7542 | + ptrace_signal_wake_up(child, true); | ||
7543 | ret = 0; | ||
7544 | } | ||
7545 | unlock_task_sighand(child, &flags); | ||
7546 | @@ -890,6 +929,8 @@ SYSCALL_DEFINE4(ptrace, long, request, long, pid, unsigned long, addr, | ||
7547 | goto out_put_task_struct; | ||
7548 | |||
7549 | ret = arch_ptrace(child, request, addr, data); | ||
7550 | + if (ret || request != PTRACE_DETACH) | ||
7551 | + ptrace_unfreeze_traced(child); | ||
7552 | |||
7553 | out_put_task_struct: | ||
7554 | put_task_struct(child); | ||
7555 | @@ -1029,8 +1070,11 @@ asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, | ||
7556 | |||
7557 | ret = ptrace_check_attach(child, request == PTRACE_KILL || | ||
7558 | request == PTRACE_INTERRUPT); | ||
7559 | - if (!ret) | ||
7560 | + if (!ret) { | ||
7561 | ret = compat_arch_ptrace(child, request, addr, data); | ||
7562 | + if (ret || request != PTRACE_DETACH) | ||
7563 | + ptrace_unfreeze_traced(child); | ||
7564 | + } | ||
7565 | |||
7566 | out_put_task_struct: | ||
7567 | put_task_struct(child); | ||
7568 | diff --git a/kernel/sched/core.c b/kernel/sched/core.c | ||
7569 | index 1a48cdb..5eb6c96 100644 | ||
7570 | --- a/kernel/sched/core.c | ||
7571 | +++ b/kernel/sched/core.c | ||
7572 | @@ -1686,7 +1686,8 @@ out: | ||
7573 | */ | ||
7574 | int wake_up_process(struct task_struct *p) | ||
7575 | { | ||
7576 | - return try_to_wake_up(p, TASK_ALL, 0); | ||
7577 | + WARN_ON(task_is_stopped_or_traced(p)); | ||
7578 | + return try_to_wake_up(p, TASK_NORMAL, 0); | ||
7579 | } | ||
7580 | EXPORT_SYMBOL(wake_up_process); | ||
7581 | |||
7582 | diff --git a/kernel/signal.c b/kernel/signal.c | ||
7583 | index be4f856..67b64be 100644 | ||
7584 | --- a/kernel/signal.c | ||
7585 | +++ b/kernel/signal.c | ||
7586 | @@ -678,23 +678,17 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info) | ||
7587 | * No need to set need_resched since signal event passing | ||
7588 | * goes through ->blocked | ||
7589 | */ | ||
7590 | -void signal_wake_up(struct task_struct *t, int resume) | ||
7591 | +void signal_wake_up_state(struct task_struct *t, unsigned int state) | ||
7592 | { | ||
7593 | - unsigned int mask; | ||
7594 | - | ||
7595 | set_tsk_thread_flag(t, TIF_SIGPENDING); | ||
7596 | - | ||
7597 | /* | ||
7598 | - * For SIGKILL, we want to wake it up in the stopped/traced/killable | ||
7599 | + * TASK_WAKEKILL also means wake it up in the stopped/traced/killable | ||
7600 | * case. We don't check t->state here because there is a race with it | ||
7601 | * executing another processor and just now entering stopped state. | ||
7602 | * By using wake_up_state, we ensure the process will wake up and | ||
7603 | * handle its death signal. | ||
7604 | */ | ||
7605 | - mask = TASK_INTERRUPTIBLE; | ||
7606 | - if (resume) | ||
7607 | - mask |= TASK_WAKEKILL; | ||
7608 | - if (!wake_up_state(t, mask)) | ||
7609 | + if (!wake_up_state(t, state | TASK_INTERRUPTIBLE)) | ||
7610 | kick_process(t); | ||
7611 | } | ||
7612 | |||
7613 | @@ -842,7 +836,7 @@ static void ptrace_trap_notify(struct task_struct *t) | ||
7614 | assert_spin_locked(&t->sighand->siglock); | ||
7615 | |||
7616 | task_set_jobctl_pending(t, JOBCTL_TRAP_NOTIFY); | ||
7617 | - signal_wake_up(t, t->jobctl & JOBCTL_LISTENING); | ||
7618 | + ptrace_signal_wake_up(t, t->jobctl & JOBCTL_LISTENING); | ||
7619 | } | ||
7620 | |||
7621 | /* | ||
7622 | @@ -1797,6 +1791,10 @@ static inline int may_ptrace_stop(void) | ||
7623 | * If SIGKILL was already sent before the caller unlocked | ||
7624 | * ->siglock we must see ->core_state != NULL. Otherwise it | ||
7625 | * is safe to enter schedule(). | ||
7626 | + * | ||
7627 | + * This is almost outdated, a task with the pending SIGKILL can't | ||
7628 | + * block in TASK_TRACED. But PTRACE_EVENT_EXIT can be reported | ||
7629 | + * after SIGKILL was already dequeued. | ||
7630 | */ | ||
7631 | if (unlikely(current->mm->core_state) && | ||
7632 | unlikely(current->mm == current->parent->mm)) | ||
7633 | @@ -1922,6 +1920,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info) | ||
7634 | if (gstop_done) | ||
7635 | do_notify_parent_cldstop(current, false, why); | ||
7636 | |||
7637 | + /* tasklist protects us from ptrace_freeze_traced() */ | ||
7638 | __set_current_state(TASK_RUNNING); | ||
7639 | if (clear_code) | ||
7640 | current->exit_code = 0; | ||
7641 | diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c | ||
7642 | index 781ecc2..7f8a8df 100644 | ||
7643 | --- a/kernel/trace/ftrace.c | ||
7644 | +++ b/kernel/trace/ftrace.c | ||
7645 | @@ -3863,7 +3863,7 @@ static int ftrace_module_notify(struct notifier_block *self, | ||
7646 | |||
7647 | struct notifier_block ftrace_module_nb = { | ||
7648 | .notifier_call = ftrace_module_notify, | ||
7649 | - .priority = 0, | ||
7650 | + .priority = INT_MAX, /* Run before anything that can use kprobes */ | ||
7651 | }; | ||
7652 | |||
7653 | extern unsigned long __start_mcount_loc[]; | ||
7654 | diff --git a/lib/atomic64.c b/lib/atomic64.c | ||
7655 | index 9785378..08a4f06 100644 | ||
7656 | --- a/lib/atomic64.c | ||
7657 | +++ b/lib/atomic64.c | ||
7658 | @@ -31,7 +31,11 @@ | ||
7659 | static union { | ||
7660 | raw_spinlock_t lock; | ||
7661 | char pad[L1_CACHE_BYTES]; | ||
7662 | -} atomic64_lock[NR_LOCKS] __cacheline_aligned_in_smp; | ||
7663 | +} atomic64_lock[NR_LOCKS] __cacheline_aligned_in_smp = { | ||
7664 | + [0 ... (NR_LOCKS - 1)] = { | ||
7665 | + .lock = __RAW_SPIN_LOCK_UNLOCKED(atomic64_lock.lock), | ||
7666 | + }, | ||
7667 | +}; | ||
7668 | |||
7669 | static inline raw_spinlock_t *lock_addr(const atomic64_t *v) | ||
7670 | { | ||
7671 | @@ -173,14 +177,3 @@ int atomic64_add_unless(atomic64_t *v, long long a, long long u) | ||
7672 | return ret; | ||
7673 | } | ||
7674 | EXPORT_SYMBOL(atomic64_add_unless); | ||
7675 | - | ||
7676 | -static int init_atomic64_lock(void) | ||
7677 | -{ | ||
7678 | - int i; | ||
7679 | - | ||
7680 | - for (i = 0; i < NR_LOCKS; ++i) | ||
7681 | - raw_spin_lock_init(&atomic64_lock[i].lock); | ||
7682 | - return 0; | ||
7683 | -} | ||
7684 | - | ||
7685 | -pure_initcall(init_atomic64_lock); | ||
7686 | diff --git a/mm/compaction.c b/mm/compaction.c | ||
7687 | index 7fcd3a5..214944a 100644 | ||
7688 | --- a/mm/compaction.c | ||
7689 | +++ b/mm/compaction.c | ||
7690 | @@ -956,7 +956,7 @@ static int compact_node(int nid) | ||
7691 | } | ||
7692 | |||
7693 | /* Compact all nodes in the system */ | ||
7694 | -static int compact_nodes(void) | ||
7695 | +static void compact_nodes(void) | ||
7696 | { | ||
7697 | int nid; | ||
7698 | |||
7699 | @@ -965,8 +965,6 @@ static int compact_nodes(void) | ||
7700 | |||
7701 | for_each_online_node(nid) | ||
7702 | compact_node(nid); | ||
7703 | - | ||
7704 | - return COMPACT_COMPLETE; | ||
7705 | } | ||
7706 | |||
7707 | /* The written value is actually unused, all memory is compacted */ | ||
7708 | @@ -977,7 +975,7 @@ int sysctl_compaction_handler(struct ctl_table *table, int write, | ||
7709 | void __user *buffer, size_t *length, loff_t *ppos) | ||
7710 | { | ||
7711 | if (write) | ||
7712 | - return compact_nodes(); | ||
7713 | + compact_nodes(); | ||
7714 | |||
7715 | return 0; | ||
7716 | } | ||
7717 | diff --git a/mm/memory.c b/mm/memory.c | ||
7718 | index 5736170..29ffb5c 100644 | ||
7719 | --- a/mm/memory.c | ||
7720 | +++ b/mm/memory.c | ||
7721 | @@ -182,10 +182,14 @@ static int tlb_next_batch(struct mmu_gather *tlb) | ||
7722 | return 1; | ||
7723 | } | ||
7724 | |||
7725 | + if (tlb->batch_count == MAX_GATHER_BATCH_COUNT) | ||
7726 | + return 0; | ||
7727 | + | ||
7728 | batch = (void *)__get_free_pages(GFP_NOWAIT | __GFP_NOWARN, 0); | ||
7729 | if (!batch) | ||
7730 | return 0; | ||
7731 | |||
7732 | + tlb->batch_count++; | ||
7733 | batch->next = NULL; | ||
7734 | batch->nr = 0; | ||
7735 | batch->max = MAX_GATHER_BATCH; | ||
7736 | @@ -214,6 +218,7 @@ void tlb_gather_mmu(struct mmu_gather *tlb, struct mm_struct *mm, bool fullmm) | ||
7737 | tlb->local.nr = 0; | ||
7738 | tlb->local.max = ARRAY_SIZE(tlb->__pages); | ||
7739 | tlb->active = &tlb->local; | ||
7740 | + tlb->batch_count = 0; | ||
7741 | |||
7742 | #ifdef CONFIG_HAVE_RCU_TABLE_FREE | ||
7743 | tlb->batch = NULL; | ||
7744 | diff --git a/mm/mempolicy.c b/mm/mempolicy.c | ||
7745 | index 01350d3..5e0fea1 100644 | ||
7746 | --- a/mm/mempolicy.c | ||
7747 | +++ b/mm/mempolicy.c | ||
7748 | @@ -2370,8 +2370,7 @@ void numa_default_policy(void) | ||
7749 | */ | ||
7750 | |||
7751 | /* | ||
7752 | - * "local" is pseudo-policy: MPOL_PREFERRED with MPOL_F_LOCAL flag | ||
7753 | - * Used only for mpol_parse_str() and mpol_to_str() | ||
7754 | + * "local" is implemented internally by MPOL_PREFERRED with MPOL_F_LOCAL flag. | ||
7755 | */ | ||
7756 | #define MPOL_LOCAL MPOL_MAX | ||
7757 | static const char * const policy_modes[] = | ||
7758 | @@ -2386,28 +2385,21 @@ static const char * const policy_modes[] = | ||
7759 | |||
7760 | #ifdef CONFIG_TMPFS | ||
7761 | /** | ||
7762 | - * mpol_parse_str - parse string to mempolicy | ||
7763 | + * mpol_parse_str - parse string to mempolicy, for tmpfs mpol mount option. | ||
7764 | * @str: string containing mempolicy to parse | ||
7765 | * @mpol: pointer to struct mempolicy pointer, returned on success. | ||
7766 | - * @no_context: flag whether to "contextualize" the mempolicy | ||
7767 | + * @unused: redundant argument, to be removed later. | ||
7768 | * | ||
7769 | * Format of input: | ||
7770 | * <mode>[=<flags>][:<nodelist>] | ||
7771 | * | ||
7772 | - * if @no_context is true, save the input nodemask in w.user_nodemask in | ||
7773 | - * the returned mempolicy. This will be used to "clone" the mempolicy in | ||
7774 | - * a specific context [cpuset] at a later time. Used to parse tmpfs mpol | ||
7775 | - * mount option. Note that if 'static' or 'relative' mode flags were | ||
7776 | - * specified, the input nodemask will already have been saved. Saving | ||
7777 | - * it again is redundant, but safe. | ||
7778 | - * | ||
7779 | * On success, returns 0, else 1 | ||
7780 | */ | ||
7781 | -int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) | ||
7782 | +int mpol_parse_str(char *str, struct mempolicy **mpol, int unused) | ||
7783 | { | ||
7784 | struct mempolicy *new = NULL; | ||
7785 | unsigned short mode; | ||
7786 | - unsigned short uninitialized_var(mode_flags); | ||
7787 | + unsigned short mode_flags; | ||
7788 | nodemask_t nodes; | ||
7789 | char *nodelist = strchr(str, ':'); | ||
7790 | char *flags = strchr(str, '='); | ||
7791 | @@ -2495,24 +2487,23 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) | ||
7792 | if (IS_ERR(new)) | ||
7793 | goto out; | ||
7794 | |||
7795 | - if (no_context) { | ||
7796 | - /* save for contextualization */ | ||
7797 | - new->w.user_nodemask = nodes; | ||
7798 | - } else { | ||
7799 | - int ret; | ||
7800 | - NODEMASK_SCRATCH(scratch); | ||
7801 | - if (scratch) { | ||
7802 | - task_lock(current); | ||
7803 | - ret = mpol_set_nodemask(new, &nodes, scratch); | ||
7804 | - task_unlock(current); | ||
7805 | - } else | ||
7806 | - ret = -ENOMEM; | ||
7807 | - NODEMASK_SCRATCH_FREE(scratch); | ||
7808 | - if (ret) { | ||
7809 | - mpol_put(new); | ||
7810 | - goto out; | ||
7811 | - } | ||
7812 | - } | ||
7813 | + /* | ||
7814 | + * Save nodes for mpol_to_str() to show the tmpfs mount options | ||
7815 | + * for /proc/mounts, /proc/pid/mounts and /proc/pid/mountinfo. | ||
7816 | + */ | ||
7817 | + if (mode != MPOL_PREFERRED) | ||
7818 | + new->v.nodes = nodes; | ||
7819 | + else if (nodelist) | ||
7820 | + new->v.preferred_node = first_node(nodes); | ||
7821 | + else | ||
7822 | + new->flags |= MPOL_F_LOCAL; | ||
7823 | + | ||
7824 | + /* | ||
7825 | + * Save nodes for contextualization: this will be used to "clone" | ||
7826 | + * the mempolicy in a specific context [cpuset] at a later time. | ||
7827 | + */ | ||
7828 | + new->w.user_nodemask = nodes; | ||
7829 | + | ||
7830 | err = 0; | ||
7831 | |||
7832 | out: | ||
7833 | @@ -2532,13 +2523,13 @@ out: | ||
7834 | * @buffer: to contain formatted mempolicy string | ||
7835 | * @maxlen: length of @buffer | ||
7836 | * @pol: pointer to mempolicy to be formatted | ||
7837 | - * @no_context: "context free" mempolicy - use nodemask in w.user_nodemask | ||
7838 | + * @unused: redundant argument, to be removed later. | ||
7839 | * | ||
7840 | * Convert a mempolicy into a string. | ||
7841 | * Returns the number of characters in buffer (if positive) | ||
7842 | * or an error (negative) | ||
7843 | */ | ||
7844 | -int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context) | ||
7845 | +int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int unused) | ||
7846 | { | ||
7847 | char *p = buffer; | ||
7848 | int l; | ||
7849 | @@ -2564,7 +2555,7 @@ int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context) | ||
7850 | case MPOL_PREFERRED: | ||
7851 | nodes_clear(nodes); | ||
7852 | if (flags & MPOL_F_LOCAL) | ||
7853 | - mode = MPOL_LOCAL; /* pseudo-policy */ | ||
7854 | + mode = MPOL_LOCAL; | ||
7855 | else | ||
7856 | node_set(pol->v.preferred_node, nodes); | ||
7857 | break; | ||
7858 | @@ -2572,10 +2563,7 @@ int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol, int no_context) | ||
7859 | case MPOL_BIND: | ||
7860 | /* Fall through */ | ||
7861 | case MPOL_INTERLEAVE: | ||
7862 | - if (no_context) | ||
7863 | - nodes = pol->w.user_nodemask; | ||
7864 | - else | ||
7865 | - nodes = pol->v.nodes; | ||
7866 | + nodes = pol->v.nodes; | ||
7867 | break; | ||
7868 | |||
7869 | default: | ||
7870 | diff --git a/mm/page-writeback.c b/mm/page-writeback.c | ||
7871 | index 5ad5ce2..7a5f842 100644 | ||
7872 | --- a/mm/page-writeback.c | ||
7873 | +++ b/mm/page-writeback.c | ||
7874 | @@ -201,6 +201,18 @@ static unsigned long highmem_dirtyable_memory(unsigned long total) | ||
7875 | zone_reclaimable_pages(z) - z->dirty_balance_reserve; | ||
7876 | } | ||
7877 | /* | ||
7878 | + * Unreclaimable memory (kernel memory or anonymous memory | ||
7879 | + * without swap) can bring down the dirtyable pages below | ||
7880 | + * the zone's dirty balance reserve and the above calculation | ||
7881 | + * will underflow. However we still want to add in nodes | ||
7882 | + * which are below threshold (negative values) to get a more | ||
7883 | + * accurate calculation but make sure that the total never | ||
7884 | + * underflows. | ||
7885 | + */ | ||
7886 | + if ((long)x < 0) | ||
7887 | + x = 0; | ||
7888 | + | ||
7889 | + /* | ||
7890 | * Make sure that the number of highmem pages is never larger | ||
7891 | * than the number of the total dirtyable memory. This can only | ||
7892 | * occur in very strange VM situations but we want to make sure | ||
7893 | @@ -222,8 +234,8 @@ static unsigned long global_dirtyable_memory(void) | ||
7894 | { | ||
7895 | unsigned long x; | ||
7896 | |||
7897 | - x = global_page_state(NR_FREE_PAGES) + global_reclaimable_pages() - | ||
7898 | - dirty_balance_reserve; | ||
7899 | + x = global_page_state(NR_FREE_PAGES) + global_reclaimable_pages(); | ||
7900 | + x -= min(x, dirty_balance_reserve); | ||
7901 | |||
7902 | if (!vm_highmem_is_dirtyable) | ||
7903 | x -= highmem_dirtyable_memory(x); | ||
7904 | @@ -290,9 +302,12 @@ static unsigned long zone_dirtyable_memory(struct zone *zone) | ||
7905 | * highmem zone can hold its share of dirty pages, so we don't | ||
7906 | * care about vm_highmem_is_dirtyable here. | ||
7907 | */ | ||
7908 | - return zone_page_state(zone, NR_FREE_PAGES) + | ||
7909 | - zone_reclaimable_pages(zone) - | ||
7910 | - zone->dirty_balance_reserve; | ||
7911 | + unsigned long nr_pages = zone_page_state(zone, NR_FREE_PAGES) + | ||
7912 | + zone_reclaimable_pages(zone); | ||
7913 | + | ||
7914 | + /* don't allow this to underflow */ | ||
7915 | + nr_pages -= min(nr_pages, zone->dirty_balance_reserve); | ||
7916 | + return nr_pages; | ||
7917 | } | ||
7918 | |||
7919 | /** | ||
7920 | diff --git a/mm/page_alloc.c b/mm/page_alloc.c | ||
7921 | index d2d8f54..fd56833 100644 | ||
7922 | --- a/mm/page_alloc.c | ||
7923 | +++ b/mm/page_alloc.c | ||
7924 | @@ -5455,7 +5455,7 @@ static inline int pfn_to_bitidx(struct zone *zone, unsigned long pfn) | ||
7925 | pfn &= (PAGES_PER_SECTION-1); | ||
7926 | return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS; | ||
7927 | #else | ||
7928 | - pfn = pfn - zone->zone_start_pfn; | ||
7929 | + pfn = pfn - round_down(zone->zone_start_pfn, pageblock_nr_pages); | ||
7930 | return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS; | ||
7931 | #endif /* CONFIG_SPARSEMEM */ | ||
7932 | } | ||
7933 | diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c | ||
7934 | index 469daab..1476f26 100644 | ||
7935 | --- a/net/batman-adv/bat_iv_ogm.c | ||
7936 | +++ b/net/batman-adv/bat_iv_ogm.c | ||
7937 | @@ -119,7 +119,7 @@ batadv_iv_ogm_emit_send_time(const struct batadv_priv *bat_priv) | ||
7938 | unsigned int msecs; | ||
7939 | |||
7940 | msecs = atomic_read(&bat_priv->orig_interval) - BATADV_JITTER; | ||
7941 | - msecs += (random32() % 2 * BATADV_JITTER); | ||
7942 | + msecs += random32() % (2 * BATADV_JITTER); | ||
7943 | |||
7944 | return jiffies + msecs_to_jiffies(msecs); | ||
7945 | } | ||
7946 | diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c | ||
7947 | index 0b997c8..aeb0962 100644 | ||
7948 | --- a/net/bluetooth/hci_core.c | ||
7949 | +++ b/net/bluetooth/hci_core.c | ||
7950 | @@ -1789,6 +1789,8 @@ void hci_unregister_dev(struct hci_dev *hdev) | ||
7951 | for (i = 0; i < NUM_REASSEMBLY; i++) | ||
7952 | kfree_skb(hdev->reassembly[i]); | ||
7953 | |||
7954 | + cancel_work_sync(&hdev->power_on); | ||
7955 | + | ||
7956 | if (!test_bit(HCI_INIT, &hdev->flags) && | ||
7957 | !test_bit(HCI_SETUP, &hdev->dev_flags)) { | ||
7958 | hci_dev_lock(hdev); | ||
7959 | diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c | ||
7960 | index 1a17850..32893a0 100644 | ||
7961 | --- a/net/bluetooth/rfcomm/sock.c | ||
7962 | +++ b/net/bluetooth/rfcomm/sock.c | ||
7963 | @@ -467,7 +467,7 @@ static int rfcomm_sock_accept(struct socket *sock, struct socket *newsock, int f | ||
7964 | long timeo; | ||
7965 | int err = 0; | ||
7966 | |||
7967 | - lock_sock(sk); | ||
7968 | + lock_sock_nested(sk, SINGLE_DEPTH_NESTING); | ||
7969 | |||
7970 | if (sk->sk_type != SOCK_STREAM) { | ||
7971 | err = -EINVAL; | ||
7972 | @@ -504,7 +504,7 @@ static int rfcomm_sock_accept(struct socket *sock, struct socket *newsock, int f | ||
7973 | |||
7974 | release_sock(sk); | ||
7975 | timeo = schedule_timeout(timeo); | ||
7976 | - lock_sock(sk); | ||
7977 | + lock_sock_nested(sk, SINGLE_DEPTH_NESTING); | ||
7978 | } | ||
7979 | __set_current_state(TASK_RUNNING); | ||
7980 | remove_wait_queue(sk_sleep(sk), &wait); | ||
7981 | diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c | ||
7982 | index a802029..ee71ea2 100644 | ||
7983 | --- a/net/ceph/ceph_common.c | ||
7984 | +++ b/net/ceph/ceph_common.c | ||
7985 | @@ -305,7 +305,6 @@ ceph_parse_options(char *options, const char *dev_name, | ||
7986 | |||
7987 | /* start with defaults */ | ||
7988 | opt->flags = CEPH_OPT_DEFAULT; | ||
7989 | - opt->osd_timeout = CEPH_OSD_TIMEOUT_DEFAULT; | ||
7990 | opt->osd_keepalive_timeout = CEPH_OSD_KEEPALIVE_DEFAULT; | ||
7991 | opt->mount_timeout = CEPH_MOUNT_TIMEOUT_DEFAULT; /* seconds */ | ||
7992 | opt->osd_idle_ttl = CEPH_OSD_IDLE_TTL_DEFAULT; /* seconds */ | ||
7993 | @@ -391,7 +390,7 @@ ceph_parse_options(char *options, const char *dev_name, | ||
7994 | |||
7995 | /* misc */ | ||
7996 | case Opt_osdtimeout: | ||
7997 | - opt->osd_timeout = intval; | ||
7998 | + pr_warning("ignoring deprecated osdtimeout option\n"); | ||
7999 | break; | ||
8000 | case Opt_osdkeepalivetimeout: | ||
8001 | opt->osd_keepalive_timeout = intval; | ||
8002 | diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c | ||
8003 | index 3ef1759..e9f2159 100644 | ||
8004 | --- a/net/ceph/messenger.c | ||
8005 | +++ b/net/ceph/messenger.c | ||
8006 | @@ -506,6 +506,7 @@ static void reset_connection(struct ceph_connection *con) | ||
8007 | { | ||
8008 | /* reset connection, out_queue, msg_ and connect_seq */ | ||
8009 | /* discard existing out_queue and msg_seq */ | ||
8010 | + dout("reset_connection %p\n", con); | ||
8011 | ceph_msg_remove_list(&con->out_queue); | ||
8012 | ceph_msg_remove_list(&con->out_sent); | ||
8013 | |||
8014 | @@ -561,7 +562,7 @@ void ceph_con_open(struct ceph_connection *con, | ||
8015 | mutex_lock(&con->mutex); | ||
8016 | dout("con_open %p %s\n", con, ceph_pr_addr(&addr->in_addr)); | ||
8017 | |||
8018 | - BUG_ON(con->state != CON_STATE_CLOSED); | ||
8019 | + WARN_ON(con->state != CON_STATE_CLOSED); | ||
8020 | con->state = CON_STATE_PREOPEN; | ||
8021 | |||
8022 | con->peer_name.type = (__u8) entity_type; | ||
8023 | @@ -1506,13 +1507,6 @@ static int process_banner(struct ceph_connection *con) | ||
8024 | return 0; | ||
8025 | } | ||
8026 | |||
8027 | -static void fail_protocol(struct ceph_connection *con) | ||
8028 | -{ | ||
8029 | - reset_connection(con); | ||
8030 | - BUG_ON(con->state != CON_STATE_NEGOTIATING); | ||
8031 | - con->state = CON_STATE_CLOSED; | ||
8032 | -} | ||
8033 | - | ||
8034 | static int process_connect(struct ceph_connection *con) | ||
8035 | { | ||
8036 | u64 sup_feat = con->msgr->supported_features; | ||
8037 | @@ -1530,7 +1524,7 @@ static int process_connect(struct ceph_connection *con) | ||
8038 | ceph_pr_addr(&con->peer_addr.in_addr), | ||
8039 | sup_feat, server_feat, server_feat & ~sup_feat); | ||
8040 | con->error_msg = "missing required protocol features"; | ||
8041 | - fail_protocol(con); | ||
8042 | + reset_connection(con); | ||
8043 | return -1; | ||
8044 | |||
8045 | case CEPH_MSGR_TAG_BADPROTOVER: | ||
8046 | @@ -1541,7 +1535,7 @@ static int process_connect(struct ceph_connection *con) | ||
8047 | le32_to_cpu(con->out_connect.protocol_version), | ||
8048 | le32_to_cpu(con->in_reply.protocol_version)); | ||
8049 | con->error_msg = "protocol version mismatch"; | ||
8050 | - fail_protocol(con); | ||
8051 | + reset_connection(con); | ||
8052 | return -1; | ||
8053 | |||
8054 | case CEPH_MSGR_TAG_BADAUTHORIZER: | ||
8055 | @@ -1631,11 +1625,11 @@ static int process_connect(struct ceph_connection *con) | ||
8056 | ceph_pr_addr(&con->peer_addr.in_addr), | ||
8057 | req_feat, server_feat, req_feat & ~server_feat); | ||
8058 | con->error_msg = "missing required protocol features"; | ||
8059 | - fail_protocol(con); | ||
8060 | + reset_connection(con); | ||
8061 | return -1; | ||
8062 | } | ||
8063 | |||
8064 | - BUG_ON(con->state != CON_STATE_NEGOTIATING); | ||
8065 | + WARN_ON(con->state != CON_STATE_NEGOTIATING); | ||
8066 | con->state = CON_STATE_OPEN; | ||
8067 | |||
8068 | con->peer_global_seq = le32_to_cpu(con->in_reply.global_seq); | ||
8069 | @@ -2132,7 +2126,6 @@ more: | ||
8070 | if (ret < 0) | ||
8071 | goto out; | ||
8072 | |||
8073 | - BUG_ON(con->state != CON_STATE_CONNECTING); | ||
8074 | con->state = CON_STATE_NEGOTIATING; | ||
8075 | |||
8076 | /* | ||
8077 | @@ -2160,7 +2153,7 @@ more: | ||
8078 | goto more; | ||
8079 | } | ||
8080 | |||
8081 | - BUG_ON(con->state != CON_STATE_OPEN); | ||
8082 | + WARN_ON(con->state != CON_STATE_OPEN); | ||
8083 | |||
8084 | if (con->in_base_pos < 0) { | ||
8085 | /* | ||
8086 | @@ -2262,6 +2255,35 @@ static void queue_con(struct ceph_connection *con) | ||
8087 | } | ||
8088 | } | ||
8089 | |||
8090 | +static bool con_sock_closed(struct ceph_connection *con) | ||
8091 | +{ | ||
8092 | + if (!test_and_clear_bit(CON_FLAG_SOCK_CLOSED, &con->flags)) | ||
8093 | + return false; | ||
8094 | + | ||
8095 | +#define CASE(x) \ | ||
8096 | + case CON_STATE_ ## x: \ | ||
8097 | + con->error_msg = "socket closed (con state " #x ")"; \ | ||
8098 | + break; | ||
8099 | + | ||
8100 | + switch (con->state) { | ||
8101 | + CASE(CLOSED); | ||
8102 | + CASE(PREOPEN); | ||
8103 | + CASE(CONNECTING); | ||
8104 | + CASE(NEGOTIATING); | ||
8105 | + CASE(OPEN); | ||
8106 | + CASE(STANDBY); | ||
8107 | + default: | ||
8108 | + pr_warning("%s con %p unrecognized state %lu\n", | ||
8109 | + __func__, con, con->state); | ||
8110 | + con->error_msg = "unrecognized con state"; | ||
8111 | + BUG(); | ||
8112 | + break; | ||
8113 | + } | ||
8114 | +#undef CASE | ||
8115 | + | ||
8116 | + return true; | ||
8117 | +} | ||
8118 | + | ||
8119 | /* | ||
8120 | * Do some work on a connection. Drop a connection ref when we're done. | ||
8121 | */ | ||
8122 | @@ -2273,24 +2295,8 @@ static void con_work(struct work_struct *work) | ||
8123 | |||
8124 | mutex_lock(&con->mutex); | ||
8125 | restart: | ||
8126 | - if (test_and_clear_bit(CON_FLAG_SOCK_CLOSED, &con->flags)) { | ||
8127 | - switch (con->state) { | ||
8128 | - case CON_STATE_CONNECTING: | ||
8129 | - con->error_msg = "connection failed"; | ||
8130 | - break; | ||
8131 | - case CON_STATE_NEGOTIATING: | ||
8132 | - con->error_msg = "negotiation failed"; | ||
8133 | - break; | ||
8134 | - case CON_STATE_OPEN: | ||
8135 | - con->error_msg = "socket closed"; | ||
8136 | - break; | ||
8137 | - default: | ||
8138 | - dout("unrecognized con state %d\n", (int)con->state); | ||
8139 | - con->error_msg = "unrecognized con state"; | ||
8140 | - BUG(); | ||
8141 | - } | ||
8142 | + if (con_sock_closed(con)) | ||
8143 | goto fault; | ||
8144 | - } | ||
8145 | |||
8146 | if (test_and_clear_bit(CON_FLAG_BACKOFF, &con->flags)) { | ||
8147 | dout("con_work %p backing off\n", con); | ||
8148 | @@ -2356,12 +2362,12 @@ fault: | ||
8149 | static void ceph_fault(struct ceph_connection *con) | ||
8150 | __releases(con->mutex) | ||
8151 | { | ||
8152 | - pr_err("%s%lld %s %s\n", ENTITY_NAME(con->peer_name), | ||
8153 | + pr_warning("%s%lld %s %s\n", ENTITY_NAME(con->peer_name), | ||
8154 | ceph_pr_addr(&con->peer_addr.in_addr), con->error_msg); | ||
8155 | dout("fault %p state %lu to peer %s\n", | ||
8156 | con, con->state, ceph_pr_addr(&con->peer_addr.in_addr)); | ||
8157 | |||
8158 | - BUG_ON(con->state != CON_STATE_CONNECTING && | ||
8159 | + WARN_ON(con->state != CON_STATE_CONNECTING && | ||
8160 | con->state != CON_STATE_NEGOTIATING && | ||
8161 | con->state != CON_STATE_OPEN); | ||
8162 | |||
8163 | diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c | ||
8164 | index f7b56e2..eb9a444 100644 | ||
8165 | --- a/net/ceph/osd_client.c | ||
8166 | +++ b/net/ceph/osd_client.c | ||
8167 | @@ -221,7 +221,7 @@ struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *osdc, | ||
8168 | kref_init(&req->r_kref); | ||
8169 | init_completion(&req->r_completion); | ||
8170 | init_completion(&req->r_safe_completion); | ||
8171 | - rb_init_node(&req->r_node); | ||
8172 | + RB_CLEAR_NODE(&req->r_node); | ||
8173 | INIT_LIST_HEAD(&req->r_unsafe_item); | ||
8174 | INIT_LIST_HEAD(&req->r_linger_item); | ||
8175 | INIT_LIST_HEAD(&req->r_linger_osd); | ||
8176 | @@ -464,6 +464,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, | ||
8177 | { | ||
8178 | struct ceph_osd_req_op ops[3]; | ||
8179 | struct ceph_osd_request *req; | ||
8180 | + int r; | ||
8181 | |||
8182 | ops[0].op = opcode; | ||
8183 | ops[0].extent.truncate_seq = truncate_seq; | ||
8184 | @@ -482,10 +483,12 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, | ||
8185 | use_mempool, | ||
8186 | GFP_NOFS, NULL, NULL); | ||
8187 | if (!req) | ||
8188 | - return NULL; | ||
8189 | + return ERR_PTR(-ENOMEM); | ||
8190 | |||
8191 | /* calculate max write size */ | ||
8192 | - calc_layout(osdc, vino, layout, off, plen, req, ops); | ||
8193 | + r = calc_layout(osdc, vino, layout, off, plen, req, ops); | ||
8194 | + if (r < 0) | ||
8195 | + return ERR_PTR(r); | ||
8196 | req->r_file_layout = *layout; /* keep a copy */ | ||
8197 | |||
8198 | /* in case it differs from natural (file) alignment that | ||
8199 | @@ -578,7 +581,7 @@ static void __kick_osd_requests(struct ceph_osd_client *osdc, | ||
8200 | |||
8201 | dout("__kick_osd_requests osd%d\n", osd->o_osd); | ||
8202 | err = __reset_osd(osdc, osd); | ||
8203 | - if (err == -EAGAIN) | ||
8204 | + if (err) | ||
8205 | return; | ||
8206 | |||
8207 | list_for_each_entry(req, &osd->o_requests, r_osd_item) { | ||
8208 | @@ -605,14 +608,6 @@ static void __kick_osd_requests(struct ceph_osd_client *osdc, | ||
8209 | } | ||
8210 | } | ||
8211 | |||
8212 | -static void kick_osd_requests(struct ceph_osd_client *osdc, | ||
8213 | - struct ceph_osd *kickosd) | ||
8214 | -{ | ||
8215 | - mutex_lock(&osdc->request_mutex); | ||
8216 | - __kick_osd_requests(osdc, kickosd); | ||
8217 | - mutex_unlock(&osdc->request_mutex); | ||
8218 | -} | ||
8219 | - | ||
8220 | /* | ||
8221 | * If the osd connection drops, we need to resubmit all requests. | ||
8222 | */ | ||
8223 | @@ -626,7 +621,9 @@ static void osd_reset(struct ceph_connection *con) | ||
8224 | dout("osd_reset osd%d\n", osd->o_osd); | ||
8225 | osdc = osd->o_osdc; | ||
8226 | down_read(&osdc->map_sem); | ||
8227 | - kick_osd_requests(osdc, osd); | ||
8228 | + mutex_lock(&osdc->request_mutex); | ||
8229 | + __kick_osd_requests(osdc, osd); | ||
8230 | + mutex_unlock(&osdc->request_mutex); | ||
8231 | send_queued(osdc); | ||
8232 | up_read(&osdc->map_sem); | ||
8233 | } | ||
8234 | @@ -645,6 +642,7 @@ static struct ceph_osd *create_osd(struct ceph_osd_client *osdc, int onum) | ||
8235 | atomic_set(&osd->o_ref, 1); | ||
8236 | osd->o_osdc = osdc; | ||
8237 | osd->o_osd = onum; | ||
8238 | + RB_CLEAR_NODE(&osd->o_node); | ||
8239 | INIT_LIST_HEAD(&osd->o_requests); | ||
8240 | INIT_LIST_HEAD(&osd->o_linger_requests); | ||
8241 | INIT_LIST_HEAD(&osd->o_osd_lru); | ||
8242 | @@ -748,6 +746,7 @@ static int __reset_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) | ||
8243 | if (list_empty(&osd->o_requests) && | ||
8244 | list_empty(&osd->o_linger_requests)) { | ||
8245 | __remove_osd(osdc, osd); | ||
8246 | + ret = -ENODEV; | ||
8247 | } else if (memcmp(&osdc->osdmap->osd_addr[osd->o_osd], | ||
8248 | &osd->o_con.peer_addr, | ||
8249 | sizeof(osd->o_con.peer_addr)) == 0 && | ||
8250 | @@ -874,9 +873,9 @@ static void __unregister_request(struct ceph_osd_client *osdc, | ||
8251 | req->r_osd = NULL; | ||
8252 | } | ||
8253 | |||
8254 | + list_del_init(&req->r_req_lru_item); | ||
8255 | ceph_osdc_put_request(req); | ||
8256 | |||
8257 | - list_del_init(&req->r_req_lru_item); | ||
8258 | if (osdc->num_requests == 0) { | ||
8259 | dout(" no requests, canceling timeout\n"); | ||
8260 | __cancel_osd_timeout(osdc); | ||
8261 | @@ -908,8 +907,8 @@ static void __unregister_linger_request(struct ceph_osd_client *osdc, | ||
8262 | struct ceph_osd_request *req) | ||
8263 | { | ||
8264 | dout("__unregister_linger_request %p\n", req); | ||
8265 | + list_del_init(&req->r_linger_item); | ||
8266 | if (req->r_osd) { | ||
8267 | - list_del_init(&req->r_linger_item); | ||
8268 | list_del_init(&req->r_linger_osd); | ||
8269 | |||
8270 | if (list_empty(&req->r_osd->o_requests) && | ||
8271 | @@ -1088,12 +1087,10 @@ static void handle_timeout(struct work_struct *work) | ||
8272 | { | ||
8273 | struct ceph_osd_client *osdc = | ||
8274 | container_of(work, struct ceph_osd_client, timeout_work.work); | ||
8275 | - struct ceph_osd_request *req, *last_req = NULL; | ||
8276 | + struct ceph_osd_request *req; | ||
8277 | struct ceph_osd *osd; | ||
8278 | - unsigned long timeout = osdc->client->options->osd_timeout * HZ; | ||
8279 | unsigned long keepalive = | ||
8280 | osdc->client->options->osd_keepalive_timeout * HZ; | ||
8281 | - unsigned long last_stamp = 0; | ||
8282 | struct list_head slow_osds; | ||
8283 | dout("timeout\n"); | ||
8284 | down_read(&osdc->map_sem); | ||
8285 | @@ -1103,37 +1100,6 @@ static void handle_timeout(struct work_struct *work) | ||
8286 | mutex_lock(&osdc->request_mutex); | ||
8287 | |||
8288 | /* | ||
8289 | - * reset osds that appear to be _really_ unresponsive. this | ||
8290 | - * is a failsafe measure.. we really shouldn't be getting to | ||
8291 | - * this point if the system is working properly. the monitors | ||
8292 | - * should mark the osd as failed and we should find out about | ||
8293 | - * it from an updated osd map. | ||
8294 | - */ | ||
8295 | - while (timeout && !list_empty(&osdc->req_lru)) { | ||
8296 | - req = list_entry(osdc->req_lru.next, struct ceph_osd_request, | ||
8297 | - r_req_lru_item); | ||
8298 | - | ||
8299 | - /* hasn't been long enough since we sent it? */ | ||
8300 | - if (time_before(jiffies, req->r_stamp + timeout)) | ||
8301 | - break; | ||
8302 | - | ||
8303 | - /* hasn't been long enough since it was acked? */ | ||
8304 | - if (req->r_request->ack_stamp == 0 || | ||
8305 | - time_before(jiffies, req->r_request->ack_stamp + timeout)) | ||
8306 | - break; | ||
8307 | - | ||
8308 | - BUG_ON(req == last_req && req->r_stamp == last_stamp); | ||
8309 | - last_req = req; | ||
8310 | - last_stamp = req->r_stamp; | ||
8311 | - | ||
8312 | - osd = req->r_osd; | ||
8313 | - BUG_ON(!osd); | ||
8314 | - pr_warning(" tid %llu timed out on osd%d, will reset osd\n", | ||
8315 | - req->r_tid, osd->o_osd); | ||
8316 | - __kick_osd_requests(osdc, osd); | ||
8317 | - } | ||
8318 | - | ||
8319 | - /* | ||
8320 | * ping osds that are a bit slow. this ensures that if there | ||
8321 | * is a break in the TCP connection we will notice, and reopen | ||
8322 | * a connection with that osd (from the fault callback). | ||
8323 | @@ -1304,7 +1270,7 @@ static void reset_changed_osds(struct ceph_osd_client *osdc) | ||
8324 | * Requeue requests whose mapping to an OSD has changed. If requests map to | ||
8325 | * no osd, request a new map. | ||
8326 | * | ||
8327 | - * Caller should hold map_sem for read and request_mutex. | ||
8328 | + * Caller should hold map_sem for read. | ||
8329 | */ | ||
8330 | static void kick_requests(struct ceph_osd_client *osdc, int force_resend) | ||
8331 | { | ||
8332 | @@ -1318,6 +1284,24 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) | ||
8333 | for (p = rb_first(&osdc->requests); p; ) { | ||
8334 | req = rb_entry(p, struct ceph_osd_request, r_node); | ||
8335 | p = rb_next(p); | ||
8336 | + | ||
8337 | + /* | ||
8338 | + * For linger requests that have not yet been | ||
8339 | + * registered, move them to the linger list; they'll | ||
8340 | + * be sent to the osd in the loop below. Unregister | ||
8341 | + * the request before re-registering it as a linger | ||
8342 | + * request to ensure the __map_request() below | ||
8343 | + * will decide it needs to be sent. | ||
8344 | + */ | ||
8345 | + if (req->r_linger && list_empty(&req->r_linger_item)) { | ||
8346 | + dout("%p tid %llu restart on osd%d\n", | ||
8347 | + req, req->r_tid, | ||
8348 | + req->r_osd ? req->r_osd->o_osd : -1); | ||
8349 | + __unregister_request(osdc, req); | ||
8350 | + __register_linger_request(osdc, req); | ||
8351 | + continue; | ||
8352 | + } | ||
8353 | + | ||
8354 | err = __map_request(osdc, req, force_resend); | ||
8355 | if (err < 0) | ||
8356 | continue; /* error */ | ||
8357 | @@ -1332,17 +1316,6 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) | ||
8358 | req->r_flags |= CEPH_OSD_FLAG_RETRY; | ||
8359 | } | ||
8360 | } | ||
8361 | - if (req->r_linger && list_empty(&req->r_linger_item)) { | ||
8362 | - /* | ||
8363 | - * register as a linger so that we will | ||
8364 | - * re-submit below and get a new tid | ||
8365 | - */ | ||
8366 | - dout("%p tid %llu restart on osd%d\n", | ||
8367 | - req, req->r_tid, | ||
8368 | - req->r_osd ? req->r_osd->o_osd : -1); | ||
8369 | - __register_linger_request(osdc, req); | ||
8370 | - __unregister_request(osdc, req); | ||
8371 | - } | ||
8372 | } | ||
8373 | |||
8374 | list_for_each_entry_safe(req, nreq, &osdc->req_linger, | ||
8375 | @@ -1350,6 +1323,7 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) | ||
8376 | dout("linger req=%p req->r_osd=%p\n", req, req->r_osd); | ||
8377 | |||
8378 | err = __map_request(osdc, req, force_resend); | ||
8379 | + dout("__map_request returned %d\n", err); | ||
8380 | if (err == 0) | ||
8381 | continue; /* no change and no osd was specified */ | ||
8382 | if (err < 0) | ||
8383 | @@ -1362,8 +1336,8 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) | ||
8384 | |||
8385 | dout("kicking lingering %p tid %llu osd%d\n", req, req->r_tid, | ||
8386 | req->r_osd ? req->r_osd->o_osd : -1); | ||
8387 | - __unregister_linger_request(osdc, req); | ||
8388 | __register_request(osdc, req); | ||
8389 | + __unregister_linger_request(osdc, req); | ||
8390 | } | ||
8391 | mutex_unlock(&osdc->request_mutex); | ||
8392 | |||
8393 | @@ -1371,6 +1345,7 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) | ||
8394 | dout("%d requests for down osds, need new map\n", needmap); | ||
8395 | ceph_monc_request_next_osdmap(&osdc->client->monc); | ||
8396 | } | ||
8397 | + reset_changed_osds(osdc); | ||
8398 | } | ||
8399 | |||
8400 | |||
8401 | @@ -1427,7 +1402,6 @@ void ceph_osdc_handle_map(struct ceph_osd_client *osdc, struct ceph_msg *msg) | ||
8402 | osdc->osdmap = newmap; | ||
8403 | } | ||
8404 | kick_requests(osdc, 0); | ||
8405 | - reset_changed_osds(osdc); | ||
8406 | } else { | ||
8407 | dout("ignoring incremental map %u len %d\n", | ||
8408 | epoch, maplen); | ||
8409 | @@ -1597,6 +1571,7 @@ int ceph_osdc_create_event(struct ceph_osd_client *osdc, | ||
8410 | event->data = data; | ||
8411 | event->osdc = osdc; | ||
8412 | INIT_LIST_HEAD(&event->osd_node); | ||
8413 | + RB_CLEAR_NODE(&event->node); | ||
8414 | kref_init(&event->kref); /* one ref for us */ | ||
8415 | kref_get(&event->kref); /* one ref for the caller */ | ||
8416 | init_completion(&event->completion); | ||
8417 | @@ -1928,8 +1903,8 @@ int ceph_osdc_readpages(struct ceph_osd_client *osdc, | ||
8418 | CEPH_OSD_OP_READ, CEPH_OSD_FLAG_READ, | ||
8419 | NULL, 0, truncate_seq, truncate_size, NULL, | ||
8420 | false, 1, page_align); | ||
8421 | - if (!req) | ||
8422 | - return -ENOMEM; | ||
8423 | + if (IS_ERR(req)) | ||
8424 | + return PTR_ERR(req); | ||
8425 | |||
8426 | /* it may be a short read due to an object boundary */ | ||
8427 | req->r_pages = pages; | ||
8428 | @@ -1971,8 +1946,8 @@ int ceph_osdc_writepages(struct ceph_osd_client *osdc, struct ceph_vino vino, | ||
8429 | snapc, do_sync, | ||
8430 | truncate_seq, truncate_size, mtime, | ||
8431 | nofail, 1, page_align); | ||
8432 | - if (!req) | ||
8433 | - return -ENOMEM; | ||
8434 | + if (IS_ERR(req)) | ||
8435 | + return PTR_ERR(req); | ||
8436 | |||
8437 | /* it may be a short write due to an object boundary */ | ||
8438 | req->r_pages = pages; | ||
8439 | diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c | ||
8440 | index 5433fb0..f552aa4 100644 | ||
8441 | --- a/net/ceph/osdmap.c | ||
8442 | +++ b/net/ceph/osdmap.c | ||
8443 | @@ -645,10 +645,12 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end) | ||
8444 | ceph_decode_32_safe(p, end, max, bad); | ||
8445 | while (max--) { | ||
8446 | ceph_decode_need(p, end, 4 + 1 + sizeof(pi->v), bad); | ||
8447 | + err = -ENOMEM; | ||
8448 | pi = kzalloc(sizeof(*pi), GFP_NOFS); | ||
8449 | if (!pi) | ||
8450 | goto bad; | ||
8451 | pi->id = ceph_decode_32(p); | ||
8452 | + err = -EINVAL; | ||
8453 | ev = ceph_decode_8(p); /* encoding version */ | ||
8454 | if (ev > CEPH_PG_POOL_VERSION) { | ||
8455 | pr_warning("got unknown v %d > %d of ceph_pg_pool\n", | ||
8456 | @@ -664,8 +666,13 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end) | ||
8457 | __insert_pg_pool(&map->pg_pools, pi); | ||
8458 | } | ||
8459 | |||
8460 | - if (version >= 5 && __decode_pool_names(p, end, map) < 0) | ||
8461 | - goto bad; | ||
8462 | + if (version >= 5) { | ||
8463 | + err = __decode_pool_names(p, end, map); | ||
8464 | + if (err < 0) { | ||
8465 | + dout("fail to decode pool names"); | ||
8466 | + goto bad; | ||
8467 | + } | ||
8468 | + } | ||
8469 | |||
8470 | ceph_decode_32_safe(p, end, map->pool_max, bad); | ||
8471 | |||
8472 | @@ -745,7 +752,7 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end) | ||
8473 | return map; | ||
8474 | |||
8475 | bad: | ||
8476 | - dout("osdmap_decode fail\n"); | ||
8477 | + dout("osdmap_decode fail err %d\n", err); | ||
8478 | ceph_osdmap_destroy(map); | ||
8479 | return ERR_PTR(err); | ||
8480 | } | ||
8481 | @@ -839,6 +846,7 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, | ||
8482 | if (ev > CEPH_PG_POOL_VERSION) { | ||
8483 | pr_warning("got unknown v %d > %d of ceph_pg_pool\n", | ||
8484 | ev, CEPH_PG_POOL_VERSION); | ||
8485 | + err = -EINVAL; | ||
8486 | goto bad; | ||
8487 | } | ||
8488 | pi = __lookup_pg_pool(&map->pg_pools, pool); | ||
8489 | @@ -855,8 +863,11 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, | ||
8490 | if (err < 0) | ||
8491 | goto bad; | ||
8492 | } | ||
8493 | - if (version >= 5 && __decode_pool_names(p, end, map) < 0) | ||
8494 | - goto bad; | ||
8495 | + if (version >= 5) { | ||
8496 | + err = __decode_pool_names(p, end, map); | ||
8497 | + if (err < 0) | ||
8498 | + goto bad; | ||
8499 | + } | ||
8500 | |||
8501 | /* old_pool */ | ||
8502 | ceph_decode_32_safe(p, end, len, bad); | ||
8503 | @@ -932,15 +943,13 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end, | ||
8504 | (void) __remove_pg_mapping(&map->pg_temp, pgid); | ||
8505 | |||
8506 | /* insert */ | ||
8507 | - if (pglen > (UINT_MAX - sizeof(*pg)) / sizeof(u32)) { | ||
8508 | - err = -EINVAL; | ||
8509 | + err = -EINVAL; | ||
8510 | + if (pglen > (UINT_MAX - sizeof(*pg)) / sizeof(u32)) | ||
8511 | goto bad; | ||
8512 | - } | ||
8513 | + err = -ENOMEM; | ||
8514 | pg = kmalloc(sizeof(*pg) + sizeof(u32)*pglen, GFP_NOFS); | ||
8515 | - if (!pg) { | ||
8516 | - err = -ENOMEM; | ||
8517 | + if (!pg) | ||
8518 | goto bad; | ||
8519 | - } | ||
8520 | pg->pgid = pgid; | ||
8521 | pg->len = pglen; | ||
8522 | for (j = 0; j < pglen; j++) | ||
8523 | diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c | ||
8524 | index 176ecdb..4f9f5eb 100644 | ||
8525 | --- a/net/dccp/ipv4.c | ||
8526 | +++ b/net/dccp/ipv4.c | ||
8527 | @@ -439,8 +439,8 @@ exit: | ||
8528 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); | ||
8529 | return NULL; | ||
8530 | put_and_exit: | ||
8531 | - bh_unlock_sock(newsk); | ||
8532 | - sock_put(newsk); | ||
8533 | + inet_csk_prepare_forced_close(newsk); | ||
8534 | + dccp_done(newsk); | ||
8535 | goto exit; | ||
8536 | } | ||
8537 | |||
8538 | diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c | ||
8539 | index 56840b2..6e05981 100644 | ||
8540 | --- a/net/dccp/ipv6.c | ||
8541 | +++ b/net/dccp/ipv6.c | ||
8542 | @@ -585,7 +585,8 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk, | ||
8543 | newinet->inet_rcv_saddr = LOOPBACK4_IPV6; | ||
8544 | |||
8545 | if (__inet_inherit_port(sk, newsk) < 0) { | ||
8546 | - sock_put(newsk); | ||
8547 | + inet_csk_prepare_forced_close(newsk); | ||
8548 | + dccp_done(newsk); | ||
8549 | goto out; | ||
8550 | } | ||
8551 | __inet6_hash(newsk, NULL); | ||
8552 | diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c | ||
8553 | index 0405cc8..567c31f 100644 | ||
8554 | --- a/net/ipv4/inet_connection_sock.c | ||
8555 | +++ b/net/ipv4/inet_connection_sock.c | ||
8556 | @@ -679,6 +679,22 @@ void inet_csk_destroy_sock(struct sock *sk) | ||
8557 | } | ||
8558 | EXPORT_SYMBOL(inet_csk_destroy_sock); | ||
8559 | |||
8560 | +/* This function allows to force a closure of a socket after the call to | ||
8561 | + * tcp/dccp_create_openreq_child(). | ||
8562 | + */ | ||
8563 | +void inet_csk_prepare_forced_close(struct sock *sk) | ||
8564 | +{ | ||
8565 | + /* sk_clone_lock locked the socket and set refcnt to 2 */ | ||
8566 | + bh_unlock_sock(sk); | ||
8567 | + sock_put(sk); | ||
8568 | + | ||
8569 | + /* The below has to be done to allow calling inet_csk_destroy_sock */ | ||
8570 | + sock_set_flag(sk, SOCK_DEAD); | ||
8571 | + percpu_counter_inc(sk->sk_prot->orphan_count); | ||
8572 | + inet_sk(sk)->inet_num = 0; | ||
8573 | +} | ||
8574 | +EXPORT_SYMBOL(inet_csk_prepare_forced_close); | ||
8575 | + | ||
8576 | int inet_csk_listen_start(struct sock *sk, const int nr_table_entries) | ||
8577 | { | ||
8578 | struct inet_sock *inet = inet_sk(sk); | ||
8579 | diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c | ||
8580 | index c92c4da..4b3f448 100644 | ||
8581 | --- a/net/ipv4/tcp_input.c | ||
8582 | +++ b/net/ipv4/tcp_input.c | ||
8583 | @@ -3579,6 +3579,24 @@ static bool tcp_process_frto(struct sock *sk, int flag) | ||
8584 | return false; | ||
8585 | } | ||
8586 | |||
8587 | +/* RFC 5961 7 [ACK Throttling] */ | ||
8588 | +static void tcp_send_challenge_ack(struct sock *sk) | ||
8589 | +{ | ||
8590 | + /* unprotected vars, we dont care of overwrites */ | ||
8591 | + static u32 challenge_timestamp; | ||
8592 | + static unsigned int challenge_count; | ||
8593 | + u32 now = jiffies / HZ; | ||
8594 | + | ||
8595 | + if (now != challenge_timestamp) { | ||
8596 | + challenge_timestamp = now; | ||
8597 | + challenge_count = 0; | ||
8598 | + } | ||
8599 | + if (++challenge_count <= sysctl_tcp_challenge_ack_limit) { | ||
8600 | + NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPCHALLENGEACK); | ||
8601 | + tcp_send_ack(sk); | ||
8602 | + } | ||
8603 | +} | ||
8604 | + | ||
8605 | /* This routine deals with incoming acks, but not outgoing ones. */ | ||
8606 | static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) | ||
8607 | { | ||
8608 | @@ -3598,8 +3616,14 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) | ||
8609 | /* If the ack is older than previous acks | ||
8610 | * then we can probably ignore it. | ||
8611 | */ | ||
8612 | - if (before(ack, prior_snd_una)) | ||
8613 | + if (before(ack, prior_snd_una)) { | ||
8614 | + /* RFC 5961 5.2 [Blind Data Injection Attack].[Mitigation] */ | ||
8615 | + if (before(ack, prior_snd_una - tp->max_window)) { | ||
8616 | + tcp_send_challenge_ack(sk); | ||
8617 | + return -1; | ||
8618 | + } | ||
8619 | goto old_ack; | ||
8620 | + } | ||
8621 | |||
8622 | /* If the ack includes data we haven't sent yet, discard | ||
8623 | * this segment (RFC793 Section 3.9). | ||
8624 | @@ -5271,23 +5295,6 @@ out: | ||
8625 | } | ||
8626 | #endif /* CONFIG_NET_DMA */ | ||
8627 | |||
8628 | -static void tcp_send_challenge_ack(struct sock *sk) | ||
8629 | -{ | ||
8630 | - /* unprotected vars, we dont care of overwrites */ | ||
8631 | - static u32 challenge_timestamp; | ||
8632 | - static unsigned int challenge_count; | ||
8633 | - u32 now = jiffies / HZ; | ||
8634 | - | ||
8635 | - if (now != challenge_timestamp) { | ||
8636 | - challenge_timestamp = now; | ||
8637 | - challenge_count = 0; | ||
8638 | - } | ||
8639 | - if (++challenge_count <= sysctl_tcp_challenge_ack_limit) { | ||
8640 | - NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPCHALLENGEACK); | ||
8641 | - tcp_send_ack(sk); | ||
8642 | - } | ||
8643 | -} | ||
8644 | - | ||
8645 | /* Does PAWS and seqno based validation of an incoming segment, flags will | ||
8646 | * play significant role here. | ||
8647 | */ | ||
8648 | @@ -5340,11 +5347,6 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb, | ||
8649 | goto discard; | ||
8650 | } | ||
8651 | |||
8652 | - /* ts_recent update must be made after we are sure that the packet | ||
8653 | - * is in window. | ||
8654 | - */ | ||
8655 | - tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq); | ||
8656 | - | ||
8657 | /* step 3: check security and precedence [ignored] */ | ||
8658 | |||
8659 | /* step 4: Check for a SYN | ||
8660 | @@ -5579,6 +5581,11 @@ step5: | ||
8661 | if (th->ack && tcp_ack(sk, skb, FLAG_SLOWPATH) < 0) | ||
8662 | goto discard; | ||
8663 | |||
8664 | + /* ts_recent update must be made after we are sure that the packet | ||
8665 | + * is in window. | ||
8666 | + */ | ||
8667 | + tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq); | ||
8668 | + | ||
8669 | tcp_rcv_rtt_measure_ts(sk, skb); | ||
8670 | |||
8671 | /* Process urgent data. */ | ||
8672 | @@ -6106,6 +6113,11 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | ||
8673 | } else | ||
8674 | goto discard; | ||
8675 | |||
8676 | + /* ts_recent update must be made after we are sure that the packet | ||
8677 | + * is in window. | ||
8678 | + */ | ||
8679 | + tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq); | ||
8680 | + | ||
8681 | /* step 6: check the URG bit */ | ||
8682 | tcp_urg(sk, skb, th); | ||
8683 | |||
8684 | diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c | ||
8685 | index db7bfad..4705caf 100644 | ||
8686 | --- a/net/ipv4/tcp_ipv4.c | ||
8687 | +++ b/net/ipv4/tcp_ipv4.c | ||
8688 | @@ -1537,10 +1537,8 @@ exit: | ||
8689 | NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_LISTENDROPS); | ||
8690 | return NULL; | ||
8691 | put_and_exit: | ||
8692 | - tcp_clear_xmit_timers(newsk); | ||
8693 | - tcp_cleanup_congestion_control(newsk); | ||
8694 | - bh_unlock_sock(newsk); | ||
8695 | - sock_put(newsk); | ||
8696 | + inet_csk_prepare_forced_close(newsk); | ||
8697 | + tcp_done(newsk); | ||
8698 | goto exit; | ||
8699 | } | ||
8700 | EXPORT_SYMBOL(tcp_v4_syn_recv_sock); | ||
8701 | diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c | ||
8702 | index 7e32d42..8b45fb4 100644 | ||
8703 | --- a/net/ipv6/tcp_ipv6.c | ||
8704 | +++ b/net/ipv6/tcp_ipv6.c | ||
8705 | @@ -1371,7 +1371,8 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | ||
8706 | #endif | ||
8707 | |||
8708 | if (__inet_inherit_port(sk, newsk) < 0) { | ||
8709 | - sock_put(newsk); | ||
8710 | + inet_csk_prepare_forced_close(newsk); | ||
8711 | + tcp_done(newsk); | ||
8712 | goto out; | ||
8713 | } | ||
8714 | __inet6_hash(newsk, NULL); | ||
8715 | diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c | ||
8716 | index a5894dd..c55eacc 100644 | ||
8717 | --- a/net/mac80211/ibss.c | ||
8718 | +++ b/net/mac80211/ibss.c | ||
8719 | @@ -647,8 +647,8 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata) | ||
8720 | sdata_info(sdata, | ||
8721 | "No active IBSS STAs - trying to scan for other IBSS networks with same SSID (merge)\n"); | ||
8722 | |||
8723 | - ieee80211_request_internal_scan(sdata, | ||
8724 | - ifibss->ssid, ifibss->ssid_len, NULL); | ||
8725 | + ieee80211_request_ibss_scan(sdata, ifibss->ssid, ifibss->ssid_len, | ||
8726 | + NULL); | ||
8727 | } | ||
8728 | |||
8729 | static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata) | ||
8730 | @@ -746,9 +746,8 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) | ||
8731 | IEEE80211_SCAN_INTERVAL)) { | ||
8732 | sdata_info(sdata, "Trigger new scan to find an IBSS to join\n"); | ||
8733 | |||
8734 | - ieee80211_request_internal_scan(sdata, | ||
8735 | - ifibss->ssid, ifibss->ssid_len, | ||
8736 | - ifibss->fixed_channel ? ifibss->channel : NULL); | ||
8737 | + ieee80211_request_ibss_scan(sdata, ifibss->ssid, | ||
8738 | + ifibss->ssid_len, chan); | ||
8739 | } else { | ||
8740 | int interval = IEEE80211_SCAN_INTERVAL; | ||
8741 | |||
8742 | diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h | ||
8743 | index 642a2a3..19d4ec3 100644 | ||
8744 | --- a/net/mac80211/ieee80211_i.h | ||
8745 | +++ b/net/mac80211/ieee80211_i.h | ||
8746 | @@ -1239,9 +1239,9 @@ void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, | ||
8747 | |||
8748 | /* scan/BSS handling */ | ||
8749 | void ieee80211_scan_work(struct work_struct *work); | ||
8750 | -int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, | ||
8751 | - const u8 *ssid, u8 ssid_len, | ||
8752 | - struct ieee80211_channel *chan); | ||
8753 | +int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, | ||
8754 | + const u8 *ssid, u8 ssid_len, | ||
8755 | + struct ieee80211_channel *chan); | ||
8756 | int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, | ||
8757 | struct cfg80211_scan_request *req); | ||
8758 | void ieee80211_scan_cancel(struct ieee80211_local *local); | ||
8759 | diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c | ||
8760 | index 839dd97..09fc38d 100644 | ||
8761 | --- a/net/mac80211/scan.c | ||
8762 | +++ b/net/mac80211/scan.c | ||
8763 | @@ -819,9 +819,9 @@ int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, | ||
8764 | return res; | ||
8765 | } | ||
8766 | |||
8767 | -int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, | ||
8768 | - const u8 *ssid, u8 ssid_len, | ||
8769 | - struct ieee80211_channel *chan) | ||
8770 | +int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, | ||
8771 | + const u8 *ssid, u8 ssid_len, | ||
8772 | + struct ieee80211_channel *chan) | ||
8773 | { | ||
8774 | struct ieee80211_local *local = sdata->local; | ||
8775 | int ret = -EBUSY; | ||
8776 | @@ -835,22 +835,36 @@ int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, | ||
8777 | |||
8778 | /* fill internal scan request */ | ||
8779 | if (!chan) { | ||
8780 | - int i, nchan = 0; | ||
8781 | + int i, max_n; | ||
8782 | + int n_ch = 0; | ||
8783 | |||
8784 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { | ||
8785 | if (!local->hw.wiphy->bands[band]) | ||
8786 | continue; | ||
8787 | - for (i = 0; | ||
8788 | - i < local->hw.wiphy->bands[band]->n_channels; | ||
8789 | - i++) { | ||
8790 | - local->int_scan_req->channels[nchan] = | ||
8791 | + | ||
8792 | + max_n = local->hw.wiphy->bands[band]->n_channels; | ||
8793 | + for (i = 0; i < max_n; i++) { | ||
8794 | + struct ieee80211_channel *tmp_ch = | ||
8795 | &local->hw.wiphy->bands[band]->channels[i]; | ||
8796 | - nchan++; | ||
8797 | + | ||
8798 | + if (tmp_ch->flags & (IEEE80211_CHAN_NO_IBSS | | ||
8799 | + IEEE80211_CHAN_DISABLED)) | ||
8800 | + continue; | ||
8801 | + | ||
8802 | + local->int_scan_req->channels[n_ch] = tmp_ch; | ||
8803 | + n_ch++; | ||
8804 | } | ||
8805 | } | ||
8806 | |||
8807 | - local->int_scan_req->n_channels = nchan; | ||
8808 | + if (WARN_ON_ONCE(n_ch == 0)) | ||
8809 | + goto unlock; | ||
8810 | + | ||
8811 | + local->int_scan_req->n_channels = n_ch; | ||
8812 | } else { | ||
8813 | + if (WARN_ON_ONCE(chan->flags & (IEEE80211_CHAN_NO_IBSS | | ||
8814 | + IEEE80211_CHAN_DISABLED))) | ||
8815 | + goto unlock; | ||
8816 | + | ||
8817 | local->int_scan_req->channels[0] = chan; | ||
8818 | local->int_scan_req->n_channels = 1; | ||
8819 | } | ||
8820 | diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c | ||
8821 | index 31aa8b8..cd7ca8d 100644 | ||
8822 | --- a/net/mac80211/sta_info.c | ||
8823 | +++ b/net/mac80211/sta_info.c | ||
8824 | @@ -835,7 +835,7 @@ void sta_info_init(struct ieee80211_local *local) | ||
8825 | |||
8826 | void sta_info_stop(struct ieee80211_local *local) | ||
8827 | { | ||
8828 | - del_timer(&local->sta_cleanup); | ||
8829 | + del_timer_sync(&local->sta_cleanup); | ||
8830 | sta_info_flush(local, NULL); | ||
8831 | } | ||
8832 | |||
8833 | diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c | ||
8834 | index 9d75b77..e9ea2f3 100644 | ||
8835 | --- a/net/sched/sch_htb.c | ||
8836 | +++ b/net/sched/sch_htb.c | ||
8837 | @@ -874,7 +874,7 @@ ok: | ||
8838 | q->now = psched_get_time(); | ||
8839 | start_at = jiffies; | ||
8840 | |||
8841 | - next_event = q->now + 5 * PSCHED_TICKS_PER_SEC; | ||
8842 | + next_event = q->now + 5LLU * PSCHED_TICKS_PER_SEC; | ||
8843 | |||
8844 | for (level = 0; level < TC_HTB_MAXDEPTH; level++) { | ||
8845 | /* common case optimization - skip event handler quickly */ | ||
8846 | diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c | ||
8847 | index fa48c60..346c387 100644 | ||
8848 | --- a/net/sunrpc/clnt.c | ||
8849 | +++ b/net/sunrpc/clnt.c | ||
8850 | @@ -234,7 +234,7 @@ static struct rpc_clnt *rpc_get_client_for_event(struct net *net, int event) | ||
8851 | spin_lock(&sn->rpc_client_lock); | ||
8852 | list_for_each_entry(clnt, &sn->all_clients, cl_clients) { | ||
8853 | if (clnt->cl_program->pipe_dir_name == NULL) | ||
8854 | - break; | ||
8855 | + continue; | ||
8856 | if (rpc_clnt_skip_event(clnt, event)) | ||
8857 | continue; | ||
8858 | if (atomic_inc_not_zero(&clnt->cl_count) == 0) | ||
8859 | diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c | ||
8860 | index 21fde99..2a419f1 100644 | ||
8861 | --- a/net/sunrpc/rpc_pipe.c | ||
8862 | +++ b/net/sunrpc/rpc_pipe.c | ||
8863 | @@ -1152,14 +1152,19 @@ static void rpc_kill_sb(struct super_block *sb) | ||
8864 | struct sunrpc_net *sn = net_generic(net, sunrpc_net_id); | ||
8865 | |||
8866 | mutex_lock(&sn->pipefs_sb_lock); | ||
8867 | + if (sn->pipefs_sb != sb) { | ||
8868 | + mutex_unlock(&sn->pipefs_sb_lock); | ||
8869 | + goto out; | ||
8870 | + } | ||
8871 | sn->pipefs_sb = NULL; | ||
8872 | mutex_unlock(&sn->pipefs_sb_lock); | ||
8873 | - put_net(net); | ||
8874 | dprintk("RPC: sending pipefs UMOUNT notification for net %p%s\n", net, | ||
8875 | NET_NAME(net)); | ||
8876 | blocking_notifier_call_chain(&rpc_pipefs_notifier_list, | ||
8877 | RPC_PIPEFS_UMOUNT, | ||
8878 | sb); | ||
8879 | + put_net(net); | ||
8880 | +out: | ||
8881 | kill_litter_super(sb); | ||
8882 | } | ||
8883 | |||
8884 | diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c | ||
8885 | index 128494e..7fc5846 100644 | ||
8886 | --- a/net/sunrpc/sched.c | ||
8887 | +++ b/net/sunrpc/sched.c | ||
8888 | @@ -919,16 +919,35 @@ struct rpc_task *rpc_new_task(const struct rpc_task_setup *setup_data) | ||
8889 | return task; | ||
8890 | } | ||
8891 | |||
8892 | +/* | ||
8893 | + * rpc_free_task - release rpc task and perform cleanups | ||
8894 | + * | ||
8895 | + * Note that we free up the rpc_task _after_ rpc_release_calldata() | ||
8896 | + * in order to work around a workqueue dependency issue. | ||
8897 | + * | ||
8898 | + * Tejun Heo states: | ||
8899 | + * "Workqueue currently considers two work items to be the same if they're | ||
8900 | + * on the same address and won't execute them concurrently - ie. it | ||
8901 | + * makes a work item which is queued again while being executed wait | ||
8902 | + * for the previous execution to complete. | ||
8903 | + * | ||
8904 | + * If a work function frees the work item, and then waits for an event | ||
8905 | + * which should be performed by another work item and *that* work item | ||
8906 | + * recycles the freed work item, it can create a false dependency loop. | ||
8907 | + * There really is no reliable way to detect this short of verifying | ||
8908 | + * every memory free." | ||
8909 | + * | ||
8910 | + */ | ||
8911 | static void rpc_free_task(struct rpc_task *task) | ||
8912 | { | ||
8913 | - const struct rpc_call_ops *tk_ops = task->tk_ops; | ||
8914 | - void *calldata = task->tk_calldata; | ||
8915 | + unsigned short tk_flags = task->tk_flags; | ||
8916 | + | ||
8917 | + rpc_release_calldata(task->tk_ops, task->tk_calldata); | ||
8918 | |||
8919 | - if (task->tk_flags & RPC_TASK_DYNAMIC) { | ||
8920 | + if (tk_flags & RPC_TASK_DYNAMIC) { | ||
8921 | dprintk("RPC: %5u freeing task\n", task->tk_pid); | ||
8922 | mempool_free(task, rpc_task_mempool); | ||
8923 | } | ||
8924 | - rpc_release_calldata(tk_ops, calldata); | ||
8925 | } | ||
8926 | |||
8927 | static void rpc_async_release(struct work_struct *work) | ||
8928 | @@ -938,8 +957,7 @@ static void rpc_async_release(struct work_struct *work) | ||
8929 | |||
8930 | static void rpc_release_resources_task(struct rpc_task *task) | ||
8931 | { | ||
8932 | - if (task->tk_rqstp) | ||
8933 | - xprt_release(task); | ||
8934 | + xprt_release(task); | ||
8935 | if (task->tk_msg.rpc_cred) { | ||
8936 | put_rpccred(task->tk_msg.rpc_cred); | ||
8937 | task->tk_msg.rpc_cred = NULL; | ||
8938 | diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c | ||
8939 | index 5d7f61d..2480c01 100644 | ||
8940 | --- a/net/sunrpc/xprt.c | ||
8941 | +++ b/net/sunrpc/xprt.c | ||
8942 | @@ -1139,10 +1139,18 @@ static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt) | ||
8943 | void xprt_release(struct rpc_task *task) | ||
8944 | { | ||
8945 | struct rpc_xprt *xprt; | ||
8946 | - struct rpc_rqst *req; | ||
8947 | + struct rpc_rqst *req = task->tk_rqstp; | ||
8948 | |||
8949 | - if (!(req = task->tk_rqstp)) | ||
8950 | + if (req == NULL) { | ||
8951 | + if (task->tk_client) { | ||
8952 | + rcu_read_lock(); | ||
8953 | + xprt = rcu_dereference(task->tk_client->cl_xprt); | ||
8954 | + if (xprt->snd_task == task) | ||
8955 | + xprt_release_write(xprt, task); | ||
8956 | + rcu_read_unlock(); | ||
8957 | + } | ||
8958 | return; | ||
8959 | + } | ||
8960 | |||
8961 | xprt = req->rq_xprt; | ||
8962 | if (task->tk_ops->rpc_count_stats != NULL) | ||
8963 | diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c | ||
8964 | index 49a464f..62fa2c5 100644 | ||
8965 | --- a/security/integrity/evm/evm_crypto.c | ||
8966 | +++ b/security/integrity/evm/evm_crypto.c | ||
8967 | @@ -205,9 +205,9 @@ int evm_update_evmxattr(struct dentry *dentry, const char *xattr_name, | ||
8968 | rc = __vfs_setxattr_noperm(dentry, XATTR_NAME_EVM, | ||
8969 | &xattr_data, | ||
8970 | sizeof(xattr_data), 0); | ||
8971 | - } | ||
8972 | - else if (rc == -ENODATA) | ||
8973 | + } else if (rc == -ENODATA && inode->i_op->removexattr) { | ||
8974 | rc = inode->i_op->removexattr(dentry, XATTR_NAME_EVM); | ||
8975 | + } | ||
8976 | return rc; | ||
8977 | } | ||
8978 | |||
8979 | diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c | ||
8980 | index 48d7c0a..bd3ba88 100644 | ||
8981 | --- a/sound/arm/pxa2xx-ac97-lib.c | ||
8982 | +++ b/sound/arm/pxa2xx-ac97-lib.c | ||
8983 | @@ -18,6 +18,7 @@ | ||
8984 | #include <linux/delay.h> | ||
8985 | #include <linux/module.h> | ||
8986 | #include <linux/io.h> | ||
8987 | +#include <linux/gpio.h> | ||
8988 | |||
8989 | #include <sound/ac97_codec.h> | ||
8990 | #include <sound/pxa2xx-lib.h> | ||
8991 | @@ -148,6 +149,8 @@ static inline void pxa_ac97_warm_pxa27x(void) | ||
8992 | |||
8993 | static inline void pxa_ac97_cold_pxa27x(void) | ||
8994 | { | ||
8995 | + unsigned int timeout; | ||
8996 | + | ||
8997 | GCR &= GCR_COLD_RST; /* clear everything but nCRST */ | ||
8998 | GCR &= ~GCR_COLD_RST; /* then assert nCRST */ | ||
8999 | |||
9000 | @@ -157,8 +160,10 @@ static inline void pxa_ac97_cold_pxa27x(void) | ||
9001 | clk_enable(ac97conf_clk); | ||
9002 | udelay(5); | ||
9003 | clk_disable(ac97conf_clk); | ||
9004 | - GCR = GCR_COLD_RST; | ||
9005 | - udelay(50); | ||
9006 | + GCR = GCR_COLD_RST | GCR_WARM_RST; | ||
9007 | + timeout = 100; /* wait for the codec-ready bit to be set */ | ||
9008 | + while (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)) && timeout--) | ||
9009 | + mdelay(1); | ||
9010 | } | ||
9011 | #endif | ||
9012 | |||
9013 | @@ -340,8 +345,21 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev) | ||
9014 | } | ||
9015 | |||
9016 | if (cpu_is_pxa27x()) { | ||
9017 | - /* Use GPIO 113 as AC97 Reset on Bulverde */ | ||
9018 | + /* | ||
9019 | + * This gpio is needed for a work-around to a bug in the ac97 | ||
9020 | + * controller during warm reset. The direction and level is set | ||
9021 | + * here so that it is an output driven high when switching from | ||
9022 | + * AC97_nRESET alt function to generic gpio. | ||
9023 | + */ | ||
9024 | + ret = gpio_request_one(reset_gpio, GPIOF_OUT_INIT_HIGH, | ||
9025 | + "pxa27x ac97 reset"); | ||
9026 | + if (ret < 0) { | ||
9027 | + pr_err("%s: gpio_request_one() failed: %d\n", | ||
9028 | + __func__, ret); | ||
9029 | + goto err_conf; | ||
9030 | + } | ||
9031 | pxa27x_assert_ac97reset(reset_gpio, 0); | ||
9032 | + | ||
9033 | ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK"); | ||
9034 | if (IS_ERR(ac97conf_clk)) { | ||
9035 | ret = PTR_ERR(ac97conf_clk); | ||
9036 | @@ -384,6 +402,8 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_probe); | ||
9037 | |||
9038 | void pxa2xx_ac97_hw_remove(struct platform_device *dev) | ||
9039 | { | ||
9040 | + if (cpu_is_pxa27x()) | ||
9041 | + gpio_free(reset_gpio); | ||
9042 | GCR |= GCR_ACLINK_OFF; | ||
9043 | free_irq(IRQ_AC97, NULL); | ||
9044 | if (ac97conf_clk) { | ||
9045 | diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c | ||
9046 | index e1b7061..31ac338 100644 | ||
9047 | --- a/sound/pci/hda/patch_realtek.c | ||
9048 | +++ b/sound/pci/hda/patch_realtek.c | ||
9049 | @@ -6562,8 +6562,8 @@ static void alc861vd_fixup_dallas(struct hda_codec *codec, | ||
9050 | const struct alc_fixup *fix, int action) | ||
9051 | { | ||
9052 | if (action == ALC_FIXUP_ACT_PRE_PROBE) { | ||
9053 | - snd_hda_override_pin_caps(codec, 0x18, 0x00001714); | ||
9054 | - snd_hda_override_pin_caps(codec, 0x19, 0x0000171c); | ||
9055 | + snd_hda_override_pin_caps(codec, 0x18, 0x00000734); | ||
9056 | + snd_hda_override_pin_caps(codec, 0x19, 0x0000073c); | ||
9057 | } | ||
9058 | } | ||
9059 | |||
9060 | diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c | ||
9061 | index 3d4722f..f206117 100644 | ||
9062 | --- a/sound/pci/hda/patch_sigmatel.c | ||
9063 | +++ b/sound/pci/hda/patch_sigmatel.c | ||
9064 | @@ -1698,7 +1698,7 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { | ||
9065 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1658, | ||
9066 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), | ||
9067 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1659, | ||
9068 | - "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), | ||
9069 | + "HP Pavilion dv7", STAC_HP_DV7_4000), | ||
9070 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165A, | ||
9071 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), | ||
9072 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B, | ||
9073 | diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c | ||
9074 | index 5be42bf..4068f24 100644 | ||
9075 | --- a/sound/soc/codecs/sigmadsp.c | ||
9076 | +++ b/sound/soc/codecs/sigmadsp.c | ||
9077 | @@ -225,7 +225,7 @@ EXPORT_SYMBOL(process_sigma_firmware); | ||
9078 | static int sigma_action_write_regmap(void *control_data, | ||
9079 | const struct sigma_action *sa, size_t len) | ||
9080 | { | ||
9081 | - return regmap_raw_write(control_data, le16_to_cpu(sa->addr), | ||
9082 | + return regmap_raw_write(control_data, be16_to_cpu(sa->addr), | ||
9083 | sa->payload, len - 2); | ||
9084 | } | ||
9085 | |||
9086 | diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c | ||
9087 | index a3acb7a..6275a2b 100644 | ||
9088 | --- a/sound/soc/codecs/wm2000.c | ||
9089 | +++ b/sound/soc/codecs/wm2000.c | ||
9090 | @@ -188,9 +188,9 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue) | ||
9091 | |||
9092 | ret = wm2000_read(i2c, WM2000_REG_SPEECH_CLARITY); | ||
9093 | if (wm2000->speech_clarity) | ||
9094 | - ret &= ~WM2000_SPEECH_CLARITY; | ||
9095 | - else | ||
9096 | ret |= WM2000_SPEECH_CLARITY; | ||
9097 | + else | ||
9098 | + ret &= ~WM2000_SPEECH_CLARITY; | ||
9099 | wm2000_write(i2c, WM2000_REG_SPEECH_CLARITY, ret); | ||
9100 | |||
9101 | wm2000_write(i2c, WM2000_REG_SYS_START0, 0x33); | ||
9102 | diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c | ||
9103 | index c8bff6d..86b84a1 100644 | ||
9104 | --- a/sound/soc/codecs/wm2200.c | ||
9105 | +++ b/sound/soc/codecs/wm2200.c | ||
9106 | @@ -1380,15 +1380,9 @@ static int wm2200_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) | ||
9107 | case SND_SOC_DAIFMT_DSP_A: | ||
9108 | fmt_val = 0; | ||
9109 | break; | ||
9110 | - case SND_SOC_DAIFMT_DSP_B: | ||
9111 | - fmt_val = 1; | ||
9112 | - break; | ||
9113 | case SND_SOC_DAIFMT_I2S: | ||
9114 | fmt_val = 2; | ||
9115 | break; | ||
9116 | - case SND_SOC_DAIFMT_LEFT_J: | ||
9117 | - fmt_val = 3; | ||
9118 | - break; | ||
9119 | default: | ||
9120 | dev_err(codec->dev, "Unsupported DAI format %d\n", | ||
9121 | fmt & SND_SOC_DAIFMT_FORMAT_MASK); | ||
9122 | @@ -1440,7 +1434,7 @@ static int wm2200_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) | ||
9123 | WM2200_AIF1TX_LRCLK_MSTR | WM2200_AIF1TX_LRCLK_INV, | ||
9124 | lrclk); | ||
9125 | snd_soc_update_bits(codec, WM2200_AUDIO_IF_1_5, | ||
9126 | - WM2200_AIF1_FMT_MASK << 1, fmt_val << 1); | ||
9127 | + WM2200_AIF1_FMT_MASK, fmt_val); | ||
9128 | |||
9129 | return 0; | ||
9130 | } | ||
9131 | diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c | ||
9132 | index f481729..10d48cd 100644 | ||
9133 | --- a/sound/soc/codecs/wm5100.c | ||
9134 | +++ b/sound/soc/codecs/wm5100.c | ||
9135 | @@ -1279,15 +1279,9 @@ static int wm5100_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) | ||
9136 | case SND_SOC_DAIFMT_DSP_A: | ||
9137 | mask = 0; | ||
9138 | break; | ||
9139 | - case SND_SOC_DAIFMT_DSP_B: | ||
9140 | - mask = 1; | ||
9141 | - break; | ||
9142 | case SND_SOC_DAIFMT_I2S: | ||
9143 | mask = 2; | ||
9144 | break; | ||
9145 | - case SND_SOC_DAIFMT_LEFT_J: | ||
9146 | - mask = 3; | ||
9147 | - break; | ||
9148 | default: | ||
9149 | dev_err(codec->dev, "Unsupported DAI format %d\n", | ||
9150 | fmt & SND_SOC_DAIFMT_FORMAT_MASK); | ||
9151 | diff --git a/sound/usb/midi.c b/sound/usb/midi.c | ||
9152 | index eeefbce..34b9bb7 100644 | ||
9153 | --- a/sound/usb/midi.c | ||
9154 | +++ b/sound/usb/midi.c | ||
9155 | @@ -116,6 +116,7 @@ struct snd_usb_midi { | ||
9156 | struct list_head list; | ||
9157 | struct timer_list error_timer; | ||
9158 | spinlock_t disc_lock; | ||
9159 | + struct rw_semaphore disc_rwsem; | ||
9160 | struct mutex mutex; | ||
9161 | u32 usb_id; | ||
9162 | int next_midi_device; | ||
9163 | @@ -125,8 +126,10 @@ struct snd_usb_midi { | ||
9164 | struct snd_usb_midi_in_endpoint *in; | ||
9165 | } endpoints[MIDI_MAX_ENDPOINTS]; | ||
9166 | unsigned long input_triggered; | ||
9167 | - unsigned int opened; | ||
9168 | + bool autopm_reference; | ||
9169 | + unsigned int opened[2]; | ||
9170 | unsigned char disconnected; | ||
9171 | + unsigned char input_running; | ||
9172 | |||
9173 | struct snd_kcontrol *roland_load_ctl; | ||
9174 | }; | ||
9175 | @@ -148,7 +151,6 @@ struct snd_usb_midi_out_endpoint { | ||
9176 | struct snd_usb_midi_out_endpoint* ep; | ||
9177 | struct snd_rawmidi_substream *substream; | ||
9178 | int active; | ||
9179 | - bool autopm_reference; | ||
9180 | uint8_t cable; /* cable number << 4 */ | ||
9181 | uint8_t state; | ||
9182 | #define STATE_UNKNOWN 0 | ||
9183 | @@ -1033,29 +1035,58 @@ static void update_roland_altsetting(struct snd_usb_midi* umidi) | ||
9184 | snd_usbmidi_input_start(&umidi->list); | ||
9185 | } | ||
9186 | |||
9187 | -static void substream_open(struct snd_rawmidi_substream *substream, int open) | ||
9188 | +static int substream_open(struct snd_rawmidi_substream *substream, int dir, | ||
9189 | + int open) | ||
9190 | { | ||
9191 | struct snd_usb_midi* umidi = substream->rmidi->private_data; | ||
9192 | struct snd_kcontrol *ctl; | ||
9193 | + int err; | ||
9194 | + | ||
9195 | + down_read(&umidi->disc_rwsem); | ||
9196 | + if (umidi->disconnected) { | ||
9197 | + up_read(&umidi->disc_rwsem); | ||
9198 | + return open ? -ENODEV : 0; | ||
9199 | + } | ||
9200 | |||
9201 | mutex_lock(&umidi->mutex); | ||
9202 | if (open) { | ||
9203 | - if (umidi->opened++ == 0 && umidi->roland_load_ctl) { | ||
9204 | - ctl = umidi->roland_load_ctl; | ||
9205 | - ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE; | ||
9206 | - snd_ctl_notify(umidi->card, | ||
9207 | + if (!umidi->opened[0] && !umidi->opened[1]) { | ||
9208 | + err = usb_autopm_get_interface(umidi->iface); | ||
9209 | + umidi->autopm_reference = err >= 0; | ||
9210 | + if (err < 0 && err != -EACCES) { | ||
9211 | + mutex_unlock(&umidi->mutex); | ||
9212 | + up_read(&umidi->disc_rwsem); | ||
9213 | + return -EIO; | ||
9214 | + } | ||
9215 | + if (umidi->roland_load_ctl) { | ||
9216 | + ctl = umidi->roland_load_ctl; | ||
9217 | + ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE; | ||
9218 | + snd_ctl_notify(umidi->card, | ||
9219 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); | ||
9220 | - update_roland_altsetting(umidi); | ||
9221 | + update_roland_altsetting(umidi); | ||
9222 | + } | ||
9223 | } | ||
9224 | + umidi->opened[dir]++; | ||
9225 | + if (umidi->opened[1]) | ||
9226 | + snd_usbmidi_input_start(&umidi->list); | ||
9227 | } else { | ||
9228 | - if (--umidi->opened == 0 && umidi->roland_load_ctl) { | ||
9229 | - ctl = umidi->roland_load_ctl; | ||
9230 | - ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; | ||
9231 | - snd_ctl_notify(umidi->card, | ||
9232 | + umidi->opened[dir]--; | ||
9233 | + if (!umidi->opened[1]) | ||
9234 | + snd_usbmidi_input_stop(&umidi->list); | ||
9235 | + if (!umidi->opened[0] && !umidi->opened[1]) { | ||
9236 | + if (umidi->roland_load_ctl) { | ||
9237 | + ctl = umidi->roland_load_ctl; | ||
9238 | + ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; | ||
9239 | + snd_ctl_notify(umidi->card, | ||
9240 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); | ||
9241 | + } | ||
9242 | + if (umidi->autopm_reference) | ||
9243 | + usb_autopm_put_interface(umidi->iface); | ||
9244 | } | ||
9245 | } | ||
9246 | mutex_unlock(&umidi->mutex); | ||
9247 | + up_read(&umidi->disc_rwsem); | ||
9248 | + return 0; | ||
9249 | } | ||
9250 | |||
9251 | static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream) | ||
9252 | @@ -1063,7 +1094,6 @@ static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream) | ||
9253 | struct snd_usb_midi* umidi = substream->rmidi->private_data; | ||
9254 | struct usbmidi_out_port* port = NULL; | ||
9255 | int i, j; | ||
9256 | - int err; | ||
9257 | |||
9258 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) | ||
9259 | if (umidi->endpoints[i].out) | ||
9260 | @@ -1076,25 +1106,15 @@ static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream) | ||
9261 | snd_BUG(); | ||
9262 | return -ENXIO; | ||
9263 | } | ||
9264 | - err = usb_autopm_get_interface(umidi->iface); | ||
9265 | - port->autopm_reference = err >= 0; | ||
9266 | - if (err < 0 && err != -EACCES) | ||
9267 | - return -EIO; | ||
9268 | + | ||
9269 | substream->runtime->private_data = port; | ||
9270 | port->state = STATE_UNKNOWN; | ||
9271 | - substream_open(substream, 1); | ||
9272 | - return 0; | ||
9273 | + return substream_open(substream, 0, 1); | ||
9274 | } | ||
9275 | |||
9276 | static int snd_usbmidi_output_close(struct snd_rawmidi_substream *substream) | ||
9277 | { | ||
9278 | - struct snd_usb_midi* umidi = substream->rmidi->private_data; | ||
9279 | - struct usbmidi_out_port *port = substream->runtime->private_data; | ||
9280 | - | ||
9281 | - substream_open(substream, 0); | ||
9282 | - if (port->autopm_reference) | ||
9283 | - usb_autopm_put_interface(umidi->iface); | ||
9284 | - return 0; | ||
9285 | + return substream_open(substream, 0, 0); | ||
9286 | } | ||
9287 | |||
9288 | static void snd_usbmidi_output_trigger(struct snd_rawmidi_substream *substream, int up) | ||
9289 | @@ -1147,14 +1167,12 @@ static void snd_usbmidi_output_drain(struct snd_rawmidi_substream *substream) | ||
9290 | |||
9291 | static int snd_usbmidi_input_open(struct snd_rawmidi_substream *substream) | ||
9292 | { | ||
9293 | - substream_open(substream, 1); | ||
9294 | - return 0; | ||
9295 | + return substream_open(substream, 1, 1); | ||
9296 | } | ||
9297 | |||
9298 | static int snd_usbmidi_input_close(struct snd_rawmidi_substream *substream) | ||
9299 | { | ||
9300 | - substream_open(substream, 0); | ||
9301 | - return 0; | ||
9302 | + return substream_open(substream, 1, 0); | ||
9303 | } | ||
9304 | |||
9305 | static void snd_usbmidi_input_trigger(struct snd_rawmidi_substream *substream, int up) | ||
9306 | @@ -1403,9 +1421,12 @@ void snd_usbmidi_disconnect(struct list_head* p) | ||
9307 | * a timer may submit an URB. To reliably break the cycle | ||
9308 | * a flag under lock must be used | ||
9309 | */ | ||
9310 | + down_write(&umidi->disc_rwsem); | ||
9311 | spin_lock_irq(&umidi->disc_lock); | ||
9312 | umidi->disconnected = 1; | ||
9313 | spin_unlock_irq(&umidi->disc_lock); | ||
9314 | + up_write(&umidi->disc_rwsem); | ||
9315 | + | ||
9316 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { | ||
9317 | struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i]; | ||
9318 | if (ep->out) | ||
9319 | @@ -2060,12 +2081,15 @@ void snd_usbmidi_input_stop(struct list_head* p) | ||
9320 | unsigned int i, j; | ||
9321 | |||
9322 | umidi = list_entry(p, struct snd_usb_midi, list); | ||
9323 | + if (!umidi->input_running) | ||
9324 | + return; | ||
9325 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { | ||
9326 | struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i]; | ||
9327 | if (ep->in) | ||
9328 | for (j = 0; j < INPUT_URBS; ++j) | ||
9329 | usb_kill_urb(ep->in->urbs[j]); | ||
9330 | } | ||
9331 | + umidi->input_running = 0; | ||
9332 | } | ||
9333 | |||
9334 | static void snd_usbmidi_input_start_ep(struct snd_usb_midi_in_endpoint* ep) | ||
9335 | @@ -2090,8 +2114,11 @@ void snd_usbmidi_input_start(struct list_head* p) | ||
9336 | int i; | ||
9337 | |||
9338 | umidi = list_entry(p, struct snd_usb_midi, list); | ||
9339 | + if (umidi->input_running || !umidi->opened[1]) | ||
9340 | + return; | ||
9341 | for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) | ||
9342 | snd_usbmidi_input_start_ep(umidi->endpoints[i].in); | ||
9343 | + umidi->input_running = 1; | ||
9344 | } | ||
9345 | |||
9346 | /* | ||
9347 | @@ -2117,6 +2144,7 @@ int snd_usbmidi_create(struct snd_card *card, | ||
9348 | umidi->usb_protocol_ops = &snd_usbmidi_standard_ops; | ||
9349 | init_timer(&umidi->error_timer); | ||
9350 | spin_lock_init(&umidi->disc_lock); | ||
9351 | + init_rwsem(&umidi->disc_rwsem); | ||
9352 | mutex_init(&umidi->mutex); | ||
9353 | umidi->usb_id = USB_ID(le16_to_cpu(umidi->dev->descriptor.idVendor), | ||
9354 | le16_to_cpu(umidi->dev->descriptor.idProduct)); | ||
9355 | @@ -2229,9 +2257,6 @@ int snd_usbmidi_create(struct snd_card *card, | ||
9356 | } | ||
9357 | |||
9358 | list_add_tail(&umidi->list, midi_list); | ||
9359 | - | ||
9360 | - for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) | ||
9361 | - snd_usbmidi_input_start_ep(umidi->endpoints[i].in); | ||
9362 | return 0; | ||
9363 | } | ||
9364 | |||
9365 | diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c | ||
9366 | index 0f58b4b..b8d1ad1 100644 | ||
9367 | --- a/sound/usb/quirks.c | ||
9368 | +++ b/sound/usb/quirks.c | ||
9369 | @@ -387,11 +387,13 @@ static int snd_usb_fasttrackpro_boot_quirk(struct usb_device *dev) | ||
9370 | * rules | ||
9371 | */ | ||
9372 | err = usb_driver_set_configuration(dev, 2); | ||
9373 | - if (err < 0) { | ||
9374 | + if (err < 0) | ||
9375 | snd_printdd("error usb_driver_set_configuration: %d\n", | ||
9376 | err); | ||
9377 | - return -ENODEV; | ||
9378 | - } | ||
9379 | + /* Always return an error, so that we stop creating a device | ||
9380 | + that will just be destroyed and recreated with a new | ||
9381 | + configuration */ | ||
9382 | + return -ENODEV; | ||
9383 | } else | ||
9384 | snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n"); | ||
9385 | |||
9386 | diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c | ||
9387 | index d617f69..cd197be 100644 | ||
9388 | --- a/virt/kvm/kvm_main.c | ||
9389 | +++ b/virt/kvm/kvm_main.c | ||
9390 | @@ -701,8 +701,7 @@ int __kvm_set_memory_region(struct kvm *kvm, | ||
9391 | int r; | ||
9392 | gfn_t base_gfn; | ||
9393 | unsigned long npages; | ||
9394 | - unsigned long i; | ||
9395 | - struct kvm_memory_slot *memslot; | ||
9396 | + struct kvm_memory_slot *memslot, *slot; | ||
9397 | struct kvm_memory_slot old, new; | ||
9398 | struct kvm_memslots *slots, *old_memslots; | ||
9399 | |||
9400 | @@ -749,13 +748,11 @@ int __kvm_set_memory_region(struct kvm *kvm, | ||
9401 | |||
9402 | /* Check for overlaps */ | ||
9403 | r = -EEXIST; | ||
9404 | - for (i = 0; i < KVM_MEMORY_SLOTS; ++i) { | ||
9405 | - struct kvm_memory_slot *s = &kvm->memslots->memslots[i]; | ||
9406 | - | ||
9407 | - if (s == memslot || !s->npages) | ||
9408 | + kvm_for_each_memslot(slot, kvm->memslots) { | ||
9409 | + if (slot->id >= KVM_MEMORY_SLOTS || slot == memslot) | ||
9410 | continue; | ||
9411 | - if (!((base_gfn + npages <= s->base_gfn) || | ||
9412 | - (base_gfn >= s->base_gfn + s->npages))) | ||
9413 | + if (!((base_gfn + npages <= slot->base_gfn) || | ||
9414 | + (base_gfn >= slot->base_gfn + slot->npages))) | ||
9415 | goto out_free; | ||
9416 | } | ||
9417 | |||