Magellan Linux

Contents of /trunk/kernel-magellan/patches-3.8/0103-3.8.4-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2132 - (show annotations) (download)
Thu Mar 21 09:09:19 2013 UTC (11 years, 1 month ago) by niro
File size: 100638 byte(s)
-linux-3.8.4
1 diff --git a/Documentation/devicetree/bindings/tty/serial/of-serial.txt b/Documentation/devicetree/bindings/tty/serial/of-serial.txt
2 index 1e1145c..8f01cb1 100644
3 --- a/Documentation/devicetree/bindings/tty/serial/of-serial.txt
4 +++ b/Documentation/devicetree/bindings/tty/serial/of-serial.txt
5 @@ -11,6 +11,9 @@ Required properties:
6 - "nvidia,tegra20-uart"
7 - "nxp,lpc3220-uart"
8 - "ibm,qpace-nwp-serial"
9 + - "altr,16550-FIFO32"
10 + - "altr,16550-FIFO64"
11 + - "altr,16550-FIFO128"
12 - "serial" if the port type is unknown.
13 - reg : offset and length of the register set for the device.
14 - interrupts : should contain uart interrupt.
15 diff --git a/arch/arm/mach-at91/board-foxg20.c b/arch/arm/mach-at91/board-foxg20.c
16 index 191d37c..1478294 100644
17 --- a/arch/arm/mach-at91/board-foxg20.c
18 +++ b/arch/arm/mach-at91/board-foxg20.c
19 @@ -176,6 +176,7 @@ static struct w1_gpio_platform_data w1_gpio_pdata = {
20 /* If you choose to use a pin other than PB16 it needs to be 3.3V */
21 .pin = AT91_PIN_PB16,
22 .is_open_drain = 1,
23 + .ext_pullup_enable_pin = -EINVAL,
24 };
25
26 static struct platform_device w1_device = {
27 diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c
28 index 48a962b..58a6758 100644
29 --- a/arch/arm/mach-at91/board-stamp9g20.c
30 +++ b/arch/arm/mach-at91/board-stamp9g20.c
31 @@ -188,6 +188,7 @@ static struct spi_board_info portuxg20_spi_devices[] = {
32 static struct w1_gpio_platform_data w1_gpio_pdata = {
33 .pin = AT91_PIN_PA29,
34 .is_open_drain = 1,
35 + .ext_pullup_enable_pin = -EINVAL,
36 };
37
38 static struct platform_device w1_device = {
39 diff --git a/arch/arm/mach-davinci/dma.c b/arch/arm/mach-davinci/dma.c
40 index a685e97..45b7c71 100644
41 --- a/arch/arm/mach-davinci/dma.c
42 +++ b/arch/arm/mach-davinci/dma.c
43 @@ -743,6 +743,9 @@ EXPORT_SYMBOL(edma_free_channel);
44 */
45 int edma_alloc_slot(unsigned ctlr, int slot)
46 {
47 + if (!edma_cc[ctlr])
48 + return -EINVAL;
49 +
50 if (slot >= 0)
51 slot = EDMA_CHAN_SLOT(slot);
52
53 diff --git a/arch/arm/mach-ixp4xx/vulcan-setup.c b/arch/arm/mach-ixp4xx/vulcan-setup.c
54 index 2798f43..1dddc1b 100644
55 --- a/arch/arm/mach-ixp4xx/vulcan-setup.c
56 +++ b/arch/arm/mach-ixp4xx/vulcan-setup.c
57 @@ -163,6 +163,7 @@ static struct platform_device vulcan_max6369 = {
58
59 static struct w1_gpio_platform_data vulcan_w1_gpio_pdata = {
60 .pin = 14,
61 + .ext_pullup_enable_pin = -EINVAL,
62 };
63
64 static struct platform_device vulcan_w1_gpio = {
65 diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
66 index de4fd2b..e714ead 100644
67 --- a/arch/arm/mach-kirkwood/board-dt.c
68 +++ b/arch/arm/mach-kirkwood/board-dt.c
69 @@ -41,16 +41,12 @@ static void __init kirkwood_legacy_clk_init(void)
70
71 struct device_node *np = of_find_compatible_node(
72 NULL, NULL, "marvell,kirkwood-gating-clock");
73 -
74 struct of_phandle_args clkspec;
75 + struct clk *clk;
76
77 clkspec.np = np;
78 clkspec.args_count = 1;
79
80 - clkspec.args[0] = CGC_BIT_GE0;
81 - orion_clkdev_add(NULL, "mv643xx_eth_port.0",
82 - of_clk_get_from_provider(&clkspec));
83 -
84 clkspec.args[0] = CGC_BIT_PEX0;
85 orion_clkdev_add("0", "pcie",
86 of_clk_get_from_provider(&clkspec));
87 @@ -63,14 +59,24 @@ static void __init kirkwood_legacy_clk_init(void)
88 orion_clkdev_add("1", "pcie",
89 of_clk_get_from_provider(&clkspec));
90
91 - clkspec.args[0] = CGC_BIT_GE1;
92 - orion_clkdev_add(NULL, "mv643xx_eth_port.1",
93 - of_clk_get_from_provider(&clkspec));
94 -
95 clkspec.args[0] = CGC_BIT_SDIO;
96 orion_clkdev_add(NULL, "mvsdio",
97 of_clk_get_from_provider(&clkspec));
98
99 + /*
100 + * The ethernet interfaces forget the MAC address assigned by
101 + * u-boot if the clocks are turned off. Until proper DT support
102 + * is available we always enable them for now.
103 + */
104 + clkspec.args[0] = CGC_BIT_GE0;
105 + clk = of_clk_get_from_provider(&clkspec);
106 + orion_clkdev_add(NULL, "mv643xx_eth_port.0", clk);
107 + clk_prepare_enable(clk);
108 +
109 + clkspec.args[0] = CGC_BIT_GE1;
110 + clk = of_clk_get_from_provider(&clkspec);
111 + orion_clkdev_add(NULL, "mv643xx_eth_port.1", clk);
112 + clk_prepare_enable(clk);
113 }
114
115 static void __init kirkwood_of_clk_init(void)
116 diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
117 index 25b08bfa..6283fcb 100644
118 --- a/arch/arm/mach-pxa/raumfeld.c
119 +++ b/arch/arm/mach-pxa/raumfeld.c
120 @@ -505,6 +505,7 @@ static struct w1_gpio_platform_data w1_gpio_platform_data = {
121 .pin = GPIO_ONE_WIRE,
122 .is_open_drain = 0,
123 .enable_external_pullup = w1_enable_external_pullup,
124 + .ext_pullup_enable_pin = -EINVAL,
125 };
126
127 struct platform_device raumfeld_w1_gpio_device = {
128 diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
129 index 2fdb47a..b59e06f 100644
130 --- a/arch/powerpc/include/asm/mmu-hash64.h
131 +++ b/arch/powerpc/include/asm/mmu-hash64.h
132 @@ -343,17 +343,16 @@ extern void slb_set_size(u16 size);
133 /*
134 * VSID allocation (256MB segment)
135 *
136 - * We first generate a 38-bit "proto-VSID". For kernel addresses this
137 - * is equal to the ESID | 1 << 37, for user addresses it is:
138 - * (context << USER_ESID_BITS) | (esid & ((1U << USER_ESID_BITS) - 1)
139 + * We first generate a 37-bit "proto-VSID". Proto-VSIDs are generated
140 + * from mmu context id and effective segment id of the address.
141 *
142 - * This splits the proto-VSID into the below range
143 - * 0 - (2^(CONTEXT_BITS + USER_ESID_BITS) - 1) : User proto-VSID range
144 - * 2^(CONTEXT_BITS + USER_ESID_BITS) - 2^(VSID_BITS) : Kernel proto-VSID range
145 - *
146 - * We also have CONTEXT_BITS + USER_ESID_BITS = VSID_BITS - 1
147 - * That is, we assign half of the space to user processes and half
148 - * to the kernel.
149 + * For user processes max context id is limited to ((1ul << 19) - 5)
150 + * for kernel space, we use the top 4 context ids to map address as below
151 + * NOTE: each context only support 64TB now.
152 + * 0x7fffc - [ 0xc000000000000000 - 0xc0003fffffffffff ]
153 + * 0x7fffd - [ 0xd000000000000000 - 0xd0003fffffffffff ]
154 + * 0x7fffe - [ 0xe000000000000000 - 0xe0003fffffffffff ]
155 + * 0x7ffff - [ 0xf000000000000000 - 0xf0003fffffffffff ]
156 *
157 * The proto-VSIDs are then scrambled into real VSIDs with the
158 * multiplicative hash:
159 @@ -363,41 +362,49 @@ extern void slb_set_size(u16 size);
160 * VSID_MULTIPLIER is prime, so in particular it is
161 * co-prime to VSID_MODULUS, making this a 1:1 scrambling function.
162 * Because the modulus is 2^n-1 we can compute it efficiently without
163 - * a divide or extra multiply (see below).
164 - *
165 - * This scheme has several advantages over older methods:
166 - *
167 - * - We have VSIDs allocated for every kernel address
168 - * (i.e. everything above 0xC000000000000000), except the very top
169 - * segment, which simplifies several things.
170 + * a divide or extra multiply (see below). The scramble function gives
171 + * robust scattering in the hash table (at least based on some initial
172 + * results).
173 *
174 - * - We allow for USER_ESID_BITS significant bits of ESID and
175 - * CONTEXT_BITS bits of context for user addresses.
176 - * i.e. 64T (46 bits) of address space for up to half a million contexts.
177 + * We also consider VSID 0 special. We use VSID 0 for slb entries mapping
178 + * bad address. This enables us to consolidate bad address handling in
179 + * hash_page.
180 *
181 - * - The scramble function gives robust scattering in the hash
182 - * table (at least based on some initial results). The previous
183 - * method was more susceptible to pathological cases giving excessive
184 - * hash collisions.
185 + * We also need to avoid the last segment of the last context, because that
186 + * would give a protovsid of 0x1fffffffff. That will result in a VSID 0
187 + * because of the modulo operation in vsid scramble. But the vmemmap
188 + * (which is what uses region 0xf) will never be close to 64TB in size
189 + * (it's 56 bytes per page of system memory).
190 */
191
192 +#define CONTEXT_BITS 19
193 +#define ESID_BITS 18
194 +#define ESID_BITS_1T 6
195 +
196 +/*
197 + * 256MB segment
198 + * The proto-VSID space has 2^(CONTEX_BITS + ESID_BITS) - 1 segments
199 + * available for user + kernel mapping. The top 4 contexts are used for
200 + * kernel mapping. Each segment contains 2^28 bytes. Each
201 + * context maps 2^46 bytes (64TB) so we can support 2^19-1 contexts
202 + * (19 == 37 + 28 - 46).
203 + */
204 +#define MAX_USER_CONTEXT ((ASM_CONST(1) << CONTEXT_BITS) - 5)
205 +
206 /*
207 * This should be computed such that protovosid * vsid_mulitplier
208 * doesn't overflow 64 bits. It should also be co-prime to vsid_modulus
209 */
210 #define VSID_MULTIPLIER_256M ASM_CONST(12538073) /* 24-bit prime */
211 -#define VSID_BITS_256M 38
212 +#define VSID_BITS_256M (CONTEXT_BITS + ESID_BITS)
213 #define VSID_MODULUS_256M ((1UL<<VSID_BITS_256M)-1)
214
215 #define VSID_MULTIPLIER_1T ASM_CONST(12538073) /* 24-bit prime */
216 -#define VSID_BITS_1T 26
217 +#define VSID_BITS_1T (CONTEXT_BITS + ESID_BITS_1T)
218 #define VSID_MODULUS_1T ((1UL<<VSID_BITS_1T)-1)
219
220 -#define CONTEXT_BITS 19
221 -#define USER_ESID_BITS 18
222 -#define USER_ESID_BITS_1T 6
223
224 -#define USER_VSID_RANGE (1UL << (USER_ESID_BITS + SID_SHIFT))
225 +#define USER_VSID_RANGE (1UL << (ESID_BITS + SID_SHIFT))
226
227 /*
228 * This macro generates asm code to compute the VSID scramble
229 @@ -421,7 +428,8 @@ extern void slb_set_size(u16 size);
230 srdi rx,rt,VSID_BITS_##size; \
231 clrldi rt,rt,(64-VSID_BITS_##size); \
232 add rt,rt,rx; /* add high and low bits */ \
233 - /* Now, r3 == VSID (mod 2^36-1), and lies between 0 and \
234 + /* NOTE: explanation based on VSID_BITS_##size = 36 \
235 + * Now, r3 == VSID (mod 2^36-1), and lies between 0 and \
236 * 2^36-1+2^28-1. That in particular means that if r3 >= \
237 * 2^36-1, then r3+1 has the 2^36 bit set. So, if r3+1 has \
238 * the bit clear, r3 already has the answer we want, if it \
239 @@ -513,34 +521,6 @@ typedef struct {
240 })
241 #endif /* 1 */
242
243 -/*
244 - * This is only valid for addresses >= PAGE_OFFSET
245 - * The proto-VSID space is divided into two class
246 - * User: 0 to 2^(CONTEXT_BITS + USER_ESID_BITS) -1
247 - * kernel: 2^(CONTEXT_BITS + USER_ESID_BITS) to 2^(VSID_BITS) - 1
248 - *
249 - * With KERNEL_START at 0xc000000000000000, the proto vsid for
250 - * the kernel ends up with 0xc00000000 (36 bits). With 64TB
251 - * support we need to have kernel proto-VSID in the
252 - * [2^37 to 2^38 - 1] range due to the increased USER_ESID_BITS.
253 - */
254 -static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize)
255 -{
256 - unsigned long proto_vsid;
257 - /*
258 - * We need to make sure proto_vsid for the kernel is
259 - * >= 2^(CONTEXT_BITS + USER_ESID_BITS[_1T])
260 - */
261 - if (ssize == MMU_SEGSIZE_256M) {
262 - proto_vsid = ea >> SID_SHIFT;
263 - proto_vsid |= (1UL << (CONTEXT_BITS + USER_ESID_BITS));
264 - return vsid_scramble(proto_vsid, 256M);
265 - }
266 - proto_vsid = ea >> SID_SHIFT_1T;
267 - proto_vsid |= (1UL << (CONTEXT_BITS + USER_ESID_BITS_1T));
268 - return vsid_scramble(proto_vsid, 1T);
269 -}
270 -
271 /* Returns the segment size indicator for a user address */
272 static inline int user_segment_size(unsigned long addr)
273 {
274 @@ -550,17 +530,41 @@ static inline int user_segment_size(unsigned long addr)
275 return MMU_SEGSIZE_256M;
276 }
277
278 -/* This is only valid for user addresses (which are below 2^44) */
279 static inline unsigned long get_vsid(unsigned long context, unsigned long ea,
280 int ssize)
281 {
282 + /*
283 + * Bad address. We return VSID 0 for that
284 + */
285 + if ((ea & ~REGION_MASK) >= PGTABLE_RANGE)
286 + return 0;
287 +
288 if (ssize == MMU_SEGSIZE_256M)
289 - return vsid_scramble((context << USER_ESID_BITS)
290 + return vsid_scramble((context << ESID_BITS)
291 | (ea >> SID_SHIFT), 256M);
292 - return vsid_scramble((context << USER_ESID_BITS_1T)
293 + return vsid_scramble((context << ESID_BITS_1T)
294 | (ea >> SID_SHIFT_1T), 1T);
295 }
296
297 +/*
298 + * This is only valid for addresses >= PAGE_OFFSET
299 + *
300 + * For kernel space, we use the top 4 context ids to map address as below
301 + * 0x7fffc - [ 0xc000000000000000 - 0xc0003fffffffffff ]
302 + * 0x7fffd - [ 0xd000000000000000 - 0xd0003fffffffffff ]
303 + * 0x7fffe - [ 0xe000000000000000 - 0xe0003fffffffffff ]
304 + * 0x7ffff - [ 0xf000000000000000 - 0xf0003fffffffffff ]
305 + */
306 +static inline unsigned long get_kernel_vsid(unsigned long ea, int ssize)
307 +{
308 + unsigned long context;
309 +
310 + /*
311 + * kernel take the top 4 context from the available range
312 + */
313 + context = (MAX_USER_CONTEXT) + ((ea >> 60) - 0xc) + 1;
314 + return get_vsid(context, ea, ssize);
315 +}
316 #endif /* __ASSEMBLY__ */
317
318 #endif /* _ASM_POWERPC_MMU_HASH64_H_ */
319 diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
320 index 75a3d71..19599ef 100644
321 --- a/arch/powerpc/kernel/cputable.c
322 +++ b/arch/powerpc/kernel/cputable.c
323 @@ -275,7 +275,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
324 .cpu_features = CPU_FTRS_PPC970,
325 .cpu_user_features = COMMON_USER_POWER4 |
326 PPC_FEATURE_HAS_ALTIVEC_COMP,
327 - .mmu_features = MMU_FTR_HPTE_TABLE,
328 + .mmu_features = MMU_FTRS_PPC970,
329 .icache_bsize = 128,
330 .dcache_bsize = 128,
331 .num_pmcs = 8,
332 diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
333 index 4665e82..3684cbd 100644
334 --- a/arch/powerpc/kernel/exceptions-64s.S
335 +++ b/arch/powerpc/kernel/exceptions-64s.S
336 @@ -1268,20 +1268,36 @@ do_ste_alloc:
337 _GLOBAL(do_stab_bolted)
338 stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */
339 std r11,PACA_EXSLB+EX_SRR0(r13) /* save SRR0 in exc. frame */
340 + mfspr r11,SPRN_DAR /* ea */
341
342 + /*
343 + * check for bad kernel/user address
344 + * (ea & ~REGION_MASK) >= PGTABLE_RANGE
345 + */
346 + rldicr. r9,r11,4,(63 - 46 - 4)
347 + li r9,0 /* VSID = 0 for bad address */
348 + bne- 0f
349 +
350 + /*
351 + * Calculate VSID:
352 + * This is the kernel vsid, we take the top for context from
353 + * the range. context = (MAX_USER_CONTEXT) + ((ea >> 60) - 0xc) + 1
354 + * Here we know that (ea >> 60) == 0xc
355 + */
356 + lis r9,(MAX_USER_CONTEXT + 1)@ha
357 + addi r9,r9,(MAX_USER_CONTEXT + 1)@l
358 +
359 + srdi r10,r11,SID_SHIFT
360 + rldimi r10,r9,ESID_BITS,0 /* proto vsid */
361 + ASM_VSID_SCRAMBLE(r10, r9, 256M)
362 + rldic r9,r10,12,16 /* r9 = vsid << 12 */
363 +
364 +0:
365 /* Hash to the primary group */
366 ld r10,PACASTABVIRT(r13)
367 - mfspr r11,SPRN_DAR
368 - srdi r11,r11,28
369 + srdi r11,r11,SID_SHIFT
370 rldimi r10,r11,7,52 /* r10 = first ste of the group */
371
372 - /* Calculate VSID */
373 - /* This is a kernel address, so protovsid = ESID | 1 << 37 */
374 - li r9,0x1
375 - rldimi r11,r9,(CONTEXT_BITS + USER_ESID_BITS),0
376 - ASM_VSID_SCRAMBLE(r11, r9, 256M)
377 - rldic r9,r11,12,16 /* r9 = vsid << 12 */
378 -
379 /* Search the primary group for a free entry */
380 1: ld r11,0(r10) /* Test valid bit of the current ste */
381 andi. r11,r11,0x80
382 diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c
383 index ead58e3..5d7d29a 100644
384 --- a/arch/powerpc/kvm/book3s_64_mmu_host.c
385 +++ b/arch/powerpc/kvm/book3s_64_mmu_host.c
386 @@ -326,8 +326,8 @@ int kvmppc_mmu_init(struct kvm_vcpu *vcpu)
387 vcpu3s->context_id[0] = err;
388
389 vcpu3s->proto_vsid_max = ((vcpu3s->context_id[0] + 1)
390 - << USER_ESID_BITS) - 1;
391 - vcpu3s->proto_vsid_first = vcpu3s->context_id[0] << USER_ESID_BITS;
392 + << ESID_BITS) - 1;
393 + vcpu3s->proto_vsid_first = vcpu3s->context_id[0] << ESID_BITS;
394 vcpu3s->proto_vsid_next = vcpu3s->proto_vsid_first;
395
396 kvmppc_mmu_hpte_init(vcpu);
397 diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
398 index 3a292be..004630b 100644
399 --- a/arch/powerpc/mm/hash_utils_64.c
400 +++ b/arch/powerpc/mm/hash_utils_64.c
401 @@ -194,6 +194,11 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
402 unsigned long vpn = hpt_vpn(vaddr, vsid, ssize);
403 unsigned long tprot = prot;
404
405 + /*
406 + * If we hit a bad address return error.
407 + */
408 + if (!vsid)
409 + return -1;
410 /* Make kernel text executable */
411 if (overlaps_kernel_text(vaddr, vaddr + step))
412 tprot &= ~HPTE_R_N;
413 @@ -758,6 +763,8 @@ void __init early_init_mmu(void)
414 /* Initialize stab / SLB management */
415 if (mmu_has_feature(MMU_FTR_SLB))
416 slb_initialize();
417 + else
418 + stab_initialize(get_paca()->stab_real);
419 }
420
421 #ifdef CONFIG_SMP
422 @@ -921,11 +928,6 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
423 DBG_LOW("hash_page(ea=%016lx, access=%lx, trap=%lx\n",
424 ea, access, trap);
425
426 - if ((ea & ~REGION_MASK) >= PGTABLE_RANGE) {
427 - DBG_LOW(" out of pgtable range !\n");
428 - return 1;
429 - }
430 -
431 /* Get region & vsid */
432 switch (REGION_ID(ea)) {
433 case USER_REGION_ID:
434 @@ -956,6 +958,11 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
435 }
436 DBG_LOW(" mm=%p, mm->pgdir=%p, vsid=%016lx\n", mm, mm->pgd, vsid);
437
438 + /* Bad address. */
439 + if (!vsid) {
440 + DBG_LOW("Bad address!\n");
441 + return 1;
442 + }
443 /* Get pgdir */
444 pgdir = mm->pgd;
445 if (pgdir == NULL)
446 @@ -1125,6 +1132,8 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
447 /* Get VSID */
448 ssize = user_segment_size(ea);
449 vsid = get_vsid(mm->context.id, ea, ssize);
450 + if (!vsid)
451 + return;
452
453 /* Hash doesn't like irqs */
454 local_irq_save(flags);
455 @@ -1217,6 +1226,9 @@ static void kernel_map_linear_page(unsigned long vaddr, unsigned long lmi)
456 hash = hpt_hash(vpn, PAGE_SHIFT, mmu_kernel_ssize);
457 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP);
458
459 + /* Don't create HPTE entries for bad address */
460 + if (!vsid)
461 + return;
462 ret = ppc_md.hpte_insert(hpteg, vpn, __pa(vaddr),
463 mode, HPTE_V_BOLTED,
464 mmu_linear_psize, mmu_kernel_ssize);
465 diff --git a/arch/powerpc/mm/mmu_context_hash64.c b/arch/powerpc/mm/mmu_context_hash64.c
466 index 40bc5b0..d1d1b92 100644
467 --- a/arch/powerpc/mm/mmu_context_hash64.c
468 +++ b/arch/powerpc/mm/mmu_context_hash64.c
469 @@ -29,15 +29,6 @@
470 static DEFINE_SPINLOCK(mmu_context_lock);
471 static DEFINE_IDA(mmu_context_ida);
472
473 -/*
474 - * 256MB segment
475 - * The proto-VSID space has 2^(CONTEX_BITS + USER_ESID_BITS) - 1 segments
476 - * available for user mappings. Each segment contains 2^28 bytes. Each
477 - * context maps 2^46 bytes (64TB) so we can support 2^19-1 contexts
478 - * (19 == 37 + 28 - 46).
479 - */
480 -#define MAX_CONTEXT ((1UL << CONTEXT_BITS) - 1)
481 -
482 int __init_new_context(void)
483 {
484 int index;
485 @@ -56,7 +47,7 @@ again:
486 else if (err)
487 return err;
488
489 - if (index > MAX_CONTEXT) {
490 + if (index > MAX_USER_CONTEXT) {
491 spin_lock(&mmu_context_lock);
492 ida_remove(&mmu_context_ida, index);
493 spin_unlock(&mmu_context_lock);
494 diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
495 index e212a27..654258f 100644
496 --- a/arch/powerpc/mm/pgtable_64.c
497 +++ b/arch/powerpc/mm/pgtable_64.c
498 @@ -61,7 +61,7 @@
499 #endif
500
501 #ifdef CONFIG_PPC_STD_MMU_64
502 -#if TASK_SIZE_USER64 > (1UL << (USER_ESID_BITS + SID_SHIFT))
503 +#if TASK_SIZE_USER64 > (1UL << (ESID_BITS + SID_SHIFT))
504 #error TASK_SIZE_USER64 exceeds user VSID range
505 #endif
506 #endif
507 diff --git a/arch/powerpc/mm/slb_low.S b/arch/powerpc/mm/slb_low.S
508 index 1a16ca2..17aa6df 100644
509 --- a/arch/powerpc/mm/slb_low.S
510 +++ b/arch/powerpc/mm/slb_low.S
511 @@ -31,10 +31,15 @@
512 * No other registers are examined or changed.
513 */
514 _GLOBAL(slb_allocate_realmode)
515 - /* r3 = faulting address */
516 + /*
517 + * check for bad kernel/user address
518 + * (ea & ~REGION_MASK) >= PGTABLE_RANGE
519 + */
520 + rldicr. r9,r3,4,(63 - 46 - 4)
521 + bne- 8f
522
523 srdi r9,r3,60 /* get region */
524 - srdi r10,r3,28 /* get esid */
525 + srdi r10,r3,SID_SHIFT /* get esid */
526 cmpldi cr7,r9,0xc /* cmp PAGE_OFFSET for later use */
527
528 /* r3 = address, r10 = esid, cr7 = <> PAGE_OFFSET */
529 @@ -56,12 +61,14 @@ _GLOBAL(slb_allocate_realmode)
530 */
531 _GLOBAL(slb_miss_kernel_load_linear)
532 li r11,0
533 - li r9,0x1
534 /*
535 - * for 1T we shift 12 bits more. slb_finish_load_1T will do
536 - * the necessary adjustment
537 + * context = (MAX_USER_CONTEXT) + ((ea >> 60) - 0xc) + 1
538 + * r9 = region id.
539 */
540 - rldimi r10,r9,(CONTEXT_BITS + USER_ESID_BITS),0
541 + addis r9,r9,(MAX_USER_CONTEXT - 0xc + 1)@ha
542 + addi r9,r9,(MAX_USER_CONTEXT - 0xc + 1)@l
543 +
544 +
545 BEGIN_FTR_SECTION
546 b slb_finish_load
547 END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT)
548 @@ -91,24 +98,19 @@ _GLOBAL(slb_miss_kernel_load_vmemmap)
549 _GLOBAL(slb_miss_kernel_load_io)
550 li r11,0
551 6:
552 - li r9,0x1
553 /*
554 - * for 1T we shift 12 bits more. slb_finish_load_1T will do
555 - * the necessary adjustment
556 + * context = (MAX_USER_CONTEXT) + ((ea >> 60) - 0xc) + 1
557 + * r9 = region id.
558 */
559 - rldimi r10,r9,(CONTEXT_BITS + USER_ESID_BITS),0
560 + addis r9,r9,(MAX_USER_CONTEXT - 0xc + 1)@ha
561 + addi r9,r9,(MAX_USER_CONTEXT - 0xc + 1)@l
562 +
563 BEGIN_FTR_SECTION
564 b slb_finish_load
565 END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT)
566 b slb_finish_load_1T
567
568 -0: /* user address: proto-VSID = context << 15 | ESID. First check
569 - * if the address is within the boundaries of the user region
570 - */
571 - srdi. r9,r10,USER_ESID_BITS
572 - bne- 8f /* invalid ea bits set */
573 -
574 -
575 +0:
576 /* when using slices, we extract the psize off the slice bitmaps
577 * and then we need to get the sllp encoding off the mmu_psize_defs
578 * array.
579 @@ -164,15 +166,13 @@ END_MMU_FTR_SECTION_IFCLR(MMU_FTR_1T_SEGMENT)
580 ld r9,PACACONTEXTID(r13)
581 BEGIN_FTR_SECTION
582 cmpldi r10,0x1000
583 -END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
584 - rldimi r10,r9,USER_ESID_BITS,0
585 -BEGIN_FTR_SECTION
586 bge slb_finish_load_1T
587 END_MMU_FTR_SECTION_IFSET(MMU_FTR_1T_SEGMENT)
588 b slb_finish_load
589
590 8: /* invalid EA */
591 li r10,0 /* BAD_VSID */
592 + li r9,0 /* BAD_VSID */
593 li r11,SLB_VSID_USER /* flags don't much matter */
594 b slb_finish_load
595
596 @@ -221,8 +221,6 @@ _GLOBAL(slb_allocate_user)
597
598 /* get context to calculate proto-VSID */
599 ld r9,PACACONTEXTID(r13)
600 - rldimi r10,r9,USER_ESID_BITS,0
601 -
602 /* fall through slb_finish_load */
603
604 #endif /* __DISABLED__ */
605 @@ -231,9 +229,10 @@ _GLOBAL(slb_allocate_user)
606 /*
607 * Finish loading of an SLB entry and return
608 *
609 - * r3 = EA, r10 = proto-VSID, r11 = flags, clobbers r9, cr7 = <> PAGE_OFFSET
610 + * r3 = EA, r9 = context, r10 = ESID, r11 = flags, clobbers r9, cr7 = <> PAGE_OFFSET
611 */
612 slb_finish_load:
613 + rldimi r10,r9,ESID_BITS,0
614 ASM_VSID_SCRAMBLE(r10,r9,256M)
615 /*
616 * bits above VSID_BITS_256M need to be ignored from r10
617 @@ -298,10 +297,11 @@ _GLOBAL(slb_compare_rr_to_size)
618 /*
619 * Finish loading of a 1T SLB entry (for the kernel linear mapping) and return.
620 *
621 - * r3 = EA, r10 = proto-VSID, r11 = flags, clobbers r9
622 + * r3 = EA, r9 = context, r10 = ESID(256MB), r11 = flags, clobbers r9
623 */
624 slb_finish_load_1T:
625 - srdi r10,r10,40-28 /* get 1T ESID */
626 + srdi r10,r10,(SID_SHIFT_1T - SID_SHIFT) /* get 1T ESID */
627 + rldimi r10,r9,ESID_BITS_1T,0
628 ASM_VSID_SCRAMBLE(r10,r9,1T)
629 /*
630 * bits above VSID_BITS_1T need to be ignored from r10
631 diff --git a/arch/powerpc/mm/tlb_hash64.c b/arch/powerpc/mm/tlb_hash64.c
632 index 0d82ef5..023ec8a 100644
633 --- a/arch/powerpc/mm/tlb_hash64.c
634 +++ b/arch/powerpc/mm/tlb_hash64.c
635 @@ -82,11 +82,11 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
636 if (!is_kernel_addr(addr)) {
637 ssize = user_segment_size(addr);
638 vsid = get_vsid(mm->context.id, addr, ssize);
639 - WARN_ON(vsid == 0);
640 } else {
641 vsid = get_kernel_vsid(addr, mmu_kernel_ssize);
642 ssize = mmu_kernel_ssize;
643 }
644 + WARN_ON(vsid == 0);
645 vpn = hpt_vpn(addr, vsid, ssize);
646 rpte = __real_pte(__pte(pte), ptep);
647
648 diff --git a/arch/s390/include/asm/tlbflush.h b/arch/s390/include/asm/tlbflush.h
649 index 1d8fe2b..6b32af3 100644
650 --- a/arch/s390/include/asm/tlbflush.h
651 +++ b/arch/s390/include/asm/tlbflush.h
652 @@ -74,8 +74,6 @@ static inline void __tlb_flush_idte(unsigned long asce)
653
654 static inline void __tlb_flush_mm(struct mm_struct * mm)
655 {
656 - if (unlikely(cpumask_empty(mm_cpumask(mm))))
657 - return;
658 /*
659 * If the machine has IDTE we prefer to do a per mm flush
660 * on all cpus instead of doing a local flush if the mm
661 diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
662 index 5502285..94feff7 100644
663 --- a/arch/s390/kernel/entry.S
664 +++ b/arch/s390/kernel/entry.S
665 @@ -636,7 +636,8 @@ ENTRY(mcck_int_handler)
666 UPDATE_VTIME %r14,%r15,__LC_MCCK_ENTER_TIMER
667 mcck_skip:
668 SWITCH_ASYNC __LC_GPREGS_SAVE_AREA+32,__LC_PANIC_STACK,PAGE_SHIFT
669 - mvc __PT_R0(64,%r11),__LC_GPREGS_SAVE_AREA
670 + stm %r0,%r7,__PT_R0(%r11)
671 + mvc __PT_R8(32,%r11),__LC_GPREGS_SAVE_AREA+32
672 stm %r8,%r9,__PT_PSW(%r11)
673 xc __SF_BACKCHAIN(4,%r15),__SF_BACKCHAIN(%r15)
674 l %r1,BASED(.Ldo_machine_check)
675 diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
676 index 6d34e0c..082b845 100644
677 --- a/arch/s390/kernel/entry64.S
678 +++ b/arch/s390/kernel/entry64.S
679 @@ -678,8 +678,9 @@ ENTRY(mcck_int_handler)
680 UPDATE_VTIME %r14,__LC_MCCK_ENTER_TIMER
681 LAST_BREAK %r14
682 mcck_skip:
683 - lghi %r14,__LC_GPREGS_SAVE_AREA
684 - mvc __PT_R0(128,%r11),0(%r14)
685 + lghi %r14,__LC_GPREGS_SAVE_AREA+64
686 + stmg %r0,%r7,__PT_R0(%r11)
687 + mvc __PT_R8(64,%r11),0(%r14)
688 stmg %r8,%r9,__PT_PSW(%r11)
689 xc __SF_BACKCHAIN(8,%r15),__SF_BACKCHAIN(%r15)
690 lgr %r2,%r11 # pass pointer to pt_regs
691 diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
692 index 826054a..b05a575 100644
693 --- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
694 +++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
695 @@ -729,3 +729,13 @@ void intel_ds_init(void)
696 }
697 }
698 }
699 +
700 +void perf_restore_debug_store(void)
701 +{
702 + struct debug_store *ds = __this_cpu_read(cpu_hw_events.ds);
703 +
704 + if (!x86_pmu.bts && !x86_pmu.pebs)
705 + return;
706 +
707 + wrmsrl(MSR_IA32_DS_AREA, (unsigned long)ds);
708 +}
709 diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c
710 index 120cee1..3c68768 100644
711 --- a/arch/x86/power/cpu.c
712 +++ b/arch/x86/power/cpu.c
713 @@ -11,6 +11,7 @@
714 #include <linux/suspend.h>
715 #include <linux/export.h>
716 #include <linux/smp.h>
717 +#include <linux/perf_event.h>
718
719 #include <asm/pgtable.h>
720 #include <asm/proto.h>
721 @@ -228,6 +229,7 @@ static void __restore_processor_state(struct saved_context *ctxt)
722 do_fpu_end();
723 x86_platform.restore_sched_clock_state();
724 mtrr_bp_restore();
725 + perf_restore_debug_store();
726 }
727
728 /* Needed by apm.c */
729 diff --git a/drivers/block/loop.c b/drivers/block/loop.c
730 index ae12512..8bc6d39 100644
731 --- a/drivers/block/loop.c
732 +++ b/drivers/block/loop.c
733 @@ -1285,11 +1285,9 @@ static int loop_set_capacity(struct loop_device *lo, struct block_device *bdev)
734 /* the width of sector_t may be narrow for bit-shift */
735 sz = sec;
736 sz <<= 9;
737 - mutex_lock(&bdev->bd_mutex);
738 bd_set_size(bdev, sz);
739 /* let user-space know about the new size */
740 kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, KOBJ_CHANGE);
741 - mutex_unlock(&bdev->bd_mutex);
742
743 out:
744 return err;
745 @@ -1858,11 +1856,15 @@ static int __init loop_init(void)
746 max_part = (1UL << part_shift) - 1;
747 }
748
749 - if ((1UL << part_shift) > DISK_MAX_PARTS)
750 - return -EINVAL;
751 + if ((1UL << part_shift) > DISK_MAX_PARTS) {
752 + err = -EINVAL;
753 + goto misc_out;
754 + }
755
756 - if (max_loop > 1UL << (MINORBITS - part_shift))
757 - return -EINVAL;
758 + if (max_loop > 1UL << (MINORBITS - part_shift)) {
759 + err = -EINVAL;
760 + goto misc_out;
761 + }
762
763 /*
764 * If max_loop is specified, create that many devices upfront.
765 @@ -1880,8 +1882,10 @@ static int __init loop_init(void)
766 range = 1UL << MINORBITS;
767 }
768
769 - if (register_blkdev(LOOP_MAJOR, "loop"))
770 - return -EIO;
771 + if (register_blkdev(LOOP_MAJOR, "loop")) {
772 + err = -EIO;
773 + goto misc_out;
774 + }
775
776 blk_register_region(MKDEV(LOOP_MAJOR, 0), range,
777 THIS_MODULE, loop_probe, NULL, NULL);
778 @@ -1894,6 +1898,10 @@ static int __init loop_init(void)
779
780 printk(KERN_INFO "loop: module loaded\n");
781 return 0;
782 +
783 +misc_out:
784 + misc_deregister(&loop_misc);
785 + return err;
786 }
787
788 static int loop_exit_cb(int id, void *ptr, void *data)
789 diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
790 index b65c103..1acc4e0 100644
791 --- a/drivers/char/hw_random/virtio-rng.c
792 +++ b/drivers/char/hw_random/virtio-rng.c
793 @@ -92,14 +92,22 @@ static int probe_common(struct virtio_device *vdev)
794 {
795 int err;
796
797 + if (vq) {
798 + /* We only support one device for now */
799 + return -EBUSY;
800 + }
801 /* We expect a single virtqueue. */
802 vq = virtio_find_single_vq(vdev, random_recv_done, "input");
803 - if (IS_ERR(vq))
804 - return PTR_ERR(vq);
805 + if (IS_ERR(vq)) {
806 + err = PTR_ERR(vq);
807 + vq = NULL;
808 + return err;
809 + }
810
811 err = hwrng_register(&virtio_hwrng);
812 if (err) {
813 vdev->config->del_vqs(vdev);
814 + vq = NULL;
815 return err;
816 }
817
818 @@ -112,6 +120,7 @@ static void remove_common(struct virtio_device *vdev)
819 busy = false;
820 hwrng_unregister(&virtio_hwrng);
821 vdev->config->del_vqs(vdev);
822 + vq = NULL;
823 }
824
825 static int virtrng_probe(struct virtio_device *vdev)
826 diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
827 index 5206f24..99daa89 100644
828 --- a/drivers/gpu/drm/i915/i915_dma.c
829 +++ b/drivers/gpu/drm/i915/i915_dma.c
830 @@ -1297,21 +1297,19 @@ static int i915_load_modeset_init(struct drm_device *dev)
831 if (ret)
832 goto cleanup_vga_switcheroo;
833
834 - ret = drm_irq_install(dev);
835 - if (ret)
836 - goto cleanup_gem_stolen;
837 -
838 - /* Important: The output setup functions called by modeset_init need
839 - * working irqs for e.g. gmbus and dp aux transfers. */
840 intel_modeset_init(dev);
841
842 ret = i915_gem_init(dev);
843 if (ret)
844 - goto cleanup_irq;
845 + goto cleanup_gem_stolen;
846 +
847 + intel_modeset_gem_init(dev);
848
849 INIT_WORK(&dev_priv->console_resume_work, intel_console_resume);
850
851 - intel_modeset_gem_init(dev);
852 + ret = drm_irq_install(dev);
853 + if (ret)
854 + goto cleanup_gem;
855
856 /* Always safe in the mode setting case. */
857 /* FIXME: do pre/post-mode set stuff in core KMS code */
858 @@ -1319,10 +1317,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
859
860 ret = intel_fbdev_init(dev);
861 if (ret)
862 - goto cleanup_gem;
863 -
864 - /* Only enable hotplug handling once the fbdev is fully set up. */
865 - dev_priv->enable_hotplug_processing = true;
866 + goto cleanup_irq;
867
868 drm_kms_helper_poll_init(dev);
869
870 @@ -1331,13 +1326,13 @@ static int i915_load_modeset_init(struct drm_device *dev)
871
872 return 0;
873
874 +cleanup_irq:
875 + drm_irq_uninstall(dev);
876 cleanup_gem:
877 mutex_lock(&dev->struct_mutex);
878 i915_gem_cleanup_ringbuffer(dev);
879 mutex_unlock(&dev->struct_mutex);
880 i915_gem_cleanup_aliasing_ppgtt(dev);
881 -cleanup_irq:
882 - drm_irq_uninstall(dev);
883 cleanup_gem_stolen:
884 i915_gem_cleanup_stolen(dev);
885 cleanup_vga_switcheroo:
886 diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
887 index fb6454c..79f5fc5 100644
888 --- a/drivers/gpu/drm/i915/i915_drv.c
889 +++ b/drivers/gpu/drm/i915/i915_drv.c
890 @@ -486,7 +486,6 @@ static int i915_drm_freeze(struct drm_device *dev)
891 intel_modeset_disable(dev);
892
893 drm_irq_uninstall(dev);
894 - dev_priv->enable_hotplug_processing = false;
895 }
896
897 i915_save_state(dev);
898 @@ -563,19 +562,9 @@ static int __i915_drm_thaw(struct drm_device *dev)
899 error = i915_gem_init_hw(dev);
900 mutex_unlock(&dev->struct_mutex);
901
902 - /* We need working interrupts for modeset enabling ... */
903 - drm_irq_install(dev);
904 -
905 intel_modeset_init_hw(dev);
906 intel_modeset_setup_hw_state(dev, false);
907 -
908 - /*
909 - * ... but also need to make sure that hotplug processing
910 - * doesn't cause havoc. Like in the driver load code we don't
911 - * bother with the tiny race here where we might loose hotplug
912 - * notifications.
913 - * */
914 - dev_priv->enable_hotplug_processing = true;
915 + drm_irq_install(dev);
916 }
917
918 intel_opregion_init(dev);
919 diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
920 index 66ad64f..7339a4b 100644
921 --- a/drivers/gpu/drm/i915/i915_drv.h
922 +++ b/drivers/gpu/drm/i915/i915_drv.h
923 @@ -672,7 +672,6 @@ typedef struct drm_i915_private {
924
925 u32 hotplug_supported_mask;
926 struct work_struct hotplug_work;
927 - bool enable_hotplug_processing;
928
929 int num_pipe;
930 int num_pch_pll;
931 diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
932 index 3c00403..fe84338 100644
933 --- a/drivers/gpu/drm/i915/i915_irq.c
934 +++ b/drivers/gpu/drm/i915/i915_irq.c
935 @@ -287,10 +287,6 @@ static void i915_hotplug_work_func(struct work_struct *work)
936 struct drm_mode_config *mode_config = &dev->mode_config;
937 struct intel_encoder *encoder;
938
939 - /* HPD irq before everything is fully set up. */
940 - if (!dev_priv->enable_hotplug_processing)
941 - return;
942 -
943 mutex_lock(&mode_config->mutex);
944 DRM_DEBUG_KMS("running encoder hotplug functions\n");
945
946 diff --git a/drivers/hwmon/lineage-pem.c b/drivers/hwmon/lineage-pem.c
947 index 41df29f..ebbb9f4 100644
948 --- a/drivers/hwmon/lineage-pem.c
949 +++ b/drivers/hwmon/lineage-pem.c
950 @@ -422,6 +422,7 @@ static struct attribute *pem_input_attributes[] = {
951 &sensor_dev_attr_in2_input.dev_attr.attr,
952 &sensor_dev_attr_curr1_input.dev_attr.attr,
953 &sensor_dev_attr_power1_input.dev_attr.attr,
954 + NULL
955 };
956
957 static const struct attribute_group pem_input_group = {
958 @@ -432,6 +433,7 @@ static struct attribute *pem_fan_attributes[] = {
959 &sensor_dev_attr_fan1_input.dev_attr.attr,
960 &sensor_dev_attr_fan2_input.dev_attr.attr,
961 &sensor_dev_attr_fan3_input.dev_attr.attr,
962 + NULL
963 };
964
965 static const struct attribute_group pem_fan_group = {
966 diff --git a/drivers/hwmon/pmbus/ltc2978.c b/drivers/hwmon/pmbus/ltc2978.c
967 index a58de38..6d61307 100644
968 --- a/drivers/hwmon/pmbus/ltc2978.c
969 +++ b/drivers/hwmon/pmbus/ltc2978.c
970 @@ -59,7 +59,7 @@ enum chips { ltc2978, ltc3880 };
971 struct ltc2978_data {
972 enum chips id;
973 int vin_min, vin_max;
974 - int temp_min, temp_max;
975 + int temp_min, temp_max[2];
976 int vout_min[8], vout_max[8];
977 int iout_max[2];
978 int temp2_max;
979 @@ -113,9 +113,10 @@ static int ltc2978_read_word_data_common(struct i2c_client *client, int page,
980 ret = pmbus_read_word_data(client, page,
981 LTC2978_MFR_TEMPERATURE_PEAK);
982 if (ret >= 0) {
983 - if (lin11_to_val(ret) > lin11_to_val(data->temp_max))
984 - data->temp_max = ret;
985 - ret = data->temp_max;
986 + if (lin11_to_val(ret)
987 + > lin11_to_val(data->temp_max[page]))
988 + data->temp_max[page] = ret;
989 + ret = data->temp_max[page];
990 }
991 break;
992 case PMBUS_VIRT_RESET_VOUT_HISTORY:
993 @@ -266,7 +267,7 @@ static int ltc2978_write_word_data(struct i2c_client *client, int page,
994 break;
995 case PMBUS_VIRT_RESET_TEMP_HISTORY:
996 data->temp_min = 0x7bff;
997 - data->temp_max = 0x7c00;
998 + data->temp_max[page] = 0x7c00;
999 ret = ltc2978_clear_peaks(client, page, data->id);
1000 break;
1001 default:
1002 @@ -323,7 +324,8 @@ static int ltc2978_probe(struct i2c_client *client,
1003 data->vin_min = 0x7bff;
1004 data->vin_max = 0x7c00;
1005 data->temp_min = 0x7bff;
1006 - data->temp_max = 0x7c00;
1007 + for (i = 0; i < ARRAY_SIZE(data->temp_max); i++)
1008 + data->temp_max[i] = 0x7c00;
1009 data->temp2_max = 0x7c00;
1010
1011 switch (data->id) {
1012 diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
1013 index 3766682..db04f53 100644
1014 --- a/drivers/mtd/nand/nand_base.c
1015 +++ b/drivers/mtd/nand/nand_base.c
1016 @@ -1527,6 +1527,14 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
1017 oobreadlen -= toread;
1018 }
1019 }
1020 +
1021 + if (chip->options & NAND_NEED_READRDY) {
1022 + /* Apply delay or wait for ready/busy pin */
1023 + if (!chip->dev_ready)
1024 + udelay(chip->chip_delay);
1025 + else
1026 + nand_wait_ready(mtd);
1027 + }
1028 } else {
1029 memcpy(buf, chip->buffers->databuf + col, bytes);
1030 buf += bytes;
1031 @@ -1791,6 +1799,14 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
1032 len = min(len, readlen);
1033 buf = nand_transfer_oob(chip, buf, ops, len);
1034
1035 + if (chip->options & NAND_NEED_READRDY) {
1036 + /* Apply delay or wait for ready/busy pin */
1037 + if (!chip->dev_ready)
1038 + udelay(chip->chip_delay);
1039 + else
1040 + nand_wait_ready(mtd);
1041 + }
1042 +
1043 readlen -= len;
1044 if (!readlen)
1045 break;
1046 diff --git a/drivers/mtd/nand/nand_ids.c b/drivers/mtd/nand/nand_ids.c
1047 index e3aa274..9c61238 100644
1048 --- a/drivers/mtd/nand/nand_ids.c
1049 +++ b/drivers/mtd/nand/nand_ids.c
1050 @@ -22,49 +22,51 @@
1051 * 512 512 Byte page size
1052 */
1053 struct nand_flash_dev nand_flash_ids[] = {
1054 +#define SP_OPTIONS NAND_NEED_READRDY
1055 +#define SP_OPTIONS16 (SP_OPTIONS | NAND_BUSWIDTH_16)
1056
1057 #ifdef CONFIG_MTD_NAND_MUSEUM_IDS
1058 - {"NAND 1MiB 5V 8-bit", 0x6e, 256, 1, 0x1000, 0},
1059 - {"NAND 2MiB 5V 8-bit", 0x64, 256, 2, 0x1000, 0},
1060 - {"NAND 4MiB 5V 8-bit", 0x6b, 512, 4, 0x2000, 0},
1061 - {"NAND 1MiB 3,3V 8-bit", 0xe8, 256, 1, 0x1000, 0},
1062 - {"NAND 1MiB 3,3V 8-bit", 0xec, 256, 1, 0x1000, 0},
1063 - {"NAND 2MiB 3,3V 8-bit", 0xea, 256, 2, 0x1000, 0},
1064 - {"NAND 4MiB 3,3V 8-bit", 0xd5, 512, 4, 0x2000, 0},
1065 - {"NAND 4MiB 3,3V 8-bit", 0xe3, 512, 4, 0x2000, 0},
1066 - {"NAND 4MiB 3,3V 8-bit", 0xe5, 512, 4, 0x2000, 0},
1067 - {"NAND 8MiB 3,3V 8-bit", 0xd6, 512, 8, 0x2000, 0},
1068 -
1069 - {"NAND 8MiB 1,8V 8-bit", 0x39, 512, 8, 0x2000, 0},
1070 - {"NAND 8MiB 3,3V 8-bit", 0xe6, 512, 8, 0x2000, 0},
1071 - {"NAND 8MiB 1,8V 16-bit", 0x49, 512, 8, 0x2000, NAND_BUSWIDTH_16},
1072 - {"NAND 8MiB 3,3V 16-bit", 0x59, 512, 8, 0x2000, NAND_BUSWIDTH_16},
1073 + {"NAND 1MiB 5V 8-bit", 0x6e, 256, 1, 0x1000, SP_OPTIONS},
1074 + {"NAND 2MiB 5V 8-bit", 0x64, 256, 2, 0x1000, SP_OPTIONS},
1075 + {"NAND 4MiB 5V 8-bit", 0x6b, 512, 4, 0x2000, SP_OPTIONS},
1076 + {"NAND 1MiB 3,3V 8-bit", 0xe8, 256, 1, 0x1000, SP_OPTIONS},
1077 + {"NAND 1MiB 3,3V 8-bit", 0xec, 256, 1, 0x1000, SP_OPTIONS},
1078 + {"NAND 2MiB 3,3V 8-bit", 0xea, 256, 2, 0x1000, SP_OPTIONS},
1079 + {"NAND 4MiB 3,3V 8-bit", 0xd5, 512, 4, 0x2000, SP_OPTIONS},
1080 + {"NAND 4MiB 3,3V 8-bit", 0xe3, 512, 4, 0x2000, SP_OPTIONS},
1081 + {"NAND 4MiB 3,3V 8-bit", 0xe5, 512, 4, 0x2000, SP_OPTIONS},
1082 + {"NAND 8MiB 3,3V 8-bit", 0xd6, 512, 8, 0x2000, SP_OPTIONS},
1083 +
1084 + {"NAND 8MiB 1,8V 8-bit", 0x39, 512, 8, 0x2000, SP_OPTIONS},
1085 + {"NAND 8MiB 3,3V 8-bit", 0xe6, 512, 8, 0x2000, SP_OPTIONS},
1086 + {"NAND 8MiB 1,8V 16-bit", 0x49, 512, 8, 0x2000, SP_OPTIONS16},
1087 + {"NAND 8MiB 3,3V 16-bit", 0x59, 512, 8, 0x2000, SP_OPTIONS16},
1088 #endif
1089
1090 - {"NAND 16MiB 1,8V 8-bit", 0x33, 512, 16, 0x4000, 0},
1091 - {"NAND 16MiB 3,3V 8-bit", 0x73, 512, 16, 0x4000, 0},
1092 - {"NAND 16MiB 1,8V 16-bit", 0x43, 512, 16, 0x4000, NAND_BUSWIDTH_16},
1093 - {"NAND 16MiB 3,3V 16-bit", 0x53, 512, 16, 0x4000, NAND_BUSWIDTH_16},
1094 -
1095 - {"NAND 32MiB 1,8V 8-bit", 0x35, 512, 32, 0x4000, 0},
1096 - {"NAND 32MiB 3,3V 8-bit", 0x75, 512, 32, 0x4000, 0},
1097 - {"NAND 32MiB 1,8V 16-bit", 0x45, 512, 32, 0x4000, NAND_BUSWIDTH_16},
1098 - {"NAND 32MiB 3,3V 16-bit", 0x55, 512, 32, 0x4000, NAND_BUSWIDTH_16},
1099 -
1100 - {"NAND 64MiB 1,8V 8-bit", 0x36, 512, 64, 0x4000, 0},
1101 - {"NAND 64MiB 3,3V 8-bit", 0x76, 512, 64, 0x4000, 0},
1102 - {"NAND 64MiB 1,8V 16-bit", 0x46, 512, 64, 0x4000, NAND_BUSWIDTH_16},
1103 - {"NAND 64MiB 3,3V 16-bit", 0x56, 512, 64, 0x4000, NAND_BUSWIDTH_16},
1104 -
1105 - {"NAND 128MiB 1,8V 8-bit", 0x78, 512, 128, 0x4000, 0},
1106 - {"NAND 128MiB 1,8V 8-bit", 0x39, 512, 128, 0x4000, 0},
1107 - {"NAND 128MiB 3,3V 8-bit", 0x79, 512, 128, 0x4000, 0},
1108 - {"NAND 128MiB 1,8V 16-bit", 0x72, 512, 128, 0x4000, NAND_BUSWIDTH_16},
1109 - {"NAND 128MiB 1,8V 16-bit", 0x49, 512, 128, 0x4000, NAND_BUSWIDTH_16},
1110 - {"NAND 128MiB 3,3V 16-bit", 0x74, 512, 128, 0x4000, NAND_BUSWIDTH_16},
1111 - {"NAND 128MiB 3,3V 16-bit", 0x59, 512, 128, 0x4000, NAND_BUSWIDTH_16},
1112 -
1113 - {"NAND 256MiB 3,3V 8-bit", 0x71, 512, 256, 0x4000, 0},
1114 + {"NAND 16MiB 1,8V 8-bit", 0x33, 512, 16, 0x4000, SP_OPTIONS},
1115 + {"NAND 16MiB 3,3V 8-bit", 0x73, 512, 16, 0x4000, SP_OPTIONS},
1116 + {"NAND 16MiB 1,8V 16-bit", 0x43, 512, 16, 0x4000, SP_OPTIONS16},
1117 + {"NAND 16MiB 3,3V 16-bit", 0x53, 512, 16, 0x4000, SP_OPTIONS16},
1118 +
1119 + {"NAND 32MiB 1,8V 8-bit", 0x35, 512, 32, 0x4000, SP_OPTIONS},
1120 + {"NAND 32MiB 3,3V 8-bit", 0x75, 512, 32, 0x4000, SP_OPTIONS},
1121 + {"NAND 32MiB 1,8V 16-bit", 0x45, 512, 32, 0x4000, SP_OPTIONS16},
1122 + {"NAND 32MiB 3,3V 16-bit", 0x55, 512, 32, 0x4000, SP_OPTIONS16},
1123 +
1124 + {"NAND 64MiB 1,8V 8-bit", 0x36, 512, 64, 0x4000, SP_OPTIONS},
1125 + {"NAND 64MiB 3,3V 8-bit", 0x76, 512, 64, 0x4000, SP_OPTIONS},
1126 + {"NAND 64MiB 1,8V 16-bit", 0x46, 512, 64, 0x4000, SP_OPTIONS16},
1127 + {"NAND 64MiB 3,3V 16-bit", 0x56, 512, 64, 0x4000, SP_OPTIONS16},
1128 +
1129 + {"NAND 128MiB 1,8V 8-bit", 0x78, 512, 128, 0x4000, SP_OPTIONS},
1130 + {"NAND 128MiB 1,8V 8-bit", 0x39, 512, 128, 0x4000, SP_OPTIONS},
1131 + {"NAND 128MiB 3,3V 8-bit", 0x79, 512, 128, 0x4000, SP_OPTIONS},
1132 + {"NAND 128MiB 1,8V 16-bit", 0x72, 512, 128, 0x4000, SP_OPTIONS16},
1133 + {"NAND 128MiB 1,8V 16-bit", 0x49, 512, 128, 0x4000, SP_OPTIONS16},
1134 + {"NAND 128MiB 3,3V 16-bit", 0x74, 512, 128, 0x4000, SP_OPTIONS16},
1135 + {"NAND 128MiB 3,3V 16-bit", 0x59, 512, 128, 0x4000, SP_OPTIONS16},
1136 +
1137 + {"NAND 256MiB 3,3V 8-bit", 0x71, 512, 256, 0x4000, SP_OPTIONS},
1138
1139 /*
1140 * These are the new chips with large page size. The pagesize and the
1141 diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
1142 index b7d45f3..a079da17 100644
1143 --- a/drivers/net/bonding/bond_main.c
1144 +++ b/drivers/net/bonding/bond_main.c
1145 @@ -1943,7 +1943,6 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1146 }
1147
1148 block_netpoll_tx();
1149 - call_netdevice_notifiers(NETDEV_RELEASE, bond_dev);
1150 write_lock_bh(&bond->lock);
1151
1152 slave = bond_get_slave_by_dev(bond, slave_dev);
1153 @@ -2047,8 +2046,10 @@ int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
1154 write_unlock_bh(&bond->lock);
1155 unblock_netpoll_tx();
1156
1157 - if (bond->slave_cnt == 0)
1158 + if (bond->slave_cnt == 0) {
1159 call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev);
1160 + call_netdevice_notifiers(NETDEV_RELEASE, bond->dev);
1161 + }
1162
1163 bond_compute_features(bond);
1164 if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) &&
1165 diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
1166 index 0035c01..bfcb8bc 100644
1167 --- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
1168 +++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
1169 @@ -2075,7 +2075,7 @@ static int atl1c_tx_map(struct atl1c_adapter *adapter,
1170 if (unlikely(pci_dma_mapping_error(adapter->pdev,
1171 buffer_info->dma)))
1172 goto err_dma;
1173 -
1174 + ATL1C_SET_BUFFER_STATE(buffer_info, ATL1C_BUFFER_BUSY);
1175 ATL1C_SET_PCIMAP_TYPE(buffer_info, ATL1C_PCIMAP_SINGLE,
1176 ATL1C_PCIMAP_TODEVICE);
1177 mapped_len += map_len;
1178 diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
1179 index 88291bb..bf3f4bc 100644
1180 --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
1181 +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
1182 @@ -1434,12 +1434,11 @@ int mlx4_en_alloc_resources(struct mlx4_en_priv *priv)
1183 }
1184
1185 #ifdef CONFIG_RFS_ACCEL
1186 - priv->dev->rx_cpu_rmap = alloc_irq_cpu_rmap(priv->mdev->dev->caps.comp_pool);
1187 - if (!priv->dev->rx_cpu_rmap)
1188 - goto err;
1189 -
1190 - INIT_LIST_HEAD(&priv->filters);
1191 - spin_lock_init(&priv->filters_lock);
1192 + if (priv->mdev->dev->caps.comp_pool) {
1193 + priv->dev->rx_cpu_rmap = alloc_irq_cpu_rmap(priv->mdev->dev->caps.comp_pool);
1194 + if (!priv->dev->rx_cpu_rmap)
1195 + goto err;
1196 + }
1197 #endif
1198
1199 return 0;
1200 @@ -1634,6 +1633,11 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
1201 if (err)
1202 goto out;
1203
1204 +#ifdef CONFIG_RFS_ACCEL
1205 + INIT_LIST_HEAD(&priv->filters);
1206 + spin_lock_init(&priv->filters_lock);
1207 +#endif
1208 +
1209 /* Allocate page for receive rings */
1210 err = mlx4_alloc_hwq_res(mdev->dev, &priv->res,
1211 MLX4_EN_PAGE_SIZE, MLX4_EN_PAGE_SIZE);
1212 diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
1213 index d3fb97d..e5cb723 100644
1214 --- a/drivers/net/macvlan.c
1215 +++ b/drivers/net/macvlan.c
1216 @@ -628,6 +628,7 @@ void macvlan_common_setup(struct net_device *dev)
1217 ether_setup(dev);
1218
1219 dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
1220 + dev->priv_flags |= IFF_UNICAST_FLT;
1221 dev->netdev_ops = &macvlan_netdev_ops;
1222 dev->destructor = free_netdev;
1223 dev->header_ops = &macvlan_hard_header_ops,
1224 diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
1225 index ad86660..8efe47a 100644
1226 --- a/drivers/net/team/team.c
1227 +++ b/drivers/net/team/team.c
1228 @@ -1139,6 +1139,8 @@ static int team_port_del(struct team *team, struct net_device *port_dev)
1229 netdev_set_master(port_dev, NULL);
1230 team_port_disable_netpoll(port);
1231 vlan_vids_del_by_dev(port_dev, dev);
1232 + dev_uc_unsync(port_dev, dev);
1233 + dev_mc_unsync(port_dev, dev);
1234 dev_close(port_dev);
1235 team_port_leave(team, port);
1236 team_port_set_orig_dev_addr(port);
1237 diff --git a/drivers/net/tun.c b/drivers/net/tun.c
1238 index 2917a86..cb95fe5 100644
1239 --- a/drivers/net/tun.c
1240 +++ b/drivers/net/tun.c
1241 @@ -748,6 +748,8 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
1242 goto drop;
1243 skb_orphan(skb);
1244
1245 + nf_reset(skb);
1246 +
1247 /* Enqueue packet */
1248 skb_queue_tail(&tfile->socket.sk->sk_receive_queue, skb);
1249
1250 diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
1251 index 656230e..6993bfa 100644
1252 --- a/drivers/net/vxlan.c
1253 +++ b/drivers/net/vxlan.c
1254 @@ -1491,6 +1491,15 @@ static __net_init int vxlan_init_net(struct net *net)
1255 static __net_exit void vxlan_exit_net(struct net *net)
1256 {
1257 struct vxlan_net *vn = net_generic(net, vxlan_net_id);
1258 + struct vxlan_dev *vxlan;
1259 + struct hlist_node *pos;
1260 + unsigned h;
1261 +
1262 + rtnl_lock();
1263 + for (h = 0; h < VNI_HASH_SIZE; ++h)
1264 + hlist_for_each_entry(vxlan, pos, &vn->vni_list[h], hlist)
1265 + dev_close(vxlan->dev);
1266 + rtnl_unlock();
1267
1268 if (vn->sock) {
1269 sk_release_kernel(vn->sock->sk);
1270 diff --git a/drivers/staging/comedi/drivers/dt9812.c b/drivers/staging/comedi/drivers/dt9812.c
1271 index 1767998..3e7f961 100644
1272 --- a/drivers/staging/comedi/drivers/dt9812.c
1273 +++ b/drivers/staging/comedi/drivers/dt9812.c
1274 @@ -948,12 +948,13 @@ static int dt9812_di_rinsn(struct comedi_device *dev,
1275 unsigned int *data)
1276 {
1277 struct comedi_dt9812 *devpriv = dev->private;
1278 + unsigned int channel = CR_CHAN(insn->chanspec);
1279 int n;
1280 u8 bits = 0;
1281
1282 dt9812_digital_in(devpriv->slot, &bits);
1283 for (n = 0; n < insn->n; n++)
1284 - data[n] = ((1 << insn->chanspec) & bits) != 0;
1285 + data[n] = ((1 << channel) & bits) != 0;
1286 return n;
1287 }
1288
1289 @@ -962,12 +963,13 @@ static int dt9812_do_winsn(struct comedi_device *dev,
1290 unsigned int *data)
1291 {
1292 struct comedi_dt9812 *devpriv = dev->private;
1293 + unsigned int channel = CR_CHAN(insn->chanspec);
1294 int n;
1295 u8 bits = 0;
1296
1297 dt9812_digital_out_shadow(devpriv->slot, &bits);
1298 for (n = 0; n < insn->n; n++) {
1299 - u8 mask = 1 << insn->chanspec;
1300 + u8 mask = 1 << channel;
1301
1302 bits &= ~mask;
1303 if (data[n])
1304 @@ -982,13 +984,13 @@ static int dt9812_ai_rinsn(struct comedi_device *dev,
1305 unsigned int *data)
1306 {
1307 struct comedi_dt9812 *devpriv = dev->private;
1308 + unsigned int channel = CR_CHAN(insn->chanspec);
1309 int n;
1310
1311 for (n = 0; n < insn->n; n++) {
1312 u16 value = 0;
1313
1314 - dt9812_analog_in(devpriv->slot, insn->chanspec, &value,
1315 - DT9812_GAIN_1);
1316 + dt9812_analog_in(devpriv->slot, channel, &value, DT9812_GAIN_1);
1317 data[n] = value;
1318 }
1319 return n;
1320 @@ -999,12 +1001,13 @@ static int dt9812_ao_rinsn(struct comedi_device *dev,
1321 unsigned int *data)
1322 {
1323 struct comedi_dt9812 *devpriv = dev->private;
1324 + unsigned int channel = CR_CHAN(insn->chanspec);
1325 int n;
1326 u16 value;
1327
1328 for (n = 0; n < insn->n; n++) {
1329 value = 0;
1330 - dt9812_analog_out_shadow(devpriv->slot, insn->chanspec, &value);
1331 + dt9812_analog_out_shadow(devpriv->slot, channel, &value);
1332 data[n] = value;
1333 }
1334 return n;
1335 @@ -1015,10 +1018,11 @@ static int dt9812_ao_winsn(struct comedi_device *dev,
1336 unsigned int *data)
1337 {
1338 struct comedi_dt9812 *devpriv = dev->private;
1339 + unsigned int channel = CR_CHAN(insn->chanspec);
1340 int n;
1341
1342 for (n = 0; n < insn->n; n++)
1343 - dt9812_analog_out(devpriv->slot, insn->chanspec, data[n]);
1344 + dt9812_analog_out(devpriv->slot, channel, data[n]);
1345 return n;
1346 }
1347
1348 diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
1349 index f33086d..f726970 100644
1350 --- a/drivers/staging/vt6656/main_usb.c
1351 +++ b/drivers/staging/vt6656/main_usb.c
1352 @@ -644,8 +644,6 @@ static int vt6656_suspend(struct usb_interface *intf, pm_message_t message)
1353 if (device->flags & DEVICE_FLAGS_OPENED)
1354 device_close(device->dev);
1355
1356 - usb_put_dev(interface_to_usbdev(intf));
1357 -
1358 return 0;
1359 }
1360
1361 @@ -656,8 +654,6 @@ static int vt6656_resume(struct usb_interface *intf)
1362 if (!device || !device->dev)
1363 return -ENODEV;
1364
1365 - usb_get_dev(interface_to_usbdev(intf));
1366 -
1367 if (!(device->flags & DEVICE_FLAGS_OPENED))
1368 device_open(device->dev);
1369
1370 diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
1371 index 79ff3a5..ac35c90 100644
1372 --- a/drivers/tty/pty.c
1373 +++ b/drivers/tty/pty.c
1374 @@ -47,7 +47,6 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
1375 /* Review - krefs on tty_link ?? */
1376 if (!tty->link)
1377 return;
1378 - tty->link->packet = 0;
1379 set_bit(TTY_OTHER_CLOSED, &tty->link->flags);
1380 wake_up_interruptible(&tty->link->read_wait);
1381 wake_up_interruptible(&tty->link->write_wait);
1382 diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
1383 index f932043..733f22c 100644
1384 --- a/drivers/tty/serial/8250/8250.c
1385 +++ b/drivers/tty/serial/8250/8250.c
1386 @@ -308,7 +308,28 @@ static const struct serial8250_config uart_config[] = {
1387 },
1388 [PORT_8250_CIR] = {
1389 .name = "CIR port"
1390 - }
1391 + },
1392 + [PORT_ALTR_16550_F32] = {
1393 + .name = "Altera 16550 FIFO32",
1394 + .fifo_size = 32,
1395 + .tx_loadsz = 32,
1396 + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
1397 + .flags = UART_CAP_FIFO | UART_CAP_AFE,
1398 + },
1399 + [PORT_ALTR_16550_F64] = {
1400 + .name = "Altera 16550 FIFO64",
1401 + .fifo_size = 64,
1402 + .tx_loadsz = 64,
1403 + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
1404 + .flags = UART_CAP_FIFO | UART_CAP_AFE,
1405 + },
1406 + [PORT_ALTR_16550_F128] = {
1407 + .name = "Altera 16550 FIFO128",
1408 + .fifo_size = 128,
1409 + .tx_loadsz = 128,
1410 + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10,
1411 + .flags = UART_CAP_FIFO | UART_CAP_AFE,
1412 + },
1413 };
1414
1415 /* Uart divisor latch read */
1416 @@ -3430,3 +3451,32 @@ module_param_array(probe_rsa, ulong, &probe_rsa_count, 0444);
1417 MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA");
1418 #endif
1419 MODULE_ALIAS_CHARDEV_MAJOR(TTY_MAJOR);
1420 +
1421 +#ifndef MODULE
1422 +/* This module was renamed to 8250_core in 3.7. Keep the old "8250" name
1423 + * working as well for the module options so we don't break people. We
1424 + * need to keep the names identical and the convenient macros will happily
1425 + * refuse to let us do that by failing the build with redefinition errors
1426 + * of global variables. So we stick them inside a dummy function to avoid
1427 + * those conflicts. The options still get parsed, and the redefined
1428 + * MODULE_PARAM_PREFIX lets us keep the "8250." syntax alive.
1429 + *
1430 + * This is hacky. I'm sorry.
1431 + */
1432 +static void __used s8250_options(void)
1433 +{
1434 +#undef MODULE_PARAM_PREFIX
1435 +#define MODULE_PARAM_PREFIX "8250."
1436 +
1437 + module_param_cb(share_irqs, &param_ops_uint, &share_irqs, 0644);
1438 + module_param_cb(nr_uarts, &param_ops_uint, &nr_uarts, 0644);
1439 + module_param_cb(skip_txen_test, &param_ops_uint, &skip_txen_test, 0644);
1440 +#ifdef CONFIG_SERIAL_8250_RSA
1441 + __module_param_call(MODULE_PARAM_PREFIX, probe_rsa,
1442 + &param_array_ops, .arr = &__param_arr_probe_rsa,
1443 + 0444, -1);
1444 +#endif
1445 +}
1446 +#else
1447 +MODULE_ALIAS("8250");
1448 +#endif
1449 diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
1450 index a27a98e..5cdb092 100644
1451 --- a/drivers/tty/serial/8250/8250_pci.c
1452 +++ b/drivers/tty/serial/8250/8250_pci.c
1453 @@ -1321,6 +1321,7 @@ pci_wch_ch353_setup(struct serial_private *priv,
1454
1455 /* Unknown vendors/cards - this should not be in linux/pci_ids.h */
1456 #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584
1457 +#define PCI_SUBDEVICE_ID_UNKNOWN_0x1588 0x1588
1458
1459 /*
1460 * Master list of serial port init/setup/exit quirks.
1461 @@ -1592,15 +1593,6 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
1462 },
1463 {
1464 .vendor = PCI_VENDOR_ID_PLX,
1465 - .device = PCI_DEVICE_ID_PLX_9050,
1466 - .subvendor = PCI_VENDOR_ID_PLX,
1467 - .subdevice = PCI_SUBDEVICE_ID_UNKNOWN_0x1584,
1468 - .init = pci_plx9050_init,
1469 - .setup = pci_default_setup,
1470 - .exit = pci_plx9050_exit,
1471 - },
1472 - {
1473 - .vendor = PCI_VENDOR_ID_PLX,
1474 .device = PCI_DEVICE_ID_PLX_ROMULUS,
1475 .subvendor = PCI_VENDOR_ID_PLX,
1476 .subdevice = PCI_DEVICE_ID_PLX_ROMULUS,
1477 @@ -3456,7 +3448,12 @@ static struct pci_device_id serial_pci_tbl[] = {
1478 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
1479 PCI_VENDOR_ID_PLX,
1480 PCI_SUBDEVICE_ID_UNKNOWN_0x1584, 0, 0,
1481 - pbn_b0_4_115200 },
1482 + pbn_b2_4_115200 },
1483 + /* Unknown card - subdevice 0x1588 */
1484 + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
1485 + PCI_VENDOR_ID_PLX,
1486 + PCI_SUBDEVICE_ID_UNKNOWN_0x1588, 0, 0,
1487 + pbn_b2_8_115200 },
1488 { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050,
1489 PCI_SUBVENDOR_ID_KEYSPAN,
1490 PCI_SUBDEVICE_ID_KEYSPAN_SX2, 0, 0,
1491 @@ -4449,6 +4446,10 @@ static struct pci_device_id serial_pci_tbl[] = {
1492 PCI_VENDOR_ID_IBM, 0x0299,
1493 0, 0, pbn_b0_bt_2_115200 },
1494
1495 + { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835,
1496 + 0x1000, 0x0012,
1497 + 0, 0, pbn_b0_bt_2_115200 },
1498 +
1499 { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9901,
1500 0xA000, 0x1000,
1501 0, 0, pbn_b0_1_115200 },
1502 diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c
1503 index 35d9ab9..b3455a9 100644
1504 --- a/drivers/tty/serial/8250/8250_pnp.c
1505 +++ b/drivers/tty/serial/8250/8250_pnp.c
1506 @@ -429,6 +429,7 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
1507 {
1508 struct uart_8250_port uart;
1509 int ret, line, flags = dev_id->driver_data;
1510 + struct resource *res = NULL;
1511
1512 if (flags & UNKNOWN_DEV) {
1513 ret = serial_pnp_guess_board(dev);
1514 @@ -439,11 +440,12 @@ serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id)
1515 memset(&uart, 0, sizeof(uart));
1516 if (pnp_irq_valid(dev, 0))
1517 uart.port.irq = pnp_irq(dev, 0);
1518 - if ((flags & CIR_PORT) && pnp_port_valid(dev, 2)) {
1519 - uart.port.iobase = pnp_port_start(dev, 2);
1520 - uart.port.iotype = UPIO_PORT;
1521 - } else if (pnp_port_valid(dev, 0)) {
1522 - uart.port.iobase = pnp_port_start(dev, 0);
1523 + if ((flags & CIR_PORT) && pnp_port_valid(dev, 2))
1524 + res = pnp_get_resource(dev, IORESOURCE_IO, 2);
1525 + else if (pnp_port_valid(dev, 0))
1526 + res = pnp_get_resource(dev, IORESOURCE_IO, 0);
1527 + if (pnp_resource_enabled(res)) {
1528 + uart.port.iobase = res->start;
1529 uart.port.iotype = UPIO_PORT;
1530 } else if (pnp_mem_valid(dev, 0)) {
1531 uart.port.mapbase = pnp_mem_start(dev, 0);
1532 diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
1533 index 59c23d0..02e706e 100644
1534 --- a/drivers/tty/serial/Kconfig
1535 +++ b/drivers/tty/serial/Kconfig
1536 @@ -209,14 +209,14 @@ config SERIAL_SAMSUNG
1537 config SERIAL_SAMSUNG_UARTS_4
1538 bool
1539 depends on PLAT_SAMSUNG
1540 - default y if !(CPU_S3C2410 || SERIAL_S3C2412 || CPU_S3C2440 || CPU_S3C2442)
1541 + default y if !(CPU_S3C2410 || CPU_S3C2412 || CPU_S3C2440 || CPU_S3C2442)
1542 help
1543 Internal node for the common case of 4 Samsung compatible UARTs
1544
1545 config SERIAL_SAMSUNG_UARTS
1546 int
1547 depends on PLAT_SAMSUNG
1548 - default 6 if ARCH_S5P6450
1549 + default 6 if CPU_S5P6450
1550 default 4 if SERIAL_SAMSUNG_UARTS_4 || CPU_S3C2416
1551 default 3
1552 help
1553 diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
1554 index e7cae1c..3490629 100644
1555 --- a/drivers/tty/serial/of_serial.c
1556 +++ b/drivers/tty/serial/of_serial.c
1557 @@ -240,6 +240,12 @@ static struct of_device_id of_platform_serial_table[] = {
1558 { .compatible = "ns16850", .data = (void *)PORT_16850, },
1559 { .compatible = "nvidia,tegra20-uart", .data = (void *)PORT_TEGRA, },
1560 { .compatible = "nxp,lpc3220-uart", .data = (void *)PORT_LPC3220, },
1561 + { .compatible = "altr,16550-FIFO32",
1562 + .data = (void *)PORT_ALTR_16550_F32, },
1563 + { .compatible = "altr,16550-FIFO64",
1564 + .data = (void *)PORT_ALTR_16550_F64, },
1565 + { .compatible = "altr,16550-FIFO128",
1566 + .data = (void *)PORT_ALTR_16550_F128, },
1567 #ifdef CONFIG_SERIAL_OF_PLATFORM_NWPSERIAL
1568 { .compatible = "ibm,qpace-nwp-serial",
1569 .data = (void *)PORT_NWPSERIAL, },
1570 diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
1571 index 45d9161..cd1f861 100644
1572 --- a/drivers/tty/tty_buffer.c
1573 +++ b/drivers/tty/tty_buffer.c
1574 @@ -473,7 +473,7 @@ static void flush_to_ldisc(struct work_struct *work)
1575 struct tty_ldisc *disc;
1576
1577 tty = port->itty;
1578 - if (WARN_RATELIMIT(tty == NULL, "tty is NULL\n"))
1579 + if (tty == NULL)
1580 return;
1581
1582 disc = tty_ldisc_ref(tty);
1583 diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
1584 index 5f0cb41..122d056 100644
1585 --- a/drivers/usb/class/cdc-wdm.c
1586 +++ b/drivers/usb/class/cdc-wdm.c
1587 @@ -56,6 +56,7 @@ MODULE_DEVICE_TABLE (usb, wdm_ids);
1588 #define WDM_RESPONDING 7
1589 #define WDM_SUSPENDING 8
1590 #define WDM_RESETTING 9
1591 +#define WDM_OVERFLOW 10
1592
1593 #define WDM_MAX 16
1594
1595 @@ -155,6 +156,7 @@ static void wdm_in_callback(struct urb *urb)
1596 {
1597 struct wdm_device *desc = urb->context;
1598 int status = urb->status;
1599 + int length = urb->actual_length;
1600
1601 spin_lock(&desc->iuspin);
1602 clear_bit(WDM_RESPONDING, &desc->flags);
1603 @@ -185,9 +187,17 @@ static void wdm_in_callback(struct urb *urb)
1604 }
1605
1606 desc->rerr = status;
1607 - desc->reslength = urb->actual_length;
1608 - memmove(desc->ubuf + desc->length, desc->inbuf, desc->reslength);
1609 - desc->length += desc->reslength;
1610 + if (length + desc->length > desc->wMaxCommand) {
1611 + /* The buffer would overflow */
1612 + set_bit(WDM_OVERFLOW, &desc->flags);
1613 + } else {
1614 + /* we may already be in overflow */
1615 + if (!test_bit(WDM_OVERFLOW, &desc->flags)) {
1616 + memmove(desc->ubuf + desc->length, desc->inbuf, length);
1617 + desc->length += length;
1618 + desc->reslength = length;
1619 + }
1620 + }
1621 skip_error:
1622 wake_up(&desc->wait);
1623
1624 @@ -435,6 +445,11 @@ retry:
1625 rv = -ENODEV;
1626 goto err;
1627 }
1628 + if (test_bit(WDM_OVERFLOW, &desc->flags)) {
1629 + clear_bit(WDM_OVERFLOW, &desc->flags);
1630 + rv = -ENOBUFS;
1631 + goto err;
1632 + }
1633 i++;
1634 if (file->f_flags & O_NONBLOCK) {
1635 if (!test_bit(WDM_READ, &desc->flags)) {
1636 @@ -478,6 +493,7 @@ retry:
1637 spin_unlock_irq(&desc->iuspin);
1638 goto retry;
1639 }
1640 +
1641 if (!desc->reslength) { /* zero length read */
1642 dev_dbg(&desc->intf->dev, "%s: zero length - clearing WDM_READ\n", __func__);
1643 clear_bit(WDM_READ, &desc->flags);
1644 @@ -1004,6 +1020,7 @@ static int wdm_post_reset(struct usb_interface *intf)
1645 struct wdm_device *desc = wdm_find_device(intf);
1646 int rv;
1647
1648 + clear_bit(WDM_OVERFLOW, &desc->flags);
1649 clear_bit(WDM_RESETTING, &desc->flags);
1650 rv = recover_from_urb_loss(desc);
1651 mutex_unlock(&desc->wlock);
1652 diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
1653 index 3a4004a..f00c749 100644
1654 --- a/drivers/usb/dwc3/core.c
1655 +++ b/drivers/usb/dwc3/core.c
1656 @@ -575,6 +575,7 @@ static int dwc3_remove(struct platform_device *pdev)
1657 break;
1658 }
1659
1660 + dwc3_free_event_buffers(dwc);
1661 dwc3_core_exit(dwc);
1662
1663 return 0;
1664 diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
1665 index fd252f0..eda2cf4 100644
1666 --- a/drivers/usb/host/ehci-q.c
1667 +++ b/drivers/usb/host/ehci-q.c
1668 @@ -135,7 +135,7 @@ qh_refresh (struct ehci_hcd *ehci, struct ehci_qh *qh)
1669 * qtd is updated in qh_completions(). Update the QH
1670 * overlay here.
1671 */
1672 - if (cpu_to_hc32(ehci, qtd->qtd_dma) == qh->hw->hw_current) {
1673 + if (qh->hw->hw_token & ACTIVE_BIT(ehci)) {
1674 qh->hw->hw_qtd_next = qtd->hw_next;
1675 qtd = NULL;
1676 }
1677 @@ -449,11 +449,19 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh)
1678 else if (last_status == -EINPROGRESS && !urb->unlinked)
1679 continue;
1680
1681 - /* qh unlinked; token in overlay may be most current */
1682 - if (state == QH_STATE_IDLE
1683 - && cpu_to_hc32(ehci, qtd->qtd_dma)
1684 - == hw->hw_current) {
1685 + /*
1686 + * If this was the active qtd when the qh was unlinked
1687 + * and the overlay's token is active, then the overlay
1688 + * hasn't been written back to the qtd yet so use its
1689 + * token instead of the qtd's. After the qtd is
1690 + * processed and removed, the overlay won't be valid
1691 + * any more.
1692 + */
1693 + if (state == QH_STATE_IDLE &&
1694 + qh->qtd_list.next == &qtd->qtd_list &&
1695 + (hw->hw_token & ACTIVE_BIT(ehci))) {
1696 token = hc32_to_cpu(ehci, hw->hw_token);
1697 + hw->hw_token &= ~ACTIVE_BIT(ehci);
1698
1699 /* An unlink may leave an incomplete
1700 * async transaction in the TT buffer.
1701 diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
1702 index edc0f0d..4747d1c 100644
1703 --- a/drivers/usb/serial/cp210x.c
1704 +++ b/drivers/usb/serial/cp210x.c
1705 @@ -85,6 +85,7 @@ static const struct usb_device_id id_table[] = {
1706 { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */
1707 { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */
1708 { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */
1709 + { USB_DEVICE(0x2405, 0x0003) }, /* West Mountain Radio RIGblaster Advantage */
1710 { USB_DEVICE(0x10C4, 0x8156) }, /* B&G H3000 link cable */
1711 { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */
1712 { USB_DEVICE(0x10C4, 0x815F) }, /* Timewave HamLinkUSB */
1713 @@ -150,6 +151,25 @@ static const struct usb_device_id id_table[] = {
1714 { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */
1715 { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */
1716 { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */
1717 + { USB_DEVICE(0x1FB9, 0x0100) }, /* Lake Shore Model 121 Current Source */
1718 + { USB_DEVICE(0x1FB9, 0x0200) }, /* Lake Shore Model 218A Temperature Monitor */
1719 + { USB_DEVICE(0x1FB9, 0x0201) }, /* Lake Shore Model 219 Temperature Monitor */
1720 + { USB_DEVICE(0x1FB9, 0x0202) }, /* Lake Shore Model 233 Temperature Transmitter */
1721 + { USB_DEVICE(0x1FB9, 0x0203) }, /* Lake Shore Model 235 Temperature Transmitter */
1722 + { USB_DEVICE(0x1FB9, 0x0300) }, /* Lake Shore Model 335 Temperature Controller */
1723 + { USB_DEVICE(0x1FB9, 0x0301) }, /* Lake Shore Model 336 Temperature Controller */
1724 + { USB_DEVICE(0x1FB9, 0x0302) }, /* Lake Shore Model 350 Temperature Controller */
1725 + { USB_DEVICE(0x1FB9, 0x0303) }, /* Lake Shore Model 371 AC Bridge */
1726 + { USB_DEVICE(0x1FB9, 0x0400) }, /* Lake Shore Model 411 Handheld Gaussmeter */
1727 + { USB_DEVICE(0x1FB9, 0x0401) }, /* Lake Shore Model 425 Gaussmeter */
1728 + { USB_DEVICE(0x1FB9, 0x0402) }, /* Lake Shore Model 455A Gaussmeter */
1729 + { USB_DEVICE(0x1FB9, 0x0403) }, /* Lake Shore Model 475A Gaussmeter */
1730 + { USB_DEVICE(0x1FB9, 0x0404) }, /* Lake Shore Model 465 Three Axis Gaussmeter */
1731 + { USB_DEVICE(0x1FB9, 0x0600) }, /* Lake Shore Model 625A Superconducting MPS */
1732 + { USB_DEVICE(0x1FB9, 0x0601) }, /* Lake Shore Model 642A Magnet Power Supply */
1733 + { USB_DEVICE(0x1FB9, 0x0602) }, /* Lake Shore Model 648 Magnet Power Supply */
1734 + { USB_DEVICE(0x1FB9, 0x0700) }, /* Lake Shore Model 737 VSM Controller */
1735 + { USB_DEVICE(0x1FB9, 0x0701) }, /* Lake Shore Model 776 Hall Matrix */
1736 { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */
1737 { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */
1738 { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */
1739 diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1740 index f7d339d..558adfc 100644
1741 --- a/drivers/usb/serial/option.c
1742 +++ b/drivers/usb/serial/option.c
1743 @@ -341,6 +341,8 @@ static void option_instat_callback(struct urb *urb);
1744 #define CINTERION_PRODUCT_EU3_E 0x0051
1745 #define CINTERION_PRODUCT_EU3_P 0x0052
1746 #define CINTERION_PRODUCT_PH8 0x0053
1747 +#define CINTERION_PRODUCT_AH6 0x0055
1748 +#define CINTERION_PRODUCT_PLS8 0x0060
1749
1750 /* Olivetti products */
1751 #define OLIVETTI_VENDOR_ID 0x0b3c
1752 @@ -579,6 +581,7 @@ static const struct usb_device_id option_ids[] = {
1753 { USB_DEVICE(QUANTA_VENDOR_ID, 0xea42),
1754 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1755 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c05, USB_CLASS_COMM, 0x02, 0xff) },
1756 + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c1f, USB_CLASS_COMM, 0x02, 0xff) },
1757 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) },
1758 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173, 0xff, 0xff, 0xff),
1759 .driver_info = (kernel_ulong_t) &net_intf1_blacklist },
1760 @@ -1260,6 +1263,8 @@ static const struct usb_device_id option_ids[] = {
1761 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_E) },
1762 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) },
1763 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8) },
1764 + { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AH6) },
1765 + { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLS8) },
1766 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) },
1767 { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
1768 { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) },
1769 diff --git a/drivers/usb/serial/qcaux.c b/drivers/usb/serial/qcaux.c
1770 index 9b1b96f..31f81c3 100644
1771 --- a/drivers/usb/serial/qcaux.c
1772 +++ b/drivers/usb/serial/qcaux.c
1773 @@ -69,6 +69,7 @@ static struct usb_device_id id_table[] = {
1774 { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfd, 0xff) }, /* NMEA */
1775 { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xfe, 0xff) }, /* WMC */
1776 { USB_VENDOR_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, 0xff, 0xff, 0xff) }, /* DIAG */
1777 + { USB_DEVICE_AND_INTERFACE_INFO(0x1fac, 0x0151, 0xff, 0xff, 0xff) },
1778 { },
1779 };
1780 MODULE_DEVICE_TABLE(usb, id_table);
1781 diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
1782 index 2466254..59b32b7 100644
1783 --- a/drivers/usb/serial/qcserial.c
1784 +++ b/drivers/usb/serial/qcserial.c
1785 @@ -197,12 +197,15 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
1786
1787 if (is_gobi1k) {
1788 /* Gobi 1K USB layout:
1789 - * 0: serial port (doesn't respond)
1790 + * 0: DM/DIAG (use libqcdm from ModemManager for communication)
1791 * 1: serial port (doesn't respond)
1792 * 2: AT-capable modem port
1793 * 3: QMI/net
1794 */
1795 - if (ifnum == 2)
1796 + if (ifnum == 0) {
1797 + dev_dbg(dev, "Gobi 1K DM/DIAG interface found\n");
1798 + altsetting = 1;
1799 + } else if (ifnum == 2)
1800 dev_dbg(dev, "Modem port found\n");
1801 else
1802 altsetting = -1;
1803 diff --git a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c
1804 index 7ab9046..105d900 100644
1805 --- a/drivers/usb/storage/initializers.c
1806 +++ b/drivers/usb/storage/initializers.c
1807 @@ -92,8 +92,8 @@ int usb_stor_ucr61s2b_init(struct us_data *us)
1808 return 0;
1809 }
1810
1811 -/* This places the HUAWEI usb dongles in multi-port mode */
1812 -static int usb_stor_huawei_feature_init(struct us_data *us)
1813 +/* This places the HUAWEI E220 devices in multi-port mode */
1814 +int usb_stor_huawei_e220_init(struct us_data *us)
1815 {
1816 int result;
1817
1818 @@ -104,75 +104,3 @@ static int usb_stor_huawei_feature_init(struct us_data *us)
1819 US_DEBUGP("Huawei mode set result is %d\n", result);
1820 return 0;
1821 }
1822 -
1823 -/*
1824 - * It will send a scsi switch command called rewind' to huawei dongle.
1825 - * When the dongle receives this command at the first time,
1826 - * it will reboot immediately. After rebooted, it will ignore this command.
1827 - * So it is unnecessary to read its response.
1828 - */
1829 -static int usb_stor_huawei_scsi_init(struct us_data *us)
1830 -{
1831 - int result = 0;
1832 - int act_len = 0;
1833 - struct bulk_cb_wrap *bcbw = (struct bulk_cb_wrap *) us->iobuf;
1834 - char rewind_cmd[] = {0x11, 0x06, 0x20, 0x00, 0x00, 0x01, 0x01, 0x00,
1835 - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
1836 -
1837 - bcbw->Signature = cpu_to_le32(US_BULK_CB_SIGN);
1838 - bcbw->Tag = 0;
1839 - bcbw->DataTransferLength = 0;
1840 - bcbw->Flags = bcbw->Lun = 0;
1841 - bcbw->Length = sizeof(rewind_cmd);
1842 - memset(bcbw->CDB, 0, sizeof(bcbw->CDB));
1843 - memcpy(bcbw->CDB, rewind_cmd, sizeof(rewind_cmd));
1844 -
1845 - result = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, bcbw,
1846 - US_BULK_CB_WRAP_LEN, &act_len);
1847 - US_DEBUGP("transfer actual length=%d, result=%d\n", act_len, result);
1848 - return result;
1849 -}
1850 -
1851 -/*
1852 - * It tries to find the supported Huawei USB dongles.
1853 - * In Huawei, they assign the following product IDs
1854 - * for all of their mobile broadband dongles,
1855 - * including the new dongles in the future.
1856 - * So if the product ID is not included in this list,
1857 - * it means it is not Huawei's mobile broadband dongles.
1858 - */
1859 -static int usb_stor_huawei_dongles_pid(struct us_data *us)
1860 -{
1861 - struct usb_interface_descriptor *idesc;
1862 - int idProduct;
1863 -
1864 - idesc = &us->pusb_intf->cur_altsetting->desc;
1865 - idProduct = le16_to_cpu(us->pusb_dev->descriptor.idProduct);
1866 - /* The first port is CDROM,
1867 - * means the dongle in the single port mode,
1868 - * and a switch command is required to be sent. */
1869 - if (idesc && idesc->bInterfaceNumber == 0) {
1870 - if ((idProduct == 0x1001)
1871 - || (idProduct == 0x1003)
1872 - || (idProduct == 0x1004)
1873 - || (idProduct >= 0x1401 && idProduct <= 0x1500)
1874 - || (idProduct >= 0x1505 && idProduct <= 0x1600)
1875 - || (idProduct >= 0x1c02 && idProduct <= 0x2202)) {
1876 - return 1;
1877 - }
1878 - }
1879 - return 0;
1880 -}
1881 -
1882 -int usb_stor_huawei_init(struct us_data *us)
1883 -{
1884 - int result = 0;
1885 -
1886 - if (usb_stor_huawei_dongles_pid(us)) {
1887 - if (le16_to_cpu(us->pusb_dev->descriptor.idProduct) >= 0x1446)
1888 - result = usb_stor_huawei_scsi_init(us);
1889 - else
1890 - result = usb_stor_huawei_feature_init(us);
1891 - }
1892 - return result;
1893 -}
1894 diff --git a/drivers/usb/storage/initializers.h b/drivers/usb/storage/initializers.h
1895 index 5376d4f..529327f 100644
1896 --- a/drivers/usb/storage/initializers.h
1897 +++ b/drivers/usb/storage/initializers.h
1898 @@ -46,5 +46,5 @@ int usb_stor_euscsi_init(struct us_data *us);
1899 * flash reader */
1900 int usb_stor_ucr61s2b_init(struct us_data *us);
1901
1902 -/* This places the HUAWEI usb dongles in multi-port mode */
1903 -int usb_stor_huawei_init(struct us_data *us);
1904 +/* This places the HUAWEI E220 devices in multi-port mode */
1905 +int usb_stor_huawei_e220_init(struct us_data *us);
1906 diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
1907 index 72923b5..d305a5a 100644
1908 --- a/drivers/usb/storage/unusual_devs.h
1909 +++ b/drivers/usb/storage/unusual_devs.h
1910 @@ -1527,10 +1527,335 @@ UNUSUAL_DEV( 0x1210, 0x0003, 0x0100, 0x0100,
1911 /* Reported by fangxiaozhi <huananhu@huawei.com>
1912 * This brings the HUAWEI data card devices into multi-port mode
1913 */
1914 -UNUSUAL_VENDOR_INTF(0x12d1, 0x08, 0x06, 0x50,
1915 +UNUSUAL_DEV( 0x12d1, 0x1001, 0x0000, 0x0000,
1916 "HUAWEI MOBILE",
1917 "Mass Storage",
1918 - USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_init,
1919 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1920 + 0),
1921 +UNUSUAL_DEV( 0x12d1, 0x1003, 0x0000, 0x0000,
1922 + "HUAWEI MOBILE",
1923 + "Mass Storage",
1924 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1925 + 0),
1926 +UNUSUAL_DEV( 0x12d1, 0x1004, 0x0000, 0x0000,
1927 + "HUAWEI MOBILE",
1928 + "Mass Storage",
1929 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1930 + 0),
1931 +UNUSUAL_DEV( 0x12d1, 0x1401, 0x0000, 0x0000,
1932 + "HUAWEI MOBILE",
1933 + "Mass Storage",
1934 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1935 + 0),
1936 +UNUSUAL_DEV( 0x12d1, 0x1402, 0x0000, 0x0000,
1937 + "HUAWEI MOBILE",
1938 + "Mass Storage",
1939 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1940 + 0),
1941 +UNUSUAL_DEV( 0x12d1, 0x1403, 0x0000, 0x0000,
1942 + "HUAWEI MOBILE",
1943 + "Mass Storage",
1944 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1945 + 0),
1946 +UNUSUAL_DEV( 0x12d1, 0x1404, 0x0000, 0x0000,
1947 + "HUAWEI MOBILE",
1948 + "Mass Storage",
1949 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1950 + 0),
1951 +UNUSUAL_DEV( 0x12d1, 0x1405, 0x0000, 0x0000,
1952 + "HUAWEI MOBILE",
1953 + "Mass Storage",
1954 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1955 + 0),
1956 +UNUSUAL_DEV( 0x12d1, 0x1406, 0x0000, 0x0000,
1957 + "HUAWEI MOBILE",
1958 + "Mass Storage",
1959 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1960 + 0),
1961 +UNUSUAL_DEV( 0x12d1, 0x1407, 0x0000, 0x0000,
1962 + "HUAWEI MOBILE",
1963 + "Mass Storage",
1964 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1965 + 0),
1966 +UNUSUAL_DEV( 0x12d1, 0x1408, 0x0000, 0x0000,
1967 + "HUAWEI MOBILE",
1968 + "Mass Storage",
1969 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1970 + 0),
1971 +UNUSUAL_DEV( 0x12d1, 0x1409, 0x0000, 0x0000,
1972 + "HUAWEI MOBILE",
1973 + "Mass Storage",
1974 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1975 + 0),
1976 +UNUSUAL_DEV( 0x12d1, 0x140A, 0x0000, 0x0000,
1977 + "HUAWEI MOBILE",
1978 + "Mass Storage",
1979 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1980 + 0),
1981 +UNUSUAL_DEV( 0x12d1, 0x140B, 0x0000, 0x0000,
1982 + "HUAWEI MOBILE",
1983 + "Mass Storage",
1984 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1985 + 0),
1986 +UNUSUAL_DEV( 0x12d1, 0x140C, 0x0000, 0x0000,
1987 + "HUAWEI MOBILE",
1988 + "Mass Storage",
1989 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1990 + 0),
1991 +UNUSUAL_DEV( 0x12d1, 0x140D, 0x0000, 0x0000,
1992 + "HUAWEI MOBILE",
1993 + "Mass Storage",
1994 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
1995 + 0),
1996 +UNUSUAL_DEV( 0x12d1, 0x140E, 0x0000, 0x0000,
1997 + "HUAWEI MOBILE",
1998 + "Mass Storage",
1999 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2000 + 0),
2001 +UNUSUAL_DEV( 0x12d1, 0x140F, 0x0000, 0x0000,
2002 + "HUAWEI MOBILE",
2003 + "Mass Storage",
2004 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2005 + 0),
2006 +UNUSUAL_DEV( 0x12d1, 0x1410, 0x0000, 0x0000,
2007 + "HUAWEI MOBILE",
2008 + "Mass Storage",
2009 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2010 + 0),
2011 +UNUSUAL_DEV( 0x12d1, 0x1411, 0x0000, 0x0000,
2012 + "HUAWEI MOBILE",
2013 + "Mass Storage",
2014 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2015 + 0),
2016 +UNUSUAL_DEV( 0x12d1, 0x1412, 0x0000, 0x0000,
2017 + "HUAWEI MOBILE",
2018 + "Mass Storage",
2019 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2020 + 0),
2021 +UNUSUAL_DEV( 0x12d1, 0x1413, 0x0000, 0x0000,
2022 + "HUAWEI MOBILE",
2023 + "Mass Storage",
2024 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2025 + 0),
2026 +UNUSUAL_DEV( 0x12d1, 0x1414, 0x0000, 0x0000,
2027 + "HUAWEI MOBILE",
2028 + "Mass Storage",
2029 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2030 + 0),
2031 +UNUSUAL_DEV( 0x12d1, 0x1415, 0x0000, 0x0000,
2032 + "HUAWEI MOBILE",
2033 + "Mass Storage",
2034 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2035 + 0),
2036 +UNUSUAL_DEV( 0x12d1, 0x1416, 0x0000, 0x0000,
2037 + "HUAWEI MOBILE",
2038 + "Mass Storage",
2039 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2040 + 0),
2041 +UNUSUAL_DEV( 0x12d1, 0x1417, 0x0000, 0x0000,
2042 + "HUAWEI MOBILE",
2043 + "Mass Storage",
2044 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2045 + 0),
2046 +UNUSUAL_DEV( 0x12d1, 0x1418, 0x0000, 0x0000,
2047 + "HUAWEI MOBILE",
2048 + "Mass Storage",
2049 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2050 + 0),
2051 +UNUSUAL_DEV( 0x12d1, 0x1419, 0x0000, 0x0000,
2052 + "HUAWEI MOBILE",
2053 + "Mass Storage",
2054 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2055 + 0),
2056 +UNUSUAL_DEV( 0x12d1, 0x141A, 0x0000, 0x0000,
2057 + "HUAWEI MOBILE",
2058 + "Mass Storage",
2059 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2060 + 0),
2061 +UNUSUAL_DEV( 0x12d1, 0x141B, 0x0000, 0x0000,
2062 + "HUAWEI MOBILE",
2063 + "Mass Storage",
2064 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2065 + 0),
2066 +UNUSUAL_DEV( 0x12d1, 0x141C, 0x0000, 0x0000,
2067 + "HUAWEI MOBILE",
2068 + "Mass Storage",
2069 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2070 + 0),
2071 +UNUSUAL_DEV( 0x12d1, 0x141D, 0x0000, 0x0000,
2072 + "HUAWEI MOBILE",
2073 + "Mass Storage",
2074 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2075 + 0),
2076 +UNUSUAL_DEV( 0x12d1, 0x141E, 0x0000, 0x0000,
2077 + "HUAWEI MOBILE",
2078 + "Mass Storage",
2079 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2080 + 0),
2081 +UNUSUAL_DEV( 0x12d1, 0x141F, 0x0000, 0x0000,
2082 + "HUAWEI MOBILE",
2083 + "Mass Storage",
2084 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2085 + 0),
2086 +UNUSUAL_DEV( 0x12d1, 0x1420, 0x0000, 0x0000,
2087 + "HUAWEI MOBILE",
2088 + "Mass Storage",
2089 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2090 + 0),
2091 +UNUSUAL_DEV( 0x12d1, 0x1421, 0x0000, 0x0000,
2092 + "HUAWEI MOBILE",
2093 + "Mass Storage",
2094 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2095 + 0),
2096 +UNUSUAL_DEV( 0x12d1, 0x1422, 0x0000, 0x0000,
2097 + "HUAWEI MOBILE",
2098 + "Mass Storage",
2099 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2100 + 0),
2101 +UNUSUAL_DEV( 0x12d1, 0x1423, 0x0000, 0x0000,
2102 + "HUAWEI MOBILE",
2103 + "Mass Storage",
2104 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2105 + 0),
2106 +UNUSUAL_DEV( 0x12d1, 0x1424, 0x0000, 0x0000,
2107 + "HUAWEI MOBILE",
2108 + "Mass Storage",
2109 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2110 + 0),
2111 +UNUSUAL_DEV( 0x12d1, 0x1425, 0x0000, 0x0000,
2112 + "HUAWEI MOBILE",
2113 + "Mass Storage",
2114 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2115 + 0),
2116 +UNUSUAL_DEV( 0x12d1, 0x1426, 0x0000, 0x0000,
2117 + "HUAWEI MOBILE",
2118 + "Mass Storage",
2119 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2120 + 0),
2121 +UNUSUAL_DEV( 0x12d1, 0x1427, 0x0000, 0x0000,
2122 + "HUAWEI MOBILE",
2123 + "Mass Storage",
2124 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2125 + 0),
2126 +UNUSUAL_DEV( 0x12d1, 0x1428, 0x0000, 0x0000,
2127 + "HUAWEI MOBILE",
2128 + "Mass Storage",
2129 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2130 + 0),
2131 +UNUSUAL_DEV( 0x12d1, 0x1429, 0x0000, 0x0000,
2132 + "HUAWEI MOBILE",
2133 + "Mass Storage",
2134 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2135 + 0),
2136 +UNUSUAL_DEV( 0x12d1, 0x142A, 0x0000, 0x0000,
2137 + "HUAWEI MOBILE",
2138 + "Mass Storage",
2139 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2140 + 0),
2141 +UNUSUAL_DEV( 0x12d1, 0x142B, 0x0000, 0x0000,
2142 + "HUAWEI MOBILE",
2143 + "Mass Storage",
2144 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2145 + 0),
2146 +UNUSUAL_DEV( 0x12d1, 0x142C, 0x0000, 0x0000,
2147 + "HUAWEI MOBILE",
2148 + "Mass Storage",
2149 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2150 + 0),
2151 +UNUSUAL_DEV( 0x12d1, 0x142D, 0x0000, 0x0000,
2152 + "HUAWEI MOBILE",
2153 + "Mass Storage",
2154 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2155 + 0),
2156 +UNUSUAL_DEV( 0x12d1, 0x142E, 0x0000, 0x0000,
2157 + "HUAWEI MOBILE",
2158 + "Mass Storage",
2159 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2160 + 0),
2161 +UNUSUAL_DEV( 0x12d1, 0x142F, 0x0000, 0x0000,
2162 + "HUAWEI MOBILE",
2163 + "Mass Storage",
2164 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2165 + 0),
2166 +UNUSUAL_DEV( 0x12d1, 0x1430, 0x0000, 0x0000,
2167 + "HUAWEI MOBILE",
2168 + "Mass Storage",
2169 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2170 + 0),
2171 +UNUSUAL_DEV( 0x12d1, 0x1431, 0x0000, 0x0000,
2172 + "HUAWEI MOBILE",
2173 + "Mass Storage",
2174 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2175 + 0),
2176 +UNUSUAL_DEV( 0x12d1, 0x1432, 0x0000, 0x0000,
2177 + "HUAWEI MOBILE",
2178 + "Mass Storage",
2179 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2180 + 0),
2181 +UNUSUAL_DEV( 0x12d1, 0x1433, 0x0000, 0x0000,
2182 + "HUAWEI MOBILE",
2183 + "Mass Storage",
2184 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2185 + 0),
2186 +UNUSUAL_DEV( 0x12d1, 0x1434, 0x0000, 0x0000,
2187 + "HUAWEI MOBILE",
2188 + "Mass Storage",
2189 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2190 + 0),
2191 +UNUSUAL_DEV( 0x12d1, 0x1435, 0x0000, 0x0000,
2192 + "HUAWEI MOBILE",
2193 + "Mass Storage",
2194 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2195 + 0),
2196 +UNUSUAL_DEV( 0x12d1, 0x1436, 0x0000, 0x0000,
2197 + "HUAWEI MOBILE",
2198 + "Mass Storage",
2199 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2200 + 0),
2201 +UNUSUAL_DEV( 0x12d1, 0x1437, 0x0000, 0x0000,
2202 + "HUAWEI MOBILE",
2203 + "Mass Storage",
2204 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2205 + 0),
2206 +UNUSUAL_DEV( 0x12d1, 0x1438, 0x0000, 0x0000,
2207 + "HUAWEI MOBILE",
2208 + "Mass Storage",
2209 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2210 + 0),
2211 +UNUSUAL_DEV( 0x12d1, 0x1439, 0x0000, 0x0000,
2212 + "HUAWEI MOBILE",
2213 + "Mass Storage",
2214 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2215 + 0),
2216 +UNUSUAL_DEV( 0x12d1, 0x143A, 0x0000, 0x0000,
2217 + "HUAWEI MOBILE",
2218 + "Mass Storage",
2219 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2220 + 0),
2221 +UNUSUAL_DEV( 0x12d1, 0x143B, 0x0000, 0x0000,
2222 + "HUAWEI MOBILE",
2223 + "Mass Storage",
2224 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2225 + 0),
2226 +UNUSUAL_DEV( 0x12d1, 0x143C, 0x0000, 0x0000,
2227 + "HUAWEI MOBILE",
2228 + "Mass Storage",
2229 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2230 + 0),
2231 +UNUSUAL_DEV( 0x12d1, 0x143D, 0x0000, 0x0000,
2232 + "HUAWEI MOBILE",
2233 + "Mass Storage",
2234 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2235 + 0),
2236 +UNUSUAL_DEV( 0x12d1, 0x143E, 0x0000, 0x0000,
2237 + "HUAWEI MOBILE",
2238 + "Mass Storage",
2239 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2240 + 0),
2241 +UNUSUAL_DEV( 0x12d1, 0x143F, 0x0000, 0x0000,
2242 + "HUAWEI MOBILE",
2243 + "Mass Storage",
2244 + USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
2245 0),
2246
2247 /* Reported by Vilius Bilinkevicius <vilisas AT xxx DOT lt) */
2248 diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
2249 index 12cf5f3..025428e 100644
2250 --- a/drivers/video/atmel_lcdfb.c
2251 +++ b/drivers/video/atmel_lcdfb.c
2252 @@ -422,17 +422,22 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
2253 = var->bits_per_pixel;
2254 break;
2255 case 16:
2256 + /* Older SOCs use IBGR:555 rather than BGR:565. */
2257 + if (sinfo->have_intensity_bit)
2258 + var->green.length = 5;
2259 + else
2260 + var->green.length = 6;
2261 +
2262 if (sinfo->lcd_wiring_mode == ATMEL_LCDC_WIRING_RGB) {
2263 - /* RGB:565 mode */
2264 - var->red.offset = 11;
2265 + /* RGB:5X5 mode */
2266 + var->red.offset = var->green.length + 5;
2267 var->blue.offset = 0;
2268 } else {
2269 - /* BGR:565 mode */
2270 + /* BGR:5X5 mode */
2271 var->red.offset = 0;
2272 - var->blue.offset = 11;
2273 + var->blue.offset = var->green.length + 5;
2274 }
2275 var->green.offset = 5;
2276 - var->green.length = 6;
2277 var->red.length = var->blue.length = 5;
2278 break;
2279 case 32:
2280 @@ -679,8 +684,7 @@ static int atmel_lcdfb_setcolreg(unsigned int regno, unsigned int red,
2281
2282 case FB_VISUAL_PSEUDOCOLOR:
2283 if (regno < 256) {
2284 - if (cpu_is_at91sam9261() || cpu_is_at91sam9263()
2285 - || cpu_is_at91sam9rl()) {
2286 + if (sinfo->have_intensity_bit) {
2287 /* old style I+BGR:555 */
2288 val = ((red >> 11) & 0x001f);
2289 val |= ((green >> 6) & 0x03e0);
2290 @@ -870,6 +874,10 @@ static int __init atmel_lcdfb_probe(struct platform_device *pdev)
2291 }
2292 sinfo->info = info;
2293 sinfo->pdev = pdev;
2294 + if (cpu_is_at91sam9261() || cpu_is_at91sam9263() ||
2295 + cpu_is_at91sam9rl()) {
2296 + sinfo->have_intensity_bit = true;
2297 + }
2298
2299 strcpy(info->fix.id, sinfo->pdev->name);
2300 info->flags = ATMEL_LCDFB_FBINFO_DEFAULT;
2301 diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c
2302 index d39dfa4..012817a 100644
2303 --- a/drivers/w1/masters/w1-gpio.c
2304 +++ b/drivers/w1/masters/w1-gpio.c
2305 @@ -158,7 +158,7 @@ static int w1_gpio_probe(struct platform_device *pdev)
2306 return err;
2307 }
2308
2309 -static int __exit w1_gpio_remove(struct platform_device *pdev)
2310 +static int w1_gpio_remove(struct platform_device *pdev)
2311 {
2312 struct w1_bus_master *master = platform_get_drvdata(pdev);
2313 struct w1_gpio_platform_data *pdata = pdev->dev.platform_data;
2314 @@ -210,7 +210,7 @@ static struct platform_driver w1_gpio_driver = {
2315 .of_match_table = of_match_ptr(w1_gpio_dt_ids),
2316 },
2317 .probe = w1_gpio_probe,
2318 - .remove = __exit_p(w1_gpio_remove),
2319 + .remove = w1_gpio_remove,
2320 .suspend = w1_gpio_suspend,
2321 .resume = w1_gpio_resume,
2322 };
2323 diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
2324 index 7994d933..7ce277d 100644
2325 --- a/drivers/w1/w1.c
2326 +++ b/drivers/w1/w1.c
2327 @@ -924,7 +924,8 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
2328 tmp64 = (triplet_ret >> 2);
2329 rn |= (tmp64 << i);
2330
2331 - if (kthread_should_stop()) {
2332 + /* ensure we're called from kthread and not by netlink callback */
2333 + if (!dev->priv && kthread_should_stop()) {
2334 mutex_unlock(&dev->bus_mutex);
2335 dev_dbg(&dev->dev, "Abort w1_search\n");
2336 return;
2337 diff --git a/drivers/xen/xen-pciback/pciback_ops.c b/drivers/xen/xen-pciback/pciback_ops.c
2338 index 37c1f82..b98cf0c 100644
2339 --- a/drivers/xen/xen-pciback/pciback_ops.c
2340 +++ b/drivers/xen/xen-pciback/pciback_ops.c
2341 @@ -113,7 +113,8 @@ void xen_pcibk_reset_device(struct pci_dev *dev)
2342 if (dev->msi_enabled)
2343 pci_disable_msi(dev);
2344 #endif
2345 - pci_disable_device(dev);
2346 + if (pci_is_enabled(dev))
2347 + pci_disable_device(dev);
2348
2349 pci_write_config_word(dev, PCI_COMMAND, 0);
2350
2351 diff --git a/fs/block_dev.c b/fs/block_dev.c
2352 index 78333a3..78edf76 100644
2353 --- a/fs/block_dev.c
2354 +++ b/fs/block_dev.c
2355 @@ -1033,7 +1033,9 @@ void bd_set_size(struct block_device *bdev, loff_t size)
2356 {
2357 unsigned bsize = bdev_logical_block_size(bdev);
2358
2359 - bdev->bd_inode->i_size = size;
2360 + mutex_lock(&bdev->bd_inode->i_mutex);
2361 + i_size_write(bdev->bd_inode, size);
2362 + mutex_unlock(&bdev->bd_inode->i_mutex);
2363 while (bsize < PAGE_CACHE_SIZE) {
2364 if (size & bsize)
2365 break;
2366 diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
2367 index ac8ff8d..1fd234a 100644
2368 --- a/fs/btrfs/volumes.c
2369 +++ b/fs/btrfs/volumes.c
2370 @@ -681,6 +681,12 @@ int btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
2371 __btrfs_close_devices(fs_devices);
2372 free_fs_devices(fs_devices);
2373 }
2374 + /*
2375 + * Wait for rcu kworkers under __btrfs_close_devices
2376 + * to finish all blkdev_puts so device is really
2377 + * free when umount is done.
2378 + */
2379 + rcu_barrier();
2380 return ret;
2381 }
2382
2383 diff --git a/fs/ext3/super.c b/fs/ext3/super.c
2384 index 6e50223..0a7f2d0b 100644
2385 --- a/fs/ext3/super.c
2386 +++ b/fs/ext3/super.c
2387 @@ -353,7 +353,7 @@ static struct block_device *ext3_blkdev_get(dev_t dev, struct super_block *sb)
2388 return bdev;
2389
2390 fail:
2391 - ext3_msg(sb, "error: failed to open journal device %s: %ld",
2392 + ext3_msg(sb, KERN_ERR, "error: failed to open journal device %s: %ld",
2393 __bdevname(dev, b), PTR_ERR(bdev));
2394
2395 return NULL;
2396 @@ -887,7 +887,7 @@ static ext3_fsblk_t get_sb_block(void **data, struct super_block *sb)
2397 /*todo: use simple_strtoll with >32bit ext3 */
2398 sb_block = simple_strtoul(options, &options, 0);
2399 if (*options && *options != ',') {
2400 - ext3_msg(sb, "error: invalid sb specification: %s",
2401 + ext3_msg(sb, KERN_ERR, "error: invalid sb specification: %s",
2402 (char *) *data);
2403 return 1;
2404 }
2405 diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
2406 index 7ccb3c5..ef52d9c 100644
2407 --- a/include/linux/mtd/nand.h
2408 +++ b/include/linux/mtd/nand.h
2409 @@ -187,6 +187,13 @@ typedef enum {
2410 * This happens with the Renesas AG-AND chips, possibly others.
2411 */
2412 #define BBT_AUTO_REFRESH 0x00000080
2413 +/*
2414 + * Chip requires ready check on read (for auto-incremented sequential read).
2415 + * True only for small page devices; large page devices do not support
2416 + * autoincrement.
2417 + */
2418 +#define NAND_NEED_READRDY 0x00000100
2419 +
2420 /* Chip does not allow subpage writes */
2421 #define NAND_NO_SUBPAGE_WRITE 0x00000200
2422
2423 diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
2424 index 6bfb2faa..a280650 100644
2425 --- a/include/linux/perf_event.h
2426 +++ b/include/linux/perf_event.h
2427 @@ -794,6 +794,12 @@ static inline int __perf_event_disable(void *info) { return -1; }
2428 static inline void perf_event_task_tick(void) { }
2429 #endif
2430
2431 +#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_INTEL)
2432 +extern void perf_restore_debug_store(void);
2433 +#else
2434 +static inline void perf_restore_debug_store(void) { }
2435 +#endif
2436 +
2437 #define perf_output_put(handle, x) perf_output_copy((handle), &(x), sizeof(x))
2438
2439 /*
2440 diff --git a/include/uapi/linux/serial_core.h b/include/uapi/linux/serial_core.h
2441 index 8f6e50a..c019b24 100644
2442 --- a/include/uapi/linux/serial_core.h
2443 +++ b/include/uapi/linux/serial_core.h
2444 @@ -51,7 +51,10 @@
2445 #define PORT_8250_CIR 23 /* CIR infrared port, has its own driver */
2446 #define PORT_XR17V35X 24 /* Exar XR17V35x UARTs */
2447 #define PORT_BRCM_TRUMANAGE 25
2448 -#define PORT_MAX_8250 25 /* max port ID */
2449 +#define PORT_ALTR_16550_F32 26 /* Altera 16550 UART with 32 FIFOs */
2450 +#define PORT_ALTR_16550_F64 27 /* Altera 16550 UART with 64 FIFOs */
2451 +#define PORT_ALTR_16550_F128 28 /* Altera 16550 UART with 128 FIFOs */
2452 +#define PORT_MAX_8250 28 /* max port ID */
2453
2454 /*
2455 * ARM specific type numbers. These are not currently guaranteed
2456 diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
2457 index 28447f1..5f0e234 100644
2458 --- a/include/video/atmel_lcdc.h
2459 +++ b/include/video/atmel_lcdc.h
2460 @@ -62,6 +62,7 @@ struct atmel_lcdfb_info {
2461 void (*atmel_lcdfb_power_control)(int on);
2462 struct fb_monspecs *default_monspecs;
2463 u32 pseudo_palette[16];
2464 + bool have_intensity_bit;
2465 };
2466
2467 #define ATMEL_LCDC_DMABADDR1 0x00
2468 diff --git a/kernel/signal.c b/kernel/signal.c
2469 index 3d09cf6..7591ccc 100644
2470 --- a/kernel/signal.c
2471 +++ b/kernel/signal.c
2472 @@ -485,6 +485,9 @@ flush_signal_handlers(struct task_struct *t, int force_default)
2473 if (force_default || ka->sa.sa_handler != SIG_IGN)
2474 ka->sa.sa_handler = SIG_DFL;
2475 ka->sa.sa_flags = 0;
2476 +#ifdef SA_RESTORER
2477 + ka->sa.sa_restorer = NULL;
2478 +#endif
2479 sigemptyset(&ka->sa.sa_mask);
2480 ka++;
2481 }
2482 diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
2483 index acc9f4c..2897e40 100644
2484 --- a/net/bridge/br_mdb.c
2485 +++ b/net/bridge/br_mdb.c
2486 @@ -82,6 +82,7 @@ static int br_mdb_fill_info(struct sk_buff *skb, struct netlink_callback *cb,
2487 port = p->port;
2488 if (port) {
2489 struct br_mdb_entry e;
2490 + memset(&e, 0, sizeof(e));
2491 e.ifindex = port->dev->ifindex;
2492 e.state = p->state;
2493 if (p->addr.proto == htons(ETH_P_IP))
2494 @@ -138,6 +139,7 @@ static int br_mdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
2495 break;
2496
2497 bpm = nlmsg_data(nlh);
2498 + memset(bpm, 0, sizeof(*bpm));
2499 bpm->ifindex = dev->ifindex;
2500 if (br_mdb_fill_info(skb, cb, dev) < 0)
2501 goto out;
2502 @@ -173,6 +175,7 @@ static int nlmsg_populate_mdb_fill(struct sk_buff *skb,
2503 return -EMSGSIZE;
2504
2505 bpm = nlmsg_data(nlh);
2506 + memset(bpm, 0, sizeof(*bpm));
2507 bpm->family = AF_BRIDGE;
2508 bpm->ifindex = dev->ifindex;
2509 nest = nla_nest_start(skb, MDBA_MDB);
2510 @@ -230,6 +233,7 @@ void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port,
2511 {
2512 struct br_mdb_entry entry;
2513
2514 + memset(&entry, 0, sizeof(entry));
2515 entry.ifindex = port->dev->ifindex;
2516 entry.addr.proto = group->proto;
2517 entry.addr.u.ip4 = group->u.ip4;
2518 diff --git a/net/core/dev.c b/net/core/dev.c
2519 index f64e439..1339f77 100644
2520 --- a/net/core/dev.c
2521 +++ b/net/core/dev.c
2522 @@ -3419,6 +3419,7 @@ ncls:
2523 }
2524 switch (rx_handler(&skb)) {
2525 case RX_HANDLER_CONSUMED:
2526 + ret = NET_RX_SUCCESS;
2527 goto unlock;
2528 case RX_HANDLER_ANOTHER:
2529 goto another_round;
2530 diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
2531 index 1868625..798f920 100644
2532 --- a/net/core/rtnetlink.c
2533 +++ b/net/core/rtnetlink.c
2534 @@ -976,6 +976,7 @@ static int rtnl_fill_ifinfo(struct sk_buff *skb, struct net_device *dev,
2535 * report anything.
2536 */
2537 ivi.spoofchk = -1;
2538 + memset(ivi.mac, 0, sizeof(ivi.mac));
2539 if (dev->netdev_ops->ndo_get_vf_config(dev, i, &ivi))
2540 break;
2541 vf_mac.vf =
2542 diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
2543 index 1b588e2..21291f1 100644
2544 --- a/net/dcb/dcbnl.c
2545 +++ b/net/dcb/dcbnl.c
2546 @@ -284,6 +284,7 @@ static int dcbnl_getperm_hwaddr(struct net_device *netdev, struct nlmsghdr *nlh,
2547 if (!netdev->dcbnl_ops->getpermhwaddr)
2548 return -EOPNOTSUPP;
2549
2550 + memset(perm_addr, 0, sizeof(perm_addr));
2551 netdev->dcbnl_ops->getpermhwaddr(netdev, perm_addr);
2552
2553 return nla_put(skb, DCB_ATTR_PERM_HWADDR, sizeof(perm_addr), perm_addr);
2554 @@ -1042,6 +1043,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev)
2555
2556 if (ops->ieee_getets) {
2557 struct ieee_ets ets;
2558 + memset(&ets, 0, sizeof(ets));
2559 err = ops->ieee_getets(netdev, &ets);
2560 if (!err &&
2561 nla_put(skb, DCB_ATTR_IEEE_ETS, sizeof(ets), &ets))
2562 @@ -1050,6 +1052,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev)
2563
2564 if (ops->ieee_getmaxrate) {
2565 struct ieee_maxrate maxrate;
2566 + memset(&maxrate, 0, sizeof(maxrate));
2567 err = ops->ieee_getmaxrate(netdev, &maxrate);
2568 if (!err) {
2569 err = nla_put(skb, DCB_ATTR_IEEE_MAXRATE,
2570 @@ -1061,6 +1064,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev)
2571
2572 if (ops->ieee_getpfc) {
2573 struct ieee_pfc pfc;
2574 + memset(&pfc, 0, sizeof(pfc));
2575 err = ops->ieee_getpfc(netdev, &pfc);
2576 if (!err &&
2577 nla_put(skb, DCB_ATTR_IEEE_PFC, sizeof(pfc), &pfc))
2578 @@ -1094,6 +1098,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev)
2579 /* get peer info if available */
2580 if (ops->ieee_peer_getets) {
2581 struct ieee_ets ets;
2582 + memset(&ets, 0, sizeof(ets));
2583 err = ops->ieee_peer_getets(netdev, &ets);
2584 if (!err &&
2585 nla_put(skb, DCB_ATTR_IEEE_PEER_ETS, sizeof(ets), &ets))
2586 @@ -1102,6 +1107,7 @@ static int dcbnl_ieee_fill(struct sk_buff *skb, struct net_device *netdev)
2587
2588 if (ops->ieee_peer_getpfc) {
2589 struct ieee_pfc pfc;
2590 + memset(&pfc, 0, sizeof(pfc));
2591 err = ops->ieee_peer_getpfc(netdev, &pfc);
2592 if (!err &&
2593 nla_put(skb, DCB_ATTR_IEEE_PEER_PFC, sizeof(pfc), &pfc))
2594 @@ -1280,6 +1286,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev)
2595 /* peer info if available */
2596 if (ops->cee_peer_getpg) {
2597 struct cee_pg pg;
2598 + memset(&pg, 0, sizeof(pg));
2599 err = ops->cee_peer_getpg(netdev, &pg);
2600 if (!err &&
2601 nla_put(skb, DCB_ATTR_CEE_PEER_PG, sizeof(pg), &pg))
2602 @@ -1288,6 +1295,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev)
2603
2604 if (ops->cee_peer_getpfc) {
2605 struct cee_pfc pfc;
2606 + memset(&pfc, 0, sizeof(pfc));
2607 err = ops->cee_peer_getpfc(netdev, &pfc);
2608 if (!err &&
2609 nla_put(skb, DCB_ATTR_CEE_PEER_PFC, sizeof(pfc), &pfc))
2610 diff --git a/net/ieee802154/6lowpan.h b/net/ieee802154/6lowpan.h
2611 index 8c2251f..bba5f83 100644
2612 --- a/net/ieee802154/6lowpan.h
2613 +++ b/net/ieee802154/6lowpan.h
2614 @@ -84,7 +84,7 @@
2615 (memcmp(addr1, addr2, length >> 3) == 0)
2616
2617 /* local link, i.e. FE80::/10 */
2618 -#define is_addr_link_local(a) (((a)->s6_addr16[0]) == 0x80FE)
2619 +#define is_addr_link_local(a) (((a)->s6_addr16[0]) == htons(0xFE80))
2620
2621 /*
2622 * check whether we can compress the IID to 16 bits,
2623 diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
2624 index ad70a96..66702d3 100644
2625 --- a/net/ipv4/tcp_input.c
2626 +++ b/net/ipv4/tcp_input.c
2627 @@ -5498,6 +5498,9 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
2628 if (tcp_checksum_complete_user(sk, skb))
2629 goto csum_error;
2630
2631 + if ((int)skb->truesize > sk->sk_forward_alloc)
2632 + goto step5;
2633 +
2634 /* Predicted packet is in window by definition.
2635 * seq == rcv_nxt and rcv_wup <= rcv_nxt.
2636 * Hence, check seq<=rcv_wup reduces to:
2637 @@ -5509,9 +5512,6 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
2638
2639 tcp_rcv_rtt_measure_ts(sk, skb);
2640
2641 - if ((int)skb->truesize > sk->sk_forward_alloc)
2642 - goto step5;
2643 -
2644 NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPHPHITS);
2645
2646 /* Bulk data transfer: receiver */
2647 diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
2648 index a52d864..b196852 100644
2649 --- a/net/ipv6/ip6_input.c
2650 +++ b/net/ipv6/ip6_input.c
2651 @@ -270,7 +270,8 @@ int ip6_mc_input(struct sk_buff *skb)
2652 * IPv6 multicast router mode is now supported ;)
2653 */
2654 if (dev_net(skb->dev)->ipv6.devconf_all->mc_forwarding &&
2655 - !(ipv6_addr_type(&hdr->daddr) & IPV6_ADDR_LINKLOCAL) &&
2656 + !(ipv6_addr_type(&hdr->daddr) &
2657 + (IPV6_ADDR_LOOPBACK|IPV6_ADDR_LINKLOCAL)) &&
2658 likely(!(IP6CB(skb)->flags & IP6SKB_FORWARDED))) {
2659 /*
2660 * Okay, we try to forward - split and duplicate
2661 diff --git a/net/ipv6/route.c b/net/ipv6/route.c
2662 index 6f9f7b6..5845613 100644
2663 --- a/net/ipv6/route.c
2664 +++ b/net/ipv6/route.c
2665 @@ -1990,7 +1990,8 @@ void rt6_purge_dflt_routers(struct net *net)
2666 restart:
2667 read_lock_bh(&table->tb6_lock);
2668 for (rt = table->tb6_root.leaf; rt; rt = rt->dst.rt6_next) {
2669 - if (rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF)) {
2670 + if (rt->rt6i_flags & (RTF_DEFAULT | RTF_ADDRCONF) &&
2671 + (!rt->rt6i_idev || rt->rt6i_idev->cnf.accept_ra != 2)) {
2672 dst_hold(&rt->dst);
2673 read_unlock_bh(&table->tb6_lock);
2674 ip6_del_rt(rt);
2675 diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
2676 index 716605c..044e9e1 100644
2677 --- a/net/l2tp/l2tp_ppp.c
2678 +++ b/net/l2tp/l2tp_ppp.c
2679 @@ -355,6 +355,7 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh
2680 l2tp_xmit_skb(session, skb, session->hdr_len);
2681
2682 sock_put(ps->tunnel_sock);
2683 + sock_put(sk);
2684
2685 return error;
2686
2687 diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
2688 index 847d495..8a6c6ea 100644
2689 --- a/net/netlabel/netlabel_unlabeled.c
2690 +++ b/net/netlabel/netlabel_unlabeled.c
2691 @@ -1189,8 +1189,6 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
2692 struct netlbl_unlhsh_walk_arg cb_arg;
2693 u32 skip_bkt = cb->args[0];
2694 u32 skip_chain = cb->args[1];
2695 - u32 skip_addr4 = cb->args[2];
2696 - u32 skip_addr6 = cb->args[3];
2697 u32 iter_bkt;
2698 u32 iter_chain = 0, iter_addr4 = 0, iter_addr6 = 0;
2699 struct netlbl_unlhsh_iface *iface;
2700 @@ -1215,7 +1213,7 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
2701 continue;
2702 netlbl_af4list_foreach_rcu(addr4,
2703 &iface->addr4_list) {
2704 - if (iter_addr4++ < skip_addr4)
2705 + if (iter_addr4++ < cb->args[2])
2706 continue;
2707 if (netlbl_unlabel_staticlist_gen(
2708 NLBL_UNLABEL_C_STATICLIST,
2709 @@ -1231,7 +1229,7 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
2710 #if IS_ENABLED(CONFIG_IPV6)
2711 netlbl_af6list_foreach_rcu(addr6,
2712 &iface->addr6_list) {
2713 - if (iter_addr6++ < skip_addr6)
2714 + if (iter_addr6++ < cb->args[3])
2715 continue;
2716 if (netlbl_unlabel_staticlist_gen(
2717 NLBL_UNLABEL_C_STATICLIST,
2718 @@ -1250,10 +1248,10 @@ static int netlbl_unlabel_staticlist(struct sk_buff *skb,
2719
2720 unlabel_staticlist_return:
2721 rcu_read_unlock();
2722 - cb->args[0] = skip_bkt;
2723 - cb->args[1] = skip_chain;
2724 - cb->args[2] = skip_addr4;
2725 - cb->args[3] = skip_addr6;
2726 + cb->args[0] = iter_bkt;
2727 + cb->args[1] = iter_chain;
2728 + cb->args[2] = iter_addr4;
2729 + cb->args[3] = iter_addr6;
2730 return skb->len;
2731 }
2732
2733 @@ -1273,12 +1271,9 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb,
2734 {
2735 struct netlbl_unlhsh_walk_arg cb_arg;
2736 struct netlbl_unlhsh_iface *iface;
2737 - u32 skip_addr4 = cb->args[0];
2738 - u32 skip_addr6 = cb->args[1];
2739 - u32 iter_addr4 = 0;
2740 + u32 iter_addr4 = 0, iter_addr6 = 0;
2741 struct netlbl_af4list *addr4;
2742 #if IS_ENABLED(CONFIG_IPV6)
2743 - u32 iter_addr6 = 0;
2744 struct netlbl_af6list *addr6;
2745 #endif
2746
2747 @@ -1292,7 +1287,7 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb,
2748 goto unlabel_staticlistdef_return;
2749
2750 netlbl_af4list_foreach_rcu(addr4, &iface->addr4_list) {
2751 - if (iter_addr4++ < skip_addr4)
2752 + if (iter_addr4++ < cb->args[0])
2753 continue;
2754 if (netlbl_unlabel_staticlist_gen(NLBL_UNLABEL_C_STATICLISTDEF,
2755 iface,
2756 @@ -1305,7 +1300,7 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb,
2757 }
2758 #if IS_ENABLED(CONFIG_IPV6)
2759 netlbl_af6list_foreach_rcu(addr6, &iface->addr6_list) {
2760 - if (iter_addr6++ < skip_addr6)
2761 + if (iter_addr6++ < cb->args[1])
2762 continue;
2763 if (netlbl_unlabel_staticlist_gen(NLBL_UNLABEL_C_STATICLISTDEF,
2764 iface,
2765 @@ -1320,8 +1315,8 @@ static int netlbl_unlabel_staticlistdef(struct sk_buff *skb,
2766
2767 unlabel_staticlistdef_return:
2768 rcu_read_unlock();
2769 - cb->args[0] = skip_addr4;
2770 - cb->args[1] = skip_addr6;
2771 + cb->args[0] = iter_addr4;
2772 + cb->args[1] = iter_addr6;
2773 return skb->len;
2774 }
2775
2776 diff --git a/net/rds/message.c b/net/rds/message.c
2777 index f0a4658..aff589c 100644
2778 --- a/net/rds/message.c
2779 +++ b/net/rds/message.c
2780 @@ -197,6 +197,9 @@ struct rds_message *rds_message_alloc(unsigned int extra_len, gfp_t gfp)
2781 {
2782 struct rds_message *rm;
2783
2784 + if (extra_len > KMALLOC_MAX_SIZE - sizeof(struct rds_message))
2785 + return NULL;
2786 +
2787 rm = kzalloc(sizeof(struct rds_message) + extra_len, gfp);
2788 if (!rm)
2789 goto out;
2790 diff --git a/net/sctp/socket.c b/net/sctp/socket.c
2791 index cedd9bf..9ef5c73 100644
2792 --- a/net/sctp/socket.c
2793 +++ b/net/sctp/socket.c
2794 @@ -5653,6 +5653,9 @@ static int sctp_getsockopt_assoc_stats(struct sock *sk, int len,
2795 if (len < sizeof(sctp_assoc_t))
2796 return -EINVAL;
2797
2798 + /* Allow the struct to grow and fill in as much as possible */
2799 + len = min_t(size_t, len, sizeof(sas));
2800 +
2801 if (copy_from_user(&sas, optval, len))
2802 return -EFAULT;
2803
2804 @@ -5686,9 +5689,6 @@ static int sctp_getsockopt_assoc_stats(struct sock *sk, int len,
2805 /* Mark beginning of a new observation period */
2806 asoc->stats.max_obs_rto = asoc->rto_min;
2807
2808 - /* Allow the struct to grow and fill in as much as possible */
2809 - len = min_t(size_t, len, sizeof(sas));
2810 -
2811 if (put_user(len, optlen))
2812 return -EFAULT;
2813
2814 diff --git a/scripts/Makefile.headersinst b/scripts/Makefile.headersinst
2815 index 06ba4a7..e253917 100644
2816 --- a/scripts/Makefile.headersinst
2817 +++ b/scripts/Makefile.headersinst
2818 @@ -8,7 +8,7 @@
2819 # ==========================================================================
2820
2821 # called may set destination dir (when installing to asm/)
2822 -_dst := $(or $(destination-y),$(dst),$(obj))
2823 +_dst := $(if $(destination-y),$(destination-y),$(if $(dst),$(dst),$(obj)))
2824
2825 # generated header directory
2826 gen := $(if $(gen),$(gen),$(subst include/,include/generated/,$(obj)))
2827 @@ -48,13 +48,14 @@ all-files := $(header-y) $(genhdr-y) $(wrapper-files)
2828 output-files := $(addprefix $(installdir)/, $(all-files))
2829
2830 input-files := $(foreach hdr, $(header-y), \
2831 - $(or \
2832 + $(if $(wildcard $(srcdir)/$(hdr)), \
2833 $(wildcard $(srcdir)/$(hdr)), \
2834 - $(wildcard $(oldsrcdir)/$(hdr)), \
2835 - $(error Missing UAPI file $(srcdir)/$(hdr)) \
2836 + $(if $(wildcard $(oldsrcdir)/$(hdr)), \
2837 + $(wildcard $(oldsrcdir)/$(hdr)), \
2838 + $(error Missing UAPI file $(srcdir)/$(hdr))) \
2839 )) \
2840 $(foreach hdr, $(genhdr-y), \
2841 - $(or \
2842 + $(if $(wildcard $(gendir)/$(hdr)), \
2843 $(wildcard $(gendir)/$(hdr)), \
2844 $(error Missing generated UAPI file $(gendir)/$(hdr)) \
2845 ))
2846 diff --git a/security/selinux/xfrm.c b/security/selinux/xfrm.c
2847 index 48665ec..8ab2951 100644
2848 --- a/security/selinux/xfrm.c
2849 +++ b/security/selinux/xfrm.c
2850 @@ -310,7 +310,7 @@ int selinux_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx,
2851
2852 if (old_ctx) {
2853 new_ctx = kmalloc(sizeof(*old_ctx) + old_ctx->ctx_len,
2854 - GFP_KERNEL);
2855 + GFP_ATOMIC);
2856 if (!new_ctx)
2857 return -ENOMEM;
2858
2859 diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c
2860 index 160b1bd..24d44b2 100644
2861 --- a/sound/core/seq/seq_timer.c
2862 +++ b/sound/core/seq/seq_timer.c
2863 @@ -290,10 +290,10 @@ int snd_seq_timer_open(struct snd_seq_queue *q)
2864 tid.device = SNDRV_TIMER_GLOBAL_SYSTEM;
2865 err = snd_timer_open(&t, str, &tid, q->queue);
2866 }
2867 - if (err < 0) {
2868 - snd_printk(KERN_ERR "seq fatal error: cannot create timer (%i)\n", err);
2869 - return err;
2870 - }
2871 + }
2872 + if (err < 0) {
2873 + snd_printk(KERN_ERR "seq fatal error: cannot create timer (%i)\n", err);
2874 + return err;
2875 }
2876 t->callback = snd_seq_timer_interrupt;
2877 t->callback_data = q;
2878 diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c
2879 index 8674b9e..fe1e66b 100644
2880 --- a/tools/usb/ffs-test.c
2881 +++ b/tools/usb/ffs-test.c
2882 @@ -38,7 +38,7 @@
2883 #include <unistd.h>
2884 #include <tools/le_byteshift.h>
2885
2886 -#include "../../include/linux/usb/functionfs.h"
2887 +#include "../../include/uapi/linux/usb/functionfs.h"
2888
2889
2890 /******************** Little Endian Handling ********************************/