Magellan Linux

Contents of /trunk/kernel26-alx/patches-3.10/0138-3.10.39-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2672 - (show annotations) (download)
Tue Jul 21 16:46:35 2015 UTC (8 years, 9 months ago) by niro
File size: 94052 byte(s)
-3.10.84-alx-r1
1 diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt
2 index 1e6b6531bbcc..d2ba80bb7af5 100644
3 --- a/Documentation/video4linux/gspca.txt
4 +++ b/Documentation/video4linux/gspca.txt
5 @@ -55,6 +55,7 @@ zc3xx 0458:700f Genius VideoCam Web V2
6 sonixj 0458:7025 Genius Eye 311Q
7 sn9c20x 0458:7029 Genius Look 320s
8 sonixj 0458:702e Genius Slim 310 NB
9 +sn9c20x 0458:7045 Genius Look 1320 V2
10 sn9c20x 0458:704a Genius Slim 1320
11 sn9c20x 0458:704c Genius i-Look 1321
12 sn9c20x 045e:00f4 LifeCam VX-6000 (SN9C20x + OV9650)
13 diff --git a/Makefile b/Makefile
14 index bd51b50a567b..1e07514be6f8 100644
15 --- a/Makefile
16 +++ b/Makefile
17 @@ -1,6 +1,6 @@
18 VERSION = 3
19 PATCHLEVEL = 10
20 -SUBLEVEL = 38
21 +SUBLEVEL = 39
22 EXTRAVERSION =
23 NAME = TOSSUG Baby Fish
24
25 diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi
26 index 4d12d2347c15..ddd068bb1457 100644
27 --- a/arch/arm/boot/dts/armada-370-xp.dtsi
28 +++ b/arch/arm/boot/dts/armada-370-xp.dtsi
29 @@ -92,6 +92,7 @@
30 #size-cells = <0>;
31 compatible = "marvell,orion-mdio";
32 reg = <0x72004 0x4>;
33 + clocks = <&gateclk 4>;
34 };
35
36 ethernet@70000 {
37 diff --git a/arch/arm/boot/dts/exynos5250-arndale.dts b/arch/arm/boot/dts/exynos5250-arndale.dts
38 index 02cfc76d002f..b64cb43a7295 100644
39 --- a/arch/arm/boot/dts/exynos5250-arndale.dts
40 +++ b/arch/arm/boot/dts/exynos5250-arndale.dts
41 @@ -263,6 +263,7 @@
42 regulator-name = "vdd_g3d";
43 regulator-min-microvolt = <1000000>;
44 regulator-max-microvolt = <1000000>;
45 + regulator-always-on;
46 regulator-boot-on;
47 op_mode = <1>;
48 };
49 diff --git a/arch/arm/include/asm/div64.h b/arch/arm/include/asm/div64.h
50 index fe92ccf1d0b0..a66061aef29c 100644
51 --- a/arch/arm/include/asm/div64.h
52 +++ b/arch/arm/include/asm/div64.h
53 @@ -156,7 +156,7 @@
54 /* Select the best insn combination to perform the */ \
55 /* actual __m * __n / (__p << 64) operation. */ \
56 if (!__c) { \
57 - asm ( "umull %Q0, %R0, %1, %Q2\n\t" \
58 + asm ( "umull %Q0, %R0, %Q1, %Q2\n\t" \
59 "mov %Q0, #0" \
60 : "=&r" (__res) \
61 : "r" (__m), "r" (__n) \
62 diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h
63 index e42cf597f6e6..2aff798fbef4 100644
64 --- a/arch/arm/include/asm/futex.h
65 +++ b/arch/arm/include/asm/futex.h
66 @@ -3,11 +3,6 @@
67
68 #ifdef __KERNEL__
69
70 -#if defined(CONFIG_CPU_USE_DOMAINS) && defined(CONFIG_SMP)
71 -/* ARM doesn't provide unprivileged exclusive memory accessors */
72 -#include <asm-generic/futex.h>
73 -#else
74 -
75 #include <linux/futex.h>
76 #include <linux/uaccess.h>
77 #include <asm/errno.h>
78 @@ -164,6 +159,5 @@ futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
79 return ret;
80 }
81
82 -#endif /* !(CPU_USE_DOMAINS && SMP) */
83 #endif /* __KERNEL__ */
84 #endif /* _ASM_ARM_FUTEX_H */
85 diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
86 index 652b56086de7..d070741b2b37 100644
87 --- a/arch/arm/include/asm/io.h
88 +++ b/arch/arm/include/asm/io.h
89 @@ -130,16 +130,16 @@ static inline u32 __raw_readl(const volatile void __iomem *addr)
90 */
91 extern void __iomem *__arm_ioremap_pfn_caller(unsigned long, unsigned long,
92 size_t, unsigned int, void *);
93 -extern void __iomem *__arm_ioremap_caller(unsigned long, size_t, unsigned int,
94 +extern void __iomem *__arm_ioremap_caller(phys_addr_t, size_t, unsigned int,
95 void *);
96
97 extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
98 -extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int);
99 -extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, bool cached);
100 +extern void __iomem *__arm_ioremap(phys_addr_t, size_t, unsigned int);
101 +extern void __iomem *__arm_ioremap_exec(phys_addr_t, size_t, bool cached);
102 extern void __iounmap(volatile void __iomem *addr);
103 extern void __arm_iounmap(volatile void __iomem *addr);
104
105 -extern void __iomem * (*arch_ioremap_caller)(unsigned long, size_t,
106 +extern void __iomem * (*arch_ioremap_caller)(phys_addr_t, size_t,
107 unsigned int, void *);
108 extern void (*arch_iounmap)(volatile void __iomem *);
109
110 diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h
111 index f97ee02386ee..c98c9c89b95c 100644
112 --- a/arch/arm/include/asm/pgtable-2level.h
113 +++ b/arch/arm/include/asm/pgtable-2level.h
114 @@ -140,6 +140,7 @@
115 #define L_PTE_MT_DEV_NONSHARED (_AT(pteval_t, 0x0c) << 2) /* 1100 */
116 #define L_PTE_MT_DEV_WC (_AT(pteval_t, 0x09) << 2) /* 1001 */
117 #define L_PTE_MT_DEV_CACHED (_AT(pteval_t, 0x0b) << 2) /* 1011 */
118 +#define L_PTE_MT_VECTORS (_AT(pteval_t, 0x0f) << 2) /* 1111 */
119 #define L_PTE_MT_MASK (_AT(pteval_t, 0x0f) << 2)
120
121 #ifndef __ASSEMBLY__
122 diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
123 index 141baa3f9a72..cbd61977c996 100644
124 --- a/arch/arm/include/asm/unistd.h
125 +++ b/arch/arm/include/asm/unistd.h
126 @@ -48,6 +48,5 @@
127 */
128 #define __IGNORE_fadvise64_64
129 #define __IGNORE_migrate_pages
130 -#define __IGNORE_kcmp
131
132 #endif /* __ASM_ARM_UNISTD_H */
133 diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
134 index 163b160c69e9..c3ef920823b6 100644
135 --- a/arch/arm/kernel/machine_kexec.c
136 +++ b/arch/arm/kernel/machine_kexec.c
137 @@ -169,3 +169,10 @@ void machine_kexec(struct kimage *image)
138
139 soft_restart(reboot_code_buffer_phys);
140 }
141 +
142 +void arch_crash_save_vmcoreinfo(void)
143 +{
144 +#ifdef CONFIG_ARM_LPAE
145 + VMCOREINFO_CONFIG(ARM_LPAE);
146 +#endif
147 +}
148 diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c
149 index b13cc74114db..8a53f346cdb3 100644
150 --- a/arch/arm/mach-ebsa110/core.c
151 +++ b/arch/arm/mach-ebsa110/core.c
152 @@ -116,7 +116,7 @@ static void __init ebsa110_map_io(void)
153 iotable_init(ebsa110_io_desc, ARRAY_SIZE(ebsa110_io_desc));
154 }
155
156 -static void __iomem *ebsa110_ioremap_caller(unsigned long cookie, size_t size,
157 +static void __iomem *ebsa110_ioremap_caller(phys_addr_t cookie, size_t size,
158 unsigned int flags, void *caller)
159 {
160 return (void __iomem *)cookie;
161 diff --git a/arch/arm/mach-imx/mm-imx3.c b/arch/arm/mach-imx/mm-imx3.c
162 index e0e69a682174..eed32ca0b8ab 100644
163 --- a/arch/arm/mach-imx/mm-imx3.c
164 +++ b/arch/arm/mach-imx/mm-imx3.c
165 @@ -65,7 +65,7 @@ static void imx3_idle(void)
166 : "=r" (reg));
167 }
168
169 -static void __iomem *imx3_ioremap_caller(unsigned long phys_addr, size_t size,
170 +static void __iomem *imx3_ioremap_caller(phys_addr_t phys_addr, size_t size,
171 unsigned int mtype, void *caller)
172 {
173 if (mtype == MT_DEVICE) {
174 diff --git a/arch/arm/mach-iop13xx/io.c b/arch/arm/mach-iop13xx/io.c
175 index 183dc8b5511b..faaf7d4482c5 100644
176 --- a/arch/arm/mach-iop13xx/io.c
177 +++ b/arch/arm/mach-iop13xx/io.c
178 @@ -23,7 +23,7 @@
179
180 #include "pci.h"
181
182 -static void __iomem *__iop13xx_ioremap_caller(unsigned long cookie,
183 +static void __iomem *__iop13xx_ioremap_caller(phys_addr_t cookie,
184 size_t size, unsigned int mtype, void *caller)
185 {
186 void __iomem * retval;
187 diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
188 index 6600cff6bd92..d7223b3b81f3 100644
189 --- a/arch/arm/mach-ixp4xx/common.c
190 +++ b/arch/arm/mach-ixp4xx/common.c
191 @@ -559,7 +559,7 @@ void ixp4xx_restart(char mode, const char *cmd)
192 * fallback to the default.
193 */
194
195 -static void __iomem *ixp4xx_ioremap_caller(unsigned long addr, size_t size,
196 +static void __iomem *ixp4xx_ioremap_caller(phys_addr_t addr, size_t size,
197 unsigned int mtype, void *caller)
198 {
199 if (!is_pci_memory(addr))
200 diff --git a/arch/arm/mach-msm/common.h b/arch/arm/mach-msm/common.h
201 index ce8215a269e5..421cf7751a80 100644
202 --- a/arch/arm/mach-msm/common.h
203 +++ b/arch/arm/mach-msm/common.h
204 @@ -23,7 +23,7 @@ extern void msm_map_msm8x60_io(void);
205 extern void msm_map_msm8960_io(void);
206 extern void msm_map_qsd8x50_io(void);
207
208 -extern void __iomem *__msm_ioremap_caller(unsigned long phys_addr, size_t size,
209 +extern void __iomem *__msm_ioremap_caller(phys_addr_t phys_addr, size_t size,
210 unsigned int mtype, void *caller);
211
212 extern struct smp_operations msm_smp_ops;
213 diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c
214 index 123ef9cbce1b..fd65b6d42cde 100644
215 --- a/arch/arm/mach-msm/io.c
216 +++ b/arch/arm/mach-msm/io.c
217 @@ -172,7 +172,7 @@ void __init msm_map_msm7x30_io(void)
218 }
219 #endif /* CONFIG_ARCH_MSM7X30 */
220
221 -void __iomem *__msm_ioremap_caller(unsigned long phys_addr, size_t size,
222 +void __iomem *__msm_ioremap_caller(phys_addr_t phys_addr, size_t size,
223 unsigned int mtype, void *caller)
224 {
225 if (mtype == MT_DEVICE) {
226 diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
227 index e022a869bff2..6037a9a01ed5 100644
228 --- a/arch/arm/mach-omap2/irq.c
229 +++ b/arch/arm/mach-omap2/irq.c
230 @@ -222,6 +222,7 @@ void __init ti81xx_init_irq(void)
231 static inline void omap_intc_handle_irq(void __iomem *base_addr, struct pt_regs *regs)
232 {
233 u32 irqnr;
234 + int handled_irq = 0;
235
236 do {
237 irqnr = readl_relaxed(base_addr + 0x98);
238 @@ -249,8 +250,15 @@ out:
239 if (irqnr) {
240 irqnr = irq_find_mapping(domain, irqnr);
241 handle_IRQ(irqnr, regs);
242 + handled_irq = 1;
243 }
244 } while (irqnr);
245 +
246 + /* If an irq is masked or deasserted while active, we will
247 + * keep ending up here with no irq handled. So remove it from
248 + * the INTC with an ack.*/
249 + if (!handled_irq)
250 + omap_ack_irq(NULL);
251 }
252
253 asmlinkage void __exception_irq_entry omap2_intc_handle_irq(struct pt_regs *regs)
254 diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
255 index 9f6238c9dfc9..8691c8cbe2c7 100644
256 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
257 +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c
258 @@ -1955,7 +1955,7 @@ static struct omap_hwmod_irq_info omap3xxx_usb_host_hs_irqs[] = {
259 static struct omap_hwmod omap3xxx_usb_host_hs_hwmod = {
260 .name = "usb_host_hs",
261 .class = &omap3xxx_usb_host_hs_hwmod_class,
262 - .clkdm_name = "l3_init_clkdm",
263 + .clkdm_name = "usbhost_clkdm",
264 .mpu_irqs = omap3xxx_usb_host_hs_irqs,
265 .main_clk = "usbhost_48m_fck",
266 .prcm = {
267 @@ -2040,7 +2040,7 @@ static struct omap_hwmod_irq_info omap3xxx_usb_tll_hs_irqs[] = {
268 static struct omap_hwmod omap3xxx_usb_tll_hs_hwmod = {
269 .name = "usb_tll_hs",
270 .class = &omap3xxx_usb_tll_hs_hwmod_class,
271 - .clkdm_name = "l3_init_clkdm",
272 + .clkdm_name = "core_l4_clkdm",
273 .mpu_irqs = omap3xxx_usb_tll_hs_irqs,
274 .main_clk = "usbtll_fck",
275 .prcm = {
276 diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
277 index 7bdd22afce69..d4d0fce325c7 100644
278 --- a/arch/arm/mach-omap2/pm.h
279 +++ b/arch/arm/mach-omap2/pm.h
280 @@ -103,7 +103,7 @@ static inline void enable_omap3630_toggle_l2_on_restore(void) { }
281
282 #define PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD (1 << 0)
283
284 -#if defined(CONFIG_ARCH_OMAP4)
285 +#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP4)
286 extern u16 pm44xx_errata;
287 #define IS_PM44XX_ERRATUM(id) (pm44xx_errata & (id))
288 #else
289 diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
290 index 08c9fe917d1f..c21082d664ed 100644
291 --- a/arch/arm/mm/Kconfig
292 +++ b/arch/arm/mm/Kconfig
293 @@ -436,7 +436,6 @@ config CPU_32v5
294
295 config CPU_32v6
296 bool
297 - select CPU_USE_DOMAINS if CPU_V6 && MMU
298 select TLS_REG_EMUL if !CPU_32v6K && !MMU
299
300 config CPU_32v6K
301 @@ -651,7 +650,7 @@ config ARM_VIRT_EXT
302
303 config SWP_EMULATE
304 bool "Emulate SWP/SWPB instructions"
305 - depends on !CPU_USE_DOMAINS && CPU_V7
306 + depends on CPU_V7
307 default y if SMP
308 select HAVE_PROC_CPU if PROC_FS
309 help
310 diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
311 index 04d9006eab1f..f123d6eb074b 100644
312 --- a/arch/arm/mm/ioremap.c
313 +++ b/arch/arm/mm/ioremap.c
314 @@ -331,10 +331,10 @@ void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
315 return (void __iomem *) (offset + addr);
316 }
317
318 -void __iomem *__arm_ioremap_caller(unsigned long phys_addr, size_t size,
319 +void __iomem *__arm_ioremap_caller(phys_addr_t phys_addr, size_t size,
320 unsigned int mtype, void *caller)
321 {
322 - unsigned long last_addr;
323 + phys_addr_t last_addr;
324 unsigned long offset = phys_addr & ~PAGE_MASK;
325 unsigned long pfn = __phys_to_pfn(phys_addr);
326
327 @@ -367,12 +367,12 @@ __arm_ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size,
328 }
329 EXPORT_SYMBOL(__arm_ioremap_pfn);
330
331 -void __iomem * (*arch_ioremap_caller)(unsigned long, size_t,
332 +void __iomem * (*arch_ioremap_caller)(phys_addr_t, size_t,
333 unsigned int, void *) =
334 __arm_ioremap_caller;
335
336 void __iomem *
337 -__arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
338 +__arm_ioremap(phys_addr_t phys_addr, size_t size, unsigned int mtype)
339 {
340 return arch_ioremap_caller(phys_addr, size, mtype,
341 __builtin_return_address(0));
342 @@ -387,7 +387,7 @@ EXPORT_SYMBOL(__arm_ioremap);
343 * CONFIG_GENERIC_ALLOCATOR for allocating external memory.
344 */
345 void __iomem *
346 -__arm_ioremap_exec(unsigned long phys_addr, size_t size, bool cached)
347 +__arm_ioremap_exec(phys_addr_t phys_addr, size_t size, bool cached)
348 {
349 unsigned int mtype;
350
351 diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
352 index daf336fe0be8..fb3c446af9e5 100644
353 --- a/arch/arm/mm/mmu.c
354 +++ b/arch/arm/mm/mmu.c
355 @@ -459,6 +459,16 @@ static void __init build_mem_type_table(void)
356 hyp_device_pgprot = s2_device_pgprot = mem_types[MT_DEVICE].prot_pte;
357
358 /*
359 + * We don't use domains on ARMv6 (since this causes problems with
360 + * v6/v7 kernels), so we must use a separate memory type for user
361 + * r/o, kernel r/w to map the vectors page.
362 + */
363 +#ifndef CONFIG_ARM_LPAE
364 + if (cpu_arch == CPU_ARCH_ARMv6)
365 + vecs_pgprot |= L_PTE_MT_VECTORS;
366 +#endif
367 +
368 + /*
369 * ARMv6 and above have extended page tables.
370 */
371 if (cpu_arch >= CPU_ARCH_ARMv6 && (cr & CR_XP)) {
372 diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
373 index eb5293a69a84..7fe0524a5449 100644
374 --- a/arch/arm/mm/nommu.c
375 +++ b/arch/arm/mm/nommu.c
376 @@ -87,16 +87,16 @@ void __iomem *__arm_ioremap_pfn_caller(unsigned long pfn, unsigned long offset,
377 return __arm_ioremap_pfn(pfn, offset, size, mtype);
378 }
379
380 -void __iomem *__arm_ioremap(unsigned long phys_addr, size_t size,
381 +void __iomem *__arm_ioremap(phys_addr_t phys_addr, size_t size,
382 unsigned int mtype)
383 {
384 return (void __iomem *)phys_addr;
385 }
386 EXPORT_SYMBOL(__arm_ioremap);
387
388 -void __iomem * (*arch_ioremap_caller)(unsigned long, size_t, unsigned int, void *);
389 +void __iomem * (*arch_ioremap_caller)(phys_addr_t, size_t, unsigned int, void *);
390
391 -void __iomem *__arm_ioremap_caller(unsigned long phys_addr, size_t size,
392 +void __iomem *__arm_ioremap_caller(phys_addr_t phys_addr, size_t size,
393 unsigned int mtype, void *caller)
394 {
395 return __arm_ioremap(phys_addr, size, mtype);
396 diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
397 index e3c48a3fe063..ee1d80593958 100644
398 --- a/arch/arm/mm/proc-macros.S
399 +++ b/arch/arm/mm/proc-macros.S
400 @@ -112,13 +112,9 @@
401 * 100x 1 0 1 r/o no acc
402 * 10x0 1 0 1 r/o no acc
403 * 1011 0 0 1 r/w no acc
404 - * 110x 0 1 0 r/w r/o
405 - * 11x0 0 1 0 r/w r/o
406 - * 1111 0 1 1 r/w r/w
407 - *
408 - * If !CONFIG_CPU_USE_DOMAINS, the following permissions are changed:
409 * 110x 1 1 1 r/o r/o
410 * 11x0 1 1 1 r/o r/o
411 + * 1111 0 1 1 r/w r/w
412 */
413 .macro armv6_mt_table pfx
414 \pfx\()_mt_table:
415 @@ -137,7 +133,7 @@
416 .long PTE_EXT_TEX(2) @ L_PTE_MT_DEV_NONSHARED
417 .long 0x00 @ unused
418 .long 0x00 @ unused
419 - .long 0x00 @ unused
420 + .long PTE_CACHEABLE | PTE_BUFFERABLE | PTE_EXT_APX @ L_PTE_MT_VECTORS
421 .endm
422
423 .macro armv6_set_pte_ext pfx
424 @@ -158,24 +154,21 @@
425
426 tst r1, #L_PTE_USER
427 orrne r3, r3, #PTE_EXT_AP1
428 -#ifdef CONFIG_CPU_USE_DOMAINS
429 - @ allow kernel read/write access to read-only user pages
430 tstne r3, #PTE_EXT_APX
431 - bicne r3, r3, #PTE_EXT_APX | PTE_EXT_AP0
432 -#endif
433 +
434 + @ user read-only -> kernel read-only
435 + bicne r3, r3, #PTE_EXT_AP0
436
437 tst r1, #L_PTE_XN
438 orrne r3, r3, #PTE_EXT_XN
439
440 - orr r3, r3, r2
441 + eor r3, r3, r2
442
443 tst r1, #L_PTE_YOUNG
444 tstne r1, #L_PTE_PRESENT
445 moveq r3, #0
446 -#ifndef CONFIG_CPU_USE_DOMAINS
447 tstne r1, #L_PTE_NONE
448 movne r3, #0
449 -#endif
450
451 str r3, [r0]
452 mcr p15, 0, r0, c7, c10, 1 @ flush_pte
453 diff --git a/arch/arm/mm/proc-v7-2level.S b/arch/arm/mm/proc-v7-2level.S
454 index b3997c70af32..bb20ba0f7bc7 100644
455 --- a/arch/arm/mm/proc-v7-2level.S
456 +++ b/arch/arm/mm/proc-v7-2level.S
457 @@ -90,21 +90,14 @@ ENTRY(cpu_v7_set_pte_ext)
458
459 tst r1, #L_PTE_USER
460 orrne r3, r3, #PTE_EXT_AP1
461 -#ifdef CONFIG_CPU_USE_DOMAINS
462 - @ allow kernel read/write access to read-only user pages
463 - tstne r3, #PTE_EXT_APX
464 - bicne r3, r3, #PTE_EXT_APX | PTE_EXT_AP0
465 -#endif
466
467 tst r1, #L_PTE_XN
468 orrne r3, r3, #PTE_EXT_XN
469
470 tst r1, #L_PTE_YOUNG
471 tstne r1, #L_PTE_VALID
472 -#ifndef CONFIG_CPU_USE_DOMAINS
473 eorne r1, r1, #L_PTE_NONE
474 tstne r1, #L_PTE_NONE
475 -#endif
476 moveq r3, #0
477
478 ARM( str r3, [r0, #2048]! )
479 diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
480 index e9a1a1d81892..3a710d7b14ce 100644
481 --- a/arch/arm64/include/asm/pgtable.h
482 +++ b/arch/arm64/include/asm/pgtable.h
483 @@ -161,7 +161,7 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
484 pte_t *ptep, pte_t pte)
485 {
486 if (pte_valid_user(pte)) {
487 - if (pte_exec(pte))
488 + if (!pte_special(pte) && pte_exec(pte))
489 __sync_icache_dcache(pte, addr);
490 if (!pte_dirty(pte))
491 pte = pte_wrprotect(pte);
492 @@ -182,11 +182,11 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
493 * Mark the prot value as uncacheable and unbufferable.
494 */
495 #define pgprot_noncached(prot) \
496 - __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRnE))
497 + __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRnE) | PTE_PXN | PTE_UXN)
498 #define pgprot_writecombine(prot) \
499 - __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC))
500 + __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN)
501 #define pgprot_dmacoherent(prot) \
502 - __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC))
503 + __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN)
504 #define __HAVE_PHYS_MEM_ACCESS_PROT
505 struct file;
506 extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
507 diff --git a/arch/s390/include/asm/ccwdev.h b/arch/s390/include/asm/ccwdev.h
508 index f201af8be580..31b5ca8f8c3d 100644
509 --- a/arch/s390/include/asm/ccwdev.h
510 +++ b/arch/s390/include/asm/ccwdev.h
511 @@ -219,7 +219,7 @@ extern void ccw_device_get_id(struct ccw_device *, struct ccw_dev_id *);
512 #define to_ccwdev(n) container_of(n, struct ccw_device, dev)
513 #define to_ccwdrv(n) container_of(n, struct ccw_driver, driver)
514
515 -extern struct ccw_device *ccw_device_probe_console(void);
516 +extern struct ccw_device *ccw_device_probe_console(struct ccw_driver *);
517 extern void ccw_device_wait_idle(struct ccw_device *);
518 extern int ccw_device_force_console(struct ccw_device *);
519
520 diff --git a/arch/sh/kernel/dumpstack.c b/arch/sh/kernel/dumpstack.c
521 index b959f5592604..8dfe645bcc4b 100644
522 --- a/arch/sh/kernel/dumpstack.c
523 +++ b/arch/sh/kernel/dumpstack.c
524 @@ -115,7 +115,7 @@ static int print_trace_stack(void *data, char *name)
525 */
526 static void print_trace_address(void *data, unsigned long addr, int reliable)
527 {
528 - printk(data);
529 + printk("%s", (char *)data);
530 printk_address(addr, reliable);
531 }
532
533 diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
534 index d606463aa6d6..1308beed7abe 100644
535 --- a/arch/x86/boot/compressed/eboot.c
536 +++ b/arch/x86/boot/compressed/eboot.c
537 @@ -865,6 +865,9 @@ fail:
538 * Because the x86 boot code expects to be passed a boot_params we
539 * need to create one ourselves (usually the bootloader would create
540 * one for us).
541 + *
542 + * The caller is responsible for filling out ->code32_start in the
543 + * returned boot_params.
544 */
545 struct boot_params *make_boot_params(void *handle, efi_system_table_t *_table)
546 {
547 @@ -921,8 +924,6 @@ struct boot_params *make_boot_params(void *handle, efi_system_table_t *_table)
548 hdr->vid_mode = 0xffff;
549 hdr->boot_flag = 0xAA55;
550
551 - hdr->code32_start = (__u64)(unsigned long)image->image_base;
552 -
553 hdr->type_of_loader = 0x21;
554
555 /* Convert unicode cmdline to ascii */
556 diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S
557 index 1e3184f6072f..abb988a54c69 100644
558 --- a/arch/x86/boot/compressed/head_32.S
559 +++ b/arch/x86/boot/compressed/head_32.S
560 @@ -50,6 +50,13 @@ ENTRY(efi_pe_entry)
561 pushl %eax
562 pushl %esi
563 pushl %ecx
564 +
565 + call reloc
566 +reloc:
567 + popl %ecx
568 + subl reloc, %ecx
569 + movl %ecx, BP_code32_start(%eax)
570 +
571 sub $0x4, %esp
572
573 ENTRY(efi_stub_entry)
574 @@ -63,12 +70,7 @@ ENTRY(efi_stub_entry)
575 hlt
576 jmp 1b
577 2:
578 - call 3f
579 -3:
580 - popl %eax
581 - subl $3b, %eax
582 - subl BP_pref_address(%esi), %eax
583 - add BP_code32_start(%esi), %eax
584 + movl BP_code32_start(%esi), %eax
585 leal preferred_addr(%eax), %eax
586 jmp *%eax
587
588 diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
589 index 16f24e6dad79..92059b8f3f7b 100644
590 --- a/arch/x86/boot/compressed/head_64.S
591 +++ b/arch/x86/boot/compressed/head_64.S
592 @@ -217,6 +217,8 @@ ENTRY(efi_pe_entry)
593 cmpq $0,%rax
594 je 1f
595 mov %rax, %rdx
596 + leaq startup_32(%rip), %rax
597 + movl %eax, BP_code32_start(%rdx)
598 popq %rsi
599 popq %rdi
600
601 @@ -230,12 +232,7 @@ ENTRY(efi_stub_entry)
602 hlt
603 jmp 1b
604 2:
605 - call 3f
606 -3:
607 - popq %rax
608 - subq $3b, %rax
609 - subq BP_pref_address(%rsi), %rax
610 - add BP_code32_start(%esi), %eax
611 + movl BP_code32_start(%esi), %eax
612 leaq preferred_addr(%rax), %rax
613 jmp *%rax
614
615 diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
616 index e6253195a301..1ffc32dbe450 100644
617 --- a/arch/x86/kernel/ftrace.c
618 +++ b/arch/x86/kernel/ftrace.c
619 @@ -659,8 +659,8 @@ ftrace_modify_code(unsigned long ip, unsigned const char *old_code,
620 ret = -EPERM;
621 goto out;
622 }
623 - run_sync();
624 out:
625 + run_sync();
626 return ret;
627
628 fail_update:
629 diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c
630 index ebc987398923..af1d14a9ebda 100644
631 --- a/arch/x86/kernel/ldt.c
632 +++ b/arch/x86/kernel/ldt.c
633 @@ -229,6 +229,17 @@ static int write_ldt(void __user *ptr, unsigned long bytecount, int oldmode)
634 }
635 }
636
637 + /*
638 + * On x86-64 we do not support 16-bit segments due to
639 + * IRET leaking the high bits of the kernel stack address.
640 + */
641 +#ifdef CONFIG_X86_64
642 + if (!ldt_info.seg_32bit) {
643 + error = -EINVAL;
644 + goto out_unlock;
645 + }
646 +#endif
647 +
648 fill_ldt(&ldt, &ldt_info);
649 if (oldmode)
650 ldt.avl = 0;
651 diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
652 index 20dd52a2f92f..6e514583aa76 100644
653 --- a/drivers/block/mtip32xx/mtip32xx.c
654 +++ b/drivers/block/mtip32xx/mtip32xx.c
655 @@ -4040,6 +4040,7 @@ skip_create_disk:
656 blk_queue_max_hw_sectors(dd->queue, 0xffff);
657 blk_queue_max_segment_size(dd->queue, 0x400000);
658 blk_queue_io_min(dd->queue, 4096);
659 + blk_queue_bounce_limit(dd->queue, dd->pdev->dma_mask);
660
661 /*
662 * write back cache is not supported in the device. FUA depends on
663 diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
664 index aaadd32f9f0d..d344cf3ac9e3 100644
665 --- a/drivers/iio/industrialio-buffer.c
666 +++ b/drivers/iio/industrialio-buffer.c
667 @@ -119,7 +119,8 @@ static ssize_t iio_scan_el_show(struct device *dev,
668 int ret;
669 struct iio_dev *indio_dev = dev_to_iio_dev(dev);
670
671 - ret = test_bit(to_iio_dev_attr(attr)->address,
672 + /* Ensure ret is 0 or 1. */
673 + ret = !!test_bit(to_iio_dev_attr(attr)->address,
674 indio_dev->buffer->scan_mask);
675
676 return sprintf(buf, "%d\n", ret);
677 @@ -762,7 +763,8 @@ int iio_scan_mask_query(struct iio_dev *indio_dev,
678 if (!buffer->scan_mask)
679 return 0;
680
681 - return test_bit(bit, buffer->scan_mask);
682 + /* Ensure return value is 0 or 1. */
683 + return !!test_bit(bit, buffer->scan_mask);
684 };
685 EXPORT_SYMBOL_GPL(iio_scan_mask_query);
686
687 diff --git a/drivers/infiniband/hw/ehca/ehca_cq.c b/drivers/infiniband/hw/ehca/ehca_cq.c
688 index 212150c25ea0..8cc837537768 100644
689 --- a/drivers/infiniband/hw/ehca/ehca_cq.c
690 +++ b/drivers/infiniband/hw/ehca/ehca_cq.c
691 @@ -283,6 +283,7 @@ struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, int comp_vector,
692 (my_cq->galpas.user.fw_handle & (PAGE_SIZE - 1));
693 if (ib_copy_to_udata(udata, &resp, sizeof(resp))) {
694 ehca_err(device, "Copy to udata failed.");
695 + cq = ERR_PTR(-EFAULT);
696 goto create_cq_exit4;
697 }
698 }
699 diff --git a/drivers/infiniband/hw/ipath/ipath_diag.c b/drivers/infiniband/hw/ipath/ipath_diag.c
700 index 714293b78518..e2f9a51f4a38 100644
701 --- a/drivers/infiniband/hw/ipath/ipath_diag.c
702 +++ b/drivers/infiniband/hw/ipath/ipath_diag.c
703 @@ -326,7 +326,7 @@ static ssize_t ipath_diagpkt_write(struct file *fp,
704 size_t count, loff_t *off)
705 {
706 u32 __iomem *piobuf;
707 - u32 plen, clen, pbufn;
708 + u32 plen, pbufn, maxlen_reserve;
709 struct ipath_diag_pkt odp;
710 struct ipath_diag_xpkt dp;
711 u32 *tmpbuf = NULL;
712 @@ -335,51 +335,29 @@ static ssize_t ipath_diagpkt_write(struct file *fp,
713 u64 val;
714 u32 l_state, lt_state; /* LinkState, LinkTrainingState */
715
716 - if (count < sizeof(odp)) {
717 - ret = -EINVAL;
718 - goto bail;
719 - }
720
721 if (count == sizeof(dp)) {
722 if (copy_from_user(&dp, data, sizeof(dp))) {
723 ret = -EFAULT;
724 goto bail;
725 }
726 - } else if (copy_from_user(&odp, data, sizeof(odp))) {
727 - ret = -EFAULT;
728 + } else if (count == sizeof(odp)) {
729 + if (copy_from_user(&odp, data, sizeof(odp))) {
730 + ret = -EFAULT;
731 + goto bail;
732 + }
733 + } else {
734 + ret = -EINVAL;
735 goto bail;
736 }
737
738 - /*
739 - * Due to padding/alignment issues (lessened with new struct)
740 - * the old and new structs are the same length. We need to
741 - * disambiguate them, which we can do because odp.len has never
742 - * been less than the total of LRH+BTH+DETH so far, while
743 - * dp.unit (same offset) unit is unlikely to get that high.
744 - * Similarly, dp.data, the pointer to user at the same offset
745 - * as odp.unit, is almost certainly at least one (512byte)page
746 - * "above" NULL. The if-block below can be omitted if compatibility
747 - * between a new driver and older diagnostic code is unimportant.
748 - * compatibility the other direction (new diags, old driver) is
749 - * handled in the diagnostic code, with a warning.
750 - */
751 - if (dp.unit >= 20 && dp.data < 512) {
752 - /* very probable version mismatch. Fix it up */
753 - memcpy(&odp, &dp, sizeof(odp));
754 - /* We got a legacy dp, copy elements to dp */
755 - dp.unit = odp.unit;
756 - dp.data = odp.data;
757 - dp.len = odp.len;
758 - dp.pbc_wd = 0; /* Indicate we need to compute PBC wd */
759 - }
760 -
761 /* send count must be an exact number of dwords */
762 if (dp.len & 3) {
763 ret = -EINVAL;
764 goto bail;
765 }
766
767 - clen = dp.len >> 2;
768 + plen = dp.len >> 2;
769
770 dd = ipath_lookup(dp.unit);
771 if (!dd || !(dd->ipath_flags & IPATH_PRESENT) ||
772 @@ -422,16 +400,22 @@ static ssize_t ipath_diagpkt_write(struct file *fp,
773 goto bail;
774 }
775
776 - /* need total length before first word written */
777 - /* +1 word is for the qword padding */
778 - plen = sizeof(u32) + dp.len;
779 -
780 - if ((plen + 4) > dd->ipath_ibmaxlen) {
781 + /*
782 + * need total length before first word written, plus 2 Dwords. One Dword
783 + * is for padding so we get the full user data when not aligned on
784 + * a word boundary. The other Dword is to make sure we have room for the
785 + * ICRC which gets tacked on later.
786 + */
787 + maxlen_reserve = 2 * sizeof(u32);
788 + if (dp.len > dd->ipath_ibmaxlen - maxlen_reserve) {
789 ipath_dbg("Pkt len 0x%x > ibmaxlen %x\n",
790 - plen - 4, dd->ipath_ibmaxlen);
791 + dp.len, dd->ipath_ibmaxlen);
792 ret = -EINVAL;
793 - goto bail; /* before writing pbc */
794 + goto bail;
795 }
796 +
797 + plen = sizeof(u32) + dp.len;
798 +
799 tmpbuf = vmalloc(plen);
800 if (!tmpbuf) {
801 dev_info(&dd->pcidev->dev, "Unable to allocate tmp buffer, "
802 @@ -473,11 +457,11 @@ static ssize_t ipath_diagpkt_write(struct file *fp,
803 */
804 if (dd->ipath_flags & IPATH_PIO_FLUSH_WC) {
805 ipath_flush_wc();
806 - __iowrite32_copy(piobuf + 2, tmpbuf, clen - 1);
807 + __iowrite32_copy(piobuf + 2, tmpbuf, plen - 1);
808 ipath_flush_wc();
809 - __raw_writel(tmpbuf[clen - 1], piobuf + clen + 1);
810 + __raw_writel(tmpbuf[plen - 1], piobuf + plen + 1);
811 } else
812 - __iowrite32_copy(piobuf + 2, tmpbuf, clen);
813 + __iowrite32_copy(piobuf + 2, tmpbuf, plen);
814
815 ipath_flush_wc();
816
817 diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
818 index 5b71d43bd89c..42dde06fdb91 100644
819 --- a/drivers/infiniband/hw/mthca/mthca_provider.c
820 +++ b/drivers/infiniband/hw/mthca/mthca_provider.c
821 @@ -695,6 +695,7 @@ static struct ib_cq *mthca_create_cq(struct ib_device *ibdev, int entries,
822
823 if (context && ib_copy_to_udata(udata, &cq->cqn, sizeof (__u32))) {
824 mthca_free_cq(to_mdev(ibdev), cq);
825 + err = -EFAULT;
826 goto err_free;
827 }
828
829 diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
830 index 8f67fe2e91e6..7510a3c80757 100644
831 --- a/drivers/infiniband/hw/nes/nes_verbs.c
832 +++ b/drivers/infiniband/hw/nes/nes_verbs.c
833 @@ -1186,7 +1186,7 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd,
834 nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num);
835 kfree(nesqp->allocated_buffer);
836 nes_debug(NES_DBG_QP, "ib_copy_from_udata() Failed \n");
837 - return NULL;
838 + return ERR_PTR(-EFAULT);
839 }
840 if (req.user_wqe_buffers) {
841 virt_wqs = 1;
842 diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
843 index 6c66a728a37f..64953dfa9d8a 100644
844 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c
845 +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
846 @@ -1078,6 +1078,7 @@ static void srpt_unmap_sg_to_ib_sge(struct srpt_rdma_ch *ch,
847 static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch,
848 struct srpt_send_ioctx *ioctx)
849 {
850 + struct ib_device *dev = ch->sport->sdev->device;
851 struct se_cmd *cmd;
852 struct scatterlist *sg, *sg_orig;
853 int sg_cnt;
854 @@ -1124,7 +1125,7 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch,
855
856 db = ioctx->rbufs;
857 tsize = cmd->data_length;
858 - dma_len = sg_dma_len(&sg[0]);
859 + dma_len = ib_sg_dma_len(dev, &sg[0]);
860 riu = ioctx->rdma_ius;
861
862 /*
863 @@ -1155,7 +1156,8 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch,
864 ++j;
865 if (j < count) {
866 sg = sg_next(sg);
867 - dma_len = sg_dma_len(sg);
868 + dma_len = ib_sg_dma_len(
869 + dev, sg);
870 }
871 }
872 } else {
873 @@ -1192,8 +1194,8 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch,
874 tsize = cmd->data_length;
875 riu = ioctx->rdma_ius;
876 sg = sg_orig;
877 - dma_len = sg_dma_len(&sg[0]);
878 - dma_addr = sg_dma_address(&sg[0]);
879 + dma_len = ib_sg_dma_len(dev, &sg[0]);
880 + dma_addr = ib_sg_dma_address(dev, &sg[0]);
881
882 /* this second loop is really mapped sg_addres to rdma_iu->ib_sge */
883 for (i = 0, j = 0;
884 @@ -1216,8 +1218,10 @@ static int srpt_map_sg_to_ib_sge(struct srpt_rdma_ch *ch,
885 ++j;
886 if (j < count) {
887 sg = sg_next(sg);
888 - dma_len = sg_dma_len(sg);
889 - dma_addr = sg_dma_address(sg);
890 + dma_len = ib_sg_dma_len(
891 + dev, sg);
892 + dma_addr = ib_sg_dma_address(
893 + dev, sg);
894 }
895 }
896 } else {
897 diff --git a/drivers/media/dvb-frontends/m88rs2000.c b/drivers/media/dvb-frontends/m88rs2000.c
898 index 02699c111019..c7a1c8eba475 100644
899 --- a/drivers/media/dvb-frontends/m88rs2000.c
900 +++ b/drivers/media/dvb-frontends/m88rs2000.c
901 @@ -712,6 +712,22 @@ static int m88rs2000_get_frontend(struct dvb_frontend *fe)
902 return 0;
903 }
904
905 +static int m88rs2000_get_tune_settings(struct dvb_frontend *fe,
906 + struct dvb_frontend_tune_settings *tune)
907 +{
908 + struct dtv_frontend_properties *c = &fe->dtv_property_cache;
909 +
910 + if (c->symbol_rate > 3000000)
911 + tune->min_delay_ms = 2000;
912 + else
913 + tune->min_delay_ms = 3000;
914 +
915 + tune->step_size = c->symbol_rate / 16000;
916 + tune->max_drift = c->symbol_rate / 2000;
917 +
918 + return 0;
919 +}
920 +
921 static int m88rs2000_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
922 {
923 struct m88rs2000_state *state = fe->demodulator_priv;
924 @@ -743,7 +759,7 @@ static struct dvb_frontend_ops m88rs2000_ops = {
925 .symbol_rate_tolerance = 500, /* ppm */
926 .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
927 FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 |
928 - FE_CAN_QPSK |
929 + FE_CAN_QPSK | FE_CAN_INVERSION_AUTO |
930 FE_CAN_FEC_AUTO
931 },
932
933 @@ -763,6 +779,7 @@ static struct dvb_frontend_ops m88rs2000_ops = {
934
935 .set_frontend = m88rs2000_set_frontend,
936 .get_frontend = m88rs2000_get_frontend,
937 + .get_tune_settings = m88rs2000_get_tune_settings,
938 };
939
940 struct dvb_frontend *m88rs2000_attach(const struct m88rs2000_config *config,
941 diff --git a/drivers/media/pci/saa7134/saa7134-cards.c b/drivers/media/pci/saa7134/saa7134-cards.c
942 index d45e7f6ff332..e87a734637a9 100644
943 --- a/drivers/media/pci/saa7134/saa7134-cards.c
944 +++ b/drivers/media/pci/saa7134/saa7134-cards.c
945 @@ -8045,8 +8045,8 @@ int saa7134_board_init2(struct saa7134_dev *dev)
946 break;
947 } /* switch() */
948
949 - /* initialize tuner */
950 - if (TUNER_ABSENT != dev->tuner_type) {
951 + /* initialize tuner (don't do this when resuming) */
952 + if (!dev->insuspend && TUNER_ABSENT != dev->tuner_type) {
953 int has_demod = (dev->tda9887_conf & TDA9887_PRESENT);
954
955 /* Note: radio tuner address is always filled in,
956 diff --git a/drivers/media/platform/omap3isp/isppreview.c b/drivers/media/platform/omap3isp/isppreview.c
957 index cd8831aebdeb..e2e4610d5550 100644
958 --- a/drivers/media/platform/omap3isp/isppreview.c
959 +++ b/drivers/media/platform/omap3isp/isppreview.c
960 @@ -1079,6 +1079,7 @@ static void preview_config_input_format(struct isp_prev_device *prev,
961 */
962 static void preview_config_input_size(struct isp_prev_device *prev, u32 active)
963 {
964 + const struct v4l2_mbus_framefmt *format = &prev->formats[PREV_PAD_SINK];
965 struct isp_device *isp = to_isp_device(prev);
966 unsigned int sph = prev->crop.left;
967 unsigned int eph = prev->crop.left + prev->crop.width - 1;
968 @@ -1086,6 +1087,14 @@ static void preview_config_input_size(struct isp_prev_device *prev, u32 active)
969 unsigned int elv = prev->crop.top + prev->crop.height - 1;
970 u32 features;
971
972 + if (format->code != V4L2_MBUS_FMT_Y8_1X8 &&
973 + format->code != V4L2_MBUS_FMT_Y10_1X10) {
974 + sph -= 2;
975 + eph += 2;
976 + slv -= 2;
977 + elv += 2;
978 + }
979 +
980 features = (prev->params.params[0].features & active)
981 | (prev->params.params[1].features & ~active);
982
983 diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
984 index b22f8fed8127..c4d669648dc7 100644
985 --- a/drivers/media/usb/em28xx/em28xx-dvb.c
986 +++ b/drivers/media/usb/em28xx/em28xx-dvb.c
987 @@ -673,7 +673,8 @@ static void pctv_520e_init(struct em28xx *dev)
988 static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe)
989 {
990 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
991 - struct em28xx *dev = fe->dvb->priv;
992 + struct em28xx_i2c_bus *i2c_bus = fe->dvb->priv;
993 + struct em28xx *dev = i2c_bus->dev;
994 #ifdef CONFIG_GPIOLIB
995 struct em28xx_dvb *dvb = dev->dvb;
996 int ret;
997 diff --git a/drivers/media/usb/gspca/sn9c20x.c b/drivers/media/usb/gspca/sn9c20x.c
998 index ead9a1f58513..8b59e5d37bae 100644
999 --- a/drivers/media/usb/gspca/sn9c20x.c
1000 +++ b/drivers/media/usb/gspca/sn9c20x.c
1001 @@ -2394,6 +2394,7 @@ static const struct usb_device_id device_table[] = {
1002 {USB_DEVICE(0x045e, 0x00f4), SN9C20X(OV9650, 0x30, 0)},
1003 {USB_DEVICE(0x145f, 0x013d), SN9C20X(OV7660, 0x21, 0)},
1004 {USB_DEVICE(0x0458, 0x7029), SN9C20X(HV7131R, 0x11, 0)},
1005 + {USB_DEVICE(0x0458, 0x7045), SN9C20X(MT9M112, 0x5d, LED_REVERSE)},
1006 {USB_DEVICE(0x0458, 0x704a), SN9C20X(MT9M112, 0x5d, 0)},
1007 {USB_DEVICE(0x0458, 0x704c), SN9C20X(MT9M112, 0x5d, 0)},
1008 {USB_DEVICE(0xa168, 0x0610), SN9C20X(HV7131R, 0x11, 0)},
1009 diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
1010 index 3394c3432011..e1c5bf3ea112 100644
1011 --- a/drivers/media/usb/uvc/uvc_video.c
1012 +++ b/drivers/media/usb/uvc/uvc_video.c
1013 @@ -1846,7 +1846,25 @@ int uvc_video_enable(struct uvc_streaming *stream, int enable)
1014
1015 if (!enable) {
1016 uvc_uninit_video(stream, 1);
1017 - usb_set_interface(stream->dev->udev, stream->intfnum, 0);
1018 + if (stream->intf->num_altsetting > 1) {
1019 + usb_set_interface(stream->dev->udev,
1020 + stream->intfnum, 0);
1021 + } else {
1022 + /* UVC doesn't specify how to inform a bulk-based device
1023 + * when the video stream is stopped. Windows sends a
1024 + * CLEAR_FEATURE(HALT) request to the video streaming
1025 + * bulk endpoint, mimic the same behaviour.
1026 + */
1027 + unsigned int epnum = stream->header.bEndpointAddress
1028 + & USB_ENDPOINT_NUMBER_MASK;
1029 + unsigned int dir = stream->header.bEndpointAddress
1030 + & USB_ENDPOINT_DIR_MASK;
1031 + unsigned int pipe;
1032 +
1033 + pipe = usb_sndbulkpipe(stream->dev->udev, epnum) | dir;
1034 + usb_clear_halt(stream->dev->udev, pipe);
1035 + }
1036 +
1037 uvc_queue_enable(&stream->queue, 0);
1038 uvc_video_clock_cleanup(stream);
1039 return 0;
1040 diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
1041 index f1295519f285..f56b729581e7 100644
1042 --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
1043 +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
1044 @@ -787,8 +787,8 @@ static int put_v4l2_subdev_edid32(struct v4l2_subdev_edid *kp, struct v4l2_subde
1045 #define VIDIOC_DQBUF32 _IOWR('V', 17, struct v4l2_buffer32)
1046 #define VIDIOC_ENUMSTD32 _IOWR('V', 25, struct v4l2_standard32)
1047 #define VIDIOC_ENUMINPUT32 _IOWR('V', 26, struct v4l2_input32)
1048 -#define VIDIOC_SUBDEV_G_EDID32 _IOWR('V', 63, struct v4l2_subdev_edid32)
1049 -#define VIDIOC_SUBDEV_S_EDID32 _IOWR('V', 64, struct v4l2_subdev_edid32)
1050 +#define VIDIOC_SUBDEV_G_EDID32 _IOWR('V', 40, struct v4l2_subdev_edid32)
1051 +#define VIDIOC_SUBDEV_S_EDID32 _IOWR('V', 41, struct v4l2_subdev_edid32)
1052 #define VIDIOC_TRY_FMT32 _IOWR('V', 64, struct v4l2_format32)
1053 #define VIDIOC_G_EXT_CTRLS32 _IOWR('V', 71, struct v4l2_ext_controls32)
1054 #define VIDIOC_S_EXT_CTRLS32 _IOWR('V', 72, struct v4l2_ext_controls32)
1055 diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c
1056 index 31ca55548ef9..30cf7eef2a8f 100644
1057 --- a/drivers/mfd/88pm860x-core.c
1058 +++ b/drivers/mfd/88pm860x-core.c
1059 @@ -1179,12 +1179,18 @@ static int pm860x_probe(struct i2c_client *client,
1060 chip->companion_addr = pdata->companion_addr;
1061 chip->companion = i2c_new_dummy(chip->client->adapter,
1062 chip->companion_addr);
1063 + if (!chip->companion) {
1064 + dev_err(&client->dev,
1065 + "Failed to allocate I2C companion device\n");
1066 + return -ENODEV;
1067 + }
1068 chip->regmap_companion = regmap_init_i2c(chip->companion,
1069 &pm860x_regmap_config);
1070 if (IS_ERR(chip->regmap_companion)) {
1071 ret = PTR_ERR(chip->regmap_companion);
1072 dev_err(&chip->companion->dev,
1073 "Failed to allocate register map: %d\n", ret);
1074 + i2c_unregister_device(chip->companion);
1075 return ret;
1076 }
1077 i2c_set_clientdata(chip->companion, chip);
1078 diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c
1079 index 8290c2382395..1b6f45a14109 100644
1080 --- a/drivers/mfd/max77686.c
1081 +++ b/drivers/mfd/max77686.c
1082 @@ -121,6 +121,10 @@ static int max77686_i2c_probe(struct i2c_client *i2c,
1083 dev_info(max77686->dev, "device found\n");
1084
1085 max77686->rtc = i2c_new_dummy(i2c->adapter, I2C_ADDR_RTC);
1086 + if (!max77686->rtc) {
1087 + dev_err(max77686->dev, "Failed to allocate I2C device for RTC\n");
1088 + return -ENODEV;
1089 + }
1090 i2c_set_clientdata(max77686->rtc, max77686);
1091
1092 max77686_irq_init(max77686);
1093 diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
1094 index 9e60fed5ff82..299970f99588 100644
1095 --- a/drivers/mfd/max77693.c
1096 +++ b/drivers/mfd/max77693.c
1097 @@ -149,9 +149,18 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
1098 dev_info(max77693->dev, "device ID: 0x%x\n", reg_data);
1099
1100 max77693->muic = i2c_new_dummy(i2c->adapter, I2C_ADDR_MUIC);
1101 + if (!max77693->muic) {
1102 + dev_err(max77693->dev, "Failed to allocate I2C device for MUIC\n");
1103 + return -ENODEV;
1104 + }
1105 i2c_set_clientdata(max77693->muic, max77693);
1106
1107 max77693->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC);
1108 + if (!max77693->haptic) {
1109 + dev_err(max77693->dev, "Failed to allocate I2C device for Haptic\n");
1110 + ret = -ENODEV;
1111 + goto err_i2c_haptic;
1112 + }
1113 i2c_set_clientdata(max77693->haptic, max77693);
1114
1115 /*
1116 @@ -187,8 +196,9 @@ err_mfd:
1117 max77693_irq_exit(max77693);
1118 err_irq:
1119 err_regmap_muic:
1120 - i2c_unregister_device(max77693->muic);
1121 i2c_unregister_device(max77693->haptic);
1122 +err_i2c_haptic:
1123 + i2c_unregister_device(max77693->muic);
1124 return ret;
1125 }
1126
1127 diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c
1128 index 92bbebd31598..c94d3337bdfd 100644
1129 --- a/drivers/mfd/max8925-i2c.c
1130 +++ b/drivers/mfd/max8925-i2c.c
1131 @@ -180,9 +180,18 @@ static int max8925_probe(struct i2c_client *client,
1132 mutex_init(&chip->io_lock);
1133
1134 chip->rtc = i2c_new_dummy(chip->i2c->adapter, RTC_I2C_ADDR);
1135 + if (!chip->rtc) {
1136 + dev_err(chip->dev, "Failed to allocate I2C device for RTC\n");
1137 + return -ENODEV;
1138 + }
1139 i2c_set_clientdata(chip->rtc, chip);
1140
1141 chip->adc = i2c_new_dummy(chip->i2c->adapter, ADC_I2C_ADDR);
1142 + if (!chip->adc) {
1143 + dev_err(chip->dev, "Failed to allocate I2C device for ADC\n");
1144 + i2c_unregister_device(chip->rtc);
1145 + return -ENODEV;
1146 + }
1147 i2c_set_clientdata(chip->adc, chip);
1148
1149 device_init_wakeup(&client->dev, 1);
1150 diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c
1151 index 14714058f2d2..ea1defbcf2cb 100644
1152 --- a/drivers/mfd/max8997.c
1153 +++ b/drivers/mfd/max8997.c
1154 @@ -218,10 +218,26 @@ static int max8997_i2c_probe(struct i2c_client *i2c,
1155 mutex_init(&max8997->iolock);
1156
1157 max8997->rtc = i2c_new_dummy(i2c->adapter, I2C_ADDR_RTC);
1158 + if (!max8997->rtc) {
1159 + dev_err(max8997->dev, "Failed to allocate I2C device for RTC\n");
1160 + return -ENODEV;
1161 + }
1162 i2c_set_clientdata(max8997->rtc, max8997);
1163 +
1164 max8997->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC);
1165 + if (!max8997->haptic) {
1166 + dev_err(max8997->dev, "Failed to allocate I2C device for Haptic\n");
1167 + ret = -ENODEV;
1168 + goto err_i2c_haptic;
1169 + }
1170 i2c_set_clientdata(max8997->haptic, max8997);
1171 +
1172 max8997->muic = i2c_new_dummy(i2c->adapter, I2C_ADDR_MUIC);
1173 + if (!max8997->muic) {
1174 + dev_err(max8997->dev, "Failed to allocate I2C device for MUIC\n");
1175 + ret = -ENODEV;
1176 + goto err_i2c_muic;
1177 + }
1178 i2c_set_clientdata(max8997->muic, max8997);
1179
1180 pm_runtime_set_active(max8997->dev);
1181 @@ -248,7 +264,9 @@ static int max8997_i2c_probe(struct i2c_client *i2c,
1182 err_mfd:
1183 mfd_remove_devices(max8997->dev);
1184 i2c_unregister_device(max8997->muic);
1185 +err_i2c_muic:
1186 i2c_unregister_device(max8997->haptic);
1187 +err_i2c_haptic:
1188 i2c_unregister_device(max8997->rtc);
1189 err:
1190 kfree(max8997);
1191 diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c
1192 index d7218cc90945..8381a76c69c0 100644
1193 --- a/drivers/mfd/max8998.c
1194 +++ b/drivers/mfd/max8998.c
1195 @@ -152,6 +152,10 @@ static int max8998_i2c_probe(struct i2c_client *i2c,
1196 mutex_init(&max8998->iolock);
1197
1198 max8998->rtc = i2c_new_dummy(i2c->adapter, RTC_I2C_ADDR);
1199 + if (!max8998->rtc) {
1200 + dev_err(&i2c->dev, "Failed to allocate I2C device for RTC\n");
1201 + return -ENODEV;
1202 + }
1203 i2c_set_clientdata(max8998->rtc, max8998);
1204
1205 max8998_irq_init(max8998);
1206 diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
1207 index 77ee26ef5941..81cfe8817fe0 100644
1208 --- a/drivers/mfd/sec-core.c
1209 +++ b/drivers/mfd/sec-core.c
1210 @@ -199,6 +199,10 @@ static int sec_pmic_probe(struct i2c_client *i2c,
1211 }
1212
1213 sec_pmic->rtc = i2c_new_dummy(i2c->adapter, RTC_I2C_ADDR);
1214 + if (!sec_pmic->rtc) {
1215 + dev_err(&i2c->dev, "Failed to allocate I2C for RTC\n");
1216 + return -ENODEV;
1217 + }
1218 i2c_set_clientdata(sec_pmic->rtc, sec_pmic);
1219
1220 if (pdata && pdata->cfg_pmic_irq)
1221 diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c
1222 index d79277204835..de87eafbeb05 100644
1223 --- a/drivers/mfd/tps65910.c
1224 +++ b/drivers/mfd/tps65910.c
1225 @@ -254,8 +254,10 @@ static int tps65910_irq_init(struct tps65910 *tps65910, int irq,
1226 ret = regmap_add_irq_chip(tps65910->regmap, tps65910->chip_irq,
1227 IRQF_ONESHOT, pdata->irq_base,
1228 tps6591x_irqs_chip, &tps65910->irq_data);
1229 - if (ret < 0)
1230 + if (ret < 0) {
1231 dev_warn(tps65910->dev, "Failed to add irq_chip %d\n", ret);
1232 + tps65910->chip_irq = 0;
1233 + }
1234 return ret;
1235 }
1236
1237 diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h
1238 index 66f411a6e8ea..cabc04383685 100644
1239 --- a/drivers/misc/mei/hw-me-regs.h
1240 +++ b/drivers/misc/mei/hw-me-regs.h
1241 @@ -115,6 +115,11 @@
1242 #define MEI_DEV_ID_LPT_HR 0x8CBA /* Lynx Point H Refresh */
1243
1244 #define MEI_DEV_ID_WPT_LP 0x9CBA /* Wildcat Point LP */
1245 +
1246 +/* Host Firmware Status Registers in PCI Config Space */
1247 +#define PCI_CFG_HFS_1 0x40
1248 +#define PCI_CFG_HFS_2 0x48
1249 +
1250 /*
1251 * MEI HW Section
1252 */
1253 diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
1254 index 371c65ae6be6..3c9e257982e3 100644
1255 --- a/drivers/misc/mei/pci-me.c
1256 +++ b/drivers/misc/mei/pci-me.c
1257 @@ -105,15 +105,31 @@ static bool mei_me_quirk_probe(struct pci_dev *pdev,
1258 const struct pci_device_id *ent)
1259 {
1260 u32 reg;
1261 - if (ent->device == MEI_DEV_ID_PBG_1) {
1262 - pci_read_config_dword(pdev, 0x48, &reg);
1263 - /* make sure that bit 9 is up and bit 10 is down */
1264 - if ((reg & 0x600) == 0x200) {
1265 - dev_info(&pdev->dev, "Device doesn't have valid ME Interface\n");
1266 - return false;
1267 - }
1268 + /* Cougar Point || Patsburg */
1269 + if (ent->device == MEI_DEV_ID_CPT_1 ||
1270 + ent->device == MEI_DEV_ID_PBG_1) {
1271 + pci_read_config_dword(pdev, PCI_CFG_HFS_2, &reg);
1272 + /* make sure that bit 9 (NM) is up and bit 10 (DM) is down */
1273 + if ((reg & 0x600) == 0x200)
1274 + goto no_mei;
1275 }
1276 +
1277 + /* Lynx Point */
1278 + if (ent->device == MEI_DEV_ID_LPT_H ||
1279 + ent->device == MEI_DEV_ID_LPT_W ||
1280 + ent->device == MEI_DEV_ID_LPT_HR) {
1281 + /* Read ME FW Status check for SPS Firmware */
1282 + pci_read_config_dword(pdev, PCI_CFG_HFS_1, &reg);
1283 + /* if bits [19:16] = 15, running SPS Firmware */
1284 + if ((reg & 0xf0000) == 0xf0000)
1285 + goto no_mei;
1286 + }
1287 +
1288 return true;
1289 +
1290 +no_mei:
1291 + dev_info(&pdev->dev, "Device doesn't have valid ME Interface\n");
1292 + return false;
1293 }
1294 /**
1295 * mei_probe - Device Initialization Routine
1296 diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c
1297 index eb5d22795c47..bb86494e2b7b 100644
1298 --- a/drivers/s390/char/con3215.c
1299 +++ b/drivers/s390/char/con3215.c
1300 @@ -922,7 +922,7 @@ static int __init con3215_init(void)
1301 raw3215_freelist = req;
1302 }
1303
1304 - cdev = ccw_device_probe_console();
1305 + cdev = ccw_device_probe_console(&raw3215_ccw_driver);
1306 if (IS_ERR(cdev))
1307 return -ENODEV;
1308
1309 diff --git a/drivers/s390/char/con3270.c b/drivers/s390/char/con3270.c
1310 index 699fd3e363df..bb6b0df50b33 100644
1311 --- a/drivers/s390/char/con3270.c
1312 +++ b/drivers/s390/char/con3270.c
1313 @@ -576,7 +576,6 @@ static struct console con3270 = {
1314 static int __init
1315 con3270_init(void)
1316 {
1317 - struct ccw_device *cdev;
1318 struct raw3270 *rp;
1319 void *cbuf;
1320 int i;
1321 @@ -591,10 +590,7 @@ con3270_init(void)
1322 cpcmd("TERM AUTOCR OFF", NULL, 0, NULL);
1323 }
1324
1325 - cdev = ccw_device_probe_console();
1326 - if (IS_ERR(cdev))
1327 - return -ENODEV;
1328 - rp = raw3270_setup_console(cdev);
1329 + rp = raw3270_setup_console();
1330 if (IS_ERR(rp))
1331 return PTR_ERR(rp);
1332
1333 diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c
1334 index 24a08e8f19e1..651d1f5da7c4 100644
1335 --- a/drivers/s390/char/raw3270.c
1336 +++ b/drivers/s390/char/raw3270.c
1337 @@ -776,16 +776,24 @@ raw3270_setup_device(struct ccw_device *cdev, struct raw3270 *rp, char *ascebc)
1338 }
1339
1340 #ifdef CONFIG_TN3270_CONSOLE
1341 +/* Tentative definition - see below for actual definition. */
1342 +static struct ccw_driver raw3270_ccw_driver;
1343 +
1344 /*
1345 * Setup 3270 device configured as console.
1346 */
1347 -struct raw3270 __init *raw3270_setup_console(struct ccw_device *cdev)
1348 +struct raw3270 __init *raw3270_setup_console(void)
1349 {
1350 + struct ccw_device *cdev;
1351 unsigned long flags;
1352 struct raw3270 *rp;
1353 char *ascebc;
1354 int rc;
1355
1356 + cdev = ccw_device_probe_console(&raw3270_ccw_driver);
1357 + if (IS_ERR(cdev))
1358 + return ERR_CAST(cdev);
1359 +
1360 rp = kzalloc(sizeof(struct raw3270), GFP_KERNEL | GFP_DMA);
1361 ascebc = kzalloc(256, GFP_KERNEL);
1362 rc = raw3270_setup_device(cdev, rp, ascebc);
1363 diff --git a/drivers/s390/char/raw3270.h b/drivers/s390/char/raw3270.h
1364 index 7b73ff8c1bd7..359276a88396 100644
1365 --- a/drivers/s390/char/raw3270.h
1366 +++ b/drivers/s390/char/raw3270.h
1367 @@ -190,7 +190,7 @@ raw3270_put_view(struct raw3270_view *view)
1368 wake_up(&raw3270_wait_queue);
1369 }
1370
1371 -struct raw3270 *raw3270_setup_console(struct ccw_device *cdev);
1372 +struct raw3270 *raw3270_setup_console(void);
1373 void raw3270_wait_cons_dev(struct raw3270 *);
1374
1375 /* Notifier for device addition/removal */
1376 diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
1377 index 1ab5f6c36d9b..8d04a9a88cc4 100644
1378 --- a/drivers/s390/cio/device.c
1379 +++ b/drivers/s390/cio/device.c
1380 @@ -1610,7 +1610,7 @@ out_unlock:
1381 return rc;
1382 }
1383
1384 -struct ccw_device *ccw_device_probe_console(void)
1385 +struct ccw_device *ccw_device_probe_console(struct ccw_driver *drv)
1386 {
1387 struct io_subchannel_private *io_priv;
1388 struct ccw_device *cdev;
1389 @@ -1632,6 +1632,7 @@ struct ccw_device *ccw_device_probe_console(void)
1390 kfree(io_priv);
1391 return cdev;
1392 }
1393 + cdev->drv = drv;
1394 set_io_private(sch, io_priv);
1395 ret = ccw_device_console_enable(cdev, sch);
1396 if (ret) {
1397 diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
1398 index 278c9fa62067..1822cb9ec623 100644
1399 --- a/drivers/scsi/arcmsr/arcmsr_hba.c
1400 +++ b/drivers/scsi/arcmsr/arcmsr_hba.c
1401 @@ -2501,16 +2501,15 @@ static int arcmsr_polling_ccbdone(struct AdapterControlBlock *acb,
1402 static int arcmsr_iop_confirm(struct AdapterControlBlock *acb)
1403 {
1404 uint32_t cdb_phyaddr, cdb_phyaddr_hi32;
1405 - dma_addr_t dma_coherent_handle;
1406 +
1407 /*
1408 ********************************************************************
1409 ** here we need to tell iop 331 our freeccb.HighPart
1410 ** if freeccb.HighPart is not zero
1411 ********************************************************************
1412 */
1413 - dma_coherent_handle = acb->dma_coherent_handle;
1414 - cdb_phyaddr = (uint32_t)(dma_coherent_handle);
1415 - cdb_phyaddr_hi32 = (uint32_t)((cdb_phyaddr >> 16) >> 16);
1416 + cdb_phyaddr = lower_32_bits(acb->dma_coherent_handle);
1417 + cdb_phyaddr_hi32 = upper_32_bits(acb->dma_coherent_handle);
1418 acb->cdb_phyaddr_hi32 = cdb_phyaddr_hi32;
1419 /*
1420 ***********************************************************************
1421 diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
1422 index ad72c1d85111..66c495d21016 100644
1423 --- a/drivers/scsi/qla2xxx/qla_os.c
1424 +++ b/drivers/scsi/qla2xxx/qla_os.c
1425 @@ -2553,7 +2553,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
1426 ha->flags.enable_64bit_addressing ? "enable" :
1427 "disable");
1428 ret = qla2x00_mem_alloc(ha, req_length, rsp_length, &req, &rsp);
1429 - if (!ret) {
1430 + if (ret) {
1431 ql_log_pci(ql_log_fatal, pdev, 0x0031,
1432 "Failed to allocate memory for adapter, aborting.\n");
1433
1434 @@ -3458,10 +3458,10 @@ qla2x00_mem_alloc(struct qla_hw_data *ha, uint16_t req_len, uint16_t rsp_len,
1435 else {
1436 qla2x00_set_reserved_loop_ids(ha);
1437 ql_dbg_pci(ql_dbg_init, ha->pdev, 0x0123,
1438 - "loop_id_map=%p. \n", ha->loop_id_map);
1439 + "loop_id_map=%p.\n", ha->loop_id_map);
1440 }
1441
1442 - return 1;
1443 + return 0;
1444
1445 fail_async_pd:
1446 dma_pool_free(ha->s_dma_pool, ha->ex_init_cb, ha->ex_init_cb_dma);
1447 diff --git a/drivers/staging/rtl8712/rtl871x_recv.c b/drivers/staging/rtl8712/rtl871x_recv.c
1448 index 23ec684b60e1..274c359279ef 100644
1449 --- a/drivers/staging/rtl8712/rtl871x_recv.c
1450 +++ b/drivers/staging/rtl8712/rtl871x_recv.c
1451 @@ -254,7 +254,7 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter,
1452 struct sta_info *psta;
1453 struct sta_priv *pstapriv;
1454 union recv_frame *prtnframe;
1455 - u16 ether_type = 0;
1456 + u16 ether_type;
1457
1458 pstapriv = &adapter->stapriv;
1459 ptr = get_recvframe_data(precv_frame);
1460 @@ -263,15 +263,14 @@ union recv_frame *r8712_portctrl(struct _adapter *adapter,
1461 psta = r8712_get_stainfo(pstapriv, psta_addr);
1462 auth_alg = adapter->securitypriv.AuthAlgrthm;
1463 if (auth_alg == 2) {
1464 + /* get ether_type */
1465 + ptr = ptr + pfhdr->attrib.hdrlen + LLC_HEADER_SIZE;
1466 + memcpy(&ether_type, ptr, 2);
1467 + ether_type = ntohs((unsigned short)ether_type);
1468 +
1469 if ((psta != NULL) && (psta->ieee8021x_blocked)) {
1470 /* blocked
1471 * only accept EAPOL frame */
1472 - prtnframe = precv_frame;
1473 - /*get ether_type */
1474 - ptr = ptr + pfhdr->attrib.hdrlen +
1475 - pfhdr->attrib.iv_len + LLC_HEADER_SIZE;
1476 - memcpy(&ether_type, ptr, 2);
1477 - ether_type = ntohs((unsigned short)ether_type);
1478 if (ether_type == 0x888e)
1479 prtnframe = precv_frame;
1480 else {
1481 diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c
1482 index 8a6e5ea476e1..380d9d707109 100644
1483 --- a/drivers/staging/serqt_usb2/serqt_usb2.c
1484 +++ b/drivers/staging/serqt_usb2/serqt_usb2.c
1485 @@ -725,7 +725,7 @@ static int qt_startup(struct usb_serial *serial)
1486 goto startup_error;
1487 }
1488
1489 - switch (serial->dev->descriptor.idProduct) {
1490 + switch (le16_to_cpu(serial->dev->descriptor.idProduct)) {
1491 case QUATECH_DSU100:
1492 case QUATECH_QSU100:
1493 case QUATECH_ESU100A:
1494 diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
1495 index 5232ac7b0745..58c479d13b57 100644
1496 --- a/drivers/target/iscsi/iscsi_target.c
1497 +++ b/drivers/target/iscsi/iscsi_target.c
1498 @@ -2454,6 +2454,7 @@ static void iscsit_build_conn_drop_async_message(struct iscsi_conn *conn)
1499 {
1500 struct iscsi_cmd *cmd;
1501 struct iscsi_conn *conn_p;
1502 + bool found = false;
1503
1504 /*
1505 * Only send a Asynchronous Message on connections whos network
1506 @@ -2462,11 +2463,12 @@ static void iscsit_build_conn_drop_async_message(struct iscsi_conn *conn)
1507 list_for_each_entry(conn_p, &conn->sess->sess_conn_list, conn_list) {
1508 if (conn_p->conn_state == TARG_CONN_STATE_LOGGED_IN) {
1509 iscsit_inc_conn_usage_count(conn_p);
1510 + found = true;
1511 break;
1512 }
1513 }
1514
1515 - if (!conn_p)
1516 + if (!found)
1517 return;
1518
1519 cmd = iscsit_allocate_cmd(conn_p, GFP_ATOMIC);
1520 diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c
1521 index 4859505ae2ed..639fdb395fb7 100644
1522 --- a/drivers/target/tcm_fc/tfc_sess.c
1523 +++ b/drivers/target/tcm_fc/tfc_sess.c
1524 @@ -68,6 +68,7 @@ static struct ft_tport *ft_tport_create(struct fc_lport *lport)
1525
1526 if (tport) {
1527 tport->tpg = tpg;
1528 + tpg->tport = tport;
1529 return tport;
1530 }
1531
1532 diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
1533 index eb255e807c06..a2a2645b296c 100644
1534 --- a/drivers/tty/hvc/hvc_console.c
1535 +++ b/drivers/tty/hvc/hvc_console.c
1536 @@ -31,6 +31,7 @@
1537 #include <linux/list.h>
1538 #include <linux/module.h>
1539 #include <linux/major.h>
1540 +#include <linux/atomic.h>
1541 #include <linux/sysrq.h>
1542 #include <linux/tty.h>
1543 #include <linux/tty_flip.h>
1544 @@ -70,6 +71,9 @@ static struct task_struct *hvc_task;
1545 /* Picks up late kicks after list walk but before schedule() */
1546 static int hvc_kicked;
1547
1548 +/* hvc_init is triggered from hvc_alloc, i.e. only when actually used */
1549 +static atomic_t hvc_needs_init __read_mostly = ATOMIC_INIT(-1);
1550 +
1551 static int hvc_init(void);
1552
1553 #ifdef CONFIG_MAGIC_SYSRQ
1554 @@ -842,7 +846,7 @@ struct hvc_struct *hvc_alloc(uint32_t vtermno, int data,
1555 int i;
1556
1557 /* We wait until a driver actually comes along */
1558 - if (!hvc_driver) {
1559 + if (atomic_inc_not_zero(&hvc_needs_init)) {
1560 int err = hvc_init();
1561 if (err)
1562 return ERR_PTR(err);
1563 diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
1564 index 6eab440e1542..4ed35231e552 100644
1565 --- a/drivers/usb/core/driver.c
1566 +++ b/drivers/usb/core/driver.c
1567 @@ -953,8 +953,7 @@ EXPORT_SYMBOL_GPL(usb_deregister);
1568 * it doesn't support pre_reset/post_reset/reset_resume or
1569 * because it doesn't support suspend/resume.
1570 *
1571 - * The caller must hold @intf's device's lock, but not its pm_mutex
1572 - * and not @intf->dev.sem.
1573 + * The caller must hold @intf's device's lock, but not @intf's lock.
1574 */
1575 void usb_forced_unbind_intf(struct usb_interface *intf)
1576 {
1577 @@ -967,16 +966,37 @@ void usb_forced_unbind_intf(struct usb_interface *intf)
1578 intf->needs_binding = 1;
1579 }
1580
1581 +/*
1582 + * Unbind drivers for @udev's marked interfaces. These interfaces have
1583 + * the needs_binding flag set, for example by usb_resume_interface().
1584 + *
1585 + * The caller must hold @udev's device lock.
1586 + */
1587 +static void unbind_marked_interfaces(struct usb_device *udev)
1588 +{
1589 + struct usb_host_config *config;
1590 + int i;
1591 + struct usb_interface *intf;
1592 +
1593 + config = udev->actconfig;
1594 + if (config) {
1595 + for (i = 0; i < config->desc.bNumInterfaces; ++i) {
1596 + intf = config->interface[i];
1597 + if (intf->dev.driver && intf->needs_binding)
1598 + usb_forced_unbind_intf(intf);
1599 + }
1600 + }
1601 +}
1602 +
1603 /* Delayed forced unbinding of a USB interface driver and scan
1604 * for rebinding.
1605 *
1606 - * The caller must hold @intf's device's lock, but not its pm_mutex
1607 - * and not @intf->dev.sem.
1608 + * The caller must hold @intf's device's lock, but not @intf's lock.
1609 *
1610 * Note: Rebinds will be skipped if a system sleep transition is in
1611 * progress and the PM "complete" callback hasn't occurred yet.
1612 */
1613 -void usb_rebind_intf(struct usb_interface *intf)
1614 +static void usb_rebind_intf(struct usb_interface *intf)
1615 {
1616 int rc;
1617
1618 @@ -993,68 +1013,66 @@ void usb_rebind_intf(struct usb_interface *intf)
1619 }
1620 }
1621
1622 -#ifdef CONFIG_PM
1623 -
1624 -/* Unbind drivers for @udev's interfaces that don't support suspend/resume
1625 - * There is no check for reset_resume here because it can be determined
1626 - * only during resume whether reset_resume is needed.
1627 +/*
1628 + * Rebind drivers to @udev's marked interfaces. These interfaces have
1629 + * the needs_binding flag set.
1630 *
1631 * The caller must hold @udev's device lock.
1632 */
1633 -static void unbind_no_pm_drivers_interfaces(struct usb_device *udev)
1634 +static void rebind_marked_interfaces(struct usb_device *udev)
1635 {
1636 struct usb_host_config *config;
1637 int i;
1638 struct usb_interface *intf;
1639 - struct usb_driver *drv;
1640
1641 config = udev->actconfig;
1642 if (config) {
1643 for (i = 0; i < config->desc.bNumInterfaces; ++i) {
1644 intf = config->interface[i];
1645 -
1646 - if (intf->dev.driver) {
1647 - drv = to_usb_driver(intf->dev.driver);
1648 - if (!drv->suspend || !drv->resume)
1649 - usb_forced_unbind_intf(intf);
1650 - }
1651 + if (intf->needs_binding)
1652 + usb_rebind_intf(intf);
1653 }
1654 }
1655 }
1656
1657 -/* Unbind drivers for @udev's interfaces that failed to support reset-resume.
1658 - * These interfaces have the needs_binding flag set by usb_resume_interface().
1659 +/*
1660 + * Unbind all of @udev's marked interfaces and then rebind all of them.
1661 + * This ordering is necessary because some drivers claim several interfaces
1662 + * when they are first probed.
1663 *
1664 * The caller must hold @udev's device lock.
1665 */
1666 -static void unbind_no_reset_resume_drivers_interfaces(struct usb_device *udev)
1667 +void usb_unbind_and_rebind_marked_interfaces(struct usb_device *udev)
1668 {
1669 - struct usb_host_config *config;
1670 - int i;
1671 - struct usb_interface *intf;
1672 -
1673 - config = udev->actconfig;
1674 - if (config) {
1675 - for (i = 0; i < config->desc.bNumInterfaces; ++i) {
1676 - intf = config->interface[i];
1677 - if (intf->dev.driver && intf->needs_binding)
1678 - usb_forced_unbind_intf(intf);
1679 - }
1680 - }
1681 + unbind_marked_interfaces(udev);
1682 + rebind_marked_interfaces(udev);
1683 }
1684
1685 -static void do_rebind_interfaces(struct usb_device *udev)
1686 +#ifdef CONFIG_PM
1687 +
1688 +/* Unbind drivers for @udev's interfaces that don't support suspend/resume
1689 + * There is no check for reset_resume here because it can be determined
1690 + * only during resume whether reset_resume is needed.
1691 + *
1692 + * The caller must hold @udev's device lock.
1693 + */
1694 +static void unbind_no_pm_drivers_interfaces(struct usb_device *udev)
1695 {
1696 struct usb_host_config *config;
1697 int i;
1698 struct usb_interface *intf;
1699 + struct usb_driver *drv;
1700
1701 config = udev->actconfig;
1702 if (config) {
1703 for (i = 0; i < config->desc.bNumInterfaces; ++i) {
1704 intf = config->interface[i];
1705 - if (intf->needs_binding)
1706 - usb_rebind_intf(intf);
1707 +
1708 + if (intf->dev.driver) {
1709 + drv = to_usb_driver(intf->dev.driver);
1710 + if (!drv->suspend || !drv->resume)
1711 + usb_forced_unbind_intf(intf);
1712 + }
1713 }
1714 }
1715 }
1716 @@ -1379,7 +1397,7 @@ int usb_resume_complete(struct device *dev)
1717 * whose needs_binding flag is set
1718 */
1719 if (udev->state != USB_STATE_NOTATTACHED)
1720 - do_rebind_interfaces(udev);
1721 + rebind_marked_interfaces(udev);
1722 return 0;
1723 }
1724
1725 @@ -1401,7 +1419,7 @@ int usb_resume(struct device *dev, pm_message_t msg)
1726 pm_runtime_disable(dev);
1727 pm_runtime_set_active(dev);
1728 pm_runtime_enable(dev);
1729 - unbind_no_reset_resume_drivers_interfaces(udev);
1730 + unbind_marked_interfaces(udev);
1731 }
1732
1733 /* Avoid PM error messages for devices disconnected while suspended
1734 diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
1735 index caeb8d6d39fb..4676917e2b1f 100644
1736 --- a/drivers/usb/core/hcd-pci.c
1737 +++ b/drivers/usb/core/hcd-pci.c
1738 @@ -75,7 +75,7 @@ static void for_each_companion(struct pci_dev *pdev, struct usb_hcd *hcd,
1739 PCI_SLOT(companion->devfn) != slot)
1740 continue;
1741 companion_hcd = pci_get_drvdata(companion);
1742 - if (!companion_hcd)
1743 + if (!companion_hcd || !companion_hcd->self.root_hub)
1744 continue;
1745 fn(pdev, hcd, companion, companion_hcd);
1746 }
1747 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1748 index 3a2eb4cc8959..a036e03ae1b3 100644
1749 --- a/drivers/usb/core/hub.c
1750 +++ b/drivers/usb/core/hub.c
1751 @@ -5252,10 +5252,11 @@ int usb_reset_device(struct usb_device *udev)
1752 else if (cintf->condition ==
1753 USB_INTERFACE_BOUND)
1754 rebind = 1;
1755 + if (rebind)
1756 + cintf->needs_binding = 1;
1757 }
1758 - if (ret == 0 && rebind)
1759 - usb_rebind_intf(cintf);
1760 }
1761 + usb_unbind_and_rebind_marked_interfaces(udev);
1762 }
1763
1764 usb_autosuspend_device(udev);
1765 diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
1766 index 823857767a16..0923add72b59 100644
1767 --- a/drivers/usb/core/usb.h
1768 +++ b/drivers/usb/core/usb.h
1769 @@ -55,7 +55,7 @@ extern int usb_match_one_id_intf(struct usb_device *dev,
1770 extern int usb_match_device(struct usb_device *dev,
1771 const struct usb_device_id *id);
1772 extern void usb_forced_unbind_intf(struct usb_interface *intf);
1773 -extern void usb_rebind_intf(struct usb_interface *intf);
1774 +extern void usb_unbind_and_rebind_marked_interfaces(struct usb_device *udev);
1775
1776 extern int usb_hub_claim_port(struct usb_device *hdev, unsigned port,
1777 struct dev_state *owner);
1778 diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
1779 index 27dad993b007..7ab3c9985253 100644
1780 --- a/drivers/usb/dwc3/core.h
1781 +++ b/drivers/usb/dwc3/core.h
1782 @@ -836,15 +836,15 @@ struct dwc3_event_depevt {
1783 * 12 - VndrDevTstRcved
1784 * @reserved15_12: Reserved, not used
1785 * @event_info: Information about this event
1786 - * @reserved31_24: Reserved, not used
1787 + * @reserved31_25: Reserved, not used
1788 */
1789 struct dwc3_event_devt {
1790 u32 one_bit:1;
1791 u32 device_event:7;
1792 u32 type:4;
1793 u32 reserved15_12:4;
1794 - u32 event_info:8;
1795 - u32 reserved31_24:8;
1796 + u32 event_info:9;
1797 + u32 reserved31_25:7;
1798 } __packed;
1799
1800 /**
1801 diff --git a/drivers/usb/gadget/tcm_usb_gadget.c b/drivers/usb/gadget/tcm_usb_gadget.c
1802 index 7cacd6ae818e..e4d8d79a4993 100644
1803 --- a/drivers/usb/gadget/tcm_usb_gadget.c
1804 +++ b/drivers/usb/gadget/tcm_usb_gadget.c
1805 @@ -1614,7 +1614,7 @@ static struct se_wwn *usbg_make_tport(
1806 return ERR_PTR(-ENOMEM);
1807 }
1808 tport->tport_wwpn = wwpn;
1809 - snprintf(tport->tport_name, sizeof(tport->tport_name), wnn_name);
1810 + snprintf(tport->tport_name, sizeof(tport->tport_name), "%s", wnn_name);
1811 return &tport->tport_wwn;
1812 }
1813
1814 diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
1815 index 0deb9d6cde26..d31814c7238f 100644
1816 --- a/drivers/usb/gadget/zero.c
1817 +++ b/drivers/usb/gadget/zero.c
1818 @@ -280,7 +280,7 @@ static int __init zero_bind(struct usb_composite_dev *cdev)
1819 ss_opts->isoc_interval = gzero_options.isoc_interval;
1820 ss_opts->isoc_maxpacket = gzero_options.isoc_maxpacket;
1821 ss_opts->isoc_mult = gzero_options.isoc_mult;
1822 - ss_opts->isoc_maxburst = gzero_options.isoc_maxpacket;
1823 + ss_opts->isoc_maxburst = gzero_options.isoc_maxburst;
1824 ss_opts->bulk_buflen = gzero_options.bulk_buflen;
1825
1826 func_ss = usb_get_function(func_inst_ss);
1827 diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
1828 index 3581416a24d8..a736d82695cb 100644
1829 --- a/drivers/usb/host/xhci-pci.c
1830 +++ b/drivers/usb/host/xhci-pci.c
1831 @@ -114,9 +114,7 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
1832 xhci->quirks |= XHCI_TRUST_TX_LENGTH;
1833 }
1834 if (pdev->vendor == PCI_VENDOR_ID_RENESAS &&
1835 - pdev->device == 0x0015 &&
1836 - pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG &&
1837 - pdev->subsystem_device == 0xc0cd)
1838 + pdev->device == 0x0015)
1839 xhci->quirks |= XHCI_RESET_ON_RESUME;
1840 if (pdev->vendor == PCI_VENDOR_ID_VIA)
1841 xhci->quirks |= XHCI_RESET_ON_RESUME;
1842 @@ -161,6 +159,10 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
1843 struct usb_hcd *hcd;
1844
1845 driver = (struct hc_driver *)id->driver_data;
1846 +
1847 + /* Prevent runtime suspending between USB-2 and USB-3 initialization */
1848 + pm_runtime_get_noresume(&dev->dev);
1849 +
1850 /* Register the USB 2.0 roothub.
1851 * FIXME: USB core must know to register the USB 2.0 roothub first.
1852 * This is sort of silly, because we could just set the HCD driver flags
1853 @@ -170,7 +172,7 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
1854 retval = usb_hcd_pci_probe(dev, id);
1855
1856 if (retval)
1857 - return retval;
1858 + goto put_runtime_pm;
1859
1860 /* USB 2.0 roothub is stored in the PCI device now. */
1861 hcd = dev_get_drvdata(&dev->dev);
1862 @@ -199,12 +201,17 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
1863 if (xhci->quirks & XHCI_LPM_SUPPORT)
1864 hcd_to_bus(xhci->shared_hcd)->root_hub->lpm_capable = 1;
1865
1866 + /* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */
1867 + pm_runtime_put_noidle(&dev->dev);
1868 +
1869 return 0;
1870
1871 put_usb3_hcd:
1872 usb_put_hcd(xhci->shared_hcd);
1873 dealloc_usb2_hcd:
1874 usb_hcd_pci_remove(dev);
1875 +put_runtime_pm:
1876 + pm_runtime_put_noidle(&dev->dev);
1877 return retval;
1878 }
1879
1880 diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
1881 index a90819b83224..4b46de842175 100644
1882 --- a/drivers/usb/host/xhci.c
1883 +++ b/drivers/usb/host/xhci.c
1884 @@ -394,16 +394,16 @@ static int xhci_try_enable_msi(struct usb_hcd *hcd)
1885
1886 #else
1887
1888 -static int xhci_try_enable_msi(struct usb_hcd *hcd)
1889 +static inline int xhci_try_enable_msi(struct usb_hcd *hcd)
1890 {
1891 return 0;
1892 }
1893
1894 -static void xhci_cleanup_msix(struct xhci_hcd *xhci)
1895 +static inline void xhci_cleanup_msix(struct xhci_hcd *xhci)
1896 {
1897 }
1898
1899 -static void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
1900 +static inline void xhci_msix_sync_irqs(struct xhci_hcd *xhci)
1901 {
1902 }
1903
1904 diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
1905 index 37a261a6bb6a..da0caf3f4b27 100644
1906 --- a/drivers/usb/musb/musb_core.c
1907 +++ b/drivers/usb/musb/musb_core.c
1908 @@ -440,7 +440,6 @@ void musb_hnp_stop(struct musb *musb)
1909 static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
1910 u8 devctl)
1911 {
1912 - struct usb_otg *otg = musb->xceiv->otg;
1913 irqreturn_t handled = IRQ_NONE;
1914
1915 dev_dbg(musb->controller, "<== DevCtl=%02x, int_usb=0x%x\n", devctl,
1916 @@ -655,7 +654,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
1917 break;
1918 case OTG_STATE_B_PERIPHERAL:
1919 musb_g_suspend(musb);
1920 - musb->is_active = otg->gadget->b_hnp_enable;
1921 + musb->is_active = musb->g.b_hnp_enable;
1922 if (musb->is_active) {
1923 musb->xceiv->state = OTG_STATE_B_WAIT_ACON;
1924 dev_dbg(musb->controller, "HNP: Setting timer for b_ase0_brst\n");
1925 @@ -671,7 +670,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb,
1926 break;
1927 case OTG_STATE_A_HOST:
1928 musb->xceiv->state = OTG_STATE_A_SUSPEND;
1929 - musb->is_active = otg->host->b_hnp_enable;
1930 + musb->is_active = musb_to_hcd(musb)->self.b_hnp_enable;
1931 break;
1932 case OTG_STATE_B_HOST:
1933 /* Transition to B_PERIPHERAL, see 6.8.2.6 p 44 */
1934 diff --git a/drivers/usb/phy/phy-ulpi.c b/drivers/usb/phy/phy-ulpi.c
1935 index 217339dd7a90..17ea3f271bd8 100644
1936 --- a/drivers/usb/phy/phy-ulpi.c
1937 +++ b/drivers/usb/phy/phy-ulpi.c
1938 @@ -47,6 +47,8 @@ struct ulpi_info {
1939 static struct ulpi_info ulpi_ids[] = {
1940 ULPI_INFO(ULPI_ID(0x04cc, 0x1504), "NXP ISP1504"),
1941 ULPI_INFO(ULPI_ID(0x0424, 0x0006), "SMSC USB331x"),
1942 + ULPI_INFO(ULPI_ID(0x0424, 0x0007), "SMSC USB3320"),
1943 + ULPI_INFO(ULPI_ID(0x0451, 0x1507), "TI TUSB1210"),
1944 };
1945
1946 static int ulpi_set_otg_flags(struct usb_phy *phy)
1947 diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
1948 index 4471f464ca26..a0b58e252073 100644
1949 --- a/drivers/usb/serial/pl2303.c
1950 +++ b/drivers/usb/serial/pl2303.c
1951 @@ -82,6 +82,9 @@ static const struct usb_device_id id_table[] = {
1952 { USB_DEVICE(YCCABLE_VENDOR_ID, YCCABLE_PRODUCT_ID) },
1953 { USB_DEVICE(SUPERIAL_VENDOR_ID, SUPERIAL_PRODUCT_ID) },
1954 { USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) },
1955 + { USB_DEVICE(HP_VENDOR_ID, HP_LD960_PRODUCT_ID) },
1956 + { USB_DEVICE(HP_VENDOR_ID, HP_LCM220_PRODUCT_ID) },
1957 + { USB_DEVICE(HP_VENDOR_ID, HP_LCM960_PRODUCT_ID) },
1958 { USB_DEVICE(CRESSI_VENDOR_ID, CRESSI_EDY_PRODUCT_ID) },
1959 { USB_DEVICE(ZEAGLE_VENDOR_ID, ZEAGLE_N2ITION3_PRODUCT_ID) },
1960 { USB_DEVICE(SONY_VENDOR_ID, SONY_QN3USB_PRODUCT_ID) },
1961 diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
1962 index c38b8c00c06f..42bc082896ac 100644
1963 --- a/drivers/usb/serial/pl2303.h
1964 +++ b/drivers/usb/serial/pl2303.h
1965 @@ -121,8 +121,11 @@
1966 #define SUPERIAL_VENDOR_ID 0x5372
1967 #define SUPERIAL_PRODUCT_ID 0x2303
1968
1969 -/* Hewlett-Packard LD220-HP POS Pole Display */
1970 +/* Hewlett-Packard POS Pole Displays */
1971 #define HP_VENDOR_ID 0x03f0
1972 +#define HP_LD960_PRODUCT_ID 0x0b39
1973 +#define HP_LCM220_PRODUCT_ID 0x3139
1974 +#define HP_LCM960_PRODUCT_ID 0x3239
1975 #define HP_LD220_PRODUCT_ID 0x3524
1976
1977 /* Cressi Edy (diving computer) PC interface */
1978 diff --git a/drivers/w1/w1_netlink.c b/drivers/w1/w1_netlink.c
1979 index 40788c925d1c..73705aff53cb 100644
1980 --- a/drivers/w1/w1_netlink.c
1981 +++ b/drivers/w1/w1_netlink.c
1982 @@ -54,28 +54,29 @@ static void w1_send_slave(struct w1_master *dev, u64 rn)
1983 struct w1_netlink_msg *hdr = (struct w1_netlink_msg *)(msg + 1);
1984 struct w1_netlink_cmd *cmd = (struct w1_netlink_cmd *)(hdr + 1);
1985 int avail;
1986 + u64 *data;
1987
1988 /* update kernel slave list */
1989 w1_slave_found(dev, rn);
1990
1991 avail = dev->priv_size - cmd->len;
1992
1993 - if (avail > 8) {
1994 - u64 *data = (void *)(cmd + 1) + cmd->len;
1995 + if (avail < 8) {
1996 + msg->ack++;
1997 + cn_netlink_send(msg, 0, GFP_KERNEL);
1998
1999 - *data = rn;
2000 - cmd->len += 8;
2001 - hdr->len += 8;
2002 - msg->len += 8;
2003 - return;
2004 + msg->len = sizeof(struct w1_netlink_msg) +
2005 + sizeof(struct w1_netlink_cmd);
2006 + hdr->len = sizeof(struct w1_netlink_cmd);
2007 + cmd->len = 0;
2008 }
2009
2010 - msg->ack++;
2011 - cn_netlink_send(msg, 0, GFP_KERNEL);
2012 + data = (void *)(cmd + 1) + cmd->len;
2013
2014 - msg->len = sizeof(struct w1_netlink_msg) + sizeof(struct w1_netlink_cmd);
2015 - hdr->len = sizeof(struct w1_netlink_cmd);
2016 - cmd->len = 0;
2017 + *data = rn;
2018 + cmd->len += 8;
2019 + hdr->len += 8;
2020 + msg->len += 8;
2021 }
2022
2023 static int w1_process_search_command(struct w1_master *dev, struct cn_msg *msg,
2024 diff --git a/fs/ext4/file.c b/fs/ext4/file.c
2025 index b19f0a457f32..4635788e14bf 100644
2026 --- a/fs/ext4/file.c
2027 +++ b/fs/ext4/file.c
2028 @@ -82,7 +82,7 @@ ext4_unaligned_aio(struct inode *inode, const struct iovec *iov,
2029 size_t count = iov_length(iov, nr_segs);
2030 loff_t final_size = pos + count;
2031
2032 - if (pos >= inode->i_size)
2033 + if (pos >= i_size_read(inode))
2034 return 0;
2035
2036 if ((pos & blockmask) || (final_size & blockmask))
2037 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
2038 index 1423c4816a47..298e9c8da364 100644
2039 --- a/fs/ext4/xattr.c
2040 +++ b/fs/ext4/xattr.c
2041 @@ -517,8 +517,8 @@ static void ext4_xattr_update_super_block(handle_t *handle,
2042 }
2043
2044 /*
2045 - * Release the xattr block BH: If the reference count is > 1, decrement
2046 - * it; otherwise free the block.
2047 + * Release the xattr block BH: If the reference count is > 1, decrement it;
2048 + * otherwise free the block.
2049 */
2050 static void
2051 ext4_xattr_release_block(handle_t *handle, struct inode *inode,
2052 @@ -538,16 +538,31 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode,
2053 if (ce)
2054 mb_cache_entry_free(ce);
2055 get_bh(bh);
2056 + unlock_buffer(bh);
2057 ext4_free_blocks(handle, inode, bh, 0, 1,
2058 EXT4_FREE_BLOCKS_METADATA |
2059 EXT4_FREE_BLOCKS_FORGET);
2060 - unlock_buffer(bh);
2061 } else {
2062 le32_add_cpu(&BHDR(bh)->h_refcount, -1);
2063 if (ce)
2064 mb_cache_entry_release(ce);
2065 + /*
2066 + * Beware of this ugliness: Releasing of xattr block references
2067 + * from different inodes can race and so we have to protect
2068 + * from a race where someone else frees the block (and releases
2069 + * its journal_head) before we are done dirtying the buffer. In
2070 + * nojournal mode this race is harmless and we actually cannot
2071 + * call ext4_handle_dirty_xattr_block() with locked buffer as
2072 + * that function can call sync_dirty_buffer() so for that case
2073 + * we handle the dirtying after unlocking the buffer.
2074 + */
2075 + if (ext4_handle_valid(handle))
2076 + error = ext4_handle_dirty_xattr_block(handle, inode,
2077 + bh);
2078 unlock_buffer(bh);
2079 - error = ext4_handle_dirty_xattr_block(handle, inode, bh);
2080 + if (!ext4_handle_valid(handle))
2081 + error = ext4_handle_dirty_xattr_block(handle, inode,
2082 + bh);
2083 if (IS_SYNC(inode))
2084 ext4_handle_sync(handle);
2085 dquot_free_block(inode, EXT4_C2B(EXT4_SB(inode->i_sb), 1));
2086 diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c
2087 index 7f05cd140de3..3eaa6e30a2dc 100644
2088 --- a/fs/nfsd/nfs4callback.c
2089 +++ b/fs/nfsd/nfs4callback.c
2090 @@ -637,9 +637,11 @@ static struct rpc_cred *get_backchannel_cred(struct nfs4_client *clp, struct rpc
2091
2092 static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *conn, struct nfsd4_session *ses)
2093 {
2094 + int maxtime = max_cb_time(clp->net);
2095 struct rpc_timeout timeparms = {
2096 - .to_initval = max_cb_time(clp->net),
2097 + .to_initval = maxtime,
2098 .to_retries = 0,
2099 + .to_maxval = maxtime,
2100 };
2101 struct rpc_create_args args = {
2102 .net = clp->net,
2103 diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
2104 index 27d74a294515..f7d7d04674fb 100644
2105 --- a/fs/nfsd/nfs4proc.c
2106 +++ b/fs/nfsd/nfs4proc.c
2107 @@ -1307,6 +1307,12 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
2108 /* If op is non-idempotent */
2109 if (opdesc->op_flags & OP_MODIFIES_SOMETHING) {
2110 plen = opdesc->op_rsize_bop(rqstp, op);
2111 + /*
2112 + * If there's still another operation, make sure
2113 + * we'll have space to at least encode an error:
2114 + */
2115 + if (resp->opcnt < args->opcnt)
2116 + plen += COMPOUND_ERR_SLACK_SPACE;
2117 op->status = nfsd4_check_resp_size(resp, plen);
2118 }
2119
2120 @@ -1471,7 +1477,8 @@ static inline u32 nfsd4_setattr_rsize(struct svc_rqst *rqstp, struct nfsd4_op *o
2121
2122 static inline u32 nfsd4_setclientid_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2123 {
2124 - return (op_encode_hdr_size + 2 + 1024) * sizeof(__be32);
2125 + return (op_encode_hdr_size + 2 + XDR_QUADLEN(NFS4_VERIFIER_SIZE)) *
2126 + sizeof(__be32);
2127 }
2128
2129 static inline u32 nfsd4_write_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op)
2130 diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
2131 index 316ec843dec2..442509285ca9 100644
2132 --- a/fs/nfsd/nfs4state.c
2133 +++ b/fs/nfsd/nfs4state.c
2134 @@ -4958,7 +4958,6 @@ nfs4_state_destroy_net(struct net *net)
2135 int i;
2136 struct nfs4_client *clp = NULL;
2137 struct nfsd_net *nn = net_generic(net, nfsd_net_id);
2138 - struct rb_node *node, *tmp;
2139
2140 for (i = 0; i < CLIENT_HASH_SIZE; i++) {
2141 while (!list_empty(&nn->conf_id_hashtbl[i])) {
2142 @@ -4967,13 +4966,11 @@ nfs4_state_destroy_net(struct net *net)
2143 }
2144 }
2145
2146 - node = rb_first(&nn->unconf_name_tree);
2147 - while (node != NULL) {
2148 - tmp = node;
2149 - node = rb_next(tmp);
2150 - clp = rb_entry(tmp, struct nfs4_client, cl_namenode);
2151 - rb_erase(tmp, &nn->unconf_name_tree);
2152 - destroy_client(clp);
2153 + for (i = 0; i < CLIENT_HASH_SIZE; i++) {
2154 + while (!list_empty(&nn->unconf_id_hashtbl[i])) {
2155 + clp = list_entry(nn->unconf_id_hashtbl[i].next, struct nfs4_client, cl_idhash);
2156 + destroy_client(clp);
2157 + }
2158 }
2159
2160 kfree(nn->sessionid_hashtbl);
2161 diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
2162 index 582321a978b0..5188a38fef06 100644
2163 --- a/fs/nfsd/nfs4xdr.c
2164 +++ b/fs/nfsd/nfs4xdr.c
2165 @@ -2401,6 +2401,8 @@ out_acl:
2166 WRITE64(stat.ino);
2167 }
2168 if (bmval2 & FATTR4_WORD2_SUPPATTR_EXCLCREAT) {
2169 + if ((buflen -= 16) < 0)
2170 + goto out_resource;
2171 WRITE32(3);
2172 WRITE32(NFSD_SUPPATTR_EXCLCREAT_WORD0);
2173 WRITE32(NFSD_SUPPATTR_EXCLCREAT_WORD1);
2174 @@ -3382,6 +3384,9 @@ nfsd4_encode_test_stateid(struct nfsd4_compoundres *resp, __be32 nfserr,
2175 struct nfsd4_test_stateid_id *stateid, *next;
2176 __be32 *p;
2177
2178 + if (nfserr)
2179 + return nfserr;
2180 +
2181 RESERVE_SPACE(4 + (4 * test_stateid->ts_num_ids));
2182 *p++ = htonl(test_stateid->ts_num_ids);
2183
2184 diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
2185 index 7f555179bf81..f34d9de802ab 100644
2186 --- a/fs/nfsd/nfsctl.c
2187 +++ b/fs/nfsd/nfsctl.c
2188 @@ -699,6 +699,11 @@ static ssize_t __write_ports_addfd(char *buf, struct net *net)
2189 if (err != 0 || fd < 0)
2190 return -EINVAL;
2191
2192 + if (svc_alien_sock(net, fd)) {
2193 + printk(KERN_ERR "%s: socket net is different to NFSd's one\n", __func__);
2194 + return -EINVAL;
2195 + }
2196 +
2197 err = nfsd_create_serv(net);
2198 if (err != 0)
2199 return err;
2200 diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
2201 index 62fd6616801d..d9b298cbfe5c 100644
2202 --- a/fs/nfsd/vfs.c
2203 +++ b/fs/nfsd/vfs.c
2204 @@ -406,6 +406,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
2205 umode_t ftype = 0;
2206 __be32 err;
2207 int host_err;
2208 + bool get_write_count;
2209 int size_change = 0;
2210
2211 if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE))
2212 @@ -413,10 +414,18 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
2213 if (iap->ia_valid & ATTR_SIZE)
2214 ftype = S_IFREG;
2215
2216 + /* Callers that do fh_verify should do the fh_want_write: */
2217 + get_write_count = !fhp->fh_dentry;
2218 +
2219 /* Get inode */
2220 err = fh_verify(rqstp, fhp, ftype, accmode);
2221 if (err)
2222 goto out;
2223 + if (get_write_count) {
2224 + host_err = fh_want_write(fhp);
2225 + if (host_err)
2226 + return nfserrno(host_err);
2227 + }
2228
2229 dentry = fhp->fh_dentry;
2230 inode = dentry->d_inode;
2231 diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c
2232 index 5d18ad10c27f..4f66e007dae1 100644
2233 --- a/fs/ocfs2/buffer_head_io.c
2234 +++ b/fs/ocfs2/buffer_head_io.c
2235 @@ -90,7 +90,6 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh,
2236 * information for this bh as it's not marked locally
2237 * uptodate. */
2238 ret = -EIO;
2239 - put_bh(bh);
2240 mlog_errno(ret);
2241 }
2242
2243 @@ -420,7 +419,6 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb,
2244
2245 if (!buffer_uptodate(bh)) {
2246 ret = -EIO;
2247 - put_bh(bh);
2248 mlog_errno(ret);
2249 }
2250
2251 diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
2252 index e68588e6b1e8..9bd981cd3142 100644
2253 --- a/fs/ocfs2/dlm/dlmrecovery.c
2254 +++ b/fs/ocfs2/dlm/dlmrecovery.c
2255 @@ -540,7 +540,10 @@ master_here:
2256 /* success! see if any other nodes need recovery */
2257 mlog(0, "DONE mastering recovery of %s:%u here(this=%u)!\n",
2258 dlm->name, dlm->reco.dead_node, dlm->node_num);
2259 - dlm_reset_recovery(dlm);
2260 + spin_lock(&dlm->spinlock);
2261 + __dlm_reset_recovery(dlm);
2262 + dlm->reco.state &= ~DLM_RECO_STATE_FINALIZE;
2263 + spin_unlock(&dlm->spinlock);
2264 }
2265 dlm_end_recovery(dlm);
2266
2267 @@ -698,6 +701,14 @@ static int dlm_remaster_locks(struct dlm_ctxt *dlm, u8 dead_node)
2268 if (all_nodes_done) {
2269 int ret;
2270
2271 + /* Set this flag on recovery master to avoid
2272 + * a new recovery for another dead node start
2273 + * before the recovery is not done. That may
2274 + * cause recovery hung.*/
2275 + spin_lock(&dlm->spinlock);
2276 + dlm->reco.state |= DLM_RECO_STATE_FINALIZE;
2277 + spin_unlock(&dlm->spinlock);
2278 +
2279 /* all nodes are now in DLM_RECO_NODE_DATA_DONE state
2280 * just send a finalize message to everyone and
2281 * clean up */
2282 @@ -1751,13 +1762,13 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
2283 struct dlm_migratable_lockres *mres)
2284 {
2285 struct dlm_migratable_lock *ml;
2286 - struct list_head *queue;
2287 + struct list_head *queue, *iter;
2288 struct list_head *tmpq = NULL;
2289 struct dlm_lock *newlock = NULL;
2290 struct dlm_lockstatus *lksb = NULL;
2291 int ret = 0;
2292 int i, j, bad;
2293 - struct dlm_lock *lock = NULL;
2294 + struct dlm_lock *lock;
2295 u8 from = O2NM_MAX_NODES;
2296 unsigned int added = 0;
2297 __be64 c;
2298 @@ -1792,14 +1803,16 @@ static int dlm_process_recovery_data(struct dlm_ctxt *dlm,
2299 /* MIGRATION ONLY! */
2300 BUG_ON(!(mres->flags & DLM_MRES_MIGRATION));
2301
2302 + lock = NULL;
2303 spin_lock(&res->spinlock);
2304 for (j = DLM_GRANTED_LIST; j <= DLM_BLOCKED_LIST; j++) {
2305 tmpq = dlm_list_idx_to_ptr(res, j);
2306 - list_for_each_entry(lock, tmpq, list) {
2307 - if (lock->ml.cookie != ml->cookie)
2308 - lock = NULL;
2309 - else
2310 + list_for_each(iter, tmpq) {
2311 + lock = list_entry(iter,
2312 + struct dlm_lock, list);
2313 + if (lock->ml.cookie == ml->cookie)
2314 break;
2315 + lock = NULL;
2316 }
2317 if (lock)
2318 break;
2319 @@ -2867,8 +2880,8 @@ int dlm_finalize_reco_handler(struct o2net_msg *msg, u32 len, void *data,
2320 BUG();
2321 }
2322 dlm->reco.state &= ~DLM_RECO_STATE_FINALIZE;
2323 + __dlm_reset_recovery(dlm);
2324 spin_unlock(&dlm->spinlock);
2325 - dlm_reset_recovery(dlm);
2326 dlm_kick_recovery_thread(dlm);
2327 break;
2328 default:
2329 diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c
2330 index 6c2d136561cb..2b96b59f75da 100644
2331 --- a/fs/reiserfs/dir.c
2332 +++ b/fs/reiserfs/dir.c
2333 @@ -128,6 +128,7 @@ int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent,
2334 char *d_name;
2335 off_t d_off;
2336 ino_t d_ino;
2337 + loff_t cur_pos = deh_offset(deh);
2338
2339 if (!de_visible(deh))
2340 /* it is hidden entry */
2341 @@ -200,8 +201,9 @@ int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent,
2342 if (local_buf != small_buf) {
2343 kfree(local_buf);
2344 }
2345 - // next entry should be looked for with such offset
2346 - next_pos = deh_offset(deh) + 1;
2347 +
2348 + /* deh_offset(deh) may be invalid now. */
2349 + next_pos = cur_pos + 1;
2350
2351 if (item_moved(&tmp_ih, &path_to_entry)) {
2352 set_cpu_key_k_offset(&pos_key,
2353 diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
2354 index eca6f9d8a263..79ddbaf93206 100644
2355 --- a/fs/xfs/xfs_da_btree.c
2356 +++ b/fs/xfs/xfs_da_btree.c
2357 @@ -1334,7 +1334,7 @@ xfs_da3_fixhashpath(
2358 node = blk->bp->b_addr;
2359 xfs_da3_node_hdr_from_disk(&nodehdr, node);
2360 btree = xfs_da3_node_tree_p(node);
2361 - if (be32_to_cpu(btree->hashval) == lasthash)
2362 + if (be32_to_cpu(btree[blk->index].hashval) == lasthash)
2363 break;
2364 blk->hashval = lasthash;
2365 btree[blk->index].hashval = cpu_to_be32(lasthash);
2366 diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
2367 index 62fd1b756e99..947009ed5996 100644
2368 --- a/include/linux/sunrpc/svcsock.h
2369 +++ b/include/linux/sunrpc/svcsock.h
2370 @@ -56,6 +56,7 @@ int svc_recv(struct svc_rqst *, long);
2371 int svc_send(struct svc_rqst *);
2372 void svc_drop(struct svc_rqst *);
2373 void svc_sock_update_bufs(struct svc_serv *serv);
2374 +bool svc_alien_sock(struct net *net, int fd);
2375 int svc_addsock(struct svc_serv *serv, const int fd,
2376 char *name_return, const size_t len);
2377 void svc_init_xprt_sock(void);
2378 diff --git a/kernel/sysctl.c b/kernel/sysctl.c
2379 index 9edcf456e0fc..ed6c01626acd 100644
2380 --- a/kernel/sysctl.c
2381 +++ b/kernel/sysctl.c
2382 @@ -144,6 +144,11 @@ static int min_percpu_pagelist_fract = 8;
2383 static int ngroups_max = NGROUPS_MAX;
2384 static const int cap_last_cap = CAP_LAST_CAP;
2385
2386 +/*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */
2387 +#ifdef CONFIG_DETECT_HUNG_TASK
2388 +static unsigned long hung_task_timeout_max = (LONG_MAX/HZ);
2389 +#endif
2390 +
2391 #ifdef CONFIG_INOTIFY_USER
2392 #include <linux/inotify.h>
2393 #endif
2394 @@ -966,6 +971,7 @@ static struct ctl_table kern_table[] = {
2395 .maxlen = sizeof(unsigned long),
2396 .mode = 0644,
2397 .proc_handler = proc_dohung_task_timeout_secs,
2398 + .extra2 = &hung_task_timeout_max,
2399 },
2400 {
2401 .procname = "hung_task_warnings",
2402 diff --git a/mm/hugetlb.c b/mm/hugetlb.c
2403 index aa3b9a63394b..8a7f27b42131 100644
2404 --- a/mm/hugetlb.c
2405 +++ b/mm/hugetlb.c
2406 @@ -1487,6 +1487,7 @@ static unsigned long set_max_huge_pages(struct hstate *h, unsigned long count,
2407 while (min_count < persistent_huge_pages(h)) {
2408 if (!free_pool_huge_page(h, nodes_allowed, 0))
2409 break;
2410 + cond_resched_lock(&hugetlb_lock);
2411 }
2412 while (count < persistent_huge_pages(h)) {
2413 if (!adjust_pool_surplus(h, nodes_allowed, 1))
2414 diff --git a/mm/mlock.c b/mm/mlock.c
2415 index 79b7cf7d1bca..713e462c0776 100644
2416 --- a/mm/mlock.c
2417 +++ b/mm/mlock.c
2418 @@ -76,6 +76,7 @@ void clear_page_mlock(struct page *page)
2419 */
2420 void mlock_vma_page(struct page *page)
2421 {
2422 + /* Serialize with page migration */
2423 BUG_ON(!PageLocked(page));
2424
2425 if (!TestSetPageMlocked(page)) {
2426 @@ -106,6 +107,7 @@ unsigned int munlock_vma_page(struct page *page)
2427 {
2428 unsigned int page_mask = 0;
2429
2430 + /* For try_to_munlock() and to serialize with page migration */
2431 BUG_ON(!PageLocked(page));
2432
2433 if (TestClearPageMlocked(page)) {
2434 diff --git a/mm/rmap.c b/mm/rmap.c
2435 index 3f6077461aea..fbf0040a7342 100644
2436 --- a/mm/rmap.c
2437 +++ b/mm/rmap.c
2438 @@ -1390,9 +1390,19 @@ static int try_to_unmap_cluster(unsigned long cursor, unsigned int *mapcount,
2439 BUG_ON(!page || PageAnon(page));
2440
2441 if (locked_vma) {
2442 - mlock_vma_page(page); /* no-op if already mlocked */
2443 - if (page == check_page)
2444 + if (page == check_page) {
2445 + /* we know we have check_page locked */
2446 + mlock_vma_page(page);
2447 ret = SWAP_MLOCK;
2448 + } else if (trylock_page(page)) {
2449 + /*
2450 + * If we can lock the page, perform mlock.
2451 + * Otherwise leave the page alone, it will be
2452 + * eventually encountered again later.
2453 + */
2454 + mlock_vma_page(page);
2455 + unlock_page(page);
2456 + }
2457 continue; /* don't unmap */
2458 }
2459
2460 diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
2461 index 305374d4fb98..422759bae60d 100644
2462 --- a/net/sunrpc/svcsock.c
2463 +++ b/net/sunrpc/svcsock.c
2464 @@ -1393,6 +1393,22 @@ static struct svc_sock *svc_setup_socket(struct svc_serv *serv,
2465 return svsk;
2466 }
2467
2468 +bool svc_alien_sock(struct net *net, int fd)
2469 +{
2470 + int err;
2471 + struct socket *sock = sockfd_lookup(fd, &err);
2472 + bool ret = false;
2473 +
2474 + if (!sock)
2475 + goto out;
2476 + if (sock_net(sock->sk) != net)
2477 + ret = true;
2478 + sockfd_put(sock);
2479 +out:
2480 + return ret;
2481 +}
2482 +EXPORT_SYMBOL_GPL(svc_alien_sock);
2483 +
2484 /**
2485 * svc_addsock - add a listener socket to an RPC service
2486 * @serv: pointer to RPC service to which to add a new listener
2487 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
2488 index 34548589f419..7de7cf1ec852 100644
2489 --- a/sound/pci/hda/patch_realtek.c
2490 +++ b/sound/pci/hda/patch_realtek.c
2491 @@ -937,6 +937,7 @@ static int alc_codec_rename_from_preset(struct hda_codec *codec)
2492
2493 static const struct snd_pci_quirk beep_white_list[] = {
2494 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
2495 + SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
2496 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
2497 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
2498 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
2499 @@ -2858,8 +2859,9 @@ static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
2500
2501 if (spec->mute_led_polarity)
2502 enabled = !enabled;
2503 - pinval = AC_PINCTL_IN_EN |
2504 - (enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80);
2505 + pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
2506 + pinval &= ~AC_PINCTL_VREFEN;
2507 + pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
2508 if (spec->mute_led_nid)
2509 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
2510 }
2511 @@ -3901,6 +3903,7 @@ static int patch_alc269(struct hda_codec *codec)
2512 spec->codec_variant = ALC269_TYPE_ALC284;
2513 break;
2514 case 0x10ec0286:
2515 + case 0x10ec0288:
2516 spec->codec_variant = ALC269_TYPE_ALC286;
2517 break;
2518 case 0x10ec0255:
2519 @@ -4643,6 +4646,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = {
2520 { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 },
2521 { .id = 0x10ec0284, .name = "ALC284", .patch = patch_alc269 },
2522 { .id = 0x10ec0286, .name = "ALC286", .patch = patch_alc269 },
2523 + { .id = 0x10ec0288, .name = "ALC288", .patch = patch_alc269 },
2524 { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 },
2525 { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 },
2526 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
2527 diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
2528 index 806407a3973e..e6b70e35f628 100644
2529 --- a/sound/pci/ice1712/ice1712.c
2530 +++ b/sound/pci/ice1712/ice1712.c
2531 @@ -685,9 +685,10 @@ static snd_pcm_uframes_t snd_ice1712_playback_pointer(struct snd_pcm_substream *
2532 if (!(snd_ice1712_read(ice, ICE1712_IREG_PBK_CTRL) & 1))
2533 return 0;
2534 ptr = runtime->buffer_size - inw(ice->ddma_port + 4);
2535 + ptr = bytes_to_frames(substream->runtime, ptr);
2536 if (ptr == runtime->buffer_size)
2537 ptr = 0;
2538 - return bytes_to_frames(substream->runtime, ptr);
2539 + return ptr;
2540 }
2541
2542 static snd_pcm_uframes_t snd_ice1712_playback_ds_pointer(struct snd_pcm_substream *substream)
2543 @@ -704,9 +705,10 @@ static snd_pcm_uframes_t snd_ice1712_playback_ds_pointer(struct snd_pcm_substrea
2544 addr = ICE1712_DSC_ADDR0;
2545 ptr = snd_ice1712_ds_read(ice, substream->number * 2, addr) -
2546 ice->playback_con_virt_addr[substream->number];
2547 + ptr = bytes_to_frames(substream->runtime, ptr);
2548 if (ptr == substream->runtime->buffer_size)
2549 ptr = 0;
2550 - return bytes_to_frames(substream->runtime, ptr);
2551 + return ptr;
2552 }
2553
2554 static snd_pcm_uframes_t snd_ice1712_capture_pointer(struct snd_pcm_substream *substream)
2555 @@ -717,9 +719,10 @@ static snd_pcm_uframes_t snd_ice1712_capture_pointer(struct snd_pcm_substream *s
2556 if (!(snd_ice1712_read(ice, ICE1712_IREG_CAP_CTRL) & 1))
2557 return 0;
2558 ptr = inl(ICEREG(ice, CONCAP_ADDR)) - ice->capture_con_virt_addr;
2559 + ptr = bytes_to_frames(substream->runtime, ptr);
2560 if (ptr == substream->runtime->buffer_size)
2561 ptr = 0;
2562 - return bytes_to_frames(substream->runtime, ptr);
2563 + return ptr;
2564 }
2565
2566 static const struct snd_pcm_hardware snd_ice1712_playback = {
2567 @@ -1113,9 +1116,10 @@ static snd_pcm_uframes_t snd_ice1712_playback_pro_pointer(struct snd_pcm_substre
2568 if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_PLAYBACK_START))
2569 return 0;
2570 ptr = ice->playback_pro_size - (inw(ICEMT(ice, PLAYBACK_SIZE)) << 2);
2571 + ptr = bytes_to_frames(substream->runtime, ptr);
2572 if (ptr == substream->runtime->buffer_size)
2573 ptr = 0;
2574 - return bytes_to_frames(substream->runtime, ptr);
2575 + return ptr;
2576 }
2577
2578 static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(struct snd_pcm_substream *substream)
2579 @@ -1126,9 +1130,10 @@ static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(struct snd_pcm_substrea
2580 if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_CAPTURE_START_SHADOW))
2581 return 0;
2582 ptr = ice->capture_pro_size - (inw(ICEMT(ice, CAPTURE_SIZE)) << 2);
2583 + ptr = bytes_to_frames(substream->runtime, ptr);
2584 if (ptr == substream->runtime->buffer_size)
2585 ptr = 0;
2586 - return bytes_to_frames(substream->runtime, ptr);
2587 + return ptr;
2588 }
2589
2590 static const struct snd_pcm_hardware snd_ice1712_playback_pro = {
2591 diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c
2592 index 1e0fa3b5f79a..e1dfebbea650 100644
2593 --- a/sound/soc/codecs/cs42l51.c
2594 +++ b/sound/soc/codecs/cs42l51.c
2595 @@ -124,9 +124,8 @@ static int cs42l51_set_chan_mix(struct snd_kcontrol *kcontrol,
2596
2597 static const DECLARE_TLV_DB_SCALE(adc_pcm_tlv, -5150, 50, 0);
2598 static const DECLARE_TLV_DB_SCALE(tone_tlv, -1050, 150, 0);
2599 -/* This is a lie. after -102 db, it stays at -102 */
2600 -/* maybe a range would be better */
2601 -static const DECLARE_TLV_DB_SCALE(aout_tlv, -11550, 50, 0);
2602 +
2603 +static const DECLARE_TLV_DB_SCALE(aout_tlv, -10200, 50, 0);
2604
2605 static const DECLARE_TLV_DB_SCALE(boost_tlv, 1600, 1600, 0);
2606 static const char *chan_mix[] = {
2607 @@ -141,7 +140,7 @@ static const struct soc_enum cs42l51_chan_mix =
2608 static const struct snd_kcontrol_new cs42l51_snd_controls[] = {
2609 SOC_DOUBLE_R_SX_TLV("PCM Playback Volume",
2610 CS42L51_PCMA_VOL, CS42L51_PCMB_VOL,
2611 - 6, 0x19, 0x7F, adc_pcm_tlv),
2612 + 0, 0x19, 0x7F, adc_pcm_tlv),
2613 SOC_DOUBLE_R("PCM Playback Switch",
2614 CS42L51_PCMA_VOL, CS42L51_PCMB_VOL, 7, 1, 1),
2615 SOC_DOUBLE_R_SX_TLV("Analog Playback Volume",
2616 @@ -149,7 +148,7 @@ static const struct snd_kcontrol_new cs42l51_snd_controls[] = {
2617 0, 0x34, 0xE4, aout_tlv),
2618 SOC_DOUBLE_R_SX_TLV("ADC Mixer Volume",
2619 CS42L51_ADCA_VOL, CS42L51_ADCB_VOL,
2620 - 6, 0x19, 0x7F, adc_pcm_tlv),
2621 + 0, 0x19, 0x7F, adc_pcm_tlv),
2622 SOC_DOUBLE_R("ADC Mixer Switch",
2623 CS42L51_ADCA_VOL, CS42L51_ADCB_VOL, 7, 1, 1),
2624 SOC_SINGLE("Playback Deemphasis Switch", CS42L51_DAC_CTL, 3, 1, 0),
2625 diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c
2626 index ee25f325d65c..b99af6362de6 100644
2627 --- a/sound/soc/codecs/cs42l52.c
2628 +++ b/sound/soc/codecs/cs42l52.c
2629 @@ -350,7 +350,7 @@ static const char * const right_swap_text[] = {
2630 static const unsigned int swap_values[] = { 0, 1, 3 };
2631
2632 static const struct soc_enum adca_swap_enum =
2633 - SOC_VALUE_ENUM_SINGLE(CS42L52_ADC_PCM_MIXER, 2, 1,
2634 + SOC_VALUE_ENUM_SINGLE(CS42L52_ADC_PCM_MIXER, 2, 3,
2635 ARRAY_SIZE(left_swap_text),
2636 left_swap_text,
2637 swap_values);
2638 @@ -359,7 +359,7 @@ static const struct snd_kcontrol_new adca_mixer =
2639 SOC_DAPM_ENUM("Route", adca_swap_enum);
2640
2641 static const struct soc_enum pcma_swap_enum =
2642 - SOC_VALUE_ENUM_SINGLE(CS42L52_ADC_PCM_MIXER, 6, 1,
2643 + SOC_VALUE_ENUM_SINGLE(CS42L52_ADC_PCM_MIXER, 6, 3,
2644 ARRAY_SIZE(left_swap_text),
2645 left_swap_text,
2646 swap_values);
2647 @@ -368,7 +368,7 @@ static const struct snd_kcontrol_new pcma_mixer =
2648 SOC_DAPM_ENUM("Route", pcma_swap_enum);
2649
2650 static const struct soc_enum adcb_swap_enum =
2651 - SOC_VALUE_ENUM_SINGLE(CS42L52_ADC_PCM_MIXER, 0, 1,
2652 + SOC_VALUE_ENUM_SINGLE(CS42L52_ADC_PCM_MIXER, 0, 3,
2653 ARRAY_SIZE(right_swap_text),
2654 right_swap_text,
2655 swap_values);
2656 @@ -377,7 +377,7 @@ static const struct snd_kcontrol_new adcb_mixer =
2657 SOC_DAPM_ENUM("Route", adcb_swap_enum);
2658
2659 static const struct soc_enum pcmb_swap_enum =
2660 - SOC_VALUE_ENUM_SINGLE(CS42L52_ADC_PCM_MIXER, 4, 1,
2661 + SOC_VALUE_ENUM_SINGLE(CS42L52_ADC_PCM_MIXER, 4, 3,
2662 ARRAY_SIZE(right_swap_text),
2663 right_swap_text,
2664 swap_values);
2665 diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c
2666 index 3b20c86cdb01..eade6e2d883d 100644
2667 --- a/sound/soc/codecs/cs42l73.c
2668 +++ b/sound/soc/codecs/cs42l73.c
2669 @@ -325,7 +325,7 @@ static const char * const cs42l73_mono_mix_texts[] = {
2670 static const unsigned int cs42l73_mono_mix_values[] = { 0, 1, 2 };
2671
2672 static const struct soc_enum spk_asp_enum =
2673 - SOC_VALUE_ENUM_SINGLE(CS42L73_MMIXCTL, 6, 1,
2674 + SOC_VALUE_ENUM_SINGLE(CS42L73_MMIXCTL, 6, 3,
2675 ARRAY_SIZE(cs42l73_mono_mix_texts),
2676 cs42l73_mono_mix_texts,
2677 cs42l73_mono_mix_values);
2678 @@ -343,7 +343,7 @@ static const struct snd_kcontrol_new spk_xsp_mixer =
2679 SOC_DAPM_ENUM("Route", spk_xsp_enum);
2680
2681 static const struct soc_enum esl_asp_enum =
2682 - SOC_VALUE_ENUM_SINGLE(CS42L73_MMIXCTL, 2, 5,
2683 + SOC_VALUE_ENUM_SINGLE(CS42L73_MMIXCTL, 2, 3,
2684 ARRAY_SIZE(cs42l73_mono_mix_texts),
2685 cs42l73_mono_mix_texts,
2686 cs42l73_mono_mix_values);
2687 @@ -352,7 +352,7 @@ static const struct snd_kcontrol_new esl_asp_mixer =
2688 SOC_DAPM_ENUM("Route", esl_asp_enum);
2689
2690 static const struct soc_enum esl_xsp_enum =
2691 - SOC_VALUE_ENUM_SINGLE(CS42L73_MMIXCTL, 0, 7,
2692 + SOC_VALUE_ENUM_SINGLE(CS42L73_MMIXCTL, 0, 3,
2693 ARRAY_SIZE(cs42l73_mono_mix_texts),
2694 cs42l73_mono_mix_texts,
2695 cs42l73_mono_mix_values);