Magellan Linux

Annotation of /trunk/kernel-alx-legacy/patches-4.9/0312-4.9.213-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3608 - (hide annotations) (download)
Fri Aug 14 07:34:29 2020 UTC (3 years, 10 months ago) by niro
File size: 83460 byte(s)
-added kerenl-alx-legacy pkg
1 niro 3608 diff --git a/Makefile b/Makefile
2     index b6c05e99814e..de79c801abcd 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,6 +1,6 @@
6     VERSION = 4
7     PATCHLEVEL = 9
8     -SUBLEVEL = 212
9     +SUBLEVEL = 213
10     EXTRAVERSION =
11     NAME = Roaring Lionus
12    
13     diff --git a/arch/arc/plat-eznps/Kconfig b/arch/arc/plat-eznps/Kconfig
14     index 1d175cc6ad6d..86f844caa405 100644
15     --- a/arch/arc/plat-eznps/Kconfig
16     +++ b/arch/arc/plat-eznps/Kconfig
17     @@ -7,7 +7,7 @@ menuconfig ARC_PLAT_EZNPS
18     bool "\"EZchip\" ARC dev platform"
19     select ARC_HAS_COH_CACHES if SMP
20     select CPU_BIG_ENDIAN
21     - select CLKSRC_NPS
22     + select CLKSRC_NPS if !PHYS_ADDR_T_64BIT
23     select EZNPS_GIC
24     select EZCHIP_NPS_MANAGEMENT_ENET if ETHERNET
25     help
26     diff --git a/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi b/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi
27     index 78bee26361f1..552de167f95f 100644
28     --- a/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi
29     +++ b/arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi
30     @@ -27,6 +27,27 @@
31     reg = <0x0 0x80000000 0x0 0x80000000>;
32     };
33    
34     + main_12v0: fixedregulator-main_12v0 {
35     + /* main supply */
36     + compatible = "regulator-fixed";
37     + regulator-name = "main_12v0";
38     + regulator-min-microvolt = <12000000>;
39     + regulator-max-microvolt = <12000000>;
40     + regulator-always-on;
41     + regulator-boot-on;
42     + };
43     +
44     + evm_5v0: fixedregulator-evm_5v0 {
45     + /* Output of TPS54531D */
46     + compatible = "regulator-fixed";
47     + regulator-name = "evm_5v0";
48     + regulator-min-microvolt = <5000000>;
49     + regulator-max-microvolt = <5000000>;
50     + vin-supply = <&main_12v0>;
51     + regulator-always-on;
52     + regulator-boot-on;
53     + };
54     +
55     vdd_3v3: fixedregulator-vdd_3v3 {
56     compatible = "regulator-fixed";
57     regulator-name = "vdd_3v3";
58     diff --git a/arch/arm64/boot/Makefile b/arch/arm64/boot/Makefile
59     index 1f012c506434..cd3414898d10 100644
60     --- a/arch/arm64/boot/Makefile
61     +++ b/arch/arm64/boot/Makefile
62     @@ -16,7 +16,7 @@
63    
64     OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
65    
66     -targets := Image Image.gz
67     +targets := Image Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo
68    
69     $(obj)/Image: vmlinux FORCE
70     $(call if_changed,objcopy)
71     diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi
72     index e1a961f05dcd..baa0c503e741 100644
73     --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi
74     +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0-best-effort.dtsi
75     @@ -63,6 +63,7 @@ fman@400000 {
76     #size-cells = <0>;
77     compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
78     reg = <0xe1000 0x1000>;
79     + fsl,erratum-a011043; /* must ignore read errors */
80    
81     pcsphy0: ethernet-phy@0 {
82     reg = <0x0>;
83     diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi
84     index c288f3c6c637..93095600e808 100644
85     --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi
86     +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-0.dtsi
87     @@ -60,6 +60,7 @@ fman@400000 {
88     #size-cells = <0>;
89     compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
90     reg = <0xf1000 0x1000>;
91     + fsl,erratum-a011043; /* must ignore read errors */
92    
93     pcsphy6: ethernet-phy@0 {
94     reg = <0x0>;
95     diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi
96     index 94f3e7175012..ff4bd38f0645 100644
97     --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi
98     +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1-best-effort.dtsi
99     @@ -63,6 +63,7 @@ fman@400000 {
100     #size-cells = <0>;
101     compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
102     reg = <0xe3000 0x1000>;
103     + fsl,erratum-a011043; /* must ignore read errors */
104    
105     pcsphy1: ethernet-phy@0 {
106     reg = <0x0>;
107     diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi
108     index 94a76982d214..1fa38ed6f59e 100644
109     --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi
110     +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-1.dtsi
111     @@ -60,6 +60,7 @@ fman@400000 {
112     #size-cells = <0>;
113     compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
114     reg = <0xf3000 0x1000>;
115     + fsl,erratum-a011043; /* must ignore read errors */
116    
117     pcsphy7: ethernet-phy@0 {
118     reg = <0x0>;
119     diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi
120     index b5ff5f71c6b8..a8cc9780c0c4 100644
121     --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi
122     +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-0.dtsi
123     @@ -59,6 +59,7 @@ fman@400000 {
124     #size-cells = <0>;
125     compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
126     reg = <0xe1000 0x1000>;
127     + fsl,erratum-a011043; /* must ignore read errors */
128    
129     pcsphy0: ethernet-phy@0 {
130     reg = <0x0>;
131     diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi
132     index ee44182c6348..8b8bd70c9382 100644
133     --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi
134     +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-1.dtsi
135     @@ -59,6 +59,7 @@ fman@400000 {
136     #size-cells = <0>;
137     compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
138     reg = <0xe3000 0x1000>;
139     + fsl,erratum-a011043; /* must ignore read errors */
140    
141     pcsphy1: ethernet-phy@0 {
142     reg = <0x0>;
143     diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi
144     index f05f0d775039..619c880b54d8 100644
145     --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi
146     +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-2.dtsi
147     @@ -59,6 +59,7 @@ fman@400000 {
148     #size-cells = <0>;
149     compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
150     reg = <0xe5000 0x1000>;
151     + fsl,erratum-a011043; /* must ignore read errors */
152    
153     pcsphy2: ethernet-phy@0 {
154     reg = <0x0>;
155     diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi
156     index a9114ec51075..d7ebb73a400d 100644
157     --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi
158     +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-3.dtsi
159     @@ -59,6 +59,7 @@ fman@400000 {
160     #size-cells = <0>;
161     compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
162     reg = <0xe7000 0x1000>;
163     + fsl,erratum-a011043; /* must ignore read errors */
164    
165     pcsphy3: ethernet-phy@0 {
166     reg = <0x0>;
167     diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi
168     index 44dd00ac7367..b151d696a069 100644
169     --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi
170     +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-4.dtsi
171     @@ -59,6 +59,7 @@ fman@400000 {
172     #size-cells = <0>;
173     compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
174     reg = <0xe9000 0x1000>;
175     + fsl,erratum-a011043; /* must ignore read errors */
176    
177     pcsphy4: ethernet-phy@0 {
178     reg = <0x0>;
179     diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi
180     index 5b1b84b58602..adc0ae0013a3 100644
181     --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi
182     +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-1g-5.dtsi
183     @@ -59,6 +59,7 @@ fman@400000 {
184     #size-cells = <0>;
185     compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
186     reg = <0xeb000 0x1000>;
187     + fsl,erratum-a011043; /* must ignore read errors */
188    
189     pcsphy5: ethernet-phy@0 {
190     reg = <0x0>;
191     diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi
192     index 0e1daaef9e74..435047e0e250 100644
193     --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi
194     +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-0.dtsi
195     @@ -60,6 +60,7 @@ fman@500000 {
196     #size-cells = <0>;
197     compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
198     reg = <0xf1000 0x1000>;
199     + fsl,erratum-a011043; /* must ignore read errors */
200    
201     pcsphy14: ethernet-phy@0 {
202     reg = <0x0>;
203     diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi
204     index 68c5ef779266..c098657cca0a 100644
205     --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi
206     +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-10g-1.dtsi
207     @@ -60,6 +60,7 @@ fman@500000 {
208     #size-cells = <0>;
209     compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
210     reg = <0xf3000 0x1000>;
211     + fsl,erratum-a011043; /* must ignore read errors */
212    
213     pcsphy15: ethernet-phy@0 {
214     reg = <0x0>;
215     diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi
216     index 605363cc1117..9d06824815f3 100644
217     --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi
218     +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-0.dtsi
219     @@ -59,6 +59,7 @@ fman@500000 {
220     #size-cells = <0>;
221     compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
222     reg = <0xe1000 0x1000>;
223     + fsl,erratum-a011043; /* must ignore read errors */
224    
225     pcsphy8: ethernet-phy@0 {
226     reg = <0x0>;
227     diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi
228     index 1955dfa13634..70e947730c4b 100644
229     --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi
230     +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-1.dtsi
231     @@ -59,6 +59,7 @@ fman@500000 {
232     #size-cells = <0>;
233     compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
234     reg = <0xe3000 0x1000>;
235     + fsl,erratum-a011043; /* must ignore read errors */
236    
237     pcsphy9: ethernet-phy@0 {
238     reg = <0x0>;
239     diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi
240     index 2c1476454ee0..ad96e6529595 100644
241     --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi
242     +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-2.dtsi
243     @@ -59,6 +59,7 @@ fman@500000 {
244     #size-cells = <0>;
245     compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
246     reg = <0xe5000 0x1000>;
247     + fsl,erratum-a011043; /* must ignore read errors */
248    
249     pcsphy10: ethernet-phy@0 {
250     reg = <0x0>;
251     diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi
252     index b8b541ff5fb0..034bc4b71f7a 100644
253     --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi
254     +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-3.dtsi
255     @@ -59,6 +59,7 @@ fman@500000 {
256     #size-cells = <0>;
257     compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
258     reg = <0xe7000 0x1000>;
259     + fsl,erratum-a011043; /* must ignore read errors */
260    
261     pcsphy11: ethernet-phy@0 {
262     reg = <0x0>;
263     diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi
264     index 4b2cfddd1b15..93ca23d82b39 100644
265     --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi
266     +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-4.dtsi
267     @@ -59,6 +59,7 @@ fman@500000 {
268     #size-cells = <0>;
269     compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
270     reg = <0xe9000 0x1000>;
271     + fsl,erratum-a011043; /* must ignore read errors */
272    
273     pcsphy12: ethernet-phy@0 {
274     reg = <0x0>;
275     diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi
276     index 0a52ddf7cc17..23b3117a2fd2 100644
277     --- a/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi
278     +++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-1-1g-5.dtsi
279     @@ -59,6 +59,7 @@ fman@500000 {
280     #size-cells = <0>;
281     compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio";
282     reg = <0xeb000 0x1000>;
283     + fsl,erratum-a011043; /* must ignore read errors */
284    
285     pcsphy13: ethernet-phy@0 {
286     reg = <0x0>;
287     diff --git a/crypto/af_alg.c b/crypto/af_alg.c
288     index b5953f1d1a18..cf3975ee4fd8 100644
289     --- a/crypto/af_alg.c
290     +++ b/crypto/af_alg.c
291     @@ -136,11 +136,13 @@ void af_alg_release_parent(struct sock *sk)
292     sk = ask->parent;
293     ask = alg_sk(sk);
294    
295     - lock_sock(sk);
296     + local_bh_disable();
297     + bh_lock_sock(sk);
298     ask->nokey_refcnt -= nokey;
299     if (!last)
300     last = !--ask->refcnt;
301     - release_sock(sk);
302     + bh_unlock_sock(sk);
303     + local_bh_enable();
304    
305     if (last)
306     sock_put(sk);
307     diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
308     index a5718c0a3dc4..1348541da463 100644
309     --- a/crypto/pcrypt.c
310     +++ b/crypto/pcrypt.c
311     @@ -505,11 +505,12 @@ err:
312    
313     static void __exit pcrypt_exit(void)
314     {
315     + crypto_unregister_template(&pcrypt_tmpl);
316     +
317     pcrypt_fini_padata(&pencrypt);
318     pcrypt_fini_padata(&pdecrypt);
319    
320     kset_unregister(pcrypt_kset);
321     - crypto_unregister_template(&pcrypt_tmpl);
322     }
323    
324     module_init(pcrypt_init);
325     diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
326     index 40c2d561417b..88819409e0be 100644
327     --- a/drivers/atm/eni.c
328     +++ b/drivers/atm/eni.c
329     @@ -372,7 +372,7 @@ static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb,
330     here = (eni_vcc->descr+skip) & (eni_vcc->words-1);
331     dma[j++] = (here << MID_DMA_COUNT_SHIFT) | (vcc->vci
332     << MID_DMA_VCI_SHIFT) | MID_DT_JK;
333     - j++;
334     + dma[j++] = 0;
335     }
336     here = (eni_vcc->descr+size+skip) & (eni_vcc->words-1);
337     if (!eff) size += skip;
338     @@ -445,7 +445,7 @@ static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb,
339     if (size != eff) {
340     dma[j++] = (here << MID_DMA_COUNT_SHIFT) |
341     (vcc->vci << MID_DMA_VCI_SHIFT) | MID_DT_JK;
342     - j++;
343     + dma[j++] = 0;
344     }
345     if (!j || j > 2*RX_DMA_BUF) {
346     printk(KERN_CRIT DEV_LABEL "!j or j too big!!!\n");
347     diff --git a/drivers/char/ttyprintk.c b/drivers/char/ttyprintk.c
348     index 67549ce88cc9..774748497ace 100644
349     --- a/drivers/char/ttyprintk.c
350     +++ b/drivers/char/ttyprintk.c
351     @@ -18,10 +18,11 @@
352     #include <linux/serial.h>
353     #include <linux/tty.h>
354     #include <linux/module.h>
355     +#include <linux/spinlock.h>
356    
357     struct ttyprintk_port {
358     struct tty_port port;
359     - struct mutex port_write_mutex;
360     + spinlock_t spinlock;
361     };
362    
363     static struct ttyprintk_port tpk_port;
364     @@ -100,11 +101,12 @@ static int tpk_open(struct tty_struct *tty, struct file *filp)
365     static void tpk_close(struct tty_struct *tty, struct file *filp)
366     {
367     struct ttyprintk_port *tpkp = tty->driver_data;
368     + unsigned long flags;
369    
370     - mutex_lock(&tpkp->port_write_mutex);
371     + spin_lock_irqsave(&tpkp->spinlock, flags);
372     /* flush tpk_printk buffer */
373     tpk_printk(NULL, 0);
374     - mutex_unlock(&tpkp->port_write_mutex);
375     + spin_unlock_irqrestore(&tpkp->spinlock, flags);
376    
377     tty_port_close(&tpkp->port, tty, filp);
378     }
379     @@ -116,13 +118,14 @@ static int tpk_write(struct tty_struct *tty,
380     const unsigned char *buf, int count)
381     {
382     struct ttyprintk_port *tpkp = tty->driver_data;
383     + unsigned long flags;
384     int ret;
385    
386    
387     /* exclusive use of tpk_printk within this tty */
388     - mutex_lock(&tpkp->port_write_mutex);
389     + spin_lock_irqsave(&tpkp->spinlock, flags);
390     ret = tpk_printk(buf, count);
391     - mutex_unlock(&tpkp->port_write_mutex);
392     + spin_unlock_irqrestore(&tpkp->spinlock, flags);
393    
394     return ret;
395     }
396     @@ -172,7 +175,7 @@ static int __init ttyprintk_init(void)
397     {
398     int ret = -ENOMEM;
399    
400     - mutex_init(&tpk_port.port_write_mutex);
401     + spin_lock_init(&tpk_port.spinlock);
402    
403     ttyprintk_driver = tty_alloc_driver(1,
404     TTY_DRIVER_RESET_TERMIOS |
405     diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c
406     index 061a9f10218b..20cfdf837bfa 100644
407     --- a/drivers/clk/mmp/clk-of-mmp2.c
408     +++ b/drivers/clk/mmp/clk-of-mmp2.c
409     @@ -134,7 +134,7 @@ static DEFINE_SPINLOCK(ssp3_lock);
410     static const char *ssp_parent_names[] = {"vctcxo_4", "vctcxo_2", "vctcxo", "pll1_16"};
411    
412     static DEFINE_SPINLOCK(timer_lock);
413     -static const char *timer_parent_names[] = {"clk32", "vctcxo_2", "vctcxo_4", "vctcxo"};
414     +static const char *timer_parent_names[] = {"clk32", "vctcxo_4", "vctcxo_2", "vctcxo"};
415    
416     static DEFINE_SPINLOCK(reset_lock);
417    
418     diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
419     index b992badb99dd..5d097d631e39 100644
420     --- a/drivers/gpio/Kconfig
421     +++ b/drivers/gpio/Kconfig
422     @@ -920,6 +920,7 @@ config GPIO_LP873X
423     config GPIO_MAX77620
424     tristate "GPIO support for PMIC MAX77620 and MAX20024"
425     depends on MFD_MAX77620
426     + select GPIOLIB_IRQCHIP
427     help
428     GPIO driver for MAX77620 and MAX20024 PMIC from Maxim Semiconductor.
429     MAX77620 PMIC has 8 pins that can be configured as GPIOs. The
430     diff --git a/drivers/iio/gyro/st_gyro.h b/drivers/iio/gyro/st_gyro.h
431     index a5c5c4e29add..48923ae6ac3b 100644
432     --- a/drivers/iio/gyro/st_gyro.h
433     +++ b/drivers/iio/gyro/st_gyro.h
434     @@ -19,6 +19,7 @@
435     #define LSM330DL_GYRO_DEV_NAME "lsm330dl_gyro"
436     #define LSM330DLC_GYRO_DEV_NAME "lsm330dlc_gyro"
437     #define L3GD20_GYRO_DEV_NAME "l3gd20"
438     +#define L3GD20H_GYRO_DEV_NAME "l3gd20h"
439     #define L3G4IS_GYRO_DEV_NAME "l3g4is_ui"
440     #define LSM330_GYRO_DEV_NAME "lsm330_gyro"
441     #define LSM9DS0_GYRO_DEV_NAME "lsm9ds0_gyro"
442     diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c
443     index aea034d8fe0f..e366422e8512 100644
444     --- a/drivers/iio/gyro/st_gyro_core.c
445     +++ b/drivers/iio/gyro/st_gyro_core.c
446     @@ -35,83 +35,11 @@
447     #define ST_GYRO_DEFAULT_OUT_Z_L_ADDR 0x2c
448    
449     /* FULLSCALE */
450     +#define ST_GYRO_FS_AVL_245DPS 245
451     #define ST_GYRO_FS_AVL_250DPS 250
452     #define ST_GYRO_FS_AVL_500DPS 500
453     #define ST_GYRO_FS_AVL_2000DPS 2000
454    
455     -/* CUSTOM VALUES FOR SENSOR 1 */
456     -#define ST_GYRO_1_WAI_EXP 0xd3
457     -#define ST_GYRO_1_ODR_ADDR 0x20
458     -#define ST_GYRO_1_ODR_MASK 0xc0
459     -#define ST_GYRO_1_ODR_AVL_100HZ_VAL 0x00
460     -#define ST_GYRO_1_ODR_AVL_200HZ_VAL 0x01
461     -#define ST_GYRO_1_ODR_AVL_400HZ_VAL 0x02
462     -#define ST_GYRO_1_ODR_AVL_800HZ_VAL 0x03
463     -#define ST_GYRO_1_PW_ADDR 0x20
464     -#define ST_GYRO_1_PW_MASK 0x08
465     -#define ST_GYRO_1_FS_ADDR 0x23
466     -#define ST_GYRO_1_FS_MASK 0x30
467     -#define ST_GYRO_1_FS_AVL_250_VAL 0x00
468     -#define ST_GYRO_1_FS_AVL_500_VAL 0x01
469     -#define ST_GYRO_1_FS_AVL_2000_VAL 0x02
470     -#define ST_GYRO_1_FS_AVL_250_GAIN IIO_DEGREE_TO_RAD(8750)
471     -#define ST_GYRO_1_FS_AVL_500_GAIN IIO_DEGREE_TO_RAD(17500)
472     -#define ST_GYRO_1_FS_AVL_2000_GAIN IIO_DEGREE_TO_RAD(70000)
473     -#define ST_GYRO_1_BDU_ADDR 0x23
474     -#define ST_GYRO_1_BDU_MASK 0x80
475     -#define ST_GYRO_1_DRDY_IRQ_ADDR 0x22
476     -#define ST_GYRO_1_DRDY_IRQ_INT2_MASK 0x08
477     -#define ST_GYRO_1_MULTIREAD_BIT true
478     -
479     -/* CUSTOM VALUES FOR SENSOR 2 */
480     -#define ST_GYRO_2_WAI_EXP 0xd4
481     -#define ST_GYRO_2_ODR_ADDR 0x20
482     -#define ST_GYRO_2_ODR_MASK 0xc0
483     -#define ST_GYRO_2_ODR_AVL_95HZ_VAL 0x00
484     -#define ST_GYRO_2_ODR_AVL_190HZ_VAL 0x01
485     -#define ST_GYRO_2_ODR_AVL_380HZ_VAL 0x02
486     -#define ST_GYRO_2_ODR_AVL_760HZ_VAL 0x03
487     -#define ST_GYRO_2_PW_ADDR 0x20
488     -#define ST_GYRO_2_PW_MASK 0x08
489     -#define ST_GYRO_2_FS_ADDR 0x23
490     -#define ST_GYRO_2_FS_MASK 0x30
491     -#define ST_GYRO_2_FS_AVL_250_VAL 0x00
492     -#define ST_GYRO_2_FS_AVL_500_VAL 0x01
493     -#define ST_GYRO_2_FS_AVL_2000_VAL 0x02
494     -#define ST_GYRO_2_FS_AVL_250_GAIN IIO_DEGREE_TO_RAD(8750)
495     -#define ST_GYRO_2_FS_AVL_500_GAIN IIO_DEGREE_TO_RAD(17500)
496     -#define ST_GYRO_2_FS_AVL_2000_GAIN IIO_DEGREE_TO_RAD(70000)
497     -#define ST_GYRO_2_BDU_ADDR 0x23
498     -#define ST_GYRO_2_BDU_MASK 0x80
499     -#define ST_GYRO_2_DRDY_IRQ_ADDR 0x22
500     -#define ST_GYRO_2_DRDY_IRQ_INT2_MASK 0x08
501     -#define ST_GYRO_2_MULTIREAD_BIT true
502     -
503     -/* CUSTOM VALUES FOR SENSOR 3 */
504     -#define ST_GYRO_3_WAI_EXP 0xd7
505     -#define ST_GYRO_3_ODR_ADDR 0x20
506     -#define ST_GYRO_3_ODR_MASK 0xc0
507     -#define ST_GYRO_3_ODR_AVL_95HZ_VAL 0x00
508     -#define ST_GYRO_3_ODR_AVL_190HZ_VAL 0x01
509     -#define ST_GYRO_3_ODR_AVL_380HZ_VAL 0x02
510     -#define ST_GYRO_3_ODR_AVL_760HZ_VAL 0x03
511     -#define ST_GYRO_3_PW_ADDR 0x20
512     -#define ST_GYRO_3_PW_MASK 0x08
513     -#define ST_GYRO_3_FS_ADDR 0x23
514     -#define ST_GYRO_3_FS_MASK 0x30
515     -#define ST_GYRO_3_FS_AVL_250_VAL 0x00
516     -#define ST_GYRO_3_FS_AVL_500_VAL 0x01
517     -#define ST_GYRO_3_FS_AVL_2000_VAL 0x02
518     -#define ST_GYRO_3_FS_AVL_250_GAIN IIO_DEGREE_TO_RAD(8750)
519     -#define ST_GYRO_3_FS_AVL_500_GAIN IIO_DEGREE_TO_RAD(17500)
520     -#define ST_GYRO_3_FS_AVL_2000_GAIN IIO_DEGREE_TO_RAD(70000)
521     -#define ST_GYRO_3_BDU_ADDR 0x23
522     -#define ST_GYRO_3_BDU_MASK 0x80
523     -#define ST_GYRO_3_DRDY_IRQ_ADDR 0x22
524     -#define ST_GYRO_3_DRDY_IRQ_INT2_MASK 0x08
525     -#define ST_GYRO_3_MULTIREAD_BIT true
526     -
527     -
528     static const struct iio_chan_spec st_gyro_16bit_channels[] = {
529     ST_SENSORS_LSM_CHANNELS(IIO_ANGL_VEL,
530     BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
531     @@ -130,7 +58,7 @@ static const struct iio_chan_spec st_gyro_16bit_channels[] = {
532    
533     static const struct st_sensor_settings st_gyro_sensors_settings[] = {
534     {
535     - .wai = ST_GYRO_1_WAI_EXP,
536     + .wai = 0xd3,
537     .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
538     .sensors_supported = {
539     [0] = L3G4200D_GYRO_DEV_NAME,
540     @@ -138,18 +66,18 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
541     },
542     .ch = (struct iio_chan_spec *)st_gyro_16bit_channels,
543     .odr = {
544     - .addr = ST_GYRO_1_ODR_ADDR,
545     - .mask = ST_GYRO_1_ODR_MASK,
546     + .addr = 0x20,
547     + .mask = 0xc0,
548     .odr_avl = {
549     - { 100, ST_GYRO_1_ODR_AVL_100HZ_VAL, },
550     - { 200, ST_GYRO_1_ODR_AVL_200HZ_VAL, },
551     - { 400, ST_GYRO_1_ODR_AVL_400HZ_VAL, },
552     - { 800, ST_GYRO_1_ODR_AVL_800HZ_VAL, },
553     + { .hz = 100, .value = 0x00, },
554     + { .hz = 200, .value = 0x01, },
555     + { .hz = 400, .value = 0x02, },
556     + { .hz = 800, .value = 0x03, },
557     },
558     },
559     .pw = {
560     - .addr = ST_GYRO_1_PW_ADDR,
561     - .mask = ST_GYRO_1_PW_MASK,
562     + .addr = 0x20,
563     + .mask = 0x08,
564     .value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE,
565     .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
566     },
567     @@ -158,33 +86,33 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
568     .mask = ST_SENSORS_DEFAULT_AXIS_MASK,
569     },
570     .fs = {
571     - .addr = ST_GYRO_1_FS_ADDR,
572     - .mask = ST_GYRO_1_FS_MASK,
573     + .addr = 0x23,
574     + .mask = 0x30,
575     .fs_avl = {
576     [0] = {
577     .num = ST_GYRO_FS_AVL_250DPS,
578     - .value = ST_GYRO_1_FS_AVL_250_VAL,
579     - .gain = ST_GYRO_1_FS_AVL_250_GAIN,
580     + .value = 0x00,
581     + .gain = IIO_DEGREE_TO_RAD(8750),
582     },
583     [1] = {
584     .num = ST_GYRO_FS_AVL_500DPS,
585     - .value = ST_GYRO_1_FS_AVL_500_VAL,
586     - .gain = ST_GYRO_1_FS_AVL_500_GAIN,
587     + .value = 0x01,
588     + .gain = IIO_DEGREE_TO_RAD(17500),
589     },
590     [2] = {
591     .num = ST_GYRO_FS_AVL_2000DPS,
592     - .value = ST_GYRO_1_FS_AVL_2000_VAL,
593     - .gain = ST_GYRO_1_FS_AVL_2000_GAIN,
594     + .value = 0x02,
595     + .gain = IIO_DEGREE_TO_RAD(70000),
596     },
597     },
598     },
599     .bdu = {
600     - .addr = ST_GYRO_1_BDU_ADDR,
601     - .mask = ST_GYRO_1_BDU_MASK,
602     + .addr = 0x23,
603     + .mask = 0x80,
604     },
605     .drdy_irq = {
606     - .addr = ST_GYRO_1_DRDY_IRQ_ADDR,
607     - .mask_int2 = ST_GYRO_1_DRDY_IRQ_INT2_MASK,
608     + .addr = 0x22,
609     + .mask_int2 = 0x08,
610     /*
611     * The sensor has IHL (active low) and open
612     * drain settings, but only for INT1 and not
613     @@ -192,11 +120,11 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
614     */
615     .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
616     },
617     - .multi_read_bit = ST_GYRO_1_MULTIREAD_BIT,
618     + .multi_read_bit = true,
619     .bootime = 2,
620     },
621     {
622     - .wai = ST_GYRO_2_WAI_EXP,
623     + .wai = 0xd4,
624     .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
625     .sensors_supported = {
626     [0] = L3GD20_GYRO_DEV_NAME,
627     @@ -208,18 +136,18 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
628     },
629     .ch = (struct iio_chan_spec *)st_gyro_16bit_channels,
630     .odr = {
631     - .addr = ST_GYRO_2_ODR_ADDR,
632     - .mask = ST_GYRO_2_ODR_MASK,
633     + .addr = 0x20,
634     + .mask = 0xc0,
635     .odr_avl = {
636     - { 95, ST_GYRO_2_ODR_AVL_95HZ_VAL, },
637     - { 190, ST_GYRO_2_ODR_AVL_190HZ_VAL, },
638     - { 380, ST_GYRO_2_ODR_AVL_380HZ_VAL, },
639     - { 760, ST_GYRO_2_ODR_AVL_760HZ_VAL, },
640     + { .hz = 95, .value = 0x00, },
641     + { .hz = 190, .value = 0x01, },
642     + { .hz = 380, .value = 0x02, },
643     + { .hz = 760, .value = 0x03, },
644     },
645     },
646     .pw = {
647     - .addr = ST_GYRO_2_PW_ADDR,
648     - .mask = ST_GYRO_2_PW_MASK,
649     + .addr = 0x20,
650     + .mask = 0x08,
651     .value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE,
652     .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
653     },
654     @@ -228,33 +156,33 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
655     .mask = ST_SENSORS_DEFAULT_AXIS_MASK,
656     },
657     .fs = {
658     - .addr = ST_GYRO_2_FS_ADDR,
659     - .mask = ST_GYRO_2_FS_MASK,
660     + .addr = 0x23,
661     + .mask = 0x30,
662     .fs_avl = {
663     [0] = {
664     .num = ST_GYRO_FS_AVL_250DPS,
665     - .value = ST_GYRO_2_FS_AVL_250_VAL,
666     - .gain = ST_GYRO_2_FS_AVL_250_GAIN,
667     + .value = 0x00,
668     + .gain = IIO_DEGREE_TO_RAD(8750),
669     },
670     [1] = {
671     .num = ST_GYRO_FS_AVL_500DPS,
672     - .value = ST_GYRO_2_FS_AVL_500_VAL,
673     - .gain = ST_GYRO_2_FS_AVL_500_GAIN,
674     + .value = 0x01,
675     + .gain = IIO_DEGREE_TO_RAD(17500),
676     },
677     [2] = {
678     .num = ST_GYRO_FS_AVL_2000DPS,
679     - .value = ST_GYRO_2_FS_AVL_2000_VAL,
680     - .gain = ST_GYRO_2_FS_AVL_2000_GAIN,
681     + .value = 0x02,
682     + .gain = IIO_DEGREE_TO_RAD(70000),
683     },
684     },
685     },
686     .bdu = {
687     - .addr = ST_GYRO_2_BDU_ADDR,
688     - .mask = ST_GYRO_2_BDU_MASK,
689     + .addr = 0x23,
690     + .mask = 0x80,
691     },
692     .drdy_irq = {
693     - .addr = ST_GYRO_2_DRDY_IRQ_ADDR,
694     - .mask_int2 = ST_GYRO_2_DRDY_IRQ_INT2_MASK,
695     + .addr = 0x22,
696     + .mask_int2 = 0x08,
697     /*
698     * The sensor has IHL (active low) and open
699     * drain settings, but only for INT1 and not
700     @@ -262,29 +190,29 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
701     */
702     .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
703     },
704     - .multi_read_bit = ST_GYRO_2_MULTIREAD_BIT,
705     + .multi_read_bit = true,
706     .bootime = 2,
707     },
708     {
709     - .wai = ST_GYRO_3_WAI_EXP,
710     + .wai = 0xd7,
711     .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
712     .sensors_supported = {
713     - [0] = L3GD20_GYRO_DEV_NAME,
714     + [0] = L3GD20H_GYRO_DEV_NAME,
715     },
716     .ch = (struct iio_chan_spec *)st_gyro_16bit_channels,
717     .odr = {
718     - .addr = ST_GYRO_3_ODR_ADDR,
719     - .mask = ST_GYRO_3_ODR_MASK,
720     + .addr = 0x20,
721     + .mask = 0xc0,
722     .odr_avl = {
723     - { 95, ST_GYRO_3_ODR_AVL_95HZ_VAL, },
724     - { 190, ST_GYRO_3_ODR_AVL_190HZ_VAL, },
725     - { 380, ST_GYRO_3_ODR_AVL_380HZ_VAL, },
726     - { 760, ST_GYRO_3_ODR_AVL_760HZ_VAL, },
727     + { .hz = 100, .value = 0x00, },
728     + { .hz = 200, .value = 0x01, },
729     + { .hz = 400, .value = 0x02, },
730     + { .hz = 800, .value = 0x03, },
731     },
732     },
733     .pw = {
734     - .addr = ST_GYRO_3_PW_ADDR,
735     - .mask = ST_GYRO_3_PW_MASK,
736     + .addr = 0x20,
737     + .mask = 0x08,
738     .value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE,
739     .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
740     },
741     @@ -293,33 +221,33 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
742     .mask = ST_SENSORS_DEFAULT_AXIS_MASK,
743     },
744     .fs = {
745     - .addr = ST_GYRO_3_FS_ADDR,
746     - .mask = ST_GYRO_3_FS_MASK,
747     + .addr = 0x23,
748     + .mask = 0x30,
749     .fs_avl = {
750     [0] = {
751     - .num = ST_GYRO_FS_AVL_250DPS,
752     - .value = ST_GYRO_3_FS_AVL_250_VAL,
753     - .gain = ST_GYRO_3_FS_AVL_250_GAIN,
754     + .num = ST_GYRO_FS_AVL_245DPS,
755     + .value = 0x00,
756     + .gain = IIO_DEGREE_TO_RAD(8750),
757     },
758     [1] = {
759     .num = ST_GYRO_FS_AVL_500DPS,
760     - .value = ST_GYRO_3_FS_AVL_500_VAL,
761     - .gain = ST_GYRO_3_FS_AVL_500_GAIN,
762     + .value = 0x01,
763     + .gain = IIO_DEGREE_TO_RAD(17500),
764     },
765     [2] = {
766     .num = ST_GYRO_FS_AVL_2000DPS,
767     - .value = ST_GYRO_3_FS_AVL_2000_VAL,
768     - .gain = ST_GYRO_3_FS_AVL_2000_GAIN,
769     + .value = 0x02,
770     + .gain = IIO_DEGREE_TO_RAD(70000),
771     },
772     },
773     },
774     .bdu = {
775     - .addr = ST_GYRO_3_BDU_ADDR,
776     - .mask = ST_GYRO_3_BDU_MASK,
777     + .addr = 0x23,
778     + .mask = 0x80,
779     },
780     .drdy_irq = {
781     - .addr = ST_GYRO_3_DRDY_IRQ_ADDR,
782     - .mask_int2 = ST_GYRO_3_DRDY_IRQ_INT2_MASK,
783     + .addr = 0x22,
784     + .mask_int2 = 0x08,
785     /*
786     * The sensor has IHL (active low) and open
787     * drain settings, but only for INT1 and not
788     @@ -327,7 +255,7 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
789     */
790     .addr_stat_drdy = ST_SENSORS_DEFAULT_STAT_ADDR,
791     },
792     - .multi_read_bit = ST_GYRO_3_MULTIREAD_BIT,
793     + .multi_read_bit = true,
794     .bootime = 2,
795     },
796     };
797     diff --git a/drivers/iio/gyro/st_gyro_i2c.c b/drivers/iio/gyro/st_gyro_i2c.c
798     index 40056b821036..3f628746cb93 100644
799     --- a/drivers/iio/gyro/st_gyro_i2c.c
800     +++ b/drivers/iio/gyro/st_gyro_i2c.c
801     @@ -40,6 +40,10 @@ static const struct of_device_id st_gyro_of_match[] = {
802     .compatible = "st,l3gd20-gyro",
803     .data = L3GD20_GYRO_DEV_NAME,
804     },
805     + {
806     + .compatible = "st,l3gd20h-gyro",
807     + .data = L3GD20H_GYRO_DEV_NAME,
808     + },
809     {
810     .compatible = "st,l3g4is-gyro",
811     .data = L3G4IS_GYRO_DEV_NAME,
812     @@ -95,6 +99,7 @@ static const struct i2c_device_id st_gyro_id_table[] = {
813     { LSM330DL_GYRO_DEV_NAME },
814     { LSM330DLC_GYRO_DEV_NAME },
815     { L3GD20_GYRO_DEV_NAME },
816     + { L3GD20H_GYRO_DEV_NAME },
817     { L3G4IS_GYRO_DEV_NAME },
818     { LSM330_GYRO_DEV_NAME },
819     { LSM9DS0_GYRO_DEV_NAME },
820     diff --git a/drivers/iio/gyro/st_gyro_spi.c b/drivers/iio/gyro/st_gyro_spi.c
821     index fbf2faed501c..fa14d8f2170d 100644
822     --- a/drivers/iio/gyro/st_gyro_spi.c
823     +++ b/drivers/iio/gyro/st_gyro_spi.c
824     @@ -52,6 +52,7 @@ static const struct spi_device_id st_gyro_id_table[] = {
825     { LSM330DL_GYRO_DEV_NAME },
826     { LSM330DLC_GYRO_DEV_NAME },
827     { L3GD20_GYRO_DEV_NAME },
828     + { L3GD20H_GYRO_DEV_NAME },
829     { L3G4IS_GYRO_DEV_NAME },
830     { LSM330_GYRO_DEV_NAME },
831     { LSM9DS0_GYRO_DEV_NAME },
832     diff --git a/drivers/media/radio/si470x/radio-si470x-i2c.c b/drivers/media/radio/si470x/radio-si470x-i2c.c
833     index fb69534a8b56..8f3086773db4 100644
834     --- a/drivers/media/radio/si470x/radio-si470x-i2c.c
835     +++ b/drivers/media/radio/si470x/radio-si470x-i2c.c
836     @@ -458,10 +458,10 @@ static int si470x_i2c_remove(struct i2c_client *client)
837    
838     free_irq(client->irq, radio);
839     video_unregister_device(&radio->videodev);
840     - kfree(radio);
841    
842     v4l2_ctrl_handler_free(&radio->hdl);
843     v4l2_device_unregister(&radio->v4l2_dev);
844     + kfree(radio);
845     return 0;
846     }
847    
848     diff --git a/drivers/media/usb/dvb-usb/af9005.c b/drivers/media/usb/dvb-usb/af9005.c
849     index e5d411007ae4..519e01ba5750 100644
850     --- a/drivers/media/usb/dvb-usb/af9005.c
851     +++ b/drivers/media/usb/dvb-usb/af9005.c
852     @@ -567,7 +567,7 @@ static int af9005_boot_packet(struct usb_device *udev, int type, u8 *reply,
853     u8 *buf, int size)
854     {
855     u16 checksum;
856     - int act_len, i, ret;
857     + int act_len = 0, i, ret;
858    
859     memset(buf, 0, size);
860     buf[0] = (u8) (FW_BULKOUT_SIZE & 0xff);
861     diff --git a/drivers/media/usb/dvb-usb/digitv.c b/drivers/media/usb/dvb-usb/digitv.c
862     index 475a3c0cdee7..20d33f0544ed 100644
863     --- a/drivers/media/usb/dvb-usb/digitv.c
864     +++ b/drivers/media/usb/dvb-usb/digitv.c
865     @@ -233,18 +233,22 @@ static struct rc_map_table rc_map_digitv_table[] = {
866    
867     static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
868     {
869     - int i;
870     + int ret, i;
871     u8 key[5];
872     u8 b[4] = { 0 };
873    
874     *event = 0;
875     *state = REMOTE_NO_KEY_PRESSED;
876    
877     - digitv_ctrl_msg(d,USB_READ_REMOTE,0,NULL,0,&key[1],4);
878     + ret = digitv_ctrl_msg(d, USB_READ_REMOTE, 0, NULL, 0, &key[1], 4);
879     + if (ret)
880     + return ret;
881    
882     /* Tell the device we've read the remote. Not sure how necessary
883     this is, but the Nebula SDK does it. */
884     - digitv_ctrl_msg(d,USB_WRITE_REMOTE,0,b,4,NULL,0);
885     + ret = digitv_ctrl_msg(d, USB_WRITE_REMOTE, 0, b, 4, NULL, 0);
886     + if (ret)
887     + return ret;
888    
889     /* if something is inside the buffer, simulate key press */
890     if (key[1] != 0)
891     diff --git a/drivers/media/usb/dvb-usb/dvb-usb-urb.c b/drivers/media/usb/dvb-usb/dvb-usb-urb.c
892     index 95f9097498cb..2fa8d71385ec 100644
893     --- a/drivers/media/usb/dvb-usb/dvb-usb-urb.c
894     +++ b/drivers/media/usb/dvb-usb/dvb-usb-urb.c
895     @@ -11,7 +11,7 @@
896     int dvb_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf,
897     u16 rlen, int delay_ms)
898     {
899     - int actlen,ret = -ENOMEM;
900     + int actlen = 0, ret = -ENOMEM;
901    
902     if (!d || wbuf == NULL || wlen == 0)
903     return -EINVAL;
904     diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
905     index af2395a76d8b..2cba2e1acdc6 100644
906     --- a/drivers/media/usb/gspca/gspca.c
907     +++ b/drivers/media/usb/gspca/gspca.c
908     @@ -2043,7 +2043,7 @@ int gspca_dev_probe2(struct usb_interface *intf,
909     pr_err("couldn't kzalloc gspca struct\n");
910     return -ENOMEM;
911     }
912     - gspca_dev->usb_buf = kmalloc(USB_BUF_SZ, GFP_KERNEL);
913     + gspca_dev->usb_buf = kzalloc(USB_BUF_SZ, GFP_KERNEL);
914     if (!gspca_dev->usb_buf) {
915     pr_err("out of memory\n");
916     ret = -ENOMEM;
917     diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
918     index 17aa33c5567d..d95dec595786 100644
919     --- a/drivers/net/ethernet/broadcom/b44.c
920     +++ b/drivers/net/ethernet/broadcom/b44.c
921     @@ -1524,8 +1524,10 @@ static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset)
922     int ethaddr_bytes = ETH_ALEN;
923    
924     memset(ppattern + offset, 0xff, magicsync);
925     - for (j = 0; j < magicsync; j++)
926     - set_bit(len++, (unsigned long *) pmask);
927     + for (j = 0; j < magicsync; j++) {
928     + pmask[len >> 3] |= BIT(len & 7);
929     + len++;
930     + }
931    
932     for (j = 0; j < B44_MAX_PATTERNS; j++) {
933     if ((B44_PATTERN_SIZE - len) >= ETH_ALEN)
934     @@ -1537,7 +1539,8 @@ static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset)
935     for (k = 0; k< ethaddr_bytes; k++) {
936     ppattern[offset + magicsync +
937     (j * ETH_ALEN) + k] = macaddr[k];
938     - set_bit(len++, (unsigned long *) pmask);
939     + pmask[len >> 3] |= BIT(len & 7);
940     + len++;
941     }
942     }
943     return len - 1;
944     diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
945     index 61c55621b958..c15052164717 100644
946     --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
947     +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.c
948     @@ -66,8 +66,7 @@ static void *seq_tab_start(struct seq_file *seq, loff_t *pos)
949     static void *seq_tab_next(struct seq_file *seq, void *v, loff_t *pos)
950     {
951     v = seq_tab_get_idx(seq->private, *pos + 1);
952     - if (v)
953     - ++*pos;
954     + ++(*pos);
955     return v;
956     }
957    
958     diff --git a/drivers/net/ethernet/chelsio/cxgb4/l2t.c b/drivers/net/ethernet/chelsio/cxgb4/l2t.c
959     index 60a26037a1c6..e58aae110ed2 100644
960     --- a/drivers/net/ethernet/chelsio/cxgb4/l2t.c
961     +++ b/drivers/net/ethernet/chelsio/cxgb4/l2t.c
962     @@ -682,8 +682,7 @@ static void *l2t_seq_start(struct seq_file *seq, loff_t *pos)
963     static void *l2t_seq_next(struct seq_file *seq, void *v, loff_t *pos)
964     {
965     v = l2t_get_idx(seq, *pos);
966     - if (v)
967     - ++*pos;
968     + ++(*pos);
969     return v;
970     }
971    
972     diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c
973     index 21dd5579130e..c30994a09a7c 100644
974     --- a/drivers/net/ethernet/freescale/fman/fman_memac.c
975     +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c
976     @@ -109,7 +109,7 @@ do { \
977     /* Interface Mode Register (IF_MODE) */
978    
979     #define IF_MODE_MASK 0x00000003 /* 30-31 Mask on i/f mode bits */
980     -#define IF_MODE_XGMII 0x00000000 /* 30-31 XGMII (10G) interface */
981     +#define IF_MODE_10G 0x00000000 /* 30-31 10G interface */
982     #define IF_MODE_GMII 0x00000002 /* 30-31 GMII (1G) interface */
983     #define IF_MODE_RGMII 0x00000004
984     #define IF_MODE_RGMII_AUTO 0x00008000
985     @@ -438,7 +438,7 @@ static int init(struct memac_regs __iomem *regs, struct memac_cfg *cfg,
986     tmp = 0;
987     switch (phy_if) {
988     case PHY_INTERFACE_MODE_XGMII:
989     - tmp |= IF_MODE_XGMII;
990     + tmp |= IF_MODE_10G;
991     break;
992     default:
993     tmp |= IF_MODE_GMII;
994     diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c
995     index e03b30c60dcf..c82c85ef5fb3 100644
996     --- a/drivers/net/ethernet/freescale/xgmac_mdio.c
997     +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c
998     @@ -49,6 +49,7 @@ struct tgec_mdio_controller {
999     struct mdio_fsl_priv {
1000     struct tgec_mdio_controller __iomem *mdio_base;
1001     bool is_little_endian;
1002     + bool has_a011043;
1003     };
1004    
1005     static u32 xgmac_read32(void __iomem *regs,
1006     @@ -226,7 +227,8 @@ static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum)
1007     return ret;
1008    
1009     /* Return all Fs if nothing was there */
1010     - if (xgmac_read32(&regs->mdio_stat, endian) & MDIO_STAT_RD_ER) {
1011     + if ((xgmac_read32(&regs->mdio_stat, endian) & MDIO_STAT_RD_ER) &&
1012     + !priv->has_a011043) {
1013     dev_err(&bus->dev,
1014     "Error while reading PHY%d reg at %d.%hhu\n",
1015     phy_id, dev_addr, regnum);
1016     @@ -274,6 +276,9 @@ static int xgmac_mdio_probe(struct platform_device *pdev)
1017     priv->is_little_endian = of_property_read_bool(pdev->dev.of_node,
1018     "little-endian");
1019    
1020     + priv->has_a011043 = of_property_read_bool(pdev->dev.of_node,
1021     + "fsl,erratum-a011043");
1022     +
1023     ret = of_mdiobus_register(bus, np);
1024     if (ret) {
1025     dev_err(&pdev->dev, "cannot register MDIO bus\n");
1026     diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
1027     index 8ad20b7852ed..4c729faeb713 100644
1028     --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
1029     +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
1030     @@ -4804,7 +4804,7 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter)
1031     struct ixgbe_hw *hw = &adapter->hw;
1032     struct hlist_node *node2;
1033     struct ixgbe_fdir_filter *filter;
1034     - u64 action;
1035     + u8 queue;
1036    
1037     spin_lock(&adapter->fdir_perfect_lock);
1038    
1039     @@ -4813,17 +4813,34 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter)
1040    
1041     hlist_for_each_entry_safe(filter, node2,
1042     &adapter->fdir_filter_list, fdir_node) {
1043     - action = filter->action;
1044     - if (action != IXGBE_FDIR_DROP_QUEUE && action != 0)
1045     - action =
1046     - (action >> ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF) - 1;
1047     + if (filter->action == IXGBE_FDIR_DROP_QUEUE) {
1048     + queue = IXGBE_FDIR_DROP_QUEUE;
1049     + } else {
1050     + u32 ring = ethtool_get_flow_spec_ring(filter->action);
1051     + u8 vf = ethtool_get_flow_spec_ring_vf(filter->action);
1052     +
1053     + if (!vf && (ring >= adapter->num_rx_queues)) {
1054     + e_err(drv, "FDIR restore failed without VF, ring: %u\n",
1055     + ring);
1056     + continue;
1057     + } else if (vf &&
1058     + ((vf > adapter->num_vfs) ||
1059     + ring >= adapter->num_rx_queues_per_pool)) {
1060     + e_err(drv, "FDIR restore failed with VF, vf: %hhu, ring: %u\n",
1061     + vf, ring);
1062     + continue;
1063     + }
1064     +
1065     + /* Map the ring onto the absolute queue index */
1066     + if (!vf)
1067     + queue = adapter->rx_ring[ring]->reg_idx;
1068     + else
1069     + queue = ((vf - 1) *
1070     + adapter->num_rx_queues_per_pool) + ring;
1071     + }
1072    
1073     ixgbe_fdir_write_perfect_filter_82599(hw,
1074     - &filter->filter,
1075     - filter->sw_idx,
1076     - (action == IXGBE_FDIR_DROP_QUEUE) ?
1077     - IXGBE_FDIR_DROP_QUEUE :
1078     - adapter->rx_ring[action]->reg_idx);
1079     + &filter->filter, filter->sw_idx, queue);
1080     }
1081    
1082     spin_unlock(&adapter->fdir_perfect_lock);
1083     diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
1084     index 75607267e656..7a763e85ff27 100644
1085     --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
1086     +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
1087     @@ -1885,11 +1885,6 @@ static int ixgbevf_write_uc_addr_list(struct net_device *netdev)
1088     struct ixgbe_hw *hw = &adapter->hw;
1089     int count = 0;
1090    
1091     - if ((netdev_uc_count(netdev)) > 10) {
1092     - pr_err("Too many unicast filters - No Space\n");
1093     - return -ENOSPC;
1094     - }
1095     -
1096     if (!netdev_uc_empty(netdev)) {
1097     struct netdev_hw_addr *ha;
1098    
1099     diff --git a/drivers/net/ethernet/natsemi/sonic.c b/drivers/net/ethernet/natsemi/sonic.c
1100     index a051dddcbd76..254e6dbc4c6a 100644
1101     --- a/drivers/net/ethernet/natsemi/sonic.c
1102     +++ b/drivers/net/ethernet/natsemi/sonic.c
1103     @@ -50,6 +50,8 @@ static int sonic_open(struct net_device *dev)
1104     if (sonic_debug > 2)
1105     printk("sonic_open: initializing sonic driver.\n");
1106    
1107     + spin_lock_init(&lp->lock);
1108     +
1109     for (i = 0; i < SONIC_NUM_RRS; i++) {
1110     struct sk_buff *skb = netdev_alloc_skb(dev, SONIC_RBSIZE + 2);
1111     if (skb == NULL) {
1112     @@ -101,6 +103,24 @@ static int sonic_open(struct net_device *dev)
1113     return 0;
1114     }
1115    
1116     +/* Wait for the SONIC to become idle. */
1117     +static void sonic_quiesce(struct net_device *dev, u16 mask)
1118     +{
1119     + struct sonic_local * __maybe_unused lp = netdev_priv(dev);
1120     + int i;
1121     + u16 bits;
1122     +
1123     + for (i = 0; i < 1000; ++i) {
1124     + bits = SONIC_READ(SONIC_CMD) & mask;
1125     + if (!bits)
1126     + return;
1127     + if (irqs_disabled() || in_interrupt())
1128     + udelay(20);
1129     + else
1130     + usleep_range(100, 200);
1131     + }
1132     + WARN_ONCE(1, "command deadline expired! 0x%04x\n", bits);
1133     +}
1134    
1135     /*
1136     * Close the SONIC device
1137     @@ -118,6 +138,9 @@ static int sonic_close(struct net_device *dev)
1138     /*
1139     * stop the SONIC, disable interrupts
1140     */
1141     + SONIC_WRITE(SONIC_CMD, SONIC_CR_RXDIS);
1142     + sonic_quiesce(dev, SONIC_CR_ALL);
1143     +
1144     SONIC_WRITE(SONIC_IMR, 0);
1145     SONIC_WRITE(SONIC_ISR, 0x7fff);
1146     SONIC_WRITE(SONIC_CMD, SONIC_CR_RST);
1147     @@ -157,6 +180,9 @@ static void sonic_tx_timeout(struct net_device *dev)
1148     * put the Sonic into software-reset mode and
1149     * disable all interrupts before releasing DMA buffers
1150     */
1151     + SONIC_WRITE(SONIC_CMD, SONIC_CR_RXDIS);
1152     + sonic_quiesce(dev, SONIC_CR_ALL);
1153     +
1154     SONIC_WRITE(SONIC_IMR, 0);
1155     SONIC_WRITE(SONIC_ISR, 0x7fff);
1156     SONIC_WRITE(SONIC_CMD, SONIC_CR_RST);
1157     @@ -194,8 +220,6 @@ static void sonic_tx_timeout(struct net_device *dev)
1158     * wake the tx queue
1159     * Concurrently with all of this, the SONIC is potentially writing to
1160     * the status flags of the TDs.
1161     - * Until some mutual exclusion is added, this code will not work with SMP. However,
1162     - * MIPS Jazz machines and m68k Macs were all uni-processor machines.
1163     */
1164    
1165     static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev)
1166     @@ -203,7 +227,8 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev)
1167     struct sonic_local *lp = netdev_priv(dev);
1168     dma_addr_t laddr;
1169     int length;
1170     - int entry = lp->next_tx;
1171     + int entry;
1172     + unsigned long flags;
1173    
1174     if (sonic_debug > 2)
1175     printk("sonic_send_packet: skb=%p, dev=%p\n", skb, dev);
1176     @@ -226,6 +251,10 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev)
1177     return NETDEV_TX_OK;
1178     }
1179    
1180     + spin_lock_irqsave(&lp->lock, flags);
1181     +
1182     + entry = lp->next_tx;
1183     +
1184     sonic_tda_put(dev, entry, SONIC_TD_STATUS, 0); /* clear status */
1185     sonic_tda_put(dev, entry, SONIC_TD_FRAG_COUNT, 1); /* single fragment */
1186     sonic_tda_put(dev, entry, SONIC_TD_PKTSIZE, length); /* length of packet */
1187     @@ -235,10 +264,6 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev)
1188     sonic_tda_put(dev, entry, SONIC_TD_LINK,
1189     sonic_tda_get(dev, entry, SONIC_TD_LINK) | SONIC_EOL);
1190    
1191     - /*
1192     - * Must set tx_skb[entry] only after clearing status, and
1193     - * before clearing EOL and before stopping queue
1194     - */
1195     wmb();
1196     lp->tx_len[entry] = length;
1197     lp->tx_laddr[entry] = laddr;
1198     @@ -263,6 +288,8 @@ static int sonic_send_packet(struct sk_buff *skb, struct net_device *dev)
1199    
1200     SONIC_WRITE(SONIC_CMD, SONIC_CR_TXP);
1201    
1202     + spin_unlock_irqrestore(&lp->lock, flags);
1203     +
1204     return NETDEV_TX_OK;
1205     }
1206    
1207     @@ -275,9 +302,21 @@ static irqreturn_t sonic_interrupt(int irq, void *dev_id)
1208     struct net_device *dev = dev_id;
1209     struct sonic_local *lp = netdev_priv(dev);
1210     int status;
1211     + unsigned long flags;
1212     +
1213     + /* The lock has two purposes. Firstly, it synchronizes sonic_interrupt()
1214     + * with sonic_send_packet() so that the two functions can share state.
1215     + * Secondly, it makes sonic_interrupt() re-entrant, as that is required
1216     + * by macsonic which must use two IRQs with different priority levels.
1217     + */
1218     + spin_lock_irqsave(&lp->lock, flags);
1219     +
1220     + status = SONIC_READ(SONIC_ISR) & SONIC_IMR_DEFAULT;
1221     + if (!status) {
1222     + spin_unlock_irqrestore(&lp->lock, flags);
1223    
1224     - if (!(status = SONIC_READ(SONIC_ISR) & SONIC_IMR_DEFAULT))
1225     return IRQ_NONE;
1226     + }
1227    
1228     do {
1229     if (status & SONIC_INT_PKTRX) {
1230     @@ -292,11 +331,12 @@ static irqreturn_t sonic_interrupt(int irq, void *dev_id)
1231     int td_status;
1232     int freed_some = 0;
1233    
1234     - /* At this point, cur_tx is the index of a TD that is one of:
1235     - * unallocated/freed (status set & tx_skb[entry] clear)
1236     - * allocated and sent (status set & tx_skb[entry] set )
1237     - * allocated and not yet sent (status clear & tx_skb[entry] set )
1238     - * still being allocated by sonic_send_packet (status clear & tx_skb[entry] clear)
1239     + /* The state of a Transmit Descriptor may be inferred
1240     + * from { tx_skb[entry], td_status } as follows.
1241     + * { clear, clear } => the TD has never been used
1242     + * { set, clear } => the TD was handed to SONIC
1243     + * { set, set } => the TD was handed back
1244     + * { clear, set } => the TD is available for re-use
1245     */
1246    
1247     if (sonic_debug > 2)
1248     @@ -398,10 +438,30 @@ static irqreturn_t sonic_interrupt(int irq, void *dev_id)
1249     /* load CAM done */
1250     if (status & SONIC_INT_LCD)
1251     SONIC_WRITE(SONIC_ISR, SONIC_INT_LCD); /* clear the interrupt */
1252     - } while((status = SONIC_READ(SONIC_ISR) & SONIC_IMR_DEFAULT));
1253     +
1254     + status = SONIC_READ(SONIC_ISR) & SONIC_IMR_DEFAULT;
1255     + } while (status);
1256     +
1257     + spin_unlock_irqrestore(&lp->lock, flags);
1258     +
1259     return IRQ_HANDLED;
1260     }
1261    
1262     +/* Return the array index corresponding to a given Receive Buffer pointer. */
1263     +static int index_from_addr(struct sonic_local *lp, dma_addr_t addr,
1264     + unsigned int last)
1265     +{
1266     + unsigned int i = last;
1267     +
1268     + do {
1269     + i = (i + 1) & SONIC_RRS_MASK;
1270     + if (addr == lp->rx_laddr[i])
1271     + return i;
1272     + } while (i != last);
1273     +
1274     + return -ENOENT;
1275     +}
1276     +
1277     /*
1278     * We have a good packet(s), pass it/them up the network stack.
1279     */
1280     @@ -421,6 +481,16 @@ static void sonic_rx(struct net_device *dev)
1281    
1282     status = sonic_rda_get(dev, entry, SONIC_RD_STATUS);
1283     if (status & SONIC_RCR_PRX) {
1284     + u32 addr = (sonic_rda_get(dev, entry,
1285     + SONIC_RD_PKTPTR_H) << 16) |
1286     + sonic_rda_get(dev, entry, SONIC_RD_PKTPTR_L);
1287     + int i = index_from_addr(lp, addr, entry);
1288     +
1289     + if (i < 0) {
1290     + WARN_ONCE(1, "failed to find buffer!\n");
1291     + break;
1292     + }
1293     +
1294     /* Malloc up new buffer. */
1295     new_skb = netdev_alloc_skb(dev, SONIC_RBSIZE + 2);
1296     if (new_skb == NULL) {
1297     @@ -442,7 +512,7 @@ static void sonic_rx(struct net_device *dev)
1298    
1299     /* now we have a new skb to replace it, pass the used one up the stack */
1300     dma_unmap_single(lp->device, lp->rx_laddr[entry], SONIC_RBSIZE, DMA_FROM_DEVICE);
1301     - used_skb = lp->rx_skb[entry];
1302     + used_skb = lp->rx_skb[i];
1303     pkt_len = sonic_rda_get(dev, entry, SONIC_RD_PKTLEN);
1304     skb_trim(used_skb, pkt_len);
1305     used_skb->protocol = eth_type_trans(used_skb, dev);
1306     @@ -451,13 +521,13 @@ static void sonic_rx(struct net_device *dev)
1307     lp->stats.rx_bytes += pkt_len;
1308    
1309     /* and insert the new skb */
1310     - lp->rx_laddr[entry] = new_laddr;
1311     - lp->rx_skb[entry] = new_skb;
1312     + lp->rx_laddr[i] = new_laddr;
1313     + lp->rx_skb[i] = new_skb;
1314    
1315     bufadr_l = (unsigned long)new_laddr & 0xffff;
1316     bufadr_h = (unsigned long)new_laddr >> 16;
1317     - sonic_rra_put(dev, entry, SONIC_RR_BUFADR_L, bufadr_l);
1318     - sonic_rra_put(dev, entry, SONIC_RR_BUFADR_H, bufadr_h);
1319     + sonic_rra_put(dev, i, SONIC_RR_BUFADR_L, bufadr_l);
1320     + sonic_rra_put(dev, i, SONIC_RR_BUFADR_H, bufadr_h);
1321     } else {
1322     /* This should only happen, if we enable accepting broken packets. */
1323     lp->stats.rx_errors++;
1324     @@ -592,6 +662,7 @@ static int sonic_init(struct net_device *dev)
1325     */
1326     SONIC_WRITE(SONIC_CMD, 0);
1327     SONIC_WRITE(SONIC_CMD, SONIC_CR_RXDIS);
1328     + sonic_quiesce(dev, SONIC_CR_ALL);
1329    
1330     /*
1331     * initialize the receive resource area
1332     diff --git a/drivers/net/ethernet/natsemi/sonic.h b/drivers/net/ethernet/natsemi/sonic.h
1333     index 07091dd27e5d..7dcf913d7395 100644
1334     --- a/drivers/net/ethernet/natsemi/sonic.h
1335     +++ b/drivers/net/ethernet/natsemi/sonic.h
1336     @@ -109,6 +109,9 @@
1337     #define SONIC_CR_TXP 0x0002
1338     #define SONIC_CR_HTX 0x0001
1339    
1340     +#define SONIC_CR_ALL (SONIC_CR_LCAM | SONIC_CR_RRRA | \
1341     + SONIC_CR_RXEN | SONIC_CR_TXP)
1342     +
1343     /*
1344     * SONIC data configuration bits
1345     */
1346     @@ -273,8 +276,9 @@
1347     #define SONIC_NUM_RDS SONIC_NUM_RRS /* number of receive descriptors */
1348     #define SONIC_NUM_TDS 16 /* number of transmit descriptors */
1349    
1350     -#define SONIC_RDS_MASK (SONIC_NUM_RDS-1)
1351     -#define SONIC_TDS_MASK (SONIC_NUM_TDS-1)
1352     +#define SONIC_RRS_MASK (SONIC_NUM_RRS - 1)
1353     +#define SONIC_RDS_MASK (SONIC_NUM_RDS - 1)
1354     +#define SONIC_TDS_MASK (SONIC_NUM_TDS - 1)
1355    
1356     #define SONIC_RBSIZE 1520 /* size of one resource buffer */
1357    
1358     @@ -320,6 +324,7 @@ struct sonic_local {
1359     unsigned int next_tx; /* next free TD */
1360     struct device *device; /* generic device */
1361     struct net_device_stats stats;
1362     + spinlock_t lock;
1363     };
1364    
1365     #define TX_TIMEOUT (3 * HZ)
1366     @@ -341,30 +346,30 @@ static void sonic_tx_timeout(struct net_device *dev);
1367     as far as we can tell. */
1368     /* OpenBSD calls this "SWO". I'd like to think that sonic_buf_put()
1369     is a much better name. */
1370     -static inline void sonic_buf_put(void* base, int bitmode,
1371     +static inline void sonic_buf_put(u16 *base, int bitmode,
1372     int offset, __u16 val)
1373     {
1374     if (bitmode)
1375     #ifdef __BIG_ENDIAN
1376     - ((__u16 *) base + (offset*2))[1] = val;
1377     + __raw_writew(val, base + (offset * 2) + 1);
1378     #else
1379     - ((__u16 *) base + (offset*2))[0] = val;
1380     + __raw_writew(val, base + (offset * 2) + 0);
1381     #endif
1382     else
1383     - ((__u16 *) base)[offset] = val;
1384     + __raw_writew(val, base + (offset * 1) + 0);
1385     }
1386    
1387     -static inline __u16 sonic_buf_get(void* base, int bitmode,
1388     +static inline __u16 sonic_buf_get(u16 *base, int bitmode,
1389     int offset)
1390     {
1391     if (bitmode)
1392     #ifdef __BIG_ENDIAN
1393     - return ((volatile __u16 *) base + (offset*2))[1];
1394     + return __raw_readw(base + (offset * 2) + 1);
1395     #else
1396     - return ((volatile __u16 *) base + (offset*2))[0];
1397     + return __raw_readw(base + (offset * 2) + 0);
1398     #endif
1399     else
1400     - return ((volatile __u16 *) base)[offset];
1401     + return __raw_readw(base + (offset * 1) + 0);
1402     }
1403    
1404     /* Inlines that you should actually use for reading/writing DMA buffers */
1405     diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
1406     index a496390b8632..07f9067affc6 100644
1407     --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
1408     +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
1409     @@ -2043,6 +2043,7 @@ static void qlcnic_83xx_exec_template_cmd(struct qlcnic_adapter *p_dev,
1410     break;
1411     }
1412     entry += p_hdr->size;
1413     + cond_resched();
1414     }
1415     p_dev->ahw->reset.seq_index = index;
1416     }
1417     diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c
1418     index 0844b7c75767..5174e0bd75d1 100644
1419     --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c
1420     +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c
1421     @@ -703,6 +703,7 @@ static u32 qlcnic_read_memory_test_agent(struct qlcnic_adapter *adapter,
1422     addr += 16;
1423     reg_read -= 16;
1424     ret += 16;
1425     + cond_resched();
1426     }
1427     out:
1428     mutex_unlock(&adapter->ahw->mem_lock);
1429     @@ -1383,6 +1384,7 @@ int qlcnic_dump_fw(struct qlcnic_adapter *adapter)
1430     buf_offset += entry->hdr.cap_size;
1431     entry_offset += entry->hdr.offset;
1432     buffer = fw_dump->data + buf_offset;
1433     + cond_resched();
1434     }
1435    
1436     fw_dump->clr = 1;
1437     diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
1438     index 3c037b76a0cc..ba7cfc089516 100644
1439     --- a/drivers/net/usb/r8152.c
1440     +++ b/drivers/net/usb/r8152.c
1441     @@ -4441,6 +4441,11 @@ static int rtl8152_probe(struct usb_interface *intf,
1442    
1443     intf->needs_remote_wakeup = 1;
1444    
1445     + if (!rtl_can_wakeup(tp))
1446     + __rtl_set_wol(tp, 0);
1447     + else
1448     + tp->saved_wolopts = __rtl_get_wol(tp);
1449     +
1450     tp->rtl_ops.init(tp);
1451     queue_delayed_work(system_long_wq, &tp->hw_phy_work, 0);
1452     set_ethernet_addr(tp);
1453     @@ -4454,10 +4459,6 @@ static int rtl8152_probe(struct usb_interface *intf,
1454     goto out1;
1455     }
1456    
1457     - if (!rtl_can_wakeup(tp))
1458     - __rtl_set_wol(tp, 0);
1459     -
1460     - tp->saved_wolopts = __rtl_get_wol(tp);
1461     if (tp->saved_wolopts)
1462     device_set_wakeup_enable(&udev->dev, true);
1463     else
1464     diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c
1465     index 421ac5f85699..79fd89150947 100644
1466     --- a/drivers/net/wan/sdla.c
1467     +++ b/drivers/net/wan/sdla.c
1468     @@ -711,7 +711,7 @@ static netdev_tx_t sdla_transmit(struct sk_buff *skb,
1469    
1470     spin_lock_irqsave(&sdla_lock, flags);
1471     SDLA_WINDOW(dev, addr);
1472     - pbuf = (void *)(((int) dev->mem_start) + (addr & SDLA_ADDR_MASK));
1473     + pbuf = (void *)(dev->mem_start + (addr & SDLA_ADDR_MASK));
1474     __sdla_write(dev, pbuf->buf_addr, skb->data, skb->len);
1475     SDLA_WINDOW(dev, addr);
1476     pbuf->opp_flag = 1;
1477     diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
1478     index f15589c70284..b5e12be73f2b 100644
1479     --- a/drivers/net/wireless/ath/ath9k/hif_usb.c
1480     +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
1481     @@ -1213,7 +1213,7 @@ err_fw:
1482     static int send_eject_command(struct usb_interface *interface)
1483     {
1484     struct usb_device *udev = interface_to_usbdev(interface);
1485     - struct usb_host_interface *iface_desc = &interface->altsetting[0];
1486     + struct usb_host_interface *iface_desc = interface->cur_altsetting;
1487     struct usb_endpoint_descriptor *endpoint;
1488     unsigned char *cmd;
1489     u8 bulk_out_ep;
1490     diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
1491     index acf513fd9e6d..05df9d8f76e9 100644
1492     --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
1493     +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
1494     @@ -1330,7 +1330,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1495     goto fail;
1496     }
1497    
1498     - desc = &intf->altsetting[0].desc;
1499     + desc = &intf->cur_altsetting->desc;
1500     if ((desc->bInterfaceClass != USB_CLASS_VENDOR_SPEC) ||
1501     (desc->bInterfaceSubClass != 2) ||
1502     (desc->bInterfaceProtocol != 0xff)) {
1503     @@ -1343,7 +1343,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
1504    
1505     num_of_eps = desc->bNumEndpoints;
1506     for (ep = 0; ep < num_of_eps; ep++) {
1507     - endpoint = &intf->altsetting[0].endpoint[ep].desc;
1508     + endpoint = &intf->cur_altsetting->endpoint[ep].desc;
1509     endpoint_num = usb_endpoint_num(endpoint);
1510     if (!usb_endpoint_xfer_bulk(endpoint))
1511     continue;
1512     diff --git a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c
1513     index 04939e576ee0..a8d470010f5e 100644
1514     --- a/drivers/net/wireless/cisco/airo.c
1515     +++ b/drivers/net/wireless/cisco/airo.c
1516     @@ -7796,16 +7796,8 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
1517     case AIROGVLIST: ridcode = RID_APLIST; break;
1518     case AIROGDRVNAM: ridcode = RID_DRVNAME; break;
1519     case AIROGEHTENC: ridcode = RID_ETHERENCAP; break;
1520     - case AIROGWEPKTMP: ridcode = RID_WEP_TEMP;
1521     - /* Only super-user can read WEP keys */
1522     - if (!capable(CAP_NET_ADMIN))
1523     - return -EPERM;
1524     - break;
1525     - case AIROGWEPKNV: ridcode = RID_WEP_PERM;
1526     - /* Only super-user can read WEP keys */
1527     - if (!capable(CAP_NET_ADMIN))
1528     - return -EPERM;
1529     - break;
1530     + case AIROGWEPKTMP: ridcode = RID_WEP_TEMP; break;
1531     + case AIROGWEPKNV: ridcode = RID_WEP_PERM; break;
1532     case AIROGSTAT: ridcode = RID_STATUS; break;
1533     case AIROGSTATSD32: ridcode = RID_STATSDELTA; break;
1534     case AIROGSTATSC32: ridcode = RID_STATS; break;
1535     @@ -7819,7 +7811,13 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
1536     return -EINVAL;
1537     }
1538    
1539     - if ((iobuf = kmalloc(RIDSIZE, GFP_KERNEL)) == NULL)
1540     + if (ridcode == RID_WEP_TEMP || ridcode == RID_WEP_PERM) {
1541     + /* Only super-user can read WEP keys */
1542     + if (!capable(CAP_NET_ADMIN))
1543     + return -EPERM;
1544     + }
1545     +
1546     + if ((iobuf = kzalloc(RIDSIZE, GFP_KERNEL)) == NULL)
1547     return -ENOMEM;
1548    
1549     PC4500_readrid(ai,ridcode,iobuf,RIDSIZE, 1);
1550     diff --git a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
1551     index bca6935a94db..8244d8262951 100644
1552     --- a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
1553     +++ b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
1554     @@ -1601,9 +1601,9 @@ static int ezusb_probe(struct usb_interface *interface,
1555     /* set up the endpoint information */
1556     /* check out the endpoints */
1557    
1558     - iface_desc = &interface->altsetting[0].desc;
1559     + iface_desc = &interface->cur_altsetting->desc;
1560     for (i = 0; i < iface_desc->bNumEndpoints; ++i) {
1561     - ep = &interface->altsetting[0].endpoint[i].desc;
1562     + ep = &interface->cur_altsetting->endpoint[i].desc;
1563    
1564     if (usb_endpoint_is_bulk_in(ep)) {
1565     /* we found a bulk in endpoint */
1566     diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
1567     index e588a0365257..18d5984b78da 100644
1568     --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
1569     +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
1570     @@ -5890,7 +5890,7 @@ static int rtl8xxxu_parse_usb(struct rtl8xxxu_priv *priv,
1571     u8 dir, xtype, num;
1572     int ret = 0;
1573    
1574     - host_interface = &interface->altsetting[0];
1575     + host_interface = interface->cur_altsetting;
1576     interface_desc = &host_interface->desc;
1577     endpoints = interface_desc->bNumEndpoints;
1578    
1579     diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c
1580     index ef5d394f185b..974387ad1e8c 100644
1581     --- a/drivers/net/wireless/rsi/rsi_91x_usb.c
1582     +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c
1583     @@ -103,7 +103,7 @@ static int rsi_find_bulk_in_and_out_endpoints(struct usb_interface *interface,
1584     __le16 buffer_size;
1585     int ii, bep_found = 0;
1586    
1587     - iface_desc = &(interface->altsetting[0]);
1588     + iface_desc = interface->cur_altsetting;
1589    
1590     for (ii = 0; ii < iface_desc->desc.bNumEndpoints; ++ii) {
1591     endpoint = &(iface_desc->endpoint[ii].desc);
1592     diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
1593     index 01ca1d57b3d9..213e5022ab93 100644
1594     --- a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
1595     +++ b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
1596     @@ -1272,7 +1272,7 @@ static void print_id(struct usb_device *udev)
1597     static int eject_installer(struct usb_interface *intf)
1598     {
1599     struct usb_device *udev = interface_to_usbdev(intf);
1600     - struct usb_host_interface *iface_desc = &intf->altsetting[0];
1601     + struct usb_host_interface *iface_desc = intf->cur_altsetting;
1602     struct usb_endpoint_descriptor *endpoint;
1603     unsigned char *cmd;
1604     u8 bulk_out_ep;
1605     diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
1606     index c056b8111ad2..7bf6102b4c3d 100644
1607     --- a/drivers/scsi/fnic/fnic_scsi.c
1608     +++ b/drivers/scsi/fnic/fnic_scsi.c
1609     @@ -445,6 +445,9 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
1610     if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_IO_BLOCKED)))
1611     return SCSI_MLQUEUE_HOST_BUSY;
1612    
1613     + if (unlikely(fnic_chk_state_flags_locked(fnic, FNIC_FLAGS_FWRESET)))
1614     + return SCSI_MLQUEUE_HOST_BUSY;
1615     +
1616     rport = starget_to_rport(scsi_target(sc->device));
1617     ret = fc_remote_port_chkready(rport);
1618     if (ret) {
1619     diff --git a/drivers/soc/ti/wkup_m3_ipc.c b/drivers/soc/ti/wkup_m3_ipc.c
1620     index 5bb376009d98..fc33bfdc957c 100644
1621     --- a/drivers/soc/ti/wkup_m3_ipc.c
1622     +++ b/drivers/soc/ti/wkup_m3_ipc.c
1623     @@ -377,6 +377,8 @@ static void wkup_m3_rproc_boot_thread(struct wkup_m3_ipc *m3_ipc)
1624     ret = rproc_boot(m3_ipc->rproc);
1625     if (ret)
1626     dev_err(dev, "rproc_boot failed\n");
1627     + else
1628     + m3_ipc_state = m3_ipc;
1629    
1630     do_exit(0);
1631     }
1632     @@ -463,8 +465,6 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev)
1633     goto err_put_rproc;
1634     }
1635    
1636     - m3_ipc_state = m3_ipc;
1637     -
1638     return 0;
1639    
1640     err_put_rproc:
1641     diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c
1642     index 4659a6450c04..6b18afb62145 100644
1643     --- a/drivers/staging/most/aim-network/networking.c
1644     +++ b/drivers/staging/most/aim-network/networking.c
1645     @@ -87,6 +87,11 @@ static int skb_to_mamac(const struct sk_buff *skb, struct mbo *mbo)
1646     unsigned int payload_len = skb->len - ETH_HLEN;
1647     unsigned int mdp_len = payload_len + MDP_HDR_LEN;
1648    
1649     + if (mdp_len < skb->len) {
1650     + pr_err("drop: too large packet! (%u)\n", skb->len);
1651     + return -EINVAL;
1652     + }
1653     +
1654     if (mbo->buffer_length < mdp_len) {
1655     pr_err("drop: too small buffer! (%d for %d)\n",
1656     mbo->buffer_length, mdp_len);
1657     @@ -134,6 +139,11 @@ static int skb_to_mep(const struct sk_buff *skb, struct mbo *mbo)
1658     u8 *buff = mbo->virt_address;
1659     unsigned int mep_len = skb->len + MEP_HDR_LEN;
1660    
1661     + if (mep_len < skb->len) {
1662     + pr_err("drop: too large packet! (%u)\n", skb->len);
1663     + return -EINVAL;
1664     + }
1665     +
1666     if (mbo->buffer_length < mep_len) {
1667     pr_err("drop: too small buffer! (%d for %d)\n",
1668     mbo->buffer_length, mep_len);
1669     diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
1670     index 5422ec1222ce..0578bf82f557 100644
1671     --- a/drivers/staging/vt6656/device.h
1672     +++ b/drivers/staging/vt6656/device.h
1673     @@ -62,6 +62,8 @@
1674     #define RATE_AUTO 12
1675    
1676     #define MAX_RATE 12
1677     +#define VNT_B_RATES (BIT(RATE_1M) | BIT(RATE_2M) |\
1678     + BIT(RATE_5M) | BIT(RATE_11M))
1679    
1680     /*
1681     * device specific
1682     diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c
1683     index 73538fb4e4e2..b554e881e67f 100644
1684     --- a/drivers/staging/vt6656/int.c
1685     +++ b/drivers/staging/vt6656/int.c
1686     @@ -107,9 +107,11 @@ static int vnt_int_report_rate(struct vnt_private *priv, u8 pkt_no, u8 tsr)
1687    
1688     info->status.rates[0].count = tx_retry;
1689    
1690     - if (!(tsr & (TSR_TMO | TSR_RETRYTMO))) {
1691     + if (!(tsr & TSR_TMO)) {
1692     info->status.rates[0].idx = idx;
1693     - info->flags |= IEEE80211_TX_STAT_ACK;
1694     +
1695     + if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
1696     + info->flags |= IEEE80211_TX_STAT_ACK;
1697     }
1698    
1699     ieee80211_tx_status_irqsafe(priv->hw, context->skb);
1700     diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
1701     index 78b09640bcf0..b93773af2031 100644
1702     --- a/drivers/staging/vt6656/main_usb.c
1703     +++ b/drivers/staging/vt6656/main_usb.c
1704     @@ -995,6 +995,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id)
1705     ieee80211_hw_set(priv->hw, RX_INCLUDES_FCS);
1706     ieee80211_hw_set(priv->hw, REPORTS_TX_ACK_STATUS);
1707     ieee80211_hw_set(priv->hw, SUPPORTS_PS);
1708     + ieee80211_hw_set(priv->hw, PS_NULLFUNC_STACK);
1709    
1710     priv->hw->max_signal = 100;
1711    
1712     diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
1713     index aa59e7f14ab3..5ccb9eb7ff1c 100644
1714     --- a/drivers/staging/vt6656/rxtx.c
1715     +++ b/drivers/staging/vt6656/rxtx.c
1716     @@ -277,11 +277,9 @@ static u16 vnt_rxtx_datahead_g(struct vnt_usb_send_context *tx_context,
1717     PK_TYPE_11B, &buf->b);
1718    
1719     /* Get Duration and TimeStamp */
1720     - if (ieee80211_is_pspoll(hdr->frame_control)) {
1721     - __le16 dur = cpu_to_le16(priv->current_aid | BIT(14) | BIT(15));
1722     -
1723     - buf->duration_a = dur;
1724     - buf->duration_b = dur;
1725     + if (ieee80211_is_nullfunc(hdr->frame_control)) {
1726     + buf->duration_a = hdr->duration_id;
1727     + buf->duration_b = hdr->duration_id;
1728     } else {
1729     buf->duration_a = vnt_get_duration_le(priv,
1730     tx_context->pkt_type, need_ack);
1731     @@ -370,10 +368,8 @@ static u16 vnt_rxtx_datahead_ab(struct vnt_usb_send_context *tx_context,
1732     tx_context->pkt_type, &buf->ab);
1733    
1734     /* Get Duration and TimeStampOff */
1735     - if (ieee80211_is_pspoll(hdr->frame_control)) {
1736     - __le16 dur = cpu_to_le16(priv->current_aid | BIT(14) | BIT(15));
1737     -
1738     - buf->duration = dur;
1739     + if (ieee80211_is_nullfunc(hdr->frame_control)) {
1740     + buf->duration = hdr->duration_id;
1741     } else {
1742     buf->duration = vnt_get_duration_le(priv, tx_context->pkt_type,
1743     need_ack);
1744     @@ -816,10 +812,14 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb)
1745     if (info->band == NL80211_BAND_5GHZ) {
1746     pkt_type = PK_TYPE_11A;
1747     } else {
1748     - if (tx_rate->flags & IEEE80211_TX_RC_USE_CTS_PROTECT)
1749     - pkt_type = PK_TYPE_11GB;
1750     - else
1751     - pkt_type = PK_TYPE_11GA;
1752     + if (tx_rate->flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
1753     + if (priv->basic_rates & VNT_B_RATES)
1754     + pkt_type = PK_TYPE_11GB;
1755     + else
1756     + pkt_type = PK_TYPE_11GA;
1757     + } else {
1758     + pkt_type = PK_TYPE_11A;
1759     + }
1760     }
1761     } else {
1762     pkt_type = PK_TYPE_11B;
1763     diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c
1764     index f815f9d5045f..08e2bbd9772f 100644
1765     --- a/drivers/staging/wlan-ng/prism2mgmt.c
1766     +++ b/drivers/staging/wlan-ng/prism2mgmt.c
1767     @@ -938,7 +938,7 @@ int prism2mgmt_flashdl_state(struct wlandevice *wlandev, void *msgp)
1768     }
1769     }
1770    
1771     - return 0;
1772     + return result;
1773     }
1774    
1775     /*----------------------------------------------------------------
1776     diff --git a/drivers/tty/serial/8250/8250_bcm2835aux.c b/drivers/tty/serial/8250/8250_bcm2835aux.c
1777     index e10f1244409b..2fa92ec1d1cc 100644
1778     --- a/drivers/tty/serial/8250/8250_bcm2835aux.c
1779     +++ b/drivers/tty/serial/8250/8250_bcm2835aux.c
1780     @@ -119,7 +119,7 @@ static int bcm2835aux_serial_remove(struct platform_device *pdev)
1781     {
1782     struct bcm2835aux_data *data = platform_get_drvdata(pdev);
1783    
1784     - serial8250_unregister_port(data->uart.port.line);
1785     + serial8250_unregister_port(data->line);
1786     clk_disable_unprepare(data->clk);
1787    
1788     return 0;
1789     diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
1790     index 30bc5996a2f2..a89072f3bd3f 100644
1791     --- a/drivers/usb/dwc3/core.c
1792     +++ b/drivers/usb/dwc3/core.c
1793     @@ -936,6 +936,9 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
1794     /* do nothing */
1795     break;
1796     }
1797     +
1798     + /* de-assert DRVVBUS for HOST and OTG mode */
1799     + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE);
1800     }
1801    
1802     #define DWC3_ALIGN_MASK (16 - 1)
1803     diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
1804     index 73956d48a0c5..1347c77facd0 100644
1805     --- a/drivers/usb/serial/ir-usb.c
1806     +++ b/drivers/usb/serial/ir-usb.c
1807     @@ -49,9 +49,10 @@ static int buffer_size;
1808     static int xbof = -1;
1809    
1810     static int ir_startup (struct usb_serial *serial);
1811     -static int ir_open(struct tty_struct *tty, struct usb_serial_port *port);
1812     -static int ir_prepare_write_buffer(struct usb_serial_port *port,
1813     - void *dest, size_t size);
1814     +static int ir_write(struct tty_struct *tty, struct usb_serial_port *port,
1815     + const unsigned char *buf, int count);
1816     +static int ir_write_room(struct tty_struct *tty);
1817     +static void ir_write_bulk_callback(struct urb *urb);
1818     static void ir_process_read_urb(struct urb *urb);
1819     static void ir_set_termios(struct tty_struct *tty,
1820     struct usb_serial_port *port, struct ktermios *old_termios);
1821     @@ -81,8 +82,9 @@ static struct usb_serial_driver ir_device = {
1822     .num_ports = 1,
1823     .set_termios = ir_set_termios,
1824     .attach = ir_startup,
1825     - .open = ir_open,
1826     - .prepare_write_buffer = ir_prepare_write_buffer,
1827     + .write = ir_write,
1828     + .write_room = ir_write_room,
1829     + .write_bulk_callback = ir_write_bulk_callback,
1830     .process_read_urb = ir_process_read_urb,
1831     };
1832    
1833     @@ -198,6 +200,9 @@ static int ir_startup(struct usb_serial *serial)
1834     {
1835     struct usb_irda_cs_descriptor *irda_desc;
1836    
1837     + if (serial->num_bulk_in < 1 || serial->num_bulk_out < 1)
1838     + return -ENODEV;
1839     +
1840     irda_desc = irda_usb_find_class_desc(serial, 0);
1841     if (!irda_desc) {
1842     dev_err(&serial->dev->dev,
1843     @@ -252,35 +257,102 @@ static int ir_startup(struct usb_serial *serial)
1844     return 0;
1845     }
1846    
1847     -static int ir_open(struct tty_struct *tty, struct usb_serial_port *port)
1848     +static int ir_write(struct tty_struct *tty, struct usb_serial_port *port,
1849     + const unsigned char *buf, int count)
1850     {
1851     - int i;
1852     + struct urb *urb = NULL;
1853     + unsigned long flags;
1854     + int ret;
1855    
1856     - for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i)
1857     - port->write_urbs[i]->transfer_flags = URB_ZERO_PACKET;
1858     + if (port->bulk_out_size == 0)
1859     + return -EINVAL;
1860    
1861     - /* Start reading from the device */
1862     - return usb_serial_generic_open(tty, port);
1863     -}
1864     + if (count == 0)
1865     + return 0;
1866    
1867     -static int ir_prepare_write_buffer(struct usb_serial_port *port,
1868     - void *dest, size_t size)
1869     -{
1870     - unsigned char *buf = dest;
1871     - int count;
1872     + count = min(count, port->bulk_out_size - 1);
1873     +
1874     + spin_lock_irqsave(&port->lock, flags);
1875     + if (__test_and_clear_bit(0, &port->write_urbs_free)) {
1876     + urb = port->write_urbs[0];
1877     + port->tx_bytes += count;
1878     + }
1879     + spin_unlock_irqrestore(&port->lock, flags);
1880     +
1881     + if (!urb)
1882     + return 0;
1883    
1884     /*
1885     * The first byte of the packet we send to the device contains an
1886     - * inbound header which indicates an additional number of BOFs and
1887     + * outbound header which indicates an additional number of BOFs and
1888     * a baud rate change.
1889     *
1890     * See section 5.4.2.2 of the USB IrDA spec.
1891     */
1892     - *buf = ir_xbof | ir_baud;
1893     + *(u8 *)urb->transfer_buffer = ir_xbof | ir_baud;
1894     +
1895     + memcpy(urb->transfer_buffer + 1, buf, count);
1896     +
1897     + urb->transfer_buffer_length = count + 1;
1898     + urb->transfer_flags = URB_ZERO_PACKET;
1899     +
1900     + ret = usb_submit_urb(urb, GFP_ATOMIC);
1901     + if (ret) {
1902     + dev_err(&port->dev, "failed to submit write urb: %d\n", ret);
1903     +
1904     + spin_lock_irqsave(&port->lock, flags);
1905     + __set_bit(0, &port->write_urbs_free);
1906     + port->tx_bytes -= count;
1907     + spin_unlock_irqrestore(&port->lock, flags);
1908     +
1909     + return ret;
1910     + }
1911     +
1912     + return count;
1913     +}
1914     +
1915     +static void ir_write_bulk_callback(struct urb *urb)
1916     +{
1917     + struct usb_serial_port *port = urb->context;
1918     + int status = urb->status;
1919     + unsigned long flags;
1920     +
1921     + spin_lock_irqsave(&port->lock, flags);
1922     + __set_bit(0, &port->write_urbs_free);
1923     + port->tx_bytes -= urb->transfer_buffer_length - 1;
1924     + spin_unlock_irqrestore(&port->lock, flags);
1925     +
1926     + switch (status) {
1927     + case 0:
1928     + break;
1929     + case -ENOENT:
1930     + case -ECONNRESET:
1931     + case -ESHUTDOWN:
1932     + dev_dbg(&port->dev, "write urb stopped: %d\n", status);
1933     + return;
1934     + case -EPIPE:
1935     + dev_err(&port->dev, "write urb stopped: %d\n", status);
1936     + return;
1937     + default:
1938     + dev_err(&port->dev, "nonzero write-urb status: %d\n", status);
1939     + break;
1940     + }
1941     +
1942     + usb_serial_port_softint(port);
1943     +}
1944     +
1945     +static int ir_write_room(struct tty_struct *tty)
1946     +{
1947     + struct usb_serial_port *port = tty->driver_data;
1948     + int count = 0;
1949     +
1950     + if (port->bulk_out_size == 0)
1951     + return 0;
1952     +
1953     + if (test_bit(0, &port->write_urbs_free))
1954     + count = port->bulk_out_size - 1;
1955    
1956     - count = kfifo_out_locked(&port->write_fifo, buf + 1, size - 1,
1957     - &port->lock);
1958     - return count + 1;
1959     + return count;
1960     }
1961    
1962     static void ir_process_read_urb(struct urb *urb)
1963     @@ -333,34 +405,34 @@ static void ir_set_termios(struct tty_struct *tty,
1964    
1965     switch (baud) {
1966     case 2400:
1967     - ir_baud = USB_IRDA_BR_2400;
1968     + ir_baud = USB_IRDA_LS_2400;
1969     break;
1970     case 9600:
1971     - ir_baud = USB_IRDA_BR_9600;
1972     + ir_baud = USB_IRDA_LS_9600;
1973     break;
1974     case 19200:
1975     - ir_baud = USB_IRDA_BR_19200;
1976     + ir_baud = USB_IRDA_LS_19200;
1977     break;
1978     case 38400:
1979     - ir_baud = USB_IRDA_BR_38400;
1980     + ir_baud = USB_IRDA_LS_38400;
1981     break;
1982     case 57600:
1983     - ir_baud = USB_IRDA_BR_57600;
1984     + ir_baud = USB_IRDA_LS_57600;
1985     break;
1986     case 115200:
1987     - ir_baud = USB_IRDA_BR_115200;
1988     + ir_baud = USB_IRDA_LS_115200;
1989     break;
1990     case 576000:
1991     - ir_baud = USB_IRDA_BR_576000;
1992     + ir_baud = USB_IRDA_LS_576000;
1993     break;
1994     case 1152000:
1995     - ir_baud = USB_IRDA_BR_1152000;
1996     + ir_baud = USB_IRDA_LS_1152000;
1997     break;
1998     case 4000000:
1999     - ir_baud = USB_IRDA_BR_4000000;
2000     + ir_baud = USB_IRDA_LS_4000000;
2001     break;
2002     default:
2003     - ir_baud = USB_IRDA_BR_9600;
2004     + ir_baud = USB_IRDA_LS_9600;
2005     baud = 9600;
2006     }
2007    
2008     diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h
2009     index f15aa47c54a9..0eb8c67ee138 100644
2010     --- a/drivers/usb/storage/unusual_uas.h
2011     +++ b/drivers/usb/storage/unusual_uas.h
2012     @@ -163,12 +163,15 @@ UNUSUAL_DEV(0x2537, 0x1068, 0x0000, 0x9999,
2013     USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2014     US_FL_IGNORE_UAS),
2015    
2016     -/* Reported-by: Takeo Nakayama <javhera@gmx.com> */
2017     +/*
2018     + * Initially Reported-by: Takeo Nakayama <javhera@gmx.com>
2019     + * UAS Ignore Reported by Steven Ellis <sellis@redhat.com>
2020     + */
2021     UNUSUAL_DEV(0x357d, 0x7788, 0x0000, 0x9999,
2022     "JMicron",
2023     "JMS566",
2024     USB_SC_DEVICE, USB_PR_DEVICE, NULL,
2025     - US_FL_NO_REPORT_OPCODES),
2026     + US_FL_NO_REPORT_OPCODES | US_FL_IGNORE_UAS),
2027    
2028     /* Reported-by: Hans de Goede <hdegoede@redhat.com> */
2029     UNUSUAL_DEV(0x4971, 0x1012, 0x0000, 0x9999,
2030     diff --git a/drivers/watchdog/rn5t618_wdt.c b/drivers/watchdog/rn5t618_wdt.c
2031     index 0805ee2acd7a..7aa8bf2d0f91 100644
2032     --- a/drivers/watchdog/rn5t618_wdt.c
2033     +++ b/drivers/watchdog/rn5t618_wdt.c
2034     @@ -193,6 +193,7 @@ static struct platform_driver rn5t618_wdt_driver = {
2035    
2036     module_platform_driver(rn5t618_wdt_driver);
2037    
2038     +MODULE_ALIAS("platform:rn5t618-wdt");
2039     MODULE_AUTHOR("Beniamino Galvani <b.galvani@gmail.com>");
2040     MODULE_DESCRIPTION("RN5T618 watchdog driver");
2041     MODULE_LICENSE("GPL v2");
2042     diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
2043     index a7b69deb6d70..0c71cdd3f98b 100644
2044     --- a/fs/btrfs/super.c
2045     +++ b/fs/btrfs/super.c
2046     @@ -2164,7 +2164,15 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf)
2047     */
2048     thresh = 4 * 1024 * 1024;
2049    
2050     - if (!mixed && total_free_meta - thresh < block_rsv->size)
2051     + /*
2052     + * We only want to claim there's no available space if we can no longer
2053     + * allocate chunks for our metadata profile and our global reserve will
2054     + * not fit in the free metadata space. If we aren't ->full then we
2055     + * still can allocate chunks and thus are fine using the currently
2056     + * calculated f_bavail.
2057     + */
2058     + if (!mixed && block_rsv->space_info->full &&
2059     + total_free_meta - thresh < block_rsv->size)
2060     buf->f_bavail = 0;
2061    
2062     buf->f_type = BTRFS_SUPER_MAGIC;
2063     diff --git a/fs/namei.c b/fs/namei.c
2064     index 7150c4d0bd7b..757a50ecf0f4 100644
2065     --- a/fs/namei.c
2066     +++ b/fs/namei.c
2067     @@ -3260,8 +3260,8 @@ static int do_last(struct nameidata *nd,
2068     int *opened)
2069     {
2070     struct dentry *dir = nd->path.dentry;
2071     - kuid_t dir_uid = dir->d_inode->i_uid;
2072     - umode_t dir_mode = dir->d_inode->i_mode;
2073     + kuid_t dir_uid = nd->inode->i_uid;
2074     + umode_t dir_mode = nd->inode->i_mode;
2075     int open_flag = op->open_flag;
2076     bool will_truncate = (open_flag & O_TRUNC) != 0;
2077     bool got_write = false;
2078     diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
2079     index cd2d555b3a6d..bfed2a700015 100644
2080     --- a/fs/reiserfs/super.c
2081     +++ b/fs/reiserfs/super.c
2082     @@ -599,6 +599,7 @@ static void reiserfs_put_super(struct super_block *s)
2083     reiserfs_write_unlock(s);
2084     mutex_destroy(&REISERFS_SB(s)->lock);
2085     destroy_workqueue(REISERFS_SB(s)->commit_wq);
2086     + kfree(REISERFS_SB(s)->s_jdev);
2087     kfree(s->s_fs_info);
2088     s->s_fs_info = NULL;
2089     }
2090     @@ -2217,6 +2218,7 @@ error_unlocked:
2091     kfree(qf_names[j]);
2092     }
2093     #endif
2094     + kfree(sbi->s_jdev);
2095     kfree(sbi);
2096    
2097     s->s_fs_info = NULL;
2098     diff --git a/include/linux/usb/irda.h b/include/linux/usb/irda.h
2099     index e345ceaf72d6..9dc46010a067 100644
2100     --- a/include/linux/usb/irda.h
2101     +++ b/include/linux/usb/irda.h
2102     @@ -118,11 +118,22 @@ struct usb_irda_cs_descriptor {
2103     * 6 - 115200 bps
2104     * 7 - 576000 bps
2105     * 8 - 1.152 Mbps
2106     - * 9 - 5 mbps
2107     + * 9 - 4 Mbps
2108     * 10..15 - Reserved
2109     */
2110     #define USB_IRDA_STATUS_LINK_SPEED 0x0f
2111    
2112     +#define USB_IRDA_LS_NO_CHANGE 0
2113     +#define USB_IRDA_LS_2400 1
2114     +#define USB_IRDA_LS_9600 2
2115     +#define USB_IRDA_LS_19200 3
2116     +#define USB_IRDA_LS_38400 4
2117     +#define USB_IRDA_LS_57600 5
2118     +#define USB_IRDA_LS_115200 6
2119     +#define USB_IRDA_LS_576000 7
2120     +#define USB_IRDA_LS_1152000 8
2121     +#define USB_IRDA_LS_4000000 9
2122     +
2123     /* The following is a 4-bit value used only for
2124     * outbound header:
2125     *
2126     diff --git a/mm/mempolicy.c b/mm/mempolicy.c
2127     index 5cb5147235df..da7a932922cb 100644
2128     --- a/mm/mempolicy.c
2129     +++ b/mm/mempolicy.c
2130     @@ -2744,6 +2744,9 @@ int mpol_parse_str(char *str, struct mempolicy **mpol)
2131     char *flags = strchr(str, '=');
2132     int err = 1;
2133    
2134     + if (flags)
2135     + *flags++ = '\0'; /* terminate mode string */
2136     +
2137     if (nodelist) {
2138     /* NUL-terminate mode or flags string */
2139     *nodelist++ = '\0';
2140     @@ -2754,9 +2757,6 @@ int mpol_parse_str(char *str, struct mempolicy **mpol)
2141     } else
2142     nodes_clear(nodes);
2143    
2144     - if (flags)
2145     - *flags++ = '\0'; /* terminate mode string */
2146     -
2147     for (mode = 0; mode < MPOL_MAX; mode++) {
2148     if (!strcmp(str, policy_modes[mode])) {
2149     break;
2150     diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
2151     index ca1836941f3c..44b3146c6117 100644
2152     --- a/net/bluetooth/hci_sock.c
2153     +++ b/net/bluetooth/hci_sock.c
2154     @@ -826,6 +826,8 @@ static int hci_sock_release(struct socket *sock)
2155     if (!sk)
2156     return 0;
2157    
2158     + lock_sock(sk);
2159     +
2160     switch (hci_pi(sk)->channel) {
2161     case HCI_CHANNEL_MONITOR:
2162     atomic_dec(&monitor_promisc);
2163     @@ -873,6 +875,7 @@ static int hci_sock_release(struct socket *sock)
2164     skb_queue_purge(&sk->sk_receive_queue);
2165     skb_queue_purge(&sk->sk_write_queue);
2166    
2167     + release_sock(sk);
2168     sock_put(sk);
2169     return 0;
2170     }
2171     diff --git a/net/core/utils.c b/net/core/utils.c
2172     index cf5622b9ccc4..3317f90b32eb 100644
2173     --- a/net/core/utils.c
2174     +++ b/net/core/utils.c
2175     @@ -316,6 +316,23 @@ void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
2176     }
2177     EXPORT_SYMBOL(inet_proto_csum_replace4);
2178    
2179     +/**
2180     + * inet_proto_csum_replace16 - update layer 4 header checksum field
2181     + * @sum: Layer 4 header checksum field
2182     + * @skb: sk_buff for the packet
2183     + * @from: old IPv6 address
2184     + * @to: new IPv6 address
2185     + * @pseudohdr: True if layer 4 header checksum includes pseudoheader
2186     + *
2187     + * Update layer 4 header as per the update in IPv6 src/dst address.
2188     + *
2189     + * There is no need to update skb->csum in this function, because update in two
2190     + * fields a.) IPv6 src/dst address and b.) L4 header checksum cancels each other
2191     + * for skb->csum calculation. Whereas inet_proto_csum_replace4 function needs to
2192     + * update skb->csum, because update in 3 fields a.) IPv4 src/dst address,
2193     + * b.) IPv4 Header checksum and c.) L4 header checksum results in same diff as
2194     + * L4 Header checksum for skb->csum calculation.
2195     + */
2196     void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb,
2197     const __be32 *from, const __be32 *to,
2198     bool pseudohdr)
2199     @@ -327,9 +344,6 @@ void inet_proto_csum_replace16(__sum16 *sum, struct sk_buff *skb,
2200     if (skb->ip_summed != CHECKSUM_PARTIAL) {
2201     *sum = csum_fold(csum_partial(diff, sizeof(diff),
2202     ~csum_unfold(*sum)));
2203     - if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
2204     - skb->csum = ~csum_partial(diff, sizeof(diff),
2205     - ~skb->csum);
2206     } else if (pseudohdr)
2207     *sum = ~csum_fold(csum_partial(diff, sizeof(diff),
2208     csum_unfold(*sum)));
2209     diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
2210     index 4e39c935e057..ec417156f388 100644
2211     --- a/net/ipv4/ip_vti.c
2212     +++ b/net/ipv4/ip_vti.c
2213     @@ -208,8 +208,17 @@ static netdev_tx_t vti_xmit(struct sk_buff *skb, struct net_device *dev,
2214     int mtu;
2215    
2216     if (!dst) {
2217     - dev->stats.tx_carrier_errors++;
2218     - goto tx_error_icmp;
2219     + struct rtable *rt;
2220     +
2221     + fl->u.ip4.flowi4_oif = dev->ifindex;
2222     + fl->u.ip4.flowi4_flags |= FLOWI_FLAG_ANYSRC;
2223     + rt = __ip_route_output_key(dev_net(dev), &fl->u.ip4);
2224     + if (IS_ERR(rt)) {
2225     + dev->stats.tx_carrier_errors++;
2226     + goto tx_error_icmp;
2227     + }
2228     + dst = &rt->dst;
2229     + skb_dst_set(skb, dst);
2230     }
2231    
2232     dst_hold(dst);
2233     diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
2234     index c2b2ee71fc6c..a266fac08426 100644
2235     --- a/net/ipv6/ip6_vti.c
2236     +++ b/net/ipv6/ip6_vti.c
2237     @@ -453,8 +453,17 @@ vti6_xmit(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
2238     int err = -1;
2239     int mtu;
2240    
2241     - if (!dst)
2242     - goto tx_err_link_failure;
2243     + if (!dst) {
2244     + fl->u.ip6.flowi6_oif = dev->ifindex;
2245     + fl->u.ip6.flowi6_flags |= FLOWI_FLAG_ANYSRC;
2246     + dst = ip6_route_output(dev_net(dev), NULL, &fl->u.ip6);
2247     + if (dst->error) {
2248     + dst_release(dst);
2249     + dst = NULL;
2250     + goto tx_err_link_failure;
2251     + }
2252     + skb_dst_set(skb, dst);
2253     + }
2254    
2255     dst_hold(dst);
2256     dst = xfrm_lookup(t->net, dst, fl, NULL, 0);
2257     diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
2258     index b0acb2961e80..5f4c228b82e5 100644
2259     --- a/net/mac80211/mesh_hwmp.c
2260     +++ b/net/mac80211/mesh_hwmp.c
2261     @@ -326,6 +326,9 @@ static u32 airtime_link_metric_get(struct ieee80211_local *local,
2262     u32 tx_time, estimated_retx;
2263     u64 result;
2264    
2265     + if (sta->mesh->plink_state != NL80211_PLINK_ESTAB)
2266     + return MAX_METRIC;
2267     +
2268     /* Try to get rate based on HW/SW RC algorithm.
2269     * Rate is returned in units of Kbps, correct this
2270     * to comply with airtime calculation units
2271     diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c
2272     index b3622823bad2..ebd66e8f46b3 100644
2273     --- a/net/mac80211/tkip.c
2274     +++ b/net/mac80211/tkip.c
2275     @@ -266,9 +266,21 @@ int ieee80211_tkip_decrypt_data(struct crypto_cipher *tfm,
2276     if ((keyid >> 6) != key->conf.keyidx)
2277     return TKIP_DECRYPT_INVALID_KEYIDX;
2278    
2279     - if (rx_ctx->ctx.state != TKIP_STATE_NOT_INIT &&
2280     - (iv32 < rx_ctx->iv32 ||
2281     - (iv32 == rx_ctx->iv32 && iv16 <= rx_ctx->iv16)))
2282     + /* Reject replays if the received TSC is smaller than or equal to the
2283     + * last received value in a valid message, but with an exception for
2284     + * the case where a new key has been set and no valid frame using that
2285     + * key has yet received and the local RSC was initialized to 0. This
2286     + * exception allows the very first frame sent by the transmitter to be
2287     + * accepted even if that transmitter were to use TSC 0 (IEEE 802.11
2288     + * described TSC to be initialized to 1 whenever a new key is taken into
2289     + * use).
2290     + */
2291     + if (iv32 < rx_ctx->iv32 ||
2292     + (iv32 == rx_ctx->iv32 &&
2293     + (iv16 < rx_ctx->iv16 ||
2294     + (iv16 == rx_ctx->iv16 &&
2295     + (rx_ctx->iv32 || rx_ctx->iv16 ||
2296     + rx_ctx->ctx.state != TKIP_STATE_NOT_INIT)))))
2297     return TKIP_DECRYPT_REPLAY;
2298    
2299     if (only_iv) {
2300     diff --git a/net/sched/ematch.c b/net/sched/ematch.c
2301     index b0b04b3c0896..d4d6f9c91e8c 100644
2302     --- a/net/sched/ematch.c
2303     +++ b/net/sched/ematch.c
2304     @@ -242,6 +242,9 @@ static int tcf_em_validate(struct tcf_proto *tp,
2305     goto errout;
2306    
2307     if (em->ops->change) {
2308     + err = -EINVAL;
2309     + if (em_hdr->flags & TCF_EM_SIMPLE)
2310     + goto errout;
2311     err = em->ops->change(net, data, data_len, em);
2312     if (err < 0)
2313     goto errout;
2314     diff --git a/net/wireless/reg.c b/net/wireless/reg.c
2315     index dde741f298de..0e66768427ba 100644
2316     --- a/net/wireless/reg.c
2317     +++ b/net/wireless/reg.c
2318     @@ -1715,14 +1715,15 @@ static void update_all_wiphy_regulatory(enum nl80211_reg_initiator initiator)
2319    
2320     static void handle_channel_custom(struct wiphy *wiphy,
2321     struct ieee80211_channel *chan,
2322     - const struct ieee80211_regdomain *regd)
2323     + const struct ieee80211_regdomain *regd,
2324     + u32 min_bw)
2325     {
2326     u32 bw_flags = 0;
2327     const struct ieee80211_reg_rule *reg_rule = NULL;
2328     const struct ieee80211_power_rule *power_rule = NULL;
2329     u32 bw;
2330    
2331     - for (bw = MHZ_TO_KHZ(20); bw >= MHZ_TO_KHZ(5); bw = bw / 2) {
2332     + for (bw = MHZ_TO_KHZ(20); bw >= min_bw; bw = bw / 2) {
2333     reg_rule = freq_reg_info_regd(MHZ_TO_KHZ(chan->center_freq),
2334     regd, bw);
2335     if (!IS_ERR(reg_rule))
2336     @@ -1778,8 +1779,14 @@ static void handle_band_custom(struct wiphy *wiphy,
2337     if (!sband)
2338     return;
2339    
2340     + /*
2341     + * We currently assume that you always want at least 20 MHz,
2342     + * otherwise channel 12 might get enabled if this rule is
2343     + * compatible to US, which permits 2402 - 2472 MHz.
2344     + */
2345     for (i = 0; i < sband->n_channels; i++)
2346     - handle_channel_custom(wiphy, &sband->channels[i], regd);
2347     + handle_channel_custom(wiphy, &sband->channels[i], regd,
2348     + MHZ_TO_KHZ(20));
2349     }
2350    
2351     /* Used by drivers prior to wiphy registration */
2352     diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
2353     index 6250b1cfcde5..4bf0296a7c43 100644
2354     --- a/net/wireless/wext-core.c
2355     +++ b/net/wireless/wext-core.c
2356     @@ -659,7 +659,8 @@ struct iw_statistics *get_wireless_stats(struct net_device *dev)
2357     return NULL;
2358     }
2359    
2360     -static int iw_handler_get_iwstats(struct net_device * dev,
2361     +/* noinline to avoid a bogus warning with -O3 */
2362     +static noinline int iw_handler_get_iwstats(struct net_device * dev,
2363     struct iw_request_info * info,
2364     union iwreq_data * wrqu,
2365     char * extra)
2366     diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
2367     index 2376b09c35cf..23e17a58651b 100644
2368     --- a/sound/core/pcm_native.c
2369     +++ b/sound/core/pcm_native.c
2370     @@ -588,7 +588,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
2371     runtime->boundary *= 2;
2372    
2373     /* clear the buffer for avoiding possible kernel info leaks */
2374     - if (runtime->dma_area)
2375     + if (runtime->dma_area && !substream->ops->copy)
2376     memset(runtime->dma_area, 0, runtime->dma_bytes);
2377    
2378     snd_pcm_timer_resolution_change(substream);
2379     diff --git a/tools/include/linux/string.h b/tools/include/linux/string.h
2380     index f436d2420a18..115ecca5f8b9 100644
2381     --- a/tools/include/linux/string.h
2382     +++ b/tools/include/linux/string.h
2383     @@ -13,7 +13,15 @@ int strtobool(const char *s, bool *res);
2384     * However uClibc headers also define __GLIBC__ hence the hack below
2385     */
2386     #if defined(__GLIBC__) && !defined(__UCLIBC__)
2387     +// pragma diagnostic was introduced in gcc 4.6
2388     +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
2389     +#pragma GCC diagnostic push
2390     +#pragma GCC diagnostic ignored "-Wredundant-decls"
2391     +#endif
2392     extern size_t strlcpy(char *dest, const char *src, size_t size);
2393     +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
2394     +#pragma GCC diagnostic pop
2395     +#endif
2396     #endif
2397    
2398     char *str_error_r(int errnum, char *buf, size_t buflen);
2399     diff --git a/tools/lib/string.c b/tools/lib/string.c
2400     index bd239bc1d557..0e071c0bb09e 100644
2401     --- a/tools/lib/string.c
2402     +++ b/tools/lib/string.c
2403     @@ -76,6 +76,10 @@ int strtobool(const char *s, bool *res)
2404     * If libc has strlcpy() then that version will override this
2405     * implementation:
2406     */
2407     +#ifdef __clang__
2408     +#pragma clang diagnostic push
2409     +#pragma clang diagnostic ignored "-Wignored-attributes"
2410     +#endif
2411     size_t __weak strlcpy(char *dest, const char *src, size_t size)
2412     {
2413     size_t ret = strlen(src);
2414     @@ -87,3 +91,6 @@ size_t __weak strlcpy(char *dest, const char *src, size_t size)
2415     }
2416     return ret;
2417     }
2418     +#ifdef __clang__
2419     +#pragma clang diagnostic pop
2420     +#endif