Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r2083 - genpatches-2.6/trunk/3.3
Date: Tue, 07 Feb 2012 13:48:08
Message-Id: 20120207134750.CE9BF2004B@flycatcher.gentoo.org
1 Author: mpagano
2 Date: 2012-02-07 13:47:50 +0000 (Tue, 07 Feb 2012)
3 New Revision: 2083
4
5 Removed:
6 genpatches-2.6/trunk/3.3/1000_linux-3.2.1.patch
7 genpatches-2.6/trunk/3.3/1001_linux-3.2.2.patch
8 genpatches-2.6/trunk/3.3/1002_linux-3.2.3.patch
9 genpatches-2.6/trunk/3.3/1003_linux-3.2.4.patch
10 genpatches-2.6/trunk/3.3/1004_linux-3.2.5.patch
11 Modified:
12 genpatches-2.6/trunk/3.3/0000_README
13 Log:
14 Prepare 3.3 branch
15
16 Modified: genpatches-2.6/trunk/3.3/0000_README
17 ===================================================================
18 --- genpatches-2.6/trunk/3.3/0000_README 2012-02-07 13:46:33 UTC (rev 2082)
19 +++ genpatches-2.6/trunk/3.3/0000_README 2012-02-07 13:47:50 UTC (rev 2083)
20 @@ -39,26 +39,6 @@
21 Individual Patch Descriptions:
22 --------------------------------------------------------------------------
23
24 -Patch: 1000_linux-3.2.1.patch
25 -From: http://www.kernel.org
26 -Desc: Linux 3.2.1
27 -
28 -Patch: 1001_linux-3.2.2.patch
29 -From: http://www.kernel.org
30 -Desc: Linux 3.2.2
31 -
32 -Patch: 1002_linux-3.2.3.patch
33 -From: http://www.kernel.org
34 -Desc: Linux 3.2.3
35 -
36 -Patch: 1003_linux-3.2.4.patch
37 -From: http://www.kernel.org
38 -Desc: Linux 3.2.4
39 -
40 -Patch: 1004_linux-3.2.5.patch
41 -From: http://www.kernel.org
42 -Desc: Linux 3.2.5
43 -
44 Patch: 2400_kcopy-patch-for-infiniband-driver.patch
45 From: Alexey Shvetsov <alexxy@g.o>
46 Desc: Zero copy for infiniband psm userspace driver
47
48 Deleted: genpatches-2.6/trunk/3.3/1000_linux-3.2.1.patch
49 ===================================================================
50 --- genpatches-2.6/trunk/3.3/1000_linux-3.2.1.patch 2012-02-07 13:46:33 UTC (rev 2082)
51 +++ genpatches-2.6/trunk/3.3/1000_linux-3.2.1.patch 2012-02-07 13:47:50 UTC (rev 2083)
52 @@ -1,1787 +0,0 @@
53 -diff --git a/Documentation/HOWTO b/Documentation/HOWTO
54 -index 81bc1a9..f7ade3b 100644
55 ---- a/Documentation/HOWTO
56 -+++ b/Documentation/HOWTO
57 -@@ -275,8 +275,8 @@ versions.
58 - If no 2.6.x.y kernel is available, then the highest numbered 2.6.x
59 - kernel is the current stable kernel.
60 -
61 --2.6.x.y are maintained by the "stable" team <stable@××××××.org>, and are
62 --released as needs dictate. The normal release period is approximately
63 -+2.6.x.y are maintained by the "stable" team <stable@×××××××××××.org>, and
64 -+are released as needs dictate. The normal release period is approximately
65 - two weeks, but it can be longer if there are no pressing problems. A
66 - security-related problem, instead, can cause a release to happen almost
67 - instantly.
68 -diff --git a/Documentation/development-process/5.Posting b/Documentation/development-process/5.Posting
69 -index 903a254..8a48c9b 100644
70 ---- a/Documentation/development-process/5.Posting
71 -+++ b/Documentation/development-process/5.Posting
72 -@@ -271,10 +271,10 @@ copies should go to:
73 - the linux-kernel list.
74 -
75 - - If you are fixing a bug, think about whether the fix should go into the
76 -- next stable update. If so, stable@××××××.org should get a copy of the
77 -- patch. Also add a "Cc: stable@××××××.org" to the tags within the patch
78 -- itself; that will cause the stable team to get a notification when your
79 -- fix goes into the mainline.
80 -+ next stable update. If so, stable@×××××××××××.org should get a copy of
81 -+ the patch. Also add a "Cc: stable@×××××××××××.org" to the tags within
82 -+ the patch itself; that will cause the stable team to get a notification
83 -+ when your fix goes into the mainline.
84 -
85 - When selecting recipients for a patch, it is good to have an idea of who
86 - you think will eventually accept the patch and get it merged. While it
87 -diff --git a/Documentation/usb/usbmon.txt b/Documentation/usb/usbmon.txt
88 -index a4efa04..5335fa8 100644
89 ---- a/Documentation/usb/usbmon.txt
90 -+++ b/Documentation/usb/usbmon.txt
91 -@@ -47,10 +47,11 @@ This allows to filter away annoying devices that talk continuously.
92 -
93 - 2. Find which bus connects to the desired device
94 -
95 --Run "cat /proc/bus/usb/devices", and find the T-line which corresponds to
96 --the device. Usually you do it by looking for the vendor string. If you have
97 --many similar devices, unplug one and compare two /proc/bus/usb/devices outputs.
98 --The T-line will have a bus number. Example:
99 -+Run "cat /sys/kernel/debug/usb/devices", and find the T-line which corresponds
100 -+to the device. Usually you do it by looking for the vendor string. If you have
101 -+many similar devices, unplug one and compare the two
102 -+/sys/kernel/debug/usb/devices outputs. The T-line will have a bus number.
103 -+Example:
104 -
105 - T: Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 0
106 - D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
107 -@@ -58,7 +59,10 @@ P: Vendor=0557 ProdID=2004 Rev= 1.00
108 - S: Manufacturer=ATEN
109 - S: Product=UC100KM V2.00
110 -
111 --Bus=03 means it's bus 3.
112 -+"Bus=03" means it's bus 3. Alternatively, you can look at the output from
113 -+"lsusb" and get the bus number from the appropriate line. Example:
114 -+
115 -+Bus 003 Device 002: ID 0557:2004 ATEN UC100KM V2.00
116 -
117 - 3. Start 'cat'
118 -
119 -diff --git a/MAINTAINERS b/MAINTAINERS
120 -index 62f1cd3..f986e7d 100644
121 ---- a/MAINTAINERS
122 -+++ b/MAINTAINERS
123 -@@ -6258,7 +6258,7 @@ F: arch/alpha/kernel/srm_env.c
124 -
125 - STABLE BRANCH
126 - M: Greg Kroah-Hartman <greg@×××××.com>
127 --L: stable@××××××.org
128 -+L: stable@×××××××××××.org
129 - S: Maintained
130 -
131 - STAGING SUBSYSTEM
132 -diff --git a/Makefile b/Makefile
133 -index adddd11..c5edffa 100644
134 ---- a/Makefile
135 -+++ b/Makefile
136 -@@ -1,6 +1,6 @@
137 - VERSION = 3
138 - PATCHLEVEL = 2
139 --SUBLEVEL = 0
140 -+SUBLEVEL = 1
141 - EXTRAVERSION =
142 - NAME = Saber-toothed Squirrel
143 -
144 -diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h
145 -index fe6f7c2..bc3c745 100644
146 ---- a/arch/powerpc/include/asm/time.h
147 -+++ b/arch/powerpc/include/asm/time.h
148 -@@ -219,5 +219,7 @@ DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array);
149 - extern void secondary_cpu_time_init(void);
150 - extern void iSeries_time_init_early(void);
151 -
152 -+extern void decrementer_check_overflow(void);
153 -+
154 - #endif /* __KERNEL__ */
155 - #endif /* __POWERPC_TIME_H */
156 -diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
157 -index 5c3c469..745c1e7 100644
158 ---- a/arch/powerpc/kernel/irq.c
159 -+++ b/arch/powerpc/kernel/irq.c
160 -@@ -164,16 +164,13 @@ notrace void arch_local_irq_restore(unsigned long en)
161 - */
162 - local_paca->hard_enabled = en;
163 -
164 --#ifndef CONFIG_BOOKE
165 -- /* On server, re-trigger the decrementer if it went negative since
166 -- * some processors only trigger on edge transitions of the sign bit.
167 -- *
168 -- * BookE has a level sensitive decrementer (latches in TSR) so we
169 -- * don't need that
170 -+ /*
171 -+ * Trigger the decrementer if we have a pending event. Some processors
172 -+ * only trigger on edge transitions of the sign bit. We might also
173 -+ * have disabled interrupts long enough that the decrementer wrapped
174 -+ * to positive.
175 - */
176 -- if ((int)mfspr(SPRN_DEC) < 0)
177 -- mtspr(SPRN_DEC, 1);
178 --#endif /* CONFIG_BOOKE */
179 -+ decrementer_check_overflow();
180 -
181 - /*
182 - * Force the delivery of pending soft-disabled interrupts on PS3.
183 -diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
184 -index 522bb1d..5db163c 100644
185 ---- a/arch/powerpc/kernel/time.c
186 -+++ b/arch/powerpc/kernel/time.c
187 -@@ -889,6 +889,15 @@ static void __init clocksource_init(void)
188 - clock->name, clock->mult, clock->shift);
189 - }
190 -
191 -+void decrementer_check_overflow(void)
192 -+{
193 -+ u64 now = get_tb_or_rtc();
194 -+ struct decrementer_clock *decrementer = &__get_cpu_var(decrementers);
195 -+
196 -+ if (now >= decrementer->next_tb)
197 -+ set_dec(1);
198 -+}
199 -+
200 - static int decrementer_set_next_event(unsigned long evt,
201 - struct clock_event_device *dev)
202 - {
203 -diff --git a/arch/powerpc/platforms/pseries/hvCall_inst.c b/arch/powerpc/platforms/pseries/hvCall_inst.c
204 -index f106662..c9311cf 100644
205 ---- a/arch/powerpc/platforms/pseries/hvCall_inst.c
206 -+++ b/arch/powerpc/platforms/pseries/hvCall_inst.c
207 -@@ -109,7 +109,7 @@ static void probe_hcall_entry(void *ignored, unsigned long opcode, unsigned long
208 - if (opcode > MAX_HCALL_OPCODE)
209 - return;
210 -
211 -- h = &get_cpu_var(hcall_stats)[opcode / 4];
212 -+ h = &__get_cpu_var(hcall_stats)[opcode / 4];
213 - h->tb_start = mftb();
214 - h->purr_start = mfspr(SPRN_PURR);
215 - }
216 -@@ -126,8 +126,6 @@ static void probe_hcall_exit(void *ignored, unsigned long opcode, unsigned long
217 - h->num_calls++;
218 - h->tb_total += mftb() - h->tb_start;
219 - h->purr_total += mfspr(SPRN_PURR) - h->purr_start;
220 --
221 -- put_cpu_var(hcall_stats);
222 - }
223 -
224 - static int __init hcall_inst_init(void)
225 -diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
226 -index 27a4950..dc36ea6 100644
227 ---- a/arch/powerpc/platforms/pseries/lpar.c
228 -+++ b/arch/powerpc/platforms/pseries/lpar.c
229 -@@ -554,6 +554,7 @@ void __trace_hcall_entry(unsigned long opcode, unsigned long *args)
230 - goto out;
231 -
232 - (*depth)++;
233 -+ preempt_disable();
234 - trace_hcall_entry(opcode, args);
235 - (*depth)--;
236 -
237 -@@ -576,6 +577,7 @@ void __trace_hcall_exit(long opcode, unsigned long retval,
238 -
239 - (*depth)++;
240 - trace_hcall_exit(opcode, retval, retbuf);
241 -+ preempt_enable();
242 - (*depth)--;
243 -
244 - out:
245 -diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
246 -index 06ed6b4..3719c94 100644
247 ---- a/drivers/base/firmware_class.c
248 -+++ b/drivers/base/firmware_class.c
249 -@@ -226,13 +226,13 @@ static ssize_t firmware_loading_store(struct device *dev,
250 - int loading = simple_strtol(buf, NULL, 10);
251 - int i;
252 -
253 -+ mutex_lock(&fw_lock);
254 -+
255 -+ if (!fw_priv->fw)
256 -+ goto out;
257 -+
258 - switch (loading) {
259 - case 1:
260 -- mutex_lock(&fw_lock);
261 -- if (!fw_priv->fw) {
262 -- mutex_unlock(&fw_lock);
263 -- break;
264 -- }
265 - firmware_free_data(fw_priv->fw);
266 - memset(fw_priv->fw, 0, sizeof(struct firmware));
267 - /* If the pages are not owned by 'struct firmware' */
268 -@@ -243,7 +243,6 @@ static ssize_t firmware_loading_store(struct device *dev,
269 - fw_priv->page_array_size = 0;
270 - fw_priv->nr_pages = 0;
271 - set_bit(FW_STATUS_LOADING, &fw_priv->status);
272 -- mutex_unlock(&fw_lock);
273 - break;
274 - case 0:
275 - if (test_bit(FW_STATUS_LOADING, &fw_priv->status)) {
276 -@@ -274,7 +273,8 @@ static ssize_t firmware_loading_store(struct device *dev,
277 - fw_load_abort(fw_priv);
278 - break;
279 - }
280 --
281 -+out:
282 -+ mutex_unlock(&fw_lock);
283 - return count;
284 - }
285 -
286 -diff --git a/drivers/bcma/bcma_private.h b/drivers/bcma/bcma_private.h
287 -index 30a3085..fda56bd 100644
288 ---- a/drivers/bcma/bcma_private.h
289 -+++ b/drivers/bcma/bcma_private.h
290 -@@ -18,6 +18,9 @@ void bcma_bus_unregister(struct bcma_bus *bus);
291 - int __init bcma_bus_early_register(struct bcma_bus *bus,
292 - struct bcma_device *core_cc,
293 - struct bcma_device *core_mips);
294 -+#ifdef CONFIG_PM
295 -+int bcma_bus_resume(struct bcma_bus *bus);
296 -+#endif
297 -
298 - /* scan.c */
299 - int bcma_bus_scan(struct bcma_bus *bus);
300 -diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c
301 -index 1b51d8b..990f5a8 100644
302 ---- a/drivers/bcma/host_pci.c
303 -+++ b/drivers/bcma/host_pci.c
304 -@@ -224,6 +224,41 @@ static void bcma_host_pci_remove(struct pci_dev *dev)
305 - pci_set_drvdata(dev, NULL);
306 - }
307 -
308 -+#ifdef CONFIG_PM
309 -+static int bcma_host_pci_suspend(struct pci_dev *dev, pm_message_t state)
310 -+{
311 -+ /* Host specific */
312 -+ pci_save_state(dev);
313 -+ pci_disable_device(dev);
314 -+ pci_set_power_state(dev, pci_choose_state(dev, state));
315 -+
316 -+ return 0;
317 -+}
318 -+
319 -+static int bcma_host_pci_resume(struct pci_dev *dev)
320 -+{
321 -+ struct bcma_bus *bus = pci_get_drvdata(dev);
322 -+ int err;
323 -+
324 -+ /* Host specific */
325 -+ pci_set_power_state(dev, 0);
326 -+ err = pci_enable_device(dev);
327 -+ if (err)
328 -+ return err;
329 -+ pci_restore_state(dev);
330 -+
331 -+ /* Bus specific */
332 -+ err = bcma_bus_resume(bus);
333 -+ if (err)
334 -+ return err;
335 -+
336 -+ return 0;
337 -+}
338 -+#else /* CONFIG_PM */
339 -+# define bcma_host_pci_suspend NULL
340 -+# define bcma_host_pci_resume NULL
341 -+#endif /* CONFIG_PM */
342 -+
343 - static DEFINE_PCI_DEVICE_TABLE(bcma_pci_bridge_tbl) = {
344 - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x0576) },
345 - { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4331) },
346 -@@ -239,6 +274,8 @@ static struct pci_driver bcma_pci_bridge_driver = {
347 - .id_table = bcma_pci_bridge_tbl,
348 - .probe = bcma_host_pci_probe,
349 - .remove = bcma_host_pci_remove,
350 -+ .suspend = bcma_host_pci_suspend,
351 -+ .resume = bcma_host_pci_resume,
352 - };
353 -
354 - int __init bcma_host_pci_init(void)
355 -diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
356 -index 70c84b9..10f92b3 100644
357 ---- a/drivers/bcma/main.c
358 -+++ b/drivers/bcma/main.c
359 -@@ -240,6 +240,22 @@ int __init bcma_bus_early_register(struct bcma_bus *bus,
360 - return 0;
361 - }
362 -
363 -+#ifdef CONFIG_PM
364 -+int bcma_bus_resume(struct bcma_bus *bus)
365 -+{
366 -+ struct bcma_device *core;
367 -+
368 -+ /* Init CC core */
369 -+ core = bcma_find_core(bus, BCMA_CORE_CHIPCOMMON);
370 -+ if (core) {
371 -+ bus->drv_cc.setup_done = false;
372 -+ bcma_core_chipcommon_init(&bus->drv_cc);
373 -+ }
374 -+
375 -+ return 0;
376 -+}
377 -+#endif
378 -+
379 - int __bcma_driver_register(struct bcma_driver *drv, struct module *owner)
380 - {
381 - drv->drv.name = drv->name;
382 -diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
383 -index 0c048dd..d2d0a2a 100644
384 ---- a/drivers/hv/vmbus_drv.c
385 -+++ b/drivers/hv/vmbus_drv.c
386 -@@ -62,6 +62,14 @@ struct hv_device_info {
387 - struct hv_dev_port_info outbound;
388 - };
389 -
390 -+static int vmbus_exists(void)
391 -+{
392 -+ if (hv_acpi_dev == NULL)
393 -+ return -ENODEV;
394 -+
395 -+ return 0;
396 -+}
397 -+
398 -
399 - static void get_channel_info(struct hv_device *device,
400 - struct hv_device_info *info)
401 -@@ -590,6 +598,10 @@ int __vmbus_driver_register(struct hv_driver *hv_driver, struct module *owner, c
402 -
403 - pr_info("registering driver %s\n", hv_driver->name);
404 -
405 -+ ret = vmbus_exists();
406 -+ if (ret < 0)
407 -+ return ret;
408 -+
409 - hv_driver->driver.name = hv_driver->name;
410 - hv_driver->driver.owner = owner;
411 - hv_driver->driver.mod_name = mod_name;
412 -@@ -614,8 +626,8 @@ void vmbus_driver_unregister(struct hv_driver *hv_driver)
413 - {
414 - pr_info("unregistering driver %s\n", hv_driver->name);
415 -
416 -- driver_unregister(&hv_driver->driver);
417 --
418 -+ if (!vmbus_exists())
419 -+ driver_unregister(&hv_driver->driver);
420 - }
421 - EXPORT_SYMBOL_GPL(vmbus_driver_unregister);
422 -
423 -@@ -776,6 +788,7 @@ static int __init hv_acpi_init(void)
424 -
425 - cleanup:
426 - acpi_bus_unregister_driver(&vmbus_acpi_driver);
427 -+ hv_acpi_dev = NULL;
428 - return ret;
429 - }
430 -
431 -diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
432 -index 254f164..e3db8ef 100644
433 ---- a/drivers/infiniband/core/uverbs_cmd.c
434 -+++ b/drivers/infiniband/core/uverbs_cmd.c
435 -@@ -241,11 +241,24 @@ static struct ib_qp *idr_read_qp(int qp_handle, struct ib_ucontext *context)
436 - return idr_read_obj(&ib_uverbs_qp_idr, qp_handle, context, 0);
437 - }
438 -
439 -+static struct ib_qp *idr_write_qp(int qp_handle, struct ib_ucontext *context)
440 -+{
441 -+ struct ib_uobject *uobj;
442 -+
443 -+ uobj = idr_write_uobj(&ib_uverbs_qp_idr, qp_handle, context);
444 -+ return uobj ? uobj->object : NULL;
445 -+}
446 -+
447 - static void put_qp_read(struct ib_qp *qp)
448 - {
449 - put_uobj_read(qp->uobject);
450 - }
451 -
452 -+static void put_qp_write(struct ib_qp *qp)
453 -+{
454 -+ put_uobj_write(qp->uobject);
455 -+}
456 -+
457 - static struct ib_srq *idr_read_srq(int srq_handle, struct ib_ucontext *context)
458 - {
459 - return idr_read_obj(&ib_uverbs_srq_idr, srq_handle, context, 0);
460 -@@ -2375,7 +2388,7 @@ ssize_t ib_uverbs_attach_mcast(struct ib_uverbs_file *file,
461 - if (copy_from_user(&cmd, buf, sizeof cmd))
462 - return -EFAULT;
463 -
464 -- qp = idr_read_qp(cmd.qp_handle, file->ucontext);
465 -+ qp = idr_write_qp(cmd.qp_handle, file->ucontext);
466 - if (!qp)
467 - return -EINVAL;
468 -
469 -@@ -2404,7 +2417,7 @@ ssize_t ib_uverbs_attach_mcast(struct ib_uverbs_file *file,
470 - kfree(mcast);
471 -
472 - out_put:
473 -- put_qp_read(qp);
474 -+ put_qp_write(qp);
475 -
476 - return ret ? ret : in_len;
477 - }
478 -@@ -2422,7 +2435,7 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file *file,
479 - if (copy_from_user(&cmd, buf, sizeof cmd))
480 - return -EFAULT;
481 -
482 -- qp = idr_read_qp(cmd.qp_handle, file->ucontext);
483 -+ qp = idr_write_qp(cmd.qp_handle, file->ucontext);
484 - if (!qp)
485 - return -EINVAL;
486 -
487 -@@ -2441,7 +2454,7 @@ ssize_t ib_uverbs_detach_mcast(struct ib_uverbs_file *file,
488 - }
489 -
490 - out_put:
491 -- put_qp_read(qp);
492 -+ put_qp_write(qp);
493 -
494 - return ret ? ret : in_len;
495 - }
496 -diff --git a/drivers/infiniband/hw/qib/qib_iba6120.c b/drivers/infiniband/hw/qib/qib_iba6120.c
497 -index 781a802..4f18e2d 100644
498 ---- a/drivers/infiniband/hw/qib/qib_iba6120.c
499 -+++ b/drivers/infiniband/hw/qib/qib_iba6120.c
500 -@@ -2076,9 +2076,11 @@ static void qib_6120_config_ctxts(struct qib_devdata *dd)
501 - static void qib_update_6120_usrhead(struct qib_ctxtdata *rcd, u64 hd,
502 - u32 updegr, u32 egrhd, u32 npkts)
503 - {
504 -- qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
505 - if (updegr)
506 - qib_write_ureg(rcd->dd, ur_rcvegrindexhead, egrhd, rcd->ctxt);
507 -+ mmiowb();
508 -+ qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
509 -+ mmiowb();
510 - }
511 -
512 - static u32 qib_6120_hdrqempty(struct qib_ctxtdata *rcd)
513 -diff --git a/drivers/infiniband/hw/qib/qib_iba7220.c b/drivers/infiniband/hw/qib/qib_iba7220.c
514 -index 439d3c5..7ec4048 100644
515 ---- a/drivers/infiniband/hw/qib/qib_iba7220.c
516 -+++ b/drivers/infiniband/hw/qib/qib_iba7220.c
517 -@@ -2725,9 +2725,11 @@ static int qib_7220_set_loopback(struct qib_pportdata *ppd, const char *what)
518 - static void qib_update_7220_usrhead(struct qib_ctxtdata *rcd, u64 hd,
519 - u32 updegr, u32 egrhd, u32 npkts)
520 - {
521 -- qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
522 - if (updegr)
523 - qib_write_ureg(rcd->dd, ur_rcvegrindexhead, egrhd, rcd->ctxt);
524 -+ mmiowb();
525 -+ qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
526 -+ mmiowb();
527 - }
528 -
529 - static u32 qib_7220_hdrqempty(struct qib_ctxtdata *rcd)
530 -diff --git a/drivers/infiniband/hw/qib/qib_iba7322.c b/drivers/infiniband/hw/qib/qib_iba7322.c
531 -index 1d58959..5a070e8 100644
532 ---- a/drivers/infiniband/hw/qib/qib_iba7322.c
533 -+++ b/drivers/infiniband/hw/qib/qib_iba7322.c
534 -@@ -4082,10 +4082,12 @@ static void qib_update_7322_usrhead(struct qib_ctxtdata *rcd, u64 hd,
535 - */
536 - if (hd >> IBA7322_HDRHEAD_PKTINT_SHIFT)
537 - adjust_rcv_timeout(rcd, npkts);
538 -- qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
539 -- qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
540 - if (updegr)
541 - qib_write_ureg(rcd->dd, ur_rcvegrindexhead, egrhd, rcd->ctxt);
542 -+ mmiowb();
543 -+ qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
544 -+ qib_write_ureg(rcd->dd, ur_rcvhdrhead, hd, rcd->ctxt);
545 -+ mmiowb();
546 - }
547 -
548 - static u32 qib_7322_hdrqempty(struct qib_ctxtdata *rcd)
549 -diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
550 -index 7f87568..e58aa2b 100644
551 ---- a/drivers/net/bonding/bond_main.c
552 -+++ b/drivers/net/bonding/bond_main.c
553 -@@ -1822,7 +1822,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
554 - "but new slave device does not support netpoll.\n",
555 - bond_dev->name);
556 - res = -EBUSY;
557 -- goto err_close;
558 -+ goto err_detach;
559 - }
560 - }
561 - #endif
562 -@@ -1831,7 +1831,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
563 -
564 - res = bond_create_slave_symlinks(bond_dev, slave_dev);
565 - if (res)
566 -- goto err_close;
567 -+ goto err_detach;
568 -
569 - res = netdev_rx_handler_register(slave_dev, bond_handle_frame,
570 - new_slave);
571 -@@ -1852,6 +1852,11 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
572 - err_dest_symlinks:
573 - bond_destroy_slave_symlinks(bond_dev, slave_dev);
574 -
575 -+err_detach:
576 -+ write_lock_bh(&bond->lock);
577 -+ bond_detach_slave(bond, new_slave);
578 -+ write_unlock_bh(&bond->lock);
579 -+
580 - err_close:
581 - dev_close(slave_dev);
582 -
583 -diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
584 -index e95f0e6..dd2625a 100644
585 ---- a/drivers/net/usb/asix.c
586 -+++ b/drivers/net/usb/asix.c
587 -@@ -376,7 +376,7 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
588 -
589 - skb_pull(skb, (size + 1) & 0xfffe);
590 -
591 -- if (skb->len == 0)
592 -+ if (skb->len < sizeof(header))
593 - break;
594 -
595 - head = (u8 *) skb->data;
596 -diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h
597 -index 69d5f85..8b9ff28 100644
598 ---- a/drivers/net/wireless/iwlwifi/iwl-commands.h
599 -+++ b/drivers/net/wireless/iwlwifi/iwl-commands.h
600 -@@ -809,7 +809,7 @@ struct iwl_qosparam_cmd {
601 - #define IWLAGN_STATION_COUNT 16
602 -
603 - #define IWL_INVALID_STATION 255
604 --#define IWL_MAX_TID_COUNT 9
605 -+#define IWL_MAX_TID_COUNT 8
606 -
607 - #define STA_FLG_TX_RATE_MSK cpu_to_le32(1 << 2)
608 - #define STA_FLG_PWR_SAVE_MSK cpu_to_le32(1 << 8)
609 -diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
610 -index 2b6756e..5c29281 100644
611 ---- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
612 -+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-int.h
613 -@@ -219,9 +219,7 @@ struct iwl_trans_pcie {
614 -
615 - /* INT ICT Table */
616 - __le32 *ict_tbl;
617 -- void *ict_tbl_vir;
618 - dma_addr_t ict_tbl_dma;
619 -- dma_addr_t aligned_ict_tbl_dma;
620 - int ict_index;
621 - u32 inta;
622 - bool use_ict;
623 -diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
624 -index 374c68c..1920237 100644
625 ---- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
626 -+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
627 -@@ -1136,7 +1136,11 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
628 - * ICT functions
629 - *
630 - ******************************************************************************/
631 --#define ICT_COUNT (PAGE_SIZE/sizeof(u32))
632 -+
633 -+/* a device (PCI-E) page is 4096 bytes long */
634 -+#define ICT_SHIFT 12
635 -+#define ICT_SIZE (1 << ICT_SHIFT)
636 -+#define ICT_COUNT (ICT_SIZE / sizeof(u32))
637 -
638 - /* Free dram table */
639 - void iwl_free_isr_ict(struct iwl_trans *trans)
640 -@@ -1144,21 +1148,19 @@ void iwl_free_isr_ict(struct iwl_trans *trans)
641 - struct iwl_trans_pcie *trans_pcie =
642 - IWL_TRANS_GET_PCIE_TRANS(trans);
643 -
644 -- if (trans_pcie->ict_tbl_vir) {
645 -- dma_free_coherent(bus(trans)->dev,
646 -- (sizeof(u32) * ICT_COUNT) + PAGE_SIZE,
647 -- trans_pcie->ict_tbl_vir,
648 -+ if (trans_pcie->ict_tbl) {
649 -+ dma_free_coherent(bus(trans)->dev, ICT_SIZE,
650 -+ trans_pcie->ict_tbl,
651 - trans_pcie->ict_tbl_dma);
652 -- trans_pcie->ict_tbl_vir = NULL;
653 -- memset(&trans_pcie->ict_tbl_dma, 0,
654 -- sizeof(trans_pcie->ict_tbl_dma));
655 -- memset(&trans_pcie->aligned_ict_tbl_dma, 0,
656 -- sizeof(trans_pcie->aligned_ict_tbl_dma));
657 -+ trans_pcie->ict_tbl = NULL;
658 -+ trans_pcie->ict_tbl_dma = 0;
659 - }
660 - }
661 -
662 -
663 --/* allocate dram shared table it is a PAGE_SIZE aligned
664 -+/*
665 -+ * allocate dram shared table, it is an aligned memory
666 -+ * block of ICT_SIZE.
667 - * also reset all data related to ICT table interrupt.
668 - */
669 - int iwl_alloc_isr_ict(struct iwl_trans *trans)
670 -@@ -1166,36 +1168,26 @@ int iwl_alloc_isr_ict(struct iwl_trans *trans)
671 - struct iwl_trans_pcie *trans_pcie =
672 - IWL_TRANS_GET_PCIE_TRANS(trans);
673 -
674 -- /* allocate shrared data table */
675 -- trans_pcie->ict_tbl_vir =
676 -- dma_alloc_coherent(bus(trans)->dev,
677 -- (sizeof(u32) * ICT_COUNT) + PAGE_SIZE,
678 -- &trans_pcie->ict_tbl_dma, GFP_KERNEL);
679 -- if (!trans_pcie->ict_tbl_vir)
680 -+ trans_pcie->ict_tbl =
681 -+ dma_alloc_coherent(bus(trans)->dev, ICT_SIZE,
682 -+ &trans_pcie->ict_tbl_dma,
683 -+ GFP_KERNEL);
684 -+ if (!trans_pcie->ict_tbl)
685 - return -ENOMEM;
686 -
687 -- /* align table to PAGE_SIZE boundary */
688 -- trans_pcie->aligned_ict_tbl_dma =
689 -- ALIGN(trans_pcie->ict_tbl_dma, PAGE_SIZE);
690 --
691 -- IWL_DEBUG_ISR(trans, "ict dma addr %Lx dma aligned %Lx diff %d\n",
692 -- (unsigned long long)trans_pcie->ict_tbl_dma,
693 -- (unsigned long long)trans_pcie->aligned_ict_tbl_dma,
694 -- (int)(trans_pcie->aligned_ict_tbl_dma -
695 -- trans_pcie->ict_tbl_dma));
696 -+ /* just an API sanity check ... it is guaranteed to be aligned */
697 -+ if (WARN_ON(trans_pcie->ict_tbl_dma & (ICT_SIZE - 1))) {
698 -+ iwl_free_isr_ict(trans);
699 -+ return -EINVAL;
700 -+ }
701 -
702 -- trans_pcie->ict_tbl = trans_pcie->ict_tbl_vir +
703 -- (trans_pcie->aligned_ict_tbl_dma -
704 -- trans_pcie->ict_tbl_dma);
705 -+ IWL_DEBUG_ISR(trans, "ict dma addr %Lx\n",
706 -+ (unsigned long long)trans_pcie->ict_tbl_dma);
707 -
708 -- IWL_DEBUG_ISR(trans, "ict vir addr %p vir aligned %p diff %d\n",
709 -- trans_pcie->ict_tbl, trans_pcie->ict_tbl_vir,
710 -- (int)(trans_pcie->aligned_ict_tbl_dma -
711 -- trans_pcie->ict_tbl_dma));
712 -+ IWL_DEBUG_ISR(trans, "ict vir addr %p\n", trans_pcie->ict_tbl);
713 -
714 - /* reset table and index to all 0 */
715 -- memset(trans_pcie->ict_tbl_vir, 0,
716 -- (sizeof(u32) * ICT_COUNT) + PAGE_SIZE);
717 -+ memset(trans_pcie->ict_tbl, 0, ICT_SIZE);
718 - trans_pcie->ict_index = 0;
719 -
720 - /* add periodic RX interrupt */
721 -@@ -1213,23 +1205,20 @@ int iwl_reset_ict(struct iwl_trans *trans)
722 - struct iwl_trans_pcie *trans_pcie =
723 - IWL_TRANS_GET_PCIE_TRANS(trans);
724 -
725 -- if (!trans_pcie->ict_tbl_vir)
726 -+ if (!trans_pcie->ict_tbl)
727 - return 0;
728 -
729 - spin_lock_irqsave(&trans->shrd->lock, flags);
730 - iwl_disable_interrupts(trans);
731 -
732 -- memset(&trans_pcie->ict_tbl[0], 0, sizeof(u32) * ICT_COUNT);
733 -+ memset(trans_pcie->ict_tbl, 0, ICT_SIZE);
734 -
735 -- val = trans_pcie->aligned_ict_tbl_dma >> PAGE_SHIFT;
736 -+ val = trans_pcie->ict_tbl_dma >> ICT_SHIFT;
737 -
738 - val |= CSR_DRAM_INT_TBL_ENABLE;
739 - val |= CSR_DRAM_INIT_TBL_WRAP_CHECK;
740 -
741 -- IWL_DEBUG_ISR(trans, "CSR_DRAM_INT_TBL_REG =0x%X "
742 -- "aligned dma address %Lx\n",
743 -- val,
744 -- (unsigned long long)trans_pcie->aligned_ict_tbl_dma);
745 -+ IWL_DEBUG_ISR(trans, "CSR_DRAM_INT_TBL_REG =0x%x\n", val);
746 -
747 - iwl_write32(bus(trans), CSR_DRAM_INT_TBL_REG, val);
748 - trans_pcie->use_ict = true;
749 -diff --git a/drivers/net/wireless/libertas/cfg.c b/drivers/net/wireless/libertas/cfg.c
750 -index a7f1ab2..db64ef1 100644
751 ---- a/drivers/net/wireless/libertas/cfg.c
752 -+++ b/drivers/net/wireless/libertas/cfg.c
753 -@@ -728,9 +728,11 @@ static void lbs_scan_worker(struct work_struct *work)
754 - le16_to_cpu(scan_cmd->hdr.size),
755 - lbs_ret_scan, 0);
756 -
757 -- if (priv->scan_channel >= priv->scan_req->n_channels)
758 -+ if (priv->scan_channel >= priv->scan_req->n_channels) {
759 - /* Mark scan done */
760 -+ cancel_delayed_work(&priv->scan_work);
761 - lbs_scan_done(priv);
762 -+ }
763 -
764 - /* Restart network */
765 - if (carrier)
766 -@@ -759,12 +761,12 @@ static void _internal_start_scan(struct lbs_private *priv, bool internal,
767 - request->n_ssids, request->n_channels, request->ie_len);
768 -
769 - priv->scan_channel = 0;
770 -- queue_delayed_work(priv->work_thread, &priv->scan_work,
771 -- msecs_to_jiffies(50));
772 --
773 - priv->scan_req = request;
774 - priv->internal_scan = internal;
775 -
776 -+ queue_delayed_work(priv->work_thread, &priv->scan_work,
777 -+ msecs_to_jiffies(50));
778 -+
779 - lbs_deb_leave(LBS_DEB_CFG80211);
780 - }
781 -
782 -diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
783 -index 3778763..3265b34 100644
784 ---- a/drivers/net/wireless/rt2x00/rt2800usb.c
785 -+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
786 -@@ -976,6 +976,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
787 - { USB_DEVICE(0x13b1, 0x0031) },
788 - { USB_DEVICE(0x1737, 0x0070) },
789 - { USB_DEVICE(0x1737, 0x0071) },
790 -+ { USB_DEVICE(0x1737, 0x0077) },
791 - /* Logitec */
792 - { USB_DEVICE(0x0789, 0x0162) },
793 - { USB_DEVICE(0x0789, 0x0163) },
794 -@@ -1171,7 +1172,6 @@ static struct usb_device_id rt2800usb_device_table[] = {
795 - { USB_DEVICE(0x1740, 0x0605) },
796 - { USB_DEVICE(0x1740, 0x0615) },
797 - /* Linksys */
798 -- { USB_DEVICE(0x1737, 0x0077) },
799 - { USB_DEVICE(0x1737, 0x0078) },
800 - /* Logitec */
801 - { USB_DEVICE(0x0789, 0x0168) },
802 -diff --git a/drivers/net/wireless/wl12xx/boot.c b/drivers/net/wireless/wl12xx/boot.c
803 -index 6813379..a7b327d 100644
804 ---- a/drivers/net/wireless/wl12xx/boot.c
805 -+++ b/drivers/net/wireless/wl12xx/boot.c
806 -@@ -347,6 +347,9 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
807 - nvs_ptr += 3;
808 -
809 - for (i = 0; i < burst_len; i++) {
810 -+ if (nvs_ptr + 3 >= (u8 *) wl->nvs + nvs_len)
811 -+ goto out_badnvs;
812 -+
813 - val = (nvs_ptr[0] | (nvs_ptr[1] << 8)
814 - | (nvs_ptr[2] << 16) | (nvs_ptr[3] << 24));
815 -
816 -@@ -358,6 +361,9 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
817 - nvs_ptr += 4;
818 - dest_addr += 4;
819 - }
820 -+
821 -+ if (nvs_ptr >= (u8 *) wl->nvs + nvs_len)
822 -+ goto out_badnvs;
823 - }
824 -
825 - /*
826 -@@ -369,6 +375,10 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
827 - */
828 - nvs_ptr = (u8 *)wl->nvs +
829 - ALIGN(nvs_ptr - (u8 *)wl->nvs + 7, 4);
830 -+
831 -+ if (nvs_ptr >= (u8 *) wl->nvs + nvs_len)
832 -+ goto out_badnvs;
833 -+
834 - nvs_len -= nvs_ptr - (u8 *)wl->nvs;
835 -
836 - /* Now we must set the partition correctly */
837 -@@ -384,6 +394,10 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
838 -
839 - kfree(nvs_aligned);
840 - return 0;
841 -+
842 -+out_badnvs:
843 -+ wl1271_error("nvs data is malformed");
844 -+ return -EILSEQ;
845 - }
846 -
847 - static void wl1271_boot_enable_interrupts(struct wl1271 *wl)
848 -diff --git a/drivers/net/wireless/wl12xx/cmd.c b/drivers/net/wireless/wl12xx/cmd.c
849 -index a52299e..54a0d66 100644
850 ---- a/drivers/net/wireless/wl12xx/cmd.c
851 -+++ b/drivers/net/wireless/wl12xx/cmd.c
852 -@@ -120,6 +120,11 @@ int wl1271_cmd_general_parms(struct wl1271 *wl)
853 - if (!wl->nvs)
854 - return -ENODEV;
855 -
856 -+ if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) {
857 -+ wl1271_warning("FEM index from INI out of bounds");
858 -+ return -EINVAL;
859 -+ }
860 -+
861 - gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL);
862 - if (!gen_parms)
863 - return -ENOMEM;
864 -@@ -143,6 +148,12 @@ int wl1271_cmd_general_parms(struct wl1271 *wl)
865 - gp->tx_bip_fem_manufacturer =
866 - gen_parms->general_params.tx_bip_fem_manufacturer;
867 -
868 -+ if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) {
869 -+ wl1271_warning("FEM index from FW out of bounds");
870 -+ ret = -EINVAL;
871 -+ goto out;
872 -+ }
873 -+
874 - wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n",
875 - answer ? "auto" : "manual", gp->tx_bip_fem_manufacturer);
876 -
877 -@@ -162,6 +173,11 @@ int wl128x_cmd_general_parms(struct wl1271 *wl)
878 - if (!wl->nvs)
879 - return -ENODEV;
880 -
881 -+ if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) {
882 -+ wl1271_warning("FEM index from ini out of bounds");
883 -+ return -EINVAL;
884 -+ }
885 -+
886 - gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL);
887 - if (!gen_parms)
888 - return -ENOMEM;
889 -@@ -186,6 +202,12 @@ int wl128x_cmd_general_parms(struct wl1271 *wl)
890 - gp->tx_bip_fem_manufacturer =
891 - gen_parms->general_params.tx_bip_fem_manufacturer;
892 -
893 -+ if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) {
894 -+ wl1271_warning("FEM index from FW out of bounds");
895 -+ ret = -EINVAL;
896 -+ goto out;
897 -+ }
898 -+
899 - wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n",
900 - answer ? "auto" : "manual", gp->tx_bip_fem_manufacturer);
901 -
902 -diff --git a/drivers/net/wireless/wl12xx/testmode.c b/drivers/net/wireless/wl12xx/testmode.c
903 -index 4ae8eff..abfb120 100644
904 ---- a/drivers/net/wireless/wl12xx/testmode.c
905 -+++ b/drivers/net/wireless/wl12xx/testmode.c
906 -@@ -36,6 +36,7 @@ enum wl1271_tm_commands {
907 - WL1271_TM_CMD_TEST,
908 - WL1271_TM_CMD_INTERROGATE,
909 - WL1271_TM_CMD_CONFIGURE,
910 -+ WL1271_TM_CMD_NVS_PUSH, /* Not in use. Keep to not break ABI */
911 - WL1271_TM_CMD_SET_PLT_MODE,
912 - WL1271_TM_CMD_RECOVER,
913 -
914 -diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
915 -index 4c823f3..90c8e3a 100644
916 ---- a/drivers/tty/serial/atmel_serial.c
917 -+++ b/drivers/tty/serial/atmel_serial.c
918 -@@ -212,8 +212,9 @@ void atmel_config_rs485(struct uart_port *port, struct serial_rs485 *rs485conf)
919 - {
920 - struct atmel_uart_port *atmel_port = to_atmel_uart_port(port);
921 - unsigned int mode;
922 -+ unsigned long flags;
923 -
924 -- spin_lock(&port->lock);
925 -+ spin_lock_irqsave(&port->lock, flags);
926 -
927 - /* Disable interrupts */
928 - UART_PUT_IDR(port, atmel_port->tx_done_mask);
929 -@@ -244,7 +245,7 @@ void atmel_config_rs485(struct uart_port *port, struct serial_rs485 *rs485conf)
930 - /* Enable interrupts */
931 - UART_PUT_IER(port, atmel_port->tx_done_mask);
932 -
933 -- spin_unlock(&port->lock);
934 -+ spin_unlock_irqrestore(&port->lock, flags);
935 -
936 - }
937 -
938 -diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
939 -index a8078d0..e61d9c4 100644
940 ---- a/drivers/usb/class/cdc-acm.c
941 -+++ b/drivers/usb/class/cdc-acm.c
942 -@@ -554,10 +554,18 @@ static void acm_port_down(struct acm *acm)
943 -
944 - static void acm_tty_hangup(struct tty_struct *tty)
945 - {
946 -- struct acm *acm = tty->driver_data;
947 -- tty_port_hangup(&acm->port);
948 -+ struct acm *acm;
949 -+
950 - mutex_lock(&open_mutex);
951 -+ acm = tty->driver_data;
952 -+
953 -+ if (!acm)
954 -+ goto out;
955 -+
956 -+ tty_port_hangup(&acm->port);
957 - acm_port_down(acm);
958 -+
959 -+out:
960 - mutex_unlock(&open_mutex);
961 - }
962 -
963 -@@ -1183,6 +1191,8 @@ made_compressed_probe:
964 - i = device_create_file(&intf->dev, &dev_attr_wCountryCodes);
965 - if (i < 0) {
966 - kfree(acm->country_codes);
967 -+ acm->country_codes = NULL;
968 -+ acm->country_code_size = 0;
969 - goto skip_countries;
970 - }
971 -
972 -@@ -1191,6 +1201,8 @@ made_compressed_probe:
973 - if (i < 0) {
974 - device_remove_file(&intf->dev, &dev_attr_wCountryCodes);
975 - kfree(acm->country_codes);
976 -+ acm->country_codes = NULL;
977 -+ acm->country_code_size = 0;
978 - goto skip_countries;
979 - }
980 - }
981 -diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
982 -index e3beaf2..7abf060 100644
983 ---- a/drivers/usb/core/devio.c
984 -+++ b/drivers/usb/core/devio.c
985 -@@ -249,7 +249,8 @@ static struct async *alloc_async(unsigned int numisoframes)
986 - static void free_async(struct async *as)
987 - {
988 - put_pid(as->pid);
989 -- put_cred(as->cred);
990 -+ if (as->cred)
991 -+ put_cred(as->cred);
992 - kfree(as->urb->transfer_buffer);
993 - kfree(as->urb->setup_packet);
994 - usb_free_urb(as->urb);
995 -diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
996 -index 13222d3..179e364 100644
997 ---- a/drivers/usb/core/hcd.c
998 -+++ b/drivers/usb/core/hcd.c
999 -@@ -1412,11 +1412,10 @@ int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
1000 - ret = -EAGAIN;
1001 - else
1002 - urb->transfer_flags |= URB_DMA_MAP_SG;
1003 -- if (n != urb->num_sgs) {
1004 -- urb->num_sgs = n;
1005 -+ urb->num_mapped_sgs = n;
1006 -+ if (n != urb->num_sgs)
1007 - urb->transfer_flags |=
1008 - URB_DMA_SG_COMBINED;
1009 -- }
1010 - } else if (urb->sg) {
1011 - struct scatterlist *sg = urb->sg;
1012 - urb->transfer_dma = dma_map_page(
1013 -diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1014 -index ecf12e1..4c65eb6 100644
1015 ---- a/drivers/usb/core/quirks.c
1016 -+++ b/drivers/usb/core/quirks.c
1017 -@@ -117,9 +117,12 @@ static const struct usb_device_id usb_quirk_list[] = {
1018 - { USB_DEVICE(0x06a3, 0x0006), .driver_info =
1019 - USB_QUIRK_CONFIG_INTF_STRINGS },
1020 -
1021 -- /* Guillemot Webcam Hercules Dualpix Exchange*/
1022 -+ /* Guillemot Webcam Hercules Dualpix Exchange (2nd ID) */
1023 - { USB_DEVICE(0x06f8, 0x0804), .driver_info = USB_QUIRK_RESET_RESUME },
1024 -
1025 -+ /* Guillemot Webcam Hercules Dualpix Exchange*/
1026 -+ { USB_DEVICE(0x06f8, 0x3005), .driver_info = USB_QUIRK_RESET_RESUME },
1027 -+
1028 - /* M-Systems Flash Disk Pioneers */
1029 - { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },
1030 -
1031 -diff --git a/drivers/usb/host/ehci-pxa168.c b/drivers/usb/host/ehci-pxa168.c
1032 -index ac0c16e..8d0e7a2 100644
1033 ---- a/drivers/usb/host/ehci-pxa168.c
1034 -+++ b/drivers/usb/host/ehci-pxa168.c
1035 -@@ -299,7 +299,7 @@ static int __devinit ehci_pxa168_drv_probe(struct platform_device *pdev)
1036 - ehci = hcd_to_ehci(hcd);
1037 - ehci->caps = hcd->regs + 0x100;
1038 - ehci->regs = hcd->regs + 0x100 +
1039 -- HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase));
1040 -+ HC_LENGTH(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase));
1041 - ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
1042 - hcd->has_tt = 1;
1043 - ehci->sbrn = 0x20;
1044 -diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
1045 -index 4e4066c..fef1db3 100644
1046 ---- a/drivers/usb/host/ehci-q.c
1047 -+++ b/drivers/usb/host/ehci-q.c
1048 -@@ -647,7 +647,7 @@ qh_urb_transaction (
1049 - /*
1050 - * data transfer stage: buffer setup
1051 - */
1052 -- i = urb->num_sgs;
1053 -+ i = urb->num_mapped_sgs;
1054 - if (len > 0 && i > 0) {
1055 - sg = urb->sg;
1056 - buf = sg_dma_address(sg);
1057 -diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
1058 -index f6ca80e..d2c6f5a 100644
1059 ---- a/drivers/usb/host/uhci-q.c
1060 -+++ b/drivers/usb/host/uhci-q.c
1061 -@@ -943,7 +943,7 @@ static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb,
1062 - if (usb_pipein(urb->pipe))
1063 - status |= TD_CTRL_SPD;
1064 -
1065 -- i = urb->num_sgs;
1066 -+ i = urb->num_mapped_sgs;
1067 - if (len > 0 && i > 0) {
1068 - sg = urb->sg;
1069 - data = sg_dma_address(sg);
1070 -diff --git a/drivers/usb/host/whci/qset.c b/drivers/usb/host/whci/qset.c
1071 -index a403b53..76083ae 100644
1072 ---- a/drivers/usb/host/whci/qset.c
1073 -+++ b/drivers/usb/host/whci/qset.c
1074 -@@ -443,7 +443,7 @@ static int qset_add_urb_sg(struct whc *whc, struct whc_qset *qset, struct urb *u
1075 -
1076 - remaining = urb->transfer_buffer_length;
1077 -
1078 -- for_each_sg(urb->sg, sg, urb->num_sgs, i) {
1079 -+ for_each_sg(urb->sg, sg, urb->num_mapped_sgs, i) {
1080 - dma_addr_t dma_addr;
1081 - size_t dma_remaining;
1082 - dma_addr_t sp, ep;
1083 -@@ -561,7 +561,7 @@ static int qset_add_urb_sg_linearize(struct whc *whc, struct whc_qset *qset,
1084 -
1085 - remaining = urb->transfer_buffer_length;
1086 -
1087 -- for_each_sg(urb->sg, sg, urb->num_sgs, i) {
1088 -+ for_each_sg(urb->sg, sg, urb->num_mapped_sgs, i) {
1089 - size_t len;
1090 - size_t sg_remaining;
1091 - void *orig;
1092 -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
1093 -index 9f1d4b1..d28c586 100644
1094 ---- a/drivers/usb/host/xhci-ring.c
1095 -+++ b/drivers/usb/host/xhci-ring.c
1096 -@@ -2561,7 +2561,7 @@ static unsigned int count_sg_trbs_needed(struct xhci_hcd *xhci, struct urb *urb)
1097 - struct scatterlist *sg;
1098 -
1099 - sg = NULL;
1100 -- num_sgs = urb->num_sgs;
1101 -+ num_sgs = urb->num_mapped_sgs;
1102 - temp = urb->transfer_buffer_length;
1103 -
1104 - xhci_dbg(xhci, "count sg list trbs: \n");
1105 -@@ -2745,7 +2745,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
1106 - return -EINVAL;
1107 -
1108 - num_trbs = count_sg_trbs_needed(xhci, urb);
1109 -- num_sgs = urb->num_sgs;
1110 -+ num_sgs = urb->num_mapped_sgs;
1111 - total_packet_count = roundup(urb->transfer_buffer_length,
1112 - usb_endpoint_maxp(&urb->ep->desc));
1113 -
1114 -diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
1115 -index a1afb7c..b33f059 100644
1116 ---- a/drivers/usb/host/xhci.c
1117 -+++ b/drivers/usb/host/xhci.c
1118 -@@ -1620,6 +1620,7 @@ static int xhci_configure_endpoint_result(struct xhci_hcd *xhci,
1119 - /* FIXME: can we allocate more resources for the HC? */
1120 - break;
1121 - case COMP_BW_ERR:
1122 -+ case COMP_2ND_BW_ERR:
1123 - dev_warn(&udev->dev, "Not enough bandwidth "
1124 - "for new device state.\n");
1125 - ret = -ENOSPC;
1126 -@@ -2796,8 +2797,7 @@ static int xhci_calculate_streams_and_bitmask(struct xhci_hcd *xhci,
1127 - if (ret < 0)
1128 - return ret;
1129 -
1130 -- max_streams = USB_SS_MAX_STREAMS(
1131 -- eps[i]->ss_ep_comp.bmAttributes);
1132 -+ max_streams = usb_ss_max_streams(&eps[i]->ss_ep_comp);
1133 - if (max_streams < (*num_streams - 1)) {
1134 - xhci_dbg(xhci, "Ep 0x%x only supports %u stream IDs.\n",
1135 - eps[i]->desc.bEndpointAddress,
1136 -diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
1137 -index 3c8fbd2..09eda3a 100644
1138 ---- a/drivers/usb/host/xhci.h
1139 -+++ b/drivers/usb/host/xhci.h
1140 -@@ -1033,7 +1033,6 @@ struct xhci_transfer_event {
1141 - /* Invalid Stream ID Error */
1142 - #define COMP_STRID_ERR 34
1143 - /* Secondary Bandwidth Error - may be returned by a Configure Endpoint cmd */
1144 --/* FIXME - check for this */
1145 - #define COMP_2ND_BW_ERR 35
1146 - /* Split Transaction Error */
1147 - #define COMP_SPLIT_ERR 36
1148 -diff --git a/drivers/usb/misc/isight_firmware.c b/drivers/usb/misc/isight_firmware.c
1149 -index fe1d443..8f725f6 100644
1150 ---- a/drivers/usb/misc/isight_firmware.c
1151 -+++ b/drivers/usb/misc/isight_firmware.c
1152 -@@ -55,8 +55,9 @@ static int isight_firmware_load(struct usb_interface *intf,
1153 -
1154 - ptr = firmware->data;
1155 -
1156 -+ buf[0] = 0x01;
1157 - if (usb_control_msg
1158 -- (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, "\1", 1,
1159 -+ (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, buf, 1,
1160 - 300) != 1) {
1161 - printk(KERN_ERR
1162 - "Failed to initialise isight firmware loader\n");
1163 -@@ -100,8 +101,9 @@ static int isight_firmware_load(struct usb_interface *intf,
1164 - }
1165 - }
1166 -
1167 -+ buf[0] = 0x00;
1168 - if (usb_control_msg
1169 -- (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, "\0", 1,
1170 -+ (dev, usb_sndctrlpipe(dev, 0), 0xa0, 0x40, 0xe600, 0, buf, 1,
1171 - 300) != 1) {
1172 - printk(KERN_ERR "isight firmware loading completion failed\n");
1173 - ret = -ENODEV;
1174 -diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
1175 -index b63ab15..920f04e 100644
1176 ---- a/drivers/usb/musb/musb_core.c
1177 -+++ b/drivers/usb/musb/musb_core.c
1178 -@@ -2012,8 +2012,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
1179 - if (status < 0)
1180 - goto fail3;
1181 -
1182 -- pm_runtime_put(musb->controller);
1183 --
1184 - status = musb_init_debugfs(musb);
1185 - if (status < 0)
1186 - goto fail4;
1187 -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
1188 -index fd67cc5..a1a324b 100644
1189 ---- a/drivers/usb/serial/cp210x.c
1190 -+++ b/drivers/usb/serial/cp210x.c
1191 -@@ -92,6 +92,7 @@ static const struct usb_device_id id_table[] = {
1192 - { USB_DEVICE(0x10C4, 0x818B) }, /* AVIT Research USB to TTL */
1193 - { USB_DEVICE(0x10C4, 0x819F) }, /* MJS USB Toslink Switcher */
1194 - { USB_DEVICE(0x10C4, 0x81A6) }, /* ThinkOptics WavIt */
1195 -+ { USB_DEVICE(0x10C4, 0x81A9) }, /* Multiplex RC Interface */
1196 - { USB_DEVICE(0x10C4, 0x81AC) }, /* MSD Dash Hawk */
1197 - { USB_DEVICE(0x10C4, 0x81AD) }, /* INSYS USB Modem */
1198 - { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */
1199 -diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
1200 -index 60f38d5..0a8c1e6 100644
1201 ---- a/drivers/usb/serial/omninet.c
1202 -+++ b/drivers/usb/serial/omninet.c
1203 -@@ -315,7 +315,7 @@ static int omninet_write_room(struct tty_struct *tty)
1204 - int room = 0; /* Default: no room */
1205 -
1206 - /* FIXME: no consistent locking for write_urb_busy */
1207 -- if (wport->write_urb_busy)
1208 -+ if (!wport->write_urb_busy)
1209 - room = wport->bulk_out_size - OMNINET_HEADERLEN;
1210 -
1211 - dbg("%s - returns %d", __func__, room);
1212 -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1213 -index 6dd6453..c96b6b6 100644
1214 ---- a/drivers/usb/serial/option.c
1215 -+++ b/drivers/usb/serial/option.c
1216 -@@ -476,6 +476,10 @@ static void option_instat_callback(struct urb *urb);
1217 - #define VIETTEL_VENDOR_ID 0x2262
1218 - #define VIETTEL_PRODUCT_VT1000 0x0002
1219 -
1220 -+/* ZD Incorporated */
1221 -+#define ZD_VENDOR_ID 0x0685
1222 -+#define ZD_PRODUCT_7000 0x7000
1223 -+
1224 - /* some devices interfaces need special handling due to a number of reasons */
1225 - enum option_blacklist_reason {
1226 - OPTION_BLACKLIST_NONE = 0,
1227 -@@ -1178,6 +1182,7 @@ static const struct usb_device_id option_ids[] = {
1228 - { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU528) },
1229 - { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU526) },
1230 - { USB_DEVICE_AND_INTERFACE_INFO(VIETTEL_VENDOR_ID, VIETTEL_PRODUCT_VT1000, 0xff, 0xff, 0xff) },
1231 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZD_VENDOR_ID, ZD_PRODUCT_7000, 0xff, 0xff, 0xff) },
1232 - { } /* Terminating entry */
1233 - };
1234 - MODULE_DEVICE_TABLE(usb, option_ids);
1235 -diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
1236 -index c325e69..9e069ef 100644
1237 ---- a/drivers/usb/storage/usb.c
1238 -+++ b/drivers/usb/storage/usb.c
1239 -@@ -1073,6 +1073,7 @@ static struct usb_driver usb_storage_driver = {
1240 - .id_table = usb_storage_usb_ids,
1241 - .supports_autosuspend = 1,
1242 - .soft_unbind = 1,
1243 -+ .no_dynamic_id = 1,
1244 - };
1245 -
1246 - static int __init usb_stor_init(void)
1247 -diff --git a/drivers/video/offb.c b/drivers/video/offb.c
1248 -index cb163a5..3251a02 100644
1249 ---- a/drivers/video/offb.c
1250 -+++ b/drivers/video/offb.c
1251 -@@ -100,36 +100,32 @@ static int offb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
1252 - u_int transp, struct fb_info *info)
1253 - {
1254 - struct offb_par *par = (struct offb_par *) info->par;
1255 -- int i, depth;
1256 -- u32 *pal = info->pseudo_palette;
1257 --
1258 -- depth = info->var.bits_per_pixel;
1259 -- if (depth == 16)
1260 -- depth = (info->var.green.length == 5) ? 15 : 16;
1261 --
1262 -- if (regno > 255 ||
1263 -- (depth == 16 && regno > 63) ||
1264 -- (depth == 15 && regno > 31))
1265 -- return 1;
1266 --
1267 -- if (regno < 16) {
1268 -- switch (depth) {
1269 -- case 15:
1270 -- pal[regno] = (regno << 10) | (regno << 5) | regno;
1271 -- break;
1272 -- case 16:
1273 -- pal[regno] = (regno << 11) | (regno << 5) | regno;
1274 -- break;
1275 -- case 24:
1276 -- pal[regno] = (regno << 16) | (regno << 8) | regno;
1277 -- break;
1278 -- case 32:
1279 -- i = (regno << 8) | regno;
1280 -- pal[regno] = (i << 16) | i;
1281 -- break;
1282 -+
1283 -+ if (info->fix.visual == FB_VISUAL_TRUECOLOR) {
1284 -+ u32 *pal = info->pseudo_palette;
1285 -+ u32 cr = red >> (16 - info->var.red.length);
1286 -+ u32 cg = green >> (16 - info->var.green.length);
1287 -+ u32 cb = blue >> (16 - info->var.blue.length);
1288 -+ u32 value;
1289 -+
1290 -+ if (regno >= 16)
1291 -+ return -EINVAL;
1292 -+
1293 -+ value = (cr << info->var.red.offset) |
1294 -+ (cg << info->var.green.offset) |
1295 -+ (cb << info->var.blue.offset);
1296 -+ if (info->var.transp.length > 0) {
1297 -+ u32 mask = (1 << info->var.transp.length) - 1;
1298 -+ mask <<= info->var.transp.offset;
1299 -+ value |= mask;
1300 - }
1301 -+ pal[regno] = value;
1302 -+ return 0;
1303 - }
1304 -
1305 -+ if (regno > 255)
1306 -+ return -EINVAL;
1307 -+
1308 - red >>= 8;
1309 - green >>= 8;
1310 - blue >>= 8;
1311 -@@ -381,7 +377,7 @@ static void __init offb_init_fb(const char *name, const char *full_name,
1312 - int pitch, unsigned long address,
1313 - int foreign_endian, struct device_node *dp)
1314 - {
1315 -- unsigned long res_size = pitch * height * (depth + 7) / 8;
1316 -+ unsigned long res_size = pitch * height;
1317 - struct offb_par *par = &default_par;
1318 - unsigned long res_start = address;
1319 - struct fb_fix_screeninfo *fix;
1320 -diff --git a/fs/Kconfig b/fs/Kconfig
1321 -index 5f4c45d..6ad58a5 100644
1322 ---- a/fs/Kconfig
1323 -+++ b/fs/Kconfig
1324 -@@ -218,6 +218,8 @@ source "fs/exofs/Kconfig"
1325 -
1326 - endif # MISC_FILESYSTEMS
1327 -
1328 -+source "fs/exofs/Kconfig.ore"
1329 -+
1330 - menuconfig NETWORK_FILESYSTEMS
1331 - bool "Network File Systems"
1332 - default y
1333 -diff --git a/fs/exofs/Kconfig b/fs/exofs/Kconfig
1334 -index da42f32..86194b2 100644
1335 ---- a/fs/exofs/Kconfig
1336 -+++ b/fs/exofs/Kconfig
1337 -@@ -1,14 +1,3 @@
1338 --# Note ORE needs to "select ASYNC_XOR". So Not to force multiple selects
1339 --# for every ORE user we do it like this. Any user should add itself here
1340 --# at the "depends on EXOFS_FS || ..." with an ||. The dependencies are
1341 --# selected here, and we default to "ON". So in effect it is like been
1342 --# selected by any of the users.
1343 --config ORE
1344 -- tristate
1345 -- depends on EXOFS_FS || PNFS_OBJLAYOUT
1346 -- select ASYNC_XOR
1347 -- default SCSI_OSD_ULD
1348 --
1349 - config EXOFS_FS
1350 - tristate "exofs: OSD based file system support"
1351 - depends on SCSI_OSD_ULD
1352 -diff --git a/fs/exofs/Kconfig.ore b/fs/exofs/Kconfig.ore
1353 -new file mode 100644
1354 -index 0000000..1ca7fb7
1355 ---- /dev/null
1356 -+++ b/fs/exofs/Kconfig.ore
1357 -@@ -0,0 +1,12 @@
1358 -+# ORE - Objects Raid Engine (libore.ko)
1359 -+#
1360 -+# Note ORE needs to "select ASYNC_XOR". So Not to force multiple selects
1361 -+# for every ORE user we do it like this. Any user should add itself here
1362 -+# at the "depends on EXOFS_FS || ..." with an ||. The dependencies are
1363 -+# selected here, and we default to "ON". So in effect it is like been
1364 -+# selected by any of the users.
1365 -+config ORE
1366 -+ tristate
1367 -+ depends on EXOFS_FS || PNFS_OBJLAYOUT
1368 -+ select ASYNC_XOR
1369 -+ default SCSI_OSD_ULD
1370 -diff --git a/fs/exofs/ore.c b/fs/exofs/ore.c
1371 -index d271ad8..49cf230 100644
1372 ---- a/fs/exofs/ore.c
1373 -+++ b/fs/exofs/ore.c
1374 -@@ -266,7 +266,7 @@ int ore_get_rw_state(struct ore_layout *layout, struct ore_components *oc,
1375 -
1376 - /* first/last seg is split */
1377 - num_raid_units += layout->group_width;
1378 -- sgs_per_dev = div_u64(num_raid_units, data_devs);
1379 -+ sgs_per_dev = div_u64(num_raid_units, data_devs) + 2;
1380 - } else {
1381 - /* For Writes add parity pages array. */
1382 - max_par_pages = num_raid_units * pages_in_unit *
1383 -@@ -445,10 +445,10 @@ int ore_check_io(struct ore_io_state *ios, ore_on_dev_error on_dev_error)
1384 - u64 residual = ios->reading ?
1385 - or->in.residual : or->out.residual;
1386 - u64 offset = (ios->offset + ios->length) - residual;
1387 -- struct ore_dev *od = ios->oc->ods[
1388 -- per_dev->dev - ios->oc->first_dev];
1389 -+ unsigned dev = per_dev->dev - ios->oc->first_dev;
1390 -+ struct ore_dev *od = ios->oc->ods[dev];
1391 -
1392 -- on_dev_error(ios, od, per_dev->dev, osi.osd_err_pri,
1393 -+ on_dev_error(ios, od, dev, osi.osd_err_pri,
1394 - offset, residual);
1395 - }
1396 - if (osi.osd_err_pri >= acumulated_osd_err) {
1397 -diff --git a/fs/exofs/ore_raid.c b/fs/exofs/ore_raid.c
1398 -index 29c47e5..d222c77 100644
1399 ---- a/fs/exofs/ore_raid.c
1400 -+++ b/fs/exofs/ore_raid.c
1401 -@@ -328,8 +328,8 @@ static int _alloc_read_4_write(struct ore_io_state *ios)
1402 - /* @si contains info of the to-be-inserted page. Update of @si should be
1403 - * maintained by caller. Specificaly si->dev, si->obj_offset, ...
1404 - */
1405 --static int _add_to_read_4_write(struct ore_io_state *ios,
1406 -- struct ore_striping_info *si, struct page *page)
1407 -+static int _add_to_r4w(struct ore_io_state *ios, struct ore_striping_info *si,
1408 -+ struct page *page, unsigned pg_len)
1409 - {
1410 - struct request_queue *q;
1411 - struct ore_per_dev_state *per_dev;
1412 -@@ -366,17 +366,60 @@ static int _add_to_read_4_write(struct ore_io_state *ios,
1413 - _ore_add_sg_seg(per_dev, gap, true);
1414 - }
1415 - q = osd_request_queue(ore_comp_dev(read_ios->oc, per_dev->dev));
1416 -- added_len = bio_add_pc_page(q, per_dev->bio, page, PAGE_SIZE, 0);
1417 -- if (unlikely(added_len != PAGE_SIZE)) {
1418 -+ added_len = bio_add_pc_page(q, per_dev->bio, page, pg_len,
1419 -+ si->obj_offset % PAGE_SIZE);
1420 -+ if (unlikely(added_len != pg_len)) {
1421 - ORE_DBGMSG("Failed to bio_add_pc_page bi_vcnt=%d\n",
1422 - per_dev->bio->bi_vcnt);
1423 - return -ENOMEM;
1424 - }
1425 -
1426 -- per_dev->length += PAGE_SIZE;
1427 -+ per_dev->length += pg_len;
1428 - return 0;
1429 - }
1430 -
1431 -+/* read the beginning of an unaligned first page */
1432 -+static int _add_to_r4w_first_page(struct ore_io_state *ios, struct page *page)
1433 -+{
1434 -+ struct ore_striping_info si;
1435 -+ unsigned pg_len;
1436 -+
1437 -+ ore_calc_stripe_info(ios->layout, ios->offset, 0, &si);
1438 -+
1439 -+ pg_len = si.obj_offset % PAGE_SIZE;
1440 -+ si.obj_offset -= pg_len;
1441 -+
1442 -+ ORE_DBGMSG("offset=0x%llx len=0x%x index=0x%lx dev=%x\n",
1443 -+ _LLU(si.obj_offset), pg_len, page->index, si.dev);
1444 -+
1445 -+ return _add_to_r4w(ios, &si, page, pg_len);
1446 -+}
1447 -+
1448 -+/* read the end of an incomplete last page */
1449 -+static int _add_to_r4w_last_page(struct ore_io_state *ios, u64 *offset)
1450 -+{
1451 -+ struct ore_striping_info si;
1452 -+ struct page *page;
1453 -+ unsigned pg_len, p, c;
1454 -+
1455 -+ ore_calc_stripe_info(ios->layout, *offset, 0, &si);
1456 -+
1457 -+ p = si.unit_off / PAGE_SIZE;
1458 -+ c = _dev_order(ios->layout->group_width * ios->layout->mirrors_p1,
1459 -+ ios->layout->mirrors_p1, si.par_dev, si.dev);
1460 -+ page = ios->sp2d->_1p_stripes[p].pages[c];
1461 -+
1462 -+ pg_len = PAGE_SIZE - (si.unit_off % PAGE_SIZE);
1463 -+ *offset += pg_len;
1464 -+
1465 -+ ORE_DBGMSG("p=%d, c=%d next-offset=0x%llx len=0x%x dev=%x par_dev=%d\n",
1466 -+ p, c, _LLU(*offset), pg_len, si.dev, si.par_dev);
1467 -+
1468 -+ BUG_ON(!page);
1469 -+
1470 -+ return _add_to_r4w(ios, &si, page, pg_len);
1471 -+}
1472 -+
1473 - static void _mark_read4write_pages_uptodate(struct ore_io_state *ios, int ret)
1474 - {
1475 - struct bio_vec *bv;
1476 -@@ -444,9 +487,13 @@ static int _read_4_write(struct ore_io_state *ios)
1477 - struct page **pp = &_1ps->pages[c];
1478 - bool uptodate;
1479 -
1480 -- if (*pp)
1481 -+ if (*pp) {
1482 -+ if (ios->offset % PAGE_SIZE)
1483 -+ /* Read the remainder of the page */
1484 -+ _add_to_r4w_first_page(ios, *pp);
1485 - /* to-be-written pages start here */
1486 - goto read_last_stripe;
1487 -+ }
1488 -
1489 - *pp = ios->r4w->get_page(ios->private, offset,
1490 - &uptodate);
1491 -@@ -454,7 +501,7 @@ static int _read_4_write(struct ore_io_state *ios)
1492 - return -ENOMEM;
1493 -
1494 - if (!uptodate)
1495 -- _add_to_read_4_write(ios, &read_si, *pp);
1496 -+ _add_to_r4w(ios, &read_si, *pp, PAGE_SIZE);
1497 -
1498 - /* Mark read-pages to be cache_released */
1499 - _1ps->page_is_read[c] = true;
1500 -@@ -465,8 +512,11 @@ static int _read_4_write(struct ore_io_state *ios)
1501 - }
1502 -
1503 - read_last_stripe:
1504 -- offset = ios->offset + (ios->length + PAGE_SIZE - 1) /
1505 -- PAGE_SIZE * PAGE_SIZE;
1506 -+ offset = ios->offset + ios->length;
1507 -+ if (offset % PAGE_SIZE)
1508 -+ _add_to_r4w_last_page(ios, &offset);
1509 -+ /* offset will be aligned to next page */
1510 -+
1511 - last_stripe_end = div_u64(offset + bytes_in_stripe - 1, bytes_in_stripe)
1512 - * bytes_in_stripe;
1513 - if (offset == last_stripe_end) /* Optimize for the aligned case */
1514 -@@ -503,7 +553,7 @@ read_last_stripe:
1515 - /* Mark read-pages to be cache_released */
1516 - _1ps->page_is_read[c] = true;
1517 - if (!uptodate)
1518 -- _add_to_read_4_write(ios, &read_si, page);
1519 -+ _add_to_r4w(ios, &read_si, page, PAGE_SIZE);
1520 - }
1521 -
1522 - offset += PAGE_SIZE;
1523 -@@ -551,7 +601,11 @@ int _ore_add_parity_unit(struct ore_io_state *ios,
1524 - unsigned cur_len)
1525 - {
1526 - if (ios->reading) {
1527 -- BUG_ON(per_dev->cur_sg >= ios->sgs_per_dev);
1528 -+ if (per_dev->cur_sg >= ios->sgs_per_dev) {
1529 -+ ORE_DBGMSG("cur_sg(%d) >= sgs_per_dev(%d)\n" ,
1530 -+ per_dev->cur_sg, ios->sgs_per_dev);
1531 -+ return -ENOMEM;
1532 -+ }
1533 - _ore_add_sg_seg(per_dev, cur_len, true);
1534 - } else {
1535 - struct __stripe_pages_2d *sp2d = ios->sp2d;
1536 -@@ -612,8 +666,6 @@ int _ore_post_alloc_raid_stuff(struct ore_io_state *ios)
1537 - return -ENOMEM;
1538 - }
1539 -
1540 -- BUG_ON(ios->offset % PAGE_SIZE);
1541 --
1542 - /* Round io down to last full strip */
1543 - first_stripe = div_u64(ios->offset, stripe_size);
1544 - last_stripe = div_u64(ios->offset + ios->length, stripe_size);
1545 -diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
1546 -index 85fe655..5b3f907 100644
1547 ---- a/fs/ext3/inode.c
1548 -+++ b/fs/ext3/inode.c
1549 -@@ -1617,7 +1617,13 @@ static int ext3_ordered_writepage(struct page *page,
1550 - int err;
1551 -
1552 - J_ASSERT(PageLocked(page));
1553 -- WARN_ON_ONCE(IS_RDONLY(inode));
1554 -+ /*
1555 -+ * We don't want to warn for emergency remount. The condition is
1556 -+ * ordered to avoid dereferencing inode->i_sb in non-error case to
1557 -+ * avoid slow-downs.
1558 -+ */
1559 -+ WARN_ON_ONCE(IS_RDONLY(inode) &&
1560 -+ !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS));
1561 -
1562 - /*
1563 - * We give up here if we're reentered, because it might be for a
1564 -@@ -1692,7 +1698,13 @@ static int ext3_writeback_writepage(struct page *page,
1565 - int err;
1566 -
1567 - J_ASSERT(PageLocked(page));
1568 -- WARN_ON_ONCE(IS_RDONLY(inode));
1569 -+ /*
1570 -+ * We don't want to warn for emergency remount. The condition is
1571 -+ * ordered to avoid dereferencing inode->i_sb in non-error case to
1572 -+ * avoid slow-downs.
1573 -+ */
1574 -+ WARN_ON_ONCE(IS_RDONLY(inode) &&
1575 -+ !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS));
1576 -
1577 - if (ext3_journal_current_handle())
1578 - goto out_fail;
1579 -@@ -1735,7 +1747,13 @@ static int ext3_journalled_writepage(struct page *page,
1580 - int err;
1581 -
1582 - J_ASSERT(PageLocked(page));
1583 -- WARN_ON_ONCE(IS_RDONLY(inode));
1584 -+ /*
1585 -+ * We don't want to warn for emergency remount. The condition is
1586 -+ * ordered to avoid dereferencing inode->i_sb in non-error case to
1587 -+ * avoid slow-downs.
1588 -+ */
1589 -+ WARN_ON_ONCE(IS_RDONLY(inode) &&
1590 -+ !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS));
1591 -
1592 - if (ext3_journal_current_handle())
1593 - goto no_write;
1594 -diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
1595 -index 14363b9..5e3527b 100644
1596 ---- a/fs/reiserfs/super.c
1597 -+++ b/fs/reiserfs/super.c
1598 -@@ -453,16 +453,20 @@ int remove_save_link(struct inode *inode, int truncate)
1599 - static void reiserfs_kill_sb(struct super_block *s)
1600 - {
1601 - if (REISERFS_SB(s)) {
1602 -- if (REISERFS_SB(s)->xattr_root) {
1603 -- d_invalidate(REISERFS_SB(s)->xattr_root);
1604 -- dput(REISERFS_SB(s)->xattr_root);
1605 -- REISERFS_SB(s)->xattr_root = NULL;
1606 -- }
1607 -- if (REISERFS_SB(s)->priv_root) {
1608 -- d_invalidate(REISERFS_SB(s)->priv_root);
1609 -- dput(REISERFS_SB(s)->priv_root);
1610 -- REISERFS_SB(s)->priv_root = NULL;
1611 -- }
1612 -+ /*
1613 -+ * Force any pending inode evictions to occur now. Any
1614 -+ * inodes to be removed that have extended attributes
1615 -+ * associated with them need to clean them up before
1616 -+ * we can release the extended attribute root dentries.
1617 -+ * shrink_dcache_for_umount will BUG if we don't release
1618 -+ * those before it's called so ->put_super is too late.
1619 -+ */
1620 -+ shrink_dcache_sb(s);
1621 -+
1622 -+ dput(REISERFS_SB(s)->xattr_root);
1623 -+ REISERFS_SB(s)->xattr_root = NULL;
1624 -+ dput(REISERFS_SB(s)->priv_root);
1625 -+ REISERFS_SB(s)->priv_root = NULL;
1626 - }
1627 -
1628 - kill_block_super(s);
1629 -@@ -1164,7 +1168,8 @@ static void handle_quota_files(struct super_block *s, char **qf_names,
1630 - kfree(REISERFS_SB(s)->s_qf_names[i]);
1631 - REISERFS_SB(s)->s_qf_names[i] = qf_names[i];
1632 - }
1633 -- REISERFS_SB(s)->s_jquota_fmt = *qfmt;
1634 -+ if (*qfmt)
1635 -+ REISERFS_SB(s)->s_jquota_fmt = *qfmt;
1636 - }
1637 - #endif
1638 -
1639 -diff --git a/fs/udf/file.c b/fs/udf/file.c
1640 -index d8ffa7c..dca0c38 100644
1641 ---- a/fs/udf/file.c
1642 -+++ b/fs/udf/file.c
1643 -@@ -125,7 +125,6 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
1644 - err = udf_expand_file_adinicb(inode);
1645 - if (err) {
1646 - udf_debug("udf_expand_adinicb: err=%d\n", err);
1647 -- up_write(&iinfo->i_data_sem);
1648 - return err;
1649 - }
1650 - } else {
1651 -@@ -133,9 +132,10 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
1652 - iinfo->i_lenAlloc = pos + count;
1653 - else
1654 - iinfo->i_lenAlloc = inode->i_size;
1655 -+ up_write(&iinfo->i_data_sem);
1656 - }
1657 -- }
1658 -- up_write(&iinfo->i_data_sem);
1659 -+ } else
1660 -+ up_write(&iinfo->i_data_sem);
1661 -
1662 - retval = generic_file_aio_write(iocb, iov, nr_segs, ppos);
1663 - if (retval > 0)
1664 -diff --git a/fs/udf/inode.c b/fs/udf/inode.c
1665 -index 4fd1d80..e2787d0 100644
1666 ---- a/fs/udf/inode.c
1667 -+++ b/fs/udf/inode.c
1668 -@@ -151,6 +151,12 @@ const struct address_space_operations udf_aops = {
1669 - .bmap = udf_bmap,
1670 - };
1671 -
1672 -+/*
1673 -+ * Expand file stored in ICB to a normal one-block-file
1674 -+ *
1675 -+ * This function requires i_data_sem for writing and releases it.
1676 -+ * This function requires i_mutex held
1677 -+ */
1678 - int udf_expand_file_adinicb(struct inode *inode)
1679 - {
1680 - struct page *page;
1681 -@@ -169,9 +175,15 @@ int udf_expand_file_adinicb(struct inode *inode)
1682 - iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG;
1683 - /* from now on we have normal address_space methods */
1684 - inode->i_data.a_ops = &udf_aops;
1685 -+ up_write(&iinfo->i_data_sem);
1686 - mark_inode_dirty(inode);
1687 - return 0;
1688 - }
1689 -+ /*
1690 -+ * Release i_data_sem so that we can lock a page - page lock ranks
1691 -+ * above i_data_sem. i_mutex still protects us against file changes.
1692 -+ */
1693 -+ up_write(&iinfo->i_data_sem);
1694 -
1695 - page = find_or_create_page(inode->i_mapping, 0, GFP_NOFS);
1696 - if (!page)
1697 -@@ -187,6 +199,7 @@ int udf_expand_file_adinicb(struct inode *inode)
1698 - SetPageUptodate(page);
1699 - kunmap(page);
1700 - }
1701 -+ down_write(&iinfo->i_data_sem);
1702 - memset(iinfo->i_ext.i_data + iinfo->i_lenEAttr, 0x00,
1703 - iinfo->i_lenAlloc);
1704 - iinfo->i_lenAlloc = 0;
1705 -@@ -196,17 +209,20 @@ int udf_expand_file_adinicb(struct inode *inode)
1706 - iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG;
1707 - /* from now on we have normal address_space methods */
1708 - inode->i_data.a_ops = &udf_aops;
1709 -+ up_write(&iinfo->i_data_sem);
1710 - err = inode->i_data.a_ops->writepage(page, &udf_wbc);
1711 - if (err) {
1712 - /* Restore everything back so that we don't lose data... */
1713 - lock_page(page);
1714 - kaddr = kmap(page);
1715 -+ down_write(&iinfo->i_data_sem);
1716 - memcpy(iinfo->i_ext.i_data + iinfo->i_lenEAttr, kaddr,
1717 - inode->i_size);
1718 - kunmap(page);
1719 - unlock_page(page);
1720 - iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB;
1721 - inode->i_data.a_ops = &udf_adinicb_aops;
1722 -+ up_write(&iinfo->i_data_sem);
1723 - }
1724 - page_cache_release(page);
1725 - mark_inode_dirty(inode);
1726 -@@ -1111,10 +1127,9 @@ int udf_setsize(struct inode *inode, loff_t newsize)
1727 - if (bsize <
1728 - (udf_file_entry_alloc_offset(inode) + newsize)) {
1729 - err = udf_expand_file_adinicb(inode);
1730 -- if (err) {
1731 -- up_write(&iinfo->i_data_sem);
1732 -+ if (err)
1733 - return err;
1734 -- }
1735 -+ down_write(&iinfo->i_data_sem);
1736 - } else
1737 - iinfo->i_lenAlloc = newsize;
1738 - }
1739 -diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
1740 -index 76e4266..ac702a6 100644
1741 ---- a/fs/xfs/xfs_acl.c
1742 -+++ b/fs/xfs/xfs_acl.c
1743 -@@ -39,7 +39,7 @@ xfs_acl_from_disk(struct xfs_acl *aclp)
1744 - struct posix_acl_entry *acl_e;
1745 - struct posix_acl *acl;
1746 - struct xfs_acl_entry *ace;
1747 -- int count, i;
1748 -+ unsigned int count, i;
1749 -
1750 - count = be32_to_cpu(aclp->acl_cnt);
1751 - if (count > XFS_ACL_MAX_ENTRIES)
1752 -diff --git a/include/linux/usb.h b/include/linux/usb.h
1753 -index d3d0c13..7503352 100644
1754 ---- a/include/linux/usb.h
1755 -+++ b/include/linux/usb.h
1756 -@@ -1221,6 +1221,7 @@ struct urb {
1757 - void *transfer_buffer; /* (in) associated data buffer */
1758 - dma_addr_t transfer_dma; /* (in) dma addr for transfer_buffer */
1759 - struct scatterlist *sg; /* (in) scatter gather buffer list */
1760 -+ int num_mapped_sgs; /* (internal) mapped sg entries */
1761 - int num_sgs; /* (in) number of entries in the sg list */
1762 - u32 transfer_buffer_length; /* (in) data buffer length */
1763 - u32 actual_length; /* (return) actual transfer length */
1764 -diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
1765 -index d5da6c6..61b2905 100644
1766 ---- a/include/linux/usb/ch9.h
1767 -+++ b/include/linux/usb/ch9.h
1768 -@@ -605,8 +605,26 @@ struct usb_ss_ep_comp_descriptor {
1769 - } __attribute__ ((packed));
1770 -
1771 - #define USB_DT_SS_EP_COMP_SIZE 6
1772 -+
1773 - /* Bits 4:0 of bmAttributes if this is a bulk endpoint */
1774 --#define USB_SS_MAX_STREAMS(p) (1 << ((p) & 0x1f))
1775 -+static inline int
1776 -+usb_ss_max_streams(const struct usb_ss_ep_comp_descriptor *comp)
1777 -+{
1778 -+ int max_streams;
1779 -+
1780 -+ if (!comp)
1781 -+ return 0;
1782 -+
1783 -+ max_streams = comp->bmAttributes & 0x1f;
1784 -+
1785 -+ if (!max_streams)
1786 -+ return 0;
1787 -+
1788 -+ max_streams = 1 << max_streams;
1789 -+
1790 -+ return max_streams;
1791 -+}
1792 -+
1793 - /* Bits 1:0 of bmAttributes if this is an isoc endpoint */
1794 - #define USB_SS_MULT(p) (1 + ((p) & 0x3))
1795 -
1796 -diff --git a/kernel/cgroup.c b/kernel/cgroup.c
1797 -index a184470..cdc0354 100644
1798 ---- a/kernel/cgroup.c
1799 -+++ b/kernel/cgroup.c
1800 -@@ -1175,10 +1175,10 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
1801 -
1802 - /*
1803 - * If the 'all' option was specified select all the subsystems,
1804 -- * otherwise 'all, 'none' and a subsystem name options were not
1805 -- * specified, let's default to 'all'
1806 -+ * otherwise if 'none', 'name=' and a subsystem name options
1807 -+ * were not specified, let's default to 'all'
1808 - */
1809 -- if (all_ss || (!all_ss && !one_ss && !opts->none)) {
1810 -+ if (all_ss || (!one_ss && !opts->none && !opts->name)) {
1811 - for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
1812 - struct cgroup_subsys *ss = subsys[i];
1813 - if (ss == NULL)
1814 -diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
1815 -index b2ca095..c3cc64c 100644
1816 ---- a/net/ipv4/igmp.c
1817 -+++ b/net/ipv4/igmp.c
1818 -@@ -875,6 +875,8 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb,
1819 - * to be intended in a v3 query.
1820 - */
1821 - max_delay = IGMPV3_MRC(ih3->code)*(HZ/IGMP_TIMER_SCALE);
1822 -+ if (!max_delay)
1823 -+ max_delay = 1; /* can't mod w/ 0 */
1824 - } else { /* v3 */
1825 - if (!pskb_may_pull(skb, sizeof(struct igmpv3_query)))
1826 - return;
1827 -diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
1828 -index 6c164dc..bf54c48 100644
1829 ---- a/tools/perf/util/trace-event-parse.c
1830 -+++ b/tools/perf/util/trace-event-parse.c
1831 -@@ -1582,6 +1582,8 @@ process_symbols(struct event *event, struct print_arg *arg, char **tok)
1832 - field = malloc_or_die(sizeof(*field));
1833 -
1834 - type = process_arg(event, field, &token);
1835 -+ while (type == EVENT_OP)
1836 -+ type = process_op(event, field, &token);
1837 - if (test_type_token(type, token, EVENT_DELIM, ","))
1838 - goto out_free;
1839 -
1840
1841 Deleted: genpatches-2.6/trunk/3.3/1001_linux-3.2.2.patch
1842 ===================================================================
1843 --- genpatches-2.6/trunk/3.3/1001_linux-3.2.2.patch 2012-02-07 13:46:33 UTC (rev 2082)
1844 +++ genpatches-2.6/trunk/3.3/1001_linux-3.2.2.patch 2012-02-07 13:47:50 UTC (rev 2083)
1845 @@ -1,6552 +0,0 @@
1846 -diff --git a/Makefile b/Makefile
1847 -index c5edffa..2f684da 100644
1848 ---- a/Makefile
1849 -+++ b/Makefile
1850 -@@ -1,6 +1,6 @@
1851 - VERSION = 3
1852 - PATCHLEVEL = 2
1853 --SUBLEVEL = 1
1854 -+SUBLEVEL = 2
1855 - EXTRAVERSION =
1856 - NAME = Saber-toothed Squirrel
1857 -
1858 -diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
1859 -index bfb4d01..5207035 100644
1860 ---- a/arch/ia64/kernel/acpi.c
1861 -+++ b/arch/ia64/kernel/acpi.c
1862 -@@ -429,22 +429,24 @@ static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
1863 - static struct acpi_table_slit __initdata *slit_table;
1864 - cpumask_t early_cpu_possible_map = CPU_MASK_NONE;
1865 -
1866 --static int get_processor_proximity_domain(struct acpi_srat_cpu_affinity *pa)
1867 -+static int __init
1868 -+get_processor_proximity_domain(struct acpi_srat_cpu_affinity *pa)
1869 - {
1870 - int pxm;
1871 -
1872 - pxm = pa->proximity_domain_lo;
1873 -- if (ia64_platform_is("sn2"))
1874 -+ if (ia64_platform_is("sn2") || acpi_srat_revision >= 2)
1875 - pxm += pa->proximity_domain_hi[0] << 8;
1876 - return pxm;
1877 - }
1878 -
1879 --static int get_memory_proximity_domain(struct acpi_srat_mem_affinity *ma)
1880 -+static int __init
1881 -+get_memory_proximity_domain(struct acpi_srat_mem_affinity *ma)
1882 - {
1883 - int pxm;
1884 -
1885 - pxm = ma->proximity_domain;
1886 -- if (!ia64_platform_is("sn2"))
1887 -+ if (!ia64_platform_is("sn2") && acpi_srat_revision <= 1)
1888 - pxm &= 0xff;
1889 -
1890 - return pxm;
1891 -diff --git a/arch/score/kernel/entry.S b/arch/score/kernel/entry.S
1892 -index 577abba..83bb960 100644
1893 ---- a/arch/score/kernel/entry.S
1894 -+++ b/arch/score/kernel/entry.S
1895 -@@ -408,7 +408,7 @@ ENTRY(handle_sys)
1896 - sw r9, [r0, PT_EPC]
1897 -
1898 - cmpi.c r27, __NR_syscalls # check syscall number
1899 -- bgtu illegal_syscall
1900 -+ bgeu illegal_syscall
1901 -
1902 - slli r8, r27, 2 # get syscall routine
1903 - la r11, sys_call_table
1904 -diff --git a/arch/x86/include/asm/amd_nb.h b/arch/x86/include/asm/amd_nb.h
1905 -index 8e41071..49ad773 100644
1906 ---- a/arch/x86/include/asm/amd_nb.h
1907 -+++ b/arch/x86/include/asm/amd_nb.h
1908 -@@ -1,6 +1,7 @@
1909 - #ifndef _ASM_X86_AMD_NB_H
1910 - #define _ASM_X86_AMD_NB_H
1911 -
1912 -+#include <linux/ioport.h>
1913 - #include <linux/pci.h>
1914 -
1915 - struct amd_nb_bus_dev_range {
1916 -@@ -13,6 +14,7 @@ extern const struct pci_device_id amd_nb_misc_ids[];
1917 - extern const struct amd_nb_bus_dev_range amd_nb_bus_dev_ranges[];
1918 -
1919 - extern bool early_is_amd_nb(u32 value);
1920 -+extern struct resource *amd_get_mmconfig_range(struct resource *res);
1921 - extern int amd_cache_northbridges(void);
1922 - extern void amd_flush_garts(void);
1923 - extern int amd_numa_init(void);
1924 -diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h
1925 -index 8e862aa..1b82f7e 100644
1926 ---- a/arch/x86/include/asm/uv/uv_bau.h
1927 -+++ b/arch/x86/include/asm/uv/uv_bau.h
1928 -@@ -65,7 +65,7 @@
1929 - * UV2: Bit 19 selects between
1930 - * (0): 10 microsecond timebase and
1931 - * (1): 80 microseconds
1932 -- * we're using 655us, similar to UV1: 65 units of 10us
1933 -+ * we're using 560us, similar to UV1: 65 units of 10us
1934 - */
1935 - #define UV1_INTD_SOFT_ACK_TIMEOUT_PERIOD (9UL)
1936 - #define UV2_INTD_SOFT_ACK_TIMEOUT_PERIOD (15UL)
1937 -@@ -167,6 +167,7 @@
1938 - #define FLUSH_RETRY_TIMEOUT 2
1939 - #define FLUSH_GIVEUP 3
1940 - #define FLUSH_COMPLETE 4
1941 -+#define FLUSH_RETRY_BUSYBUG 5
1942 -
1943 - /*
1944 - * tuning the action when the numalink network is extremely delayed
1945 -@@ -235,10 +236,10 @@ struct bau_msg_payload {
1946 -
1947 -
1948 - /*
1949 -- * Message header: 16 bytes (128 bits) (bytes 0x30-0x3f of descriptor)
1950 -+ * UV1 Message header: 16 bytes (128 bits) (bytes 0x30-0x3f of descriptor)
1951 - * see table 4.2.3.0.1 in broacast_assist spec.
1952 - */
1953 --struct bau_msg_header {
1954 -+struct uv1_bau_msg_header {
1955 - unsigned int dest_subnodeid:6; /* must be 0x10, for the LB */
1956 - /* bits 5:0 */
1957 - unsigned int base_dest_nasid:15; /* nasid of the first bit */
1958 -@@ -318,19 +319,87 @@ struct bau_msg_header {
1959 - };
1960 -
1961 - /*
1962 -+ * UV2 Message header: 16 bytes (128 bits) (bytes 0x30-0x3f of descriptor)
1963 -+ * see figure 9-2 of harp_sys.pdf
1964 -+ */
1965 -+struct uv2_bau_msg_header {
1966 -+ unsigned int base_dest_nasid:15; /* nasid of the first bit */
1967 -+ /* bits 14:0 */ /* in uvhub map */
1968 -+ unsigned int dest_subnodeid:5; /* must be 0x10, for the LB */
1969 -+ /* bits 19:15 */
1970 -+ unsigned int rsvd_1:1; /* must be zero */
1971 -+ /* bit 20 */
1972 -+ /* Address bits 59:21 */
1973 -+ /* bits 25:2 of address (44:21) are payload */
1974 -+ /* these next 24 bits become bytes 12-14 of msg */
1975 -+ /* bits 28:21 land in byte 12 */
1976 -+ unsigned int replied_to:1; /* sent as 0 by the source to
1977 -+ byte 12 */
1978 -+ /* bit 21 */
1979 -+ unsigned int msg_type:3; /* software type of the
1980 -+ message */
1981 -+ /* bits 24:22 */
1982 -+ unsigned int canceled:1; /* message canceled, resource
1983 -+ is to be freed*/
1984 -+ /* bit 25 */
1985 -+ unsigned int payload_1:3; /* not currently used */
1986 -+ /* bits 28:26 */
1987 -+
1988 -+ /* bits 36:29 land in byte 13 */
1989 -+ unsigned int payload_2a:3; /* not currently used */
1990 -+ unsigned int payload_2b:5; /* not currently used */
1991 -+ /* bits 36:29 */
1992 -+
1993 -+ /* bits 44:37 land in byte 14 */
1994 -+ unsigned int payload_3:8; /* not currently used */
1995 -+ /* bits 44:37 */
1996 -+
1997 -+ unsigned int rsvd_2:7; /* reserved */
1998 -+ /* bits 51:45 */
1999 -+ unsigned int swack_flag:1; /* software acknowledge flag */
2000 -+ /* bit 52 */
2001 -+ unsigned int rsvd_3a:3; /* must be zero */
2002 -+ unsigned int rsvd_3b:8; /* must be zero */
2003 -+ unsigned int rsvd_3c:8; /* must be zero */
2004 -+ unsigned int rsvd_3d:3; /* must be zero */
2005 -+ /* bits 74:53 */
2006 -+ unsigned int fairness:3; /* usually zero */
2007 -+ /* bits 77:75 */
2008 -+
2009 -+ unsigned int sequence:16; /* message sequence number */
2010 -+ /* bits 93:78 Suppl_A */
2011 -+ unsigned int chaining:1; /* next descriptor is part of
2012 -+ this activation*/
2013 -+ /* bit 94 */
2014 -+ unsigned int multilevel:1; /* multi-level multicast
2015 -+ format */
2016 -+ /* bit 95 */
2017 -+ unsigned int rsvd_4:24; /* ordered / source node /
2018 -+ source subnode / aging
2019 -+ must be zero */
2020 -+ /* bits 119:96 */
2021 -+ unsigned int command:8; /* message type */
2022 -+ /* bits 127:120 */
2023 -+};
2024 -+
2025 -+/*
2026 - * The activation descriptor:
2027 - * The format of the message to send, plus all accompanying control
2028 - * Should be 64 bytes
2029 - */
2030 - struct bau_desc {
2031 -- struct pnmask distribution;
2032 -+ struct pnmask distribution;
2033 - /*
2034 - * message template, consisting of header and payload:
2035 - */
2036 -- struct bau_msg_header header;
2037 -- struct bau_msg_payload payload;
2038 -+ union bau_msg_header {
2039 -+ struct uv1_bau_msg_header uv1_hdr;
2040 -+ struct uv2_bau_msg_header uv2_hdr;
2041 -+ } header;
2042 -+
2043 -+ struct bau_msg_payload payload;
2044 - };
2045 --/*
2046 -+/* UV1:
2047 - * -payload-- ---------header------
2048 - * bytes 0-11 bits 41-56 bits 58-81
2049 - * A B (2) C (3)
2050 -@@ -340,6 +409,16 @@ struct bau_desc {
2051 - * bytes 0-11 bytes 12-14 bytes 16-17 (byte 15 filled in by hw as vector)
2052 - * ------------payload queue-----------
2053 - */
2054 -+/* UV2:
2055 -+ * -payload-- ---------header------
2056 -+ * bytes 0-11 bits 70-78 bits 21-44
2057 -+ * A B (2) C (3)
2058 -+ *
2059 -+ * A/B/C are moved to:
2060 -+ * A C B
2061 -+ * bytes 0-11 bytes 12-14 bytes 16-17 (byte 15 filled in by hw as vector)
2062 -+ * ------------payload queue-----------
2063 -+ */
2064 -
2065 - /*
2066 - * The payload queue on the destination side is an array of these.
2067 -@@ -385,7 +464,6 @@ struct bau_pq_entry {
2068 - struct msg_desc {
2069 - struct bau_pq_entry *msg;
2070 - int msg_slot;
2071 -- int swack_slot;
2072 - struct bau_pq_entry *queue_first;
2073 - struct bau_pq_entry *queue_last;
2074 - };
2075 -@@ -439,6 +517,9 @@ struct ptc_stats {
2076 - unsigned long s_retry_messages; /* retry broadcasts */
2077 - unsigned long s_bau_reenabled; /* for bau enable/disable */
2078 - unsigned long s_bau_disabled; /* for bau enable/disable */
2079 -+ unsigned long s_uv2_wars; /* uv2 workaround, perm. busy */
2080 -+ unsigned long s_uv2_wars_hw; /* uv2 workaround, hiwater */
2081 -+ unsigned long s_uv2_war_waits; /* uv2 workaround, long waits */
2082 - /* destination statistics */
2083 - unsigned long d_alltlb; /* times all tlb's on this
2084 - cpu were flushed */
2085 -@@ -511,9 +592,12 @@ struct bau_control {
2086 - short osnode;
2087 - short uvhub_cpu;
2088 - short uvhub;
2089 -+ short uvhub_version;
2090 - short cpus_in_socket;
2091 - short cpus_in_uvhub;
2092 - short partition_base_pnode;
2093 -+ short using_desc; /* an index, like uvhub_cpu */
2094 -+ unsigned int inuse_map;
2095 - unsigned short message_number;
2096 - unsigned short uvhub_quiesce;
2097 - short socket_acknowledge_count[DEST_Q_SIZE];
2098 -@@ -531,6 +615,7 @@ struct bau_control {
2099 - int cong_response_us;
2100 - int cong_reps;
2101 - int cong_period;
2102 -+ unsigned long clocks_per_100_usec;
2103 - cycles_t period_time;
2104 - long period_requests;
2105 - struct hub_and_pnode *thp;
2106 -@@ -591,6 +676,11 @@ static inline void write_mmr_sw_ack(unsigned long mr)
2107 - uv_write_local_mmr(UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS, mr);
2108 - }
2109 -
2110 -+static inline void write_gmmr_sw_ack(int pnode, unsigned long mr)
2111 -+{
2112 -+ write_gmmr(pnode, UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE_ALIAS, mr);
2113 -+}
2114 -+
2115 - static inline unsigned long read_mmr_sw_ack(void)
2116 - {
2117 - return read_lmmr(UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE);
2118 -diff --git a/arch/x86/kernel/amd_nb.c b/arch/x86/kernel/amd_nb.c
2119 -index 4c39baa..bae1efe 100644
2120 ---- a/arch/x86/kernel/amd_nb.c
2121 -+++ b/arch/x86/kernel/amd_nb.c
2122 -@@ -119,6 +119,37 @@ bool __init early_is_amd_nb(u32 device)
2123 - return false;
2124 - }
2125 -
2126 -+struct resource *amd_get_mmconfig_range(struct resource *res)
2127 -+{
2128 -+ u32 address;
2129 -+ u64 base, msr;
2130 -+ unsigned segn_busn_bits;
2131 -+
2132 -+ if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
2133 -+ return NULL;
2134 -+
2135 -+ /* assume all cpus from fam10h have mmconfig */
2136 -+ if (boot_cpu_data.x86 < 0x10)
2137 -+ return NULL;
2138 -+
2139 -+ address = MSR_FAM10H_MMIO_CONF_BASE;
2140 -+ rdmsrl(address, msr);
2141 -+
2142 -+ /* mmconfig is not enabled */
2143 -+ if (!(msr & FAM10H_MMIO_CONF_ENABLE))
2144 -+ return NULL;
2145 -+
2146 -+ base = msr & (FAM10H_MMIO_CONF_BASE_MASK<<FAM10H_MMIO_CONF_BASE_SHIFT);
2147 -+
2148 -+ segn_busn_bits = (msr >> FAM10H_MMIO_CONF_BUSRANGE_SHIFT) &
2149 -+ FAM10H_MMIO_CONF_BUSRANGE_MASK;
2150 -+
2151 -+ res->flags = IORESOURCE_MEM;
2152 -+ res->start = base;
2153 -+ res->end = base + (1ULL<<(segn_busn_bits + 20)) - 1;
2154 -+ return res;
2155 -+}
2156 -+
2157 - int amd_get_subcaches(int cpu)
2158 - {
2159 - struct pci_dev *link = node_to_amd_nb(amd_get_nb_id(cpu))->link;
2160 -diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
2161 -index 9d59bba..79b05b8 100644
2162 ---- a/arch/x86/kernel/apic/x2apic_uv_x.c
2163 -+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
2164 -@@ -769,7 +769,12 @@ void __init uv_system_init(void)
2165 - for(i = 0; i < UVH_NODE_PRESENT_TABLE_DEPTH; i++)
2166 - uv_possible_blades +=
2167 - hweight64(uv_read_local_mmr( UVH_NODE_PRESENT_TABLE + i * 8));
2168 -- printk(KERN_DEBUG "UV: Found %d blades\n", uv_num_possible_blades());
2169 -+
2170 -+ /* uv_num_possible_blades() is really the hub count */
2171 -+ printk(KERN_INFO "UV: Found %d blades, %d hubs\n",
2172 -+ is_uv1_hub() ? uv_num_possible_blades() :
2173 -+ (uv_num_possible_blades() + 1) / 2,
2174 -+ uv_num_possible_blades());
2175 -
2176 - bytes = sizeof(struct uv_blade_info) * uv_num_possible_blades();
2177 - uv_blade_info = kzalloc(bytes, GFP_KERNEL);
2178 -diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
2179 -index 4b5ba85..845df68 100644
2180 ---- a/arch/x86/mm/mmap.c
2181 -+++ b/arch/x86/mm/mmap.c
2182 -@@ -75,9 +75,9 @@ static unsigned long mmap_rnd(void)
2183 - */
2184 - if (current->flags & PF_RANDOMIZE) {
2185 - if (mmap_is_ia32())
2186 -- rnd = (long)get_random_int() % (1<<8);
2187 -+ rnd = get_random_int() % (1<<8);
2188 - else
2189 -- rnd = (long)(get_random_int() % (1<<28));
2190 -+ rnd = get_random_int() % (1<<28);
2191 - }
2192 - return rnd << PAGE_SHIFT;
2193 - }
2194 -diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c
2195 -index 81dbfde..7efd0c6 100644
2196 ---- a/arch/x86/mm/srat.c
2197 -+++ b/arch/x86/mm/srat.c
2198 -@@ -104,6 +104,8 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
2199 - if ((pa->flags & ACPI_SRAT_CPU_ENABLED) == 0)
2200 - return;
2201 - pxm = pa->proximity_domain_lo;
2202 -+ if (acpi_srat_revision >= 2)
2203 -+ pxm |= *((unsigned int*)pa->proximity_domain_hi) << 8;
2204 - node = setup_node(pxm);
2205 - if (node < 0) {
2206 - printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm);
2207 -@@ -155,6 +157,8 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
2208 - start = ma->base_address;
2209 - end = start + ma->length;
2210 - pxm = ma->proximity_domain;
2211 -+ if (acpi_srat_revision <= 1)
2212 -+ pxm &= 0xff;
2213 - node = setup_node(pxm);
2214 - if (node < 0) {
2215 - printk(KERN_ERR "SRAT: Too many proximity domains.\n");
2216 -diff --git a/arch/x86/pci/Makefile b/arch/x86/pci/Makefile
2217 -index 6b8759f..d24d3da 100644
2218 ---- a/arch/x86/pci/Makefile
2219 -+++ b/arch/x86/pci/Makefile
2220 -@@ -18,8 +18,9 @@ obj-$(CONFIG_X86_NUMAQ) += numaq_32.o
2221 - obj-$(CONFIG_X86_MRST) += mrst.o
2222 -
2223 - obj-y += common.o early.o
2224 --obj-y += amd_bus.o bus_numa.o
2225 -+obj-y += bus_numa.o
2226 -
2227 -+obj-$(CONFIG_AMD_NB) += amd_bus.o
2228 - obj-$(CONFIG_PCI_CNB20LE_QUIRK) += broadcom_bus.o
2229 -
2230 - ifeq ($(CONFIG_PCI_DEBUG),y)
2231 -diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
2232 -index 404f21a..f8348ab 100644
2233 ---- a/arch/x86/pci/acpi.c
2234 -+++ b/arch/x86/pci/acpi.c
2235 -@@ -149,7 +149,7 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
2236 - struct acpi_resource_address64 addr;
2237 - acpi_status status;
2238 - unsigned long flags;
2239 -- u64 start, end;
2240 -+ u64 start, orig_end, end;
2241 -
2242 - status = resource_to_addr(acpi_res, &addr);
2243 - if (!ACPI_SUCCESS(status))
2244 -@@ -165,7 +165,21 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
2245 - return AE_OK;
2246 -
2247 - start = addr.minimum + addr.translation_offset;
2248 -- end = addr.maximum + addr.translation_offset;
2249 -+ orig_end = end = addr.maximum + addr.translation_offset;
2250 -+
2251 -+ /* Exclude non-addressable range or non-addressable portion of range */
2252 -+ end = min(end, (u64)iomem_resource.end);
2253 -+ if (end <= start) {
2254 -+ dev_info(&info->bridge->dev,
2255 -+ "host bridge window [%#llx-%#llx] "
2256 -+ "(ignored, not CPU addressable)\n", start, orig_end);
2257 -+ return AE_OK;
2258 -+ } else if (orig_end != end) {
2259 -+ dev_info(&info->bridge->dev,
2260 -+ "host bridge window [%#llx-%#llx] "
2261 -+ "([%#llx-%#llx] ignored, not CPU addressable)\n",
2262 -+ start, orig_end, end + 1, orig_end);
2263 -+ }
2264 -
2265 - res = &info->res[info->res_num];
2266 - res->name = info->name;
2267 -diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
2268 -index 026e493..385a940 100644
2269 ---- a/arch/x86/pci/amd_bus.c
2270 -+++ b/arch/x86/pci/amd_bus.c
2271 -@@ -30,34 +30,6 @@ static struct pci_hostbridge_probe pci_probes[] __initdata = {
2272 - { 0, 0x18, PCI_VENDOR_ID_AMD, 0x1300 },
2273 - };
2274 -
2275 --static u64 __initdata fam10h_mmconf_start;
2276 --static u64 __initdata fam10h_mmconf_end;
2277 --static void __init get_pci_mmcfg_amd_fam10h_range(void)
2278 --{
2279 -- u32 address;
2280 -- u64 base, msr;
2281 -- unsigned segn_busn_bits;
2282 --
2283 -- /* assume all cpus from fam10h have mmconf */
2284 -- if (boot_cpu_data.x86 < 0x10)
2285 -- return;
2286 --
2287 -- address = MSR_FAM10H_MMIO_CONF_BASE;
2288 -- rdmsrl(address, msr);
2289 --
2290 -- /* mmconfig is not enable */
2291 -- if (!(msr & FAM10H_MMIO_CONF_ENABLE))
2292 -- return;
2293 --
2294 -- base = msr & (FAM10H_MMIO_CONF_BASE_MASK<<FAM10H_MMIO_CONF_BASE_SHIFT);
2295 --
2296 -- segn_busn_bits = (msr >> FAM10H_MMIO_CONF_BUSRANGE_SHIFT) &
2297 -- FAM10H_MMIO_CONF_BUSRANGE_MASK;
2298 --
2299 -- fam10h_mmconf_start = base;
2300 -- fam10h_mmconf_end = base + (1ULL<<(segn_busn_bits + 20)) - 1;
2301 --}
2302 --
2303 - #define RANGE_NUM 16
2304 -
2305 - /**
2306 -@@ -85,6 +57,9 @@ static int __init early_fill_mp_bus_info(void)
2307 - u64 val;
2308 - u32 address;
2309 - bool found;
2310 -+ struct resource fam10h_mmconf_res, *fam10h_mmconf;
2311 -+ u64 fam10h_mmconf_start;
2312 -+ u64 fam10h_mmconf_end;
2313 -
2314 - if (!early_pci_allowed())
2315 - return -1;
2316 -@@ -211,12 +186,17 @@ static int __init early_fill_mp_bus_info(void)
2317 - subtract_range(range, RANGE_NUM, 0, end);
2318 -
2319 - /* get mmconfig */
2320 -- get_pci_mmcfg_amd_fam10h_range();
2321 -+ fam10h_mmconf = amd_get_mmconfig_range(&fam10h_mmconf_res);
2322 - /* need to take out mmconf range */
2323 -- if (fam10h_mmconf_end) {
2324 -- printk(KERN_DEBUG "Fam 10h mmconf [%llx, %llx]\n", fam10h_mmconf_start, fam10h_mmconf_end);
2325 -+ if (fam10h_mmconf) {
2326 -+ printk(KERN_DEBUG "Fam 10h mmconf %pR\n", fam10h_mmconf);
2327 -+ fam10h_mmconf_start = fam10h_mmconf->start;
2328 -+ fam10h_mmconf_end = fam10h_mmconf->end;
2329 - subtract_range(range, RANGE_NUM, fam10h_mmconf_start,
2330 - fam10h_mmconf_end + 1);
2331 -+ } else {
2332 -+ fam10h_mmconf_start = 0;
2333 -+ fam10h_mmconf_end = 0;
2334 - }
2335 -
2336 - /* mmio resource */
2337 -diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
2338 -index 5b55219..9010ca7 100644
2339 ---- a/arch/x86/platform/uv/tlb_uv.c
2340 -+++ b/arch/x86/platform/uv/tlb_uv.c
2341 -@@ -157,13 +157,14 @@ static int __init uvhub_to_first_apicid(int uvhub)
2342 - * clear of the Timeout bit (as well) will free the resource. No reply will
2343 - * be sent (the hardware will only do one reply per message).
2344 - */
2345 --static void reply_to_message(struct msg_desc *mdp, struct bau_control *bcp)
2346 -+static void reply_to_message(struct msg_desc *mdp, struct bau_control *bcp,
2347 -+ int do_acknowledge)
2348 - {
2349 - unsigned long dw;
2350 - struct bau_pq_entry *msg;
2351 -
2352 - msg = mdp->msg;
2353 -- if (!msg->canceled) {
2354 -+ if (!msg->canceled && do_acknowledge) {
2355 - dw = (msg->swack_vec << UV_SW_ACK_NPENDING) | msg->swack_vec;
2356 - write_mmr_sw_ack(dw);
2357 - }
2358 -@@ -212,8 +213,8 @@ static void bau_process_retry_msg(struct msg_desc *mdp,
2359 - if (mmr & (msg_res << UV_SW_ACK_NPENDING)) {
2360 - unsigned long mr;
2361 - /*
2362 -- * is the resource timed out?
2363 -- * make everyone ignore the cancelled message.
2364 -+ * Is the resource timed out?
2365 -+ * Make everyone ignore the cancelled message.
2366 - */
2367 - msg2->canceled = 1;
2368 - stat->d_canceled++;
2369 -@@ -231,8 +232,8 @@ static void bau_process_retry_msg(struct msg_desc *mdp,
2370 - * Do all the things a cpu should do for a TLB shootdown message.
2371 - * Other cpu's may come here at the same time for this message.
2372 - */
2373 --static void bau_process_message(struct msg_desc *mdp,
2374 -- struct bau_control *bcp)
2375 -+static void bau_process_message(struct msg_desc *mdp, struct bau_control *bcp,
2376 -+ int do_acknowledge)
2377 - {
2378 - short socket_ack_count = 0;
2379 - short *sp;
2380 -@@ -284,8 +285,9 @@ static void bau_process_message(struct msg_desc *mdp,
2381 - if (msg_ack_count == bcp->cpus_in_uvhub) {
2382 - /*
2383 - * All cpus in uvhub saw it; reply
2384 -+ * (unless we are in the UV2 workaround)
2385 - */
2386 -- reply_to_message(mdp, bcp);
2387 -+ reply_to_message(mdp, bcp, do_acknowledge);
2388 - }
2389 - }
2390 -
2391 -@@ -491,27 +493,138 @@ static int uv1_wait_completion(struct bau_desc *bau_desc,
2392 - /*
2393 - * UV2 has an extra bit of status in the ACTIVATION_STATUS_2 register.
2394 - */
2395 --static unsigned long uv2_read_status(unsigned long offset, int rshft, int cpu)
2396 -+static unsigned long uv2_read_status(unsigned long offset, int rshft, int desc)
2397 - {
2398 - unsigned long descriptor_status;
2399 - unsigned long descriptor_status2;
2400 -
2401 - descriptor_status = ((read_lmmr(offset) >> rshft) & UV_ACT_STATUS_MASK);
2402 -- descriptor_status2 = (read_mmr_uv2_status() >> cpu) & 0x1UL;
2403 -+ descriptor_status2 = (read_mmr_uv2_status() >> desc) & 0x1UL;
2404 - descriptor_status = (descriptor_status << 1) | descriptor_status2;
2405 - return descriptor_status;
2406 - }
2407 -
2408 -+/*
2409 -+ * Return whether the status of the descriptor that is normally used for this
2410 -+ * cpu (the one indexed by its hub-relative cpu number) is busy.
2411 -+ * The status of the original 32 descriptors is always reflected in the 64
2412 -+ * bits of UVH_LB_BAU_SB_ACTIVATION_STATUS_0.
2413 -+ * The bit provided by the activation_status_2 register is irrelevant to
2414 -+ * the status if it is only being tested for busy or not busy.
2415 -+ */
2416 -+int normal_busy(struct bau_control *bcp)
2417 -+{
2418 -+ int cpu = bcp->uvhub_cpu;
2419 -+ int mmr_offset;
2420 -+ int right_shift;
2421 -+
2422 -+ mmr_offset = UVH_LB_BAU_SB_ACTIVATION_STATUS_0;
2423 -+ right_shift = cpu * UV_ACT_STATUS_SIZE;
2424 -+ return (((((read_lmmr(mmr_offset) >> right_shift) &
2425 -+ UV_ACT_STATUS_MASK)) << 1) == UV2H_DESC_BUSY);
2426 -+}
2427 -+
2428 -+/*
2429 -+ * Entered when a bau descriptor has gone into a permanent busy wait because
2430 -+ * of a hardware bug.
2431 -+ * Workaround the bug.
2432 -+ */
2433 -+int handle_uv2_busy(struct bau_control *bcp)
2434 -+{
2435 -+ int busy_one = bcp->using_desc;
2436 -+ int normal = bcp->uvhub_cpu;
2437 -+ int selected = -1;
2438 -+ int i;
2439 -+ unsigned long descriptor_status;
2440 -+ unsigned long status;
2441 -+ int mmr_offset;
2442 -+ struct bau_desc *bau_desc_old;
2443 -+ struct bau_desc *bau_desc_new;
2444 -+ struct bau_control *hmaster = bcp->uvhub_master;
2445 -+ struct ptc_stats *stat = bcp->statp;
2446 -+ cycles_t ttm;
2447 -+
2448 -+ stat->s_uv2_wars++;
2449 -+ spin_lock(&hmaster->uvhub_lock);
2450 -+ /* try for the original first */
2451 -+ if (busy_one != normal) {
2452 -+ if (!normal_busy(bcp))
2453 -+ selected = normal;
2454 -+ }
2455 -+ if (selected < 0) {
2456 -+ /* can't use the normal, select an alternate */
2457 -+ mmr_offset = UVH_LB_BAU_SB_ACTIVATION_STATUS_1;
2458 -+ descriptor_status = read_lmmr(mmr_offset);
2459 -+
2460 -+ /* scan available descriptors 32-63 */
2461 -+ for (i = 0; i < UV_CPUS_PER_AS; i++) {
2462 -+ if ((hmaster->inuse_map & (1 << i)) == 0) {
2463 -+ status = ((descriptor_status >>
2464 -+ (i * UV_ACT_STATUS_SIZE)) &
2465 -+ UV_ACT_STATUS_MASK) << 1;
2466 -+ if (status != UV2H_DESC_BUSY) {
2467 -+ selected = i + UV_CPUS_PER_AS;
2468 -+ break;
2469 -+ }
2470 -+ }
2471 -+ }
2472 -+ }
2473 -+
2474 -+ if (busy_one != normal)
2475 -+ /* mark the busy alternate as not in-use */
2476 -+ hmaster->inuse_map &= ~(1 << (busy_one - UV_CPUS_PER_AS));
2477 -+
2478 -+ if (selected >= 0) {
2479 -+ /* switch to the selected descriptor */
2480 -+ if (selected != normal) {
2481 -+ /* set the selected alternate as in-use */
2482 -+ hmaster->inuse_map |=
2483 -+ (1 << (selected - UV_CPUS_PER_AS));
2484 -+ if (selected > stat->s_uv2_wars_hw)
2485 -+ stat->s_uv2_wars_hw = selected;
2486 -+ }
2487 -+ bau_desc_old = bcp->descriptor_base;
2488 -+ bau_desc_old += (ITEMS_PER_DESC * busy_one);
2489 -+ bcp->using_desc = selected;
2490 -+ bau_desc_new = bcp->descriptor_base;
2491 -+ bau_desc_new += (ITEMS_PER_DESC * selected);
2492 -+ *bau_desc_new = *bau_desc_old;
2493 -+ } else {
2494 -+ /*
2495 -+ * All are busy. Wait for the normal one for this cpu to
2496 -+ * free up.
2497 -+ */
2498 -+ stat->s_uv2_war_waits++;
2499 -+ spin_unlock(&hmaster->uvhub_lock);
2500 -+ ttm = get_cycles();
2501 -+ do {
2502 -+ cpu_relax();
2503 -+ } while (normal_busy(bcp));
2504 -+ spin_lock(&hmaster->uvhub_lock);
2505 -+ /* switch to the original descriptor */
2506 -+ bcp->using_desc = normal;
2507 -+ bau_desc_old = bcp->descriptor_base;
2508 -+ bau_desc_old += (ITEMS_PER_DESC * bcp->using_desc);
2509 -+ bcp->using_desc = (ITEMS_PER_DESC * normal);
2510 -+ bau_desc_new = bcp->descriptor_base;
2511 -+ bau_desc_new += (ITEMS_PER_DESC * normal);
2512 -+ *bau_desc_new = *bau_desc_old; /* copy the entire descriptor */
2513 -+ }
2514 -+ spin_unlock(&hmaster->uvhub_lock);
2515 -+ return FLUSH_RETRY_BUSYBUG;
2516 -+}
2517 -+
2518 - static int uv2_wait_completion(struct bau_desc *bau_desc,
2519 - unsigned long mmr_offset, int right_shift,
2520 - struct bau_control *bcp, long try)
2521 - {
2522 - unsigned long descriptor_stat;
2523 - cycles_t ttm;
2524 -- int cpu = bcp->uvhub_cpu;
2525 -+ int desc = bcp->using_desc;
2526 -+ long busy_reps = 0;
2527 - struct ptc_stats *stat = bcp->statp;
2528 -
2529 -- descriptor_stat = uv2_read_status(mmr_offset, right_shift, cpu);
2530 -+ descriptor_stat = uv2_read_status(mmr_offset, right_shift, desc);
2531 -
2532 - /* spin on the status MMR, waiting for it to go idle */
2533 - while (descriptor_stat != UV2H_DESC_IDLE) {
2534 -@@ -542,12 +655,23 @@ static int uv2_wait_completion(struct bau_desc *bau_desc,
2535 - bcp->conseccompletes = 0;
2536 - return FLUSH_RETRY_TIMEOUT;
2537 - } else {
2538 -+ busy_reps++;
2539 -+ if (busy_reps > 1000000) {
2540 -+ /* not to hammer on the clock */
2541 -+ busy_reps = 0;
2542 -+ ttm = get_cycles();
2543 -+ if ((ttm - bcp->send_message) >
2544 -+ (bcp->clocks_per_100_usec)) {
2545 -+ return handle_uv2_busy(bcp);
2546 -+ }
2547 -+ }
2548 - /*
2549 - * descriptor_stat is still BUSY
2550 - */
2551 - cpu_relax();
2552 - }
2553 -- descriptor_stat = uv2_read_status(mmr_offset, right_shift, cpu);
2554 -+ descriptor_stat = uv2_read_status(mmr_offset, right_shift,
2555 -+ desc);
2556 - }
2557 - bcp->conseccompletes++;
2558 - return FLUSH_COMPLETE;
2559 -@@ -563,17 +687,17 @@ static int wait_completion(struct bau_desc *bau_desc,
2560 - {
2561 - int right_shift;
2562 - unsigned long mmr_offset;
2563 -- int cpu = bcp->uvhub_cpu;
2564 -+ int desc = bcp->using_desc;
2565 -
2566 -- if (cpu < UV_CPUS_PER_AS) {
2567 -+ if (desc < UV_CPUS_PER_AS) {
2568 - mmr_offset = UVH_LB_BAU_SB_ACTIVATION_STATUS_0;
2569 -- right_shift = cpu * UV_ACT_STATUS_SIZE;
2570 -+ right_shift = desc * UV_ACT_STATUS_SIZE;
2571 - } else {
2572 - mmr_offset = UVH_LB_BAU_SB_ACTIVATION_STATUS_1;
2573 -- right_shift = ((cpu - UV_CPUS_PER_AS) * UV_ACT_STATUS_SIZE);
2574 -+ right_shift = ((desc - UV_CPUS_PER_AS) * UV_ACT_STATUS_SIZE);
2575 - }
2576 -
2577 -- if (is_uv1_hub())
2578 -+ if (bcp->uvhub_version == 1)
2579 - return uv1_wait_completion(bau_desc, mmr_offset, right_shift,
2580 - bcp, try);
2581 - else
2582 -@@ -752,19 +876,22 @@ static void handle_cmplt(int completion_status, struct bau_desc *bau_desc,
2583 - * Returns 1 if it gives up entirely and the original cpu mask is to be
2584 - * returned to the kernel.
2585 - */
2586 --int uv_flush_send_and_wait(struct bau_desc *bau_desc,
2587 -- struct cpumask *flush_mask, struct bau_control *bcp)
2588 -+int uv_flush_send_and_wait(struct cpumask *flush_mask, struct bau_control *bcp)
2589 - {
2590 - int seq_number = 0;
2591 - int completion_stat = 0;
2592 -+ int uv1 = 0;
2593 - long try = 0;
2594 - unsigned long index;
2595 - cycles_t time1;
2596 - cycles_t time2;
2597 - struct ptc_stats *stat = bcp->statp;
2598 - struct bau_control *hmaster = bcp->uvhub_master;
2599 -+ struct uv1_bau_msg_header *uv1_hdr = NULL;
2600 -+ struct uv2_bau_msg_header *uv2_hdr = NULL;
2601 -+ struct bau_desc *bau_desc;
2602 -
2603 -- if (is_uv1_hub())
2604 -+ if (bcp->uvhub_version == 1)
2605 - uv1_throttle(hmaster, stat);
2606 -
2607 - while (hmaster->uvhub_quiesce)
2608 -@@ -772,22 +899,39 @@ int uv_flush_send_and_wait(struct bau_desc *bau_desc,
2609 -
2610 - time1 = get_cycles();
2611 - do {
2612 -- if (try == 0) {
2613 -- bau_desc->header.msg_type = MSG_REGULAR;
2614 -+ bau_desc = bcp->descriptor_base;
2615 -+ bau_desc += (ITEMS_PER_DESC * bcp->using_desc);
2616 -+ if (bcp->uvhub_version == 1) {
2617 -+ uv1 = 1;
2618 -+ uv1_hdr = &bau_desc->header.uv1_hdr;
2619 -+ } else
2620 -+ uv2_hdr = &bau_desc->header.uv2_hdr;
2621 -+ if ((try == 0) || (completion_stat == FLUSH_RETRY_BUSYBUG)) {
2622 -+ if (uv1)
2623 -+ uv1_hdr->msg_type = MSG_REGULAR;
2624 -+ else
2625 -+ uv2_hdr->msg_type = MSG_REGULAR;
2626 - seq_number = bcp->message_number++;
2627 - } else {
2628 -- bau_desc->header.msg_type = MSG_RETRY;
2629 -+ if (uv1)
2630 -+ uv1_hdr->msg_type = MSG_RETRY;
2631 -+ else
2632 -+ uv2_hdr->msg_type = MSG_RETRY;
2633 - stat->s_retry_messages++;
2634 - }
2635 -
2636 -- bau_desc->header.sequence = seq_number;
2637 -- index = (1UL << AS_PUSH_SHIFT) | bcp->uvhub_cpu;
2638 -+ if (uv1)
2639 -+ uv1_hdr->sequence = seq_number;
2640 -+ else
2641 -+ uv2_hdr->sequence = seq_number;
2642 -+ index = (1UL << AS_PUSH_SHIFT) | bcp->using_desc;
2643 - bcp->send_message = get_cycles();
2644 -
2645 - write_mmr_activation(index);
2646 -
2647 - try++;
2648 - completion_stat = wait_completion(bau_desc, bcp, try);
2649 -+ /* UV2: wait_completion() may change the bcp->using_desc */
2650 -
2651 - handle_cmplt(completion_stat, bau_desc, bcp, hmaster, stat);
2652 -
2653 -@@ -798,6 +942,7 @@ int uv_flush_send_and_wait(struct bau_desc *bau_desc,
2654 - }
2655 - cpu_relax();
2656 - } while ((completion_stat == FLUSH_RETRY_PLUGGED) ||
2657 -+ (completion_stat == FLUSH_RETRY_BUSYBUG) ||
2658 - (completion_stat == FLUSH_RETRY_TIMEOUT));
2659 -
2660 - time2 = get_cycles();
2661 -@@ -812,6 +957,7 @@ int uv_flush_send_and_wait(struct bau_desc *bau_desc,
2662 - record_send_stats(time1, time2, bcp, stat, completion_stat, try);
2663 -
2664 - if (completion_stat == FLUSH_GIVEUP)
2665 -+ /* FLUSH_GIVEUP will fall back to using IPI's for tlb flush */
2666 - return 1;
2667 - return 0;
2668 - }
2669 -@@ -967,7 +1113,7 @@ const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
2670 - stat->s_ntargself++;
2671 -
2672 - bau_desc = bcp->descriptor_base;
2673 -- bau_desc += ITEMS_PER_DESC * bcp->uvhub_cpu;
2674 -+ bau_desc += (ITEMS_PER_DESC * bcp->using_desc);
2675 - bau_uvhubs_clear(&bau_desc->distribution, UV_DISTRIBUTION_SIZE);
2676 - if (set_distrib_bits(flush_mask, bcp, bau_desc, &locals, &remotes))
2677 - return NULL;
2678 -@@ -980,13 +1126,86 @@ const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
2679 - * uv_flush_send_and_wait returns 0 if all cpu's were messaged,
2680 - * or 1 if it gave up and the original cpumask should be returned.
2681 - */
2682 -- if (!uv_flush_send_and_wait(bau_desc, flush_mask, bcp))
2683 -+ if (!uv_flush_send_and_wait(flush_mask, bcp))
2684 - return NULL;
2685 - else
2686 - return cpumask;
2687 - }
2688 -
2689 - /*
2690 -+ * Search the message queue for any 'other' message with the same software
2691 -+ * acknowledge resource bit vector.
2692 -+ */
2693 -+struct bau_pq_entry *find_another_by_swack(struct bau_pq_entry *msg,
2694 -+ struct bau_control *bcp, unsigned char swack_vec)
2695 -+{
2696 -+ struct bau_pq_entry *msg_next = msg + 1;
2697 -+
2698 -+ if (msg_next > bcp->queue_last)
2699 -+ msg_next = bcp->queue_first;
2700 -+ while ((msg_next->swack_vec != 0) && (msg_next != msg)) {
2701 -+ if (msg_next->swack_vec == swack_vec)
2702 -+ return msg_next;
2703 -+ msg_next++;
2704 -+ if (msg_next > bcp->queue_last)
2705 -+ msg_next = bcp->queue_first;
2706 -+ }
2707 -+ return NULL;
2708 -+}
2709 -+
2710 -+/*
2711 -+ * UV2 needs to work around a bug in which an arriving message has not
2712 -+ * set a bit in the UVH_LB_BAU_INTD_SOFTWARE_ACKNOWLEDGE register.
2713 -+ * Such a message must be ignored.
2714 -+ */
2715 -+void process_uv2_message(struct msg_desc *mdp, struct bau_control *bcp)
2716 -+{
2717 -+ unsigned long mmr_image;
2718 -+ unsigned char swack_vec;
2719 -+ struct bau_pq_entry *msg = mdp->msg;
2720 -+ struct bau_pq_entry *other_msg;
2721 -+
2722 -+ mmr_image = read_mmr_sw_ack();
2723 -+ swack_vec = msg->swack_vec;
2724 -+
2725 -+ if ((swack_vec & mmr_image) == 0) {
2726 -+ /*
2727 -+ * This message was assigned a swack resource, but no
2728 -+ * reserved acknowlegment is pending.
2729 -+ * The bug has prevented this message from setting the MMR.
2730 -+ * And no other message has used the same sw_ack resource.
2731 -+ * Do the requested shootdown but do not reply to the msg.
2732 -+ * (the 0 means make no acknowledge)
2733 -+ */
2734 -+ bau_process_message(mdp, bcp, 0);
2735 -+ return;
2736 -+ }
2737 -+
2738 -+ /*
2739 -+ * Some message has set the MMR 'pending' bit; it might have been
2740 -+ * another message. Look for that message.
2741 -+ */
2742 -+ other_msg = find_another_by_swack(msg, bcp, msg->swack_vec);
2743 -+ if (other_msg) {
2744 -+ /* There is another. Do not ack the current one. */
2745 -+ bau_process_message(mdp, bcp, 0);
2746 -+ /*
2747 -+ * Let the natural processing of that message acknowledge
2748 -+ * it. Don't get the processing of sw_ack's out of order.
2749 -+ */
2750 -+ return;
2751 -+ }
2752 -+
2753 -+ /*
2754 -+ * There is no other message using this sw_ack, so it is safe to
2755 -+ * acknowledge it.
2756 -+ */
2757 -+ bau_process_message(mdp, bcp, 1);
2758 -+
2759 -+ return;
2760 -+}
2761 -+
2762 -+/*
2763 - * The BAU message interrupt comes here. (registered by set_intr_gate)
2764 - * See entry_64.S
2765 - *
2766 -@@ -1022,9 +1241,11 @@ void uv_bau_message_interrupt(struct pt_regs *regs)
2767 - count++;
2768 -
2769 - msgdesc.msg_slot = msg - msgdesc.queue_first;
2770 -- msgdesc.swack_slot = ffs(msg->swack_vec) - 1;
2771 - msgdesc.msg = msg;
2772 -- bau_process_message(&msgdesc, bcp);
2773 -+ if (bcp->uvhub_version == 2)
2774 -+ process_uv2_message(&msgdesc, bcp);
2775 -+ else
2776 -+ bau_process_message(&msgdesc, bcp, 1);
2777 -
2778 - msg++;
2779 - if (msg > msgdesc.queue_last)
2780 -@@ -1083,7 +1304,7 @@ static void __init enable_timeouts(void)
2781 - */
2782 - mmr_image |= (1L << SOFTACK_MSHIFT);
2783 - if (is_uv2_hub()) {
2784 -- mmr_image |= (1L << UV2_LEG_SHFT);
2785 -+ mmr_image &= ~(1L << UV2_LEG_SHFT);
2786 - mmr_image |= (1L << UV2_EXT_SHFT);
2787 - }
2788 - write_mmr_misc_control(pnode, mmr_image);
2789 -@@ -1142,7 +1363,7 @@ static int ptc_seq_show(struct seq_file *file, void *data)
2790 - seq_printf(file,
2791 - "all one mult none retry canc nocan reset rcan ");
2792 - seq_printf(file,
2793 -- "disable enable\n");
2794 -+ "disable enable wars warshw warwaits\n");
2795 - }
2796 - if (cpu < num_possible_cpus() && cpu_online(cpu)) {
2797 - stat = &per_cpu(ptcstats, cpu);
2798 -@@ -1173,8 +1394,10 @@ static int ptc_seq_show(struct seq_file *file, void *data)
2799 - stat->d_nomsg, stat->d_retries, stat->d_canceled,
2800 - stat->d_nocanceled, stat->d_resets,
2801 - stat->d_rcanceled);
2802 -- seq_printf(file, "%ld %ld\n",
2803 -- stat->s_bau_disabled, stat->s_bau_reenabled);
2804 -+ seq_printf(file, "%ld %ld %ld %ld %ld\n",
2805 -+ stat->s_bau_disabled, stat->s_bau_reenabled,
2806 -+ stat->s_uv2_wars, stat->s_uv2_wars_hw,
2807 -+ stat->s_uv2_war_waits);
2808 - }
2809 - return 0;
2810 - }
2811 -@@ -1432,12 +1655,15 @@ static void activation_descriptor_init(int node, int pnode, int base_pnode)
2812 - {
2813 - int i;
2814 - int cpu;
2815 -+ int uv1 = 0;
2816 - unsigned long gpa;
2817 - unsigned long m;
2818 - unsigned long n;
2819 - size_t dsize;
2820 - struct bau_desc *bau_desc;
2821 - struct bau_desc *bd2;
2822 -+ struct uv1_bau_msg_header *uv1_hdr;
2823 -+ struct uv2_bau_msg_header *uv2_hdr;
2824 - struct bau_control *bcp;
2825 -
2826 - /*
2827 -@@ -1451,6 +1677,8 @@ static void activation_descriptor_init(int node, int pnode, int base_pnode)
2828 - gpa = uv_gpa(bau_desc);
2829 - n = uv_gpa_to_gnode(gpa);
2830 - m = uv_gpa_to_offset(gpa);
2831 -+ if (is_uv1_hub())
2832 -+ uv1 = 1;
2833 -
2834 - /* the 14-bit pnode */
2835 - write_mmr_descriptor_base(pnode, (n << UV_DESC_PSHIFT | m));
2836 -@@ -1461,21 +1689,33 @@ static void activation_descriptor_init(int node, int pnode, int base_pnode)
2837 - */
2838 - for (i = 0, bd2 = bau_desc; i < (ADP_SZ * ITEMS_PER_DESC); i++, bd2++) {
2839 - memset(bd2, 0, sizeof(struct bau_desc));
2840 -- bd2->header.swack_flag = 1;
2841 -- /*
2842 -- * The base_dest_nasid set in the message header is the nasid
2843 -- * of the first uvhub in the partition. The bit map will
2844 -- * indicate destination pnode numbers relative to that base.
2845 -- * They may not be consecutive if nasid striding is being used.
2846 -- */
2847 -- bd2->header.base_dest_nasid = UV_PNODE_TO_NASID(base_pnode);
2848 -- bd2->header.dest_subnodeid = UV_LB_SUBNODEID;
2849 -- bd2->header.command = UV_NET_ENDPOINT_INTD;
2850 -- bd2->header.int_both = 1;
2851 -- /*
2852 -- * all others need to be set to zero:
2853 -- * fairness chaining multilevel count replied_to
2854 -- */
2855 -+ if (uv1) {
2856 -+ uv1_hdr = &bd2->header.uv1_hdr;
2857 -+ uv1_hdr->swack_flag = 1;
2858 -+ /*
2859 -+ * The base_dest_nasid set in the message header
2860 -+ * is the nasid of the first uvhub in the partition.
2861 -+ * The bit map will indicate destination pnode numbers
2862 -+ * relative to that base. They may not be consecutive
2863 -+ * if nasid striding is being used.
2864 -+ */
2865 -+ uv1_hdr->base_dest_nasid =
2866 -+ UV_PNODE_TO_NASID(base_pnode);
2867 -+ uv1_hdr->dest_subnodeid = UV_LB_SUBNODEID;
2868 -+ uv1_hdr->command = UV_NET_ENDPOINT_INTD;
2869 -+ uv1_hdr->int_both = 1;
2870 -+ /*
2871 -+ * all others need to be set to zero:
2872 -+ * fairness chaining multilevel count replied_to
2873 -+ */
2874 -+ } else {
2875 -+ uv2_hdr = &bd2->header.uv2_hdr;
2876 -+ uv2_hdr->swack_flag = 1;
2877 -+ uv2_hdr->base_dest_nasid =
2878 -+ UV_PNODE_TO_NASID(base_pnode);
2879 -+ uv2_hdr->dest_subnodeid = UV_LB_SUBNODEID;
2880 -+ uv2_hdr->command = UV_NET_ENDPOINT_INTD;
2881 -+ }
2882 - }
2883 - for_each_present_cpu(cpu) {
2884 - if (pnode != uv_blade_to_pnode(uv_cpu_to_blade_id(cpu)))
2885 -@@ -1531,6 +1771,7 @@ static void pq_init(int node, int pnode)
2886 - write_mmr_payload_first(pnode, pn_first);
2887 - write_mmr_payload_tail(pnode, first);
2888 - write_mmr_payload_last(pnode, last);
2889 -+ write_gmmr_sw_ack(pnode, 0xffffUL);
2890 -
2891 - /* in effect, all msg_type's are set to MSG_NOOP */
2892 - memset(pqp, 0, sizeof(struct bau_pq_entry) * DEST_Q_SIZE);
2893 -@@ -1584,14 +1825,14 @@ static int calculate_destination_timeout(void)
2894 - ts_ns = base * mult1 * mult2;
2895 - ret = ts_ns / 1000;
2896 - } else {
2897 -- /* 4 bits 0/1 for 10/80us, 3 bits of multiplier */
2898 -- mmr_image = uv_read_local_mmr(UVH_AGING_PRESCALE_SEL);
2899 -+ /* 4 bits 0/1 for 10/80us base, 3 bits of multiplier */
2900 -+ mmr_image = uv_read_local_mmr(UVH_LB_BAU_MISC_CONTROL);
2901 - mmr_image = (mmr_image & UV_SA_MASK) >> UV_SA_SHFT;
2902 - if (mmr_image & (1L << UV2_ACK_UNITS_SHFT))
2903 -- mult1 = 80;
2904 -+ base = 80;
2905 - else
2906 -- mult1 = 10;
2907 -- base = mmr_image & UV2_ACK_MASK;
2908 -+ base = 10;
2909 -+ mult1 = mmr_image & UV2_ACK_MASK;
2910 - ret = mult1 * base;
2911 - }
2912 - return ret;
2913 -@@ -1618,6 +1859,7 @@ static void __init init_per_cpu_tunables(void)
2914 - bcp->cong_response_us = congested_respns_us;
2915 - bcp->cong_reps = congested_reps;
2916 - bcp->cong_period = congested_period;
2917 -+ bcp->clocks_per_100_usec = usec_2_cycles(100);
2918 - }
2919 - }
2920 -
2921 -@@ -1728,8 +1970,17 @@ static int scan_sock(struct socket_desc *sdp, struct uvhub_desc *bdp,
2922 - bcp->cpus_in_socket = sdp->num_cpus;
2923 - bcp->socket_master = *smasterp;
2924 - bcp->uvhub = bdp->uvhub;
2925 -+ if (is_uv1_hub())
2926 -+ bcp->uvhub_version = 1;
2927 -+ else if (is_uv2_hub())
2928 -+ bcp->uvhub_version = 2;
2929 -+ else {
2930 -+ printk(KERN_EMERG "uvhub version not 1 or 2\n");
2931 -+ return 1;
2932 -+ }
2933 - bcp->uvhub_master = *hmasterp;
2934 - bcp->uvhub_cpu = uv_cpu_hub_info(cpu)->blade_processor_id;
2935 -+ bcp->using_desc = bcp->uvhub_cpu;
2936 - if (bcp->uvhub_cpu >= MAX_CPUS_PER_UVHUB) {
2937 - printk(KERN_EMERG "%d cpus per uvhub invalid\n",
2938 - bcp->uvhub_cpu);
2939 -@@ -1845,6 +2096,8 @@ static int __init uv_bau_init(void)
2940 - uv_base_pnode = uv_blade_to_pnode(uvhub);
2941 - }
2942 -
2943 -+ enable_timeouts();
2944 -+
2945 - if (init_per_cpu(nuvhubs, uv_base_pnode)) {
2946 - nobau = 1;
2947 - return 0;
2948 -@@ -1855,7 +2108,6 @@ static int __init uv_bau_init(void)
2949 - if (uv_blade_nr_possible_cpus(uvhub))
2950 - init_uvhub(uvhub, vector, uv_base_pnode);
2951 -
2952 -- enable_timeouts();
2953 - alloc_intr_gate(vector, uv_bau_message_intr1);
2954 -
2955 - for_each_possible_blade(uvhub) {
2956 -@@ -1867,7 +2119,8 @@ static int __init uv_bau_init(void)
2957 - val = 1L << 63;
2958 - write_gmmr_activation(pnode, val);
2959 - mmr = 1; /* should be 1 to broadcast to both sockets */
2960 -- write_mmr_data_broadcast(pnode, mmr);
2961 -+ if (!is_uv1_hub())
2962 -+ write_mmr_data_broadcast(pnode, mmr);
2963 - }
2964 - }
2965 -
2966 -diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
2967 -index fbdf0d8..688be8a 100644
2968 ---- a/block/scsi_ioctl.c
2969 -+++ b/block/scsi_ioctl.c
2970 -@@ -24,6 +24,7 @@
2971 - #include <linux/capability.h>
2972 - #include <linux/completion.h>
2973 - #include <linux/cdrom.h>
2974 -+#include <linux/ratelimit.h>
2975 - #include <linux/slab.h>
2976 - #include <linux/times.h>
2977 - #include <asm/uaccess.h>
2978 -@@ -690,6 +691,57 @@ int scsi_cmd_ioctl(struct request_queue *q, struct gendisk *bd_disk, fmode_t mod
2979 - }
2980 - EXPORT_SYMBOL(scsi_cmd_ioctl);
2981 -
2982 -+int scsi_verify_blk_ioctl(struct block_device *bd, unsigned int cmd)
2983 -+{
2984 -+ if (bd && bd == bd->bd_contains)
2985 -+ return 0;
2986 -+
2987 -+ /* Actually none of these is particularly useful on a partition,
2988 -+ * but they are safe.
2989 -+ */
2990 -+ switch (cmd) {
2991 -+ case SCSI_IOCTL_GET_IDLUN:
2992 -+ case SCSI_IOCTL_GET_BUS_NUMBER:
2993 -+ case SCSI_IOCTL_GET_PCI:
2994 -+ case SCSI_IOCTL_PROBE_HOST:
2995 -+ case SG_GET_VERSION_NUM:
2996 -+ case SG_SET_TIMEOUT:
2997 -+ case SG_GET_TIMEOUT:
2998 -+ case SG_GET_RESERVED_SIZE:
2999 -+ case SG_SET_RESERVED_SIZE:
3000 -+ case SG_EMULATED_HOST:
3001 -+ return 0;
3002 -+ case CDROM_GET_CAPABILITY:
3003 -+ /* Keep this until we remove the printk below. udev sends it
3004 -+ * and we do not want to spam dmesg about it. CD-ROMs do
3005 -+ * not have partitions, so we get here only for disks.
3006 -+ */
3007 -+ return -ENOTTY;
3008 -+ default:
3009 -+ break;
3010 -+ }
3011 -+
3012 -+ /* In particular, rule out all resets and host-specific ioctls. */
3013 -+ printk_ratelimited(KERN_WARNING
3014 -+ "%s: sending ioctl %x to a partition!\n", current->comm, cmd);
3015 -+
3016 -+ return capable(CAP_SYS_RAWIO) ? 0 : -ENOTTY;
3017 -+}
3018 -+EXPORT_SYMBOL(scsi_verify_blk_ioctl);
3019 -+
3020 -+int scsi_cmd_blk_ioctl(struct block_device *bd, fmode_t mode,
3021 -+ unsigned int cmd, void __user *arg)
3022 -+{
3023 -+ int ret;
3024 -+
3025 -+ ret = scsi_verify_blk_ioctl(bd, cmd);
3026 -+ if (ret < 0)
3027 -+ return ret;
3028 -+
3029 -+ return scsi_cmd_ioctl(bd->bd_disk->queue, bd->bd_disk, mode, cmd, arg);
3030 -+}
3031 -+EXPORT_SYMBOL(scsi_cmd_blk_ioctl);
3032 -+
3033 - static int __init blk_scsi_ioctl_init(void)
3034 - {
3035 - blk_set_cmd_filter_defaults(&blk_default_cmd_filter);
3036 -diff --git a/drivers/acpi/acpica/dsargs.c b/drivers/acpi/acpica/dsargs.c
3037 -index 8c7b997..42163d8 100644
3038 ---- a/drivers/acpi/acpica/dsargs.c
3039 -+++ b/drivers/acpi/acpica/dsargs.c
3040 -@@ -387,5 +387,29 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc)
3041 - status = acpi_ds_execute_arguments(node, node->parent,
3042 - extra_desc->extra.aml_length,
3043 - extra_desc->extra.aml_start);
3044 -+ if (ACPI_FAILURE(status)) {
3045 -+ return_ACPI_STATUS(status);
3046 -+ }
3047 -+
3048 -+ /* Validate the region address/length via the host OS */
3049 -+
3050 -+ status = acpi_os_validate_address(obj_desc->region.space_id,
3051 -+ obj_desc->region.address,
3052 -+ (acpi_size) obj_desc->region.length,
3053 -+ acpi_ut_get_node_name(node));
3054 -+
3055 -+ if (ACPI_FAILURE(status)) {
3056 -+ /*
3057 -+ * Invalid address/length. We will emit an error message and mark
3058 -+ * the region as invalid, so that it will cause an additional error if
3059 -+ * it is ever used. Then return AE_OK.
3060 -+ */
3061 -+ ACPI_EXCEPTION((AE_INFO, status,
3062 -+ "During address validation of OpRegion [%4.4s]",
3063 -+ node->name.ascii));
3064 -+ obj_desc->common.flags |= AOPOBJ_INVALID;
3065 -+ status = AE_OK;
3066 -+ }
3067 -+
3068 - return_ACPI_STATUS(status);
3069 - }
3070 -diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
3071 -index 3b5c318..e56f3be 100644
3072 ---- a/drivers/acpi/numa.c
3073 -+++ b/drivers/acpi/numa.c
3074 -@@ -45,6 +45,8 @@ static int pxm_to_node_map[MAX_PXM_DOMAINS]
3075 - static int node_to_pxm_map[MAX_NUMNODES]
3076 - = { [0 ... MAX_NUMNODES - 1] = PXM_INVAL };
3077 -
3078 -+unsigned char acpi_srat_revision __initdata;
3079 -+
3080 - int pxm_to_node(int pxm)
3081 - {
3082 - if (pxm < 0)
3083 -@@ -255,9 +257,13 @@ acpi_parse_memory_affinity(struct acpi_subtable_header * header,
3084 -
3085 - static int __init acpi_parse_srat(struct acpi_table_header *table)
3086 - {
3087 -+ struct acpi_table_srat *srat;
3088 - if (!table)
3089 - return -EINVAL;
3090 -
3091 -+ srat = (struct acpi_table_srat *)table;
3092 -+ acpi_srat_revision = srat->header.revision;
3093 -+
3094 - /* Real work done in acpi_table_parse_srat below. */
3095 -
3096 - return 0;
3097 -diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
3098 -index 3a0428e..c850de4 100644
3099 ---- a/drivers/acpi/processor_core.c
3100 -+++ b/drivers/acpi/processor_core.c
3101 -@@ -173,8 +173,30 @@ int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id)
3102 - apic_id = map_mat_entry(handle, type, acpi_id);
3103 - if (apic_id == -1)
3104 - apic_id = map_madt_entry(type, acpi_id);
3105 -- if (apic_id == -1)
3106 -- return apic_id;
3107 -+ if (apic_id == -1) {
3108 -+ /*
3109 -+ * On UP processor, there is no _MAT or MADT table.
3110 -+ * So above apic_id is always set to -1.
3111 -+ *
3112 -+ * BIOS may define multiple CPU handles even for UP processor.
3113 -+ * For example,
3114 -+ *
3115 -+ * Scope (_PR)
3116 -+ * {
3117 -+ * Processor (CPU0, 0x00, 0x00000410, 0x06) {}
3118 -+ * Processor (CPU1, 0x01, 0x00000410, 0x06) {}
3119 -+ * Processor (CPU2, 0x02, 0x00000410, 0x06) {}
3120 -+ * Processor (CPU3, 0x03, 0x00000410, 0x06) {}
3121 -+ * }
3122 -+ *
3123 -+ * Ignores apic_id and always return 0 for CPU0's handle.
3124 -+ * Return -1 for other CPU's handle.
3125 -+ */
3126 -+ if (acpi_id == 0)
3127 -+ return acpi_id;
3128 -+ else
3129 -+ return apic_id;
3130 -+ }
3131 -
3132 - #ifdef CONFIG_SMP
3133 - for_each_possible_cpu(i) {
3134 -diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c
3135 -index 990f5a8..48e06be 100644
3136 ---- a/drivers/bcma/host_pci.c
3137 -+++ b/drivers/bcma/host_pci.c
3138 -@@ -227,11 +227,14 @@ static void bcma_host_pci_remove(struct pci_dev *dev)
3139 - #ifdef CONFIG_PM
3140 - static int bcma_host_pci_suspend(struct pci_dev *dev, pm_message_t state)
3141 - {
3142 -+ struct bcma_bus *bus = pci_get_drvdata(dev);
3143 -+
3144 - /* Host specific */
3145 - pci_save_state(dev);
3146 - pci_disable_device(dev);
3147 - pci_set_power_state(dev, pci_choose_state(dev, state));
3148 -
3149 -+ bus->mapped_core = NULL;
3150 - return 0;
3151 - }
3152 -
3153 -diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
3154 -index 587cce5..b0f553b 100644
3155 ---- a/drivers/block/cciss.c
3156 -+++ b/drivers/block/cciss.c
3157 -@@ -1735,7 +1735,7 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
3158 - case CCISS_BIG_PASSTHRU:
3159 - return cciss_bigpassthru(h, argp);
3160 -
3161 -- /* scsi_cmd_ioctl handles these, below, though some are not */
3162 -+ /* scsi_cmd_blk_ioctl handles these, below, though some are not */
3163 - /* very meaningful for cciss. SG_IO is the main one people want. */
3164 -
3165 - case SG_GET_VERSION_NUM:
3166 -@@ -1746,9 +1746,9 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
3167 - case SG_EMULATED_HOST:
3168 - case SG_IO:
3169 - case SCSI_IOCTL_SEND_COMMAND:
3170 -- return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp);
3171 -+ return scsi_cmd_blk_ioctl(bdev, mode, cmd, argp);
3172 -
3173 -- /* scsi_cmd_ioctl would normally handle these, below, but */
3174 -+ /* scsi_cmd_blk_ioctl would normally handle these, below, but */
3175 - /* they aren't a good fit for cciss, as CD-ROMs are */
3176 - /* not supported, and we don't have any bus/target/lun */
3177 - /* which we present to the kernel. */
3178 -diff --git a/drivers/block/ub.c b/drivers/block/ub.c
3179 -index 0e376d4..7333b9e 100644
3180 ---- a/drivers/block/ub.c
3181 -+++ b/drivers/block/ub.c
3182 -@@ -1744,12 +1744,11 @@ static int ub_bd_release(struct gendisk *disk, fmode_t mode)
3183 - static int ub_bd_ioctl(struct block_device *bdev, fmode_t mode,
3184 - unsigned int cmd, unsigned long arg)
3185 - {
3186 -- struct gendisk *disk = bdev->bd_disk;
3187 - void __user *usermem = (void __user *) arg;
3188 - int ret;
3189 -
3190 - mutex_lock(&ub_mutex);
3191 -- ret = scsi_cmd_ioctl(disk->queue, disk, mode, cmd, usermem);
3192 -+ ret = scsi_cmd_blk_ioctl(bdev, mode, cmd, usermem);
3193 - mutex_unlock(&ub_mutex);
3194 -
3195 - return ret;
3196 -diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
3197 -index 4d0b70a..e46f2f7 100644
3198 ---- a/drivers/block/virtio_blk.c
3199 -+++ b/drivers/block/virtio_blk.c
3200 -@@ -243,8 +243,8 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode,
3201 - if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI))
3202 - return -ENOTTY;
3203 -
3204 -- return scsi_cmd_ioctl(disk->queue, disk, mode, cmd,
3205 -- (void __user *)data);
3206 -+ return scsi_cmd_blk_ioctl(bdev, mode, cmd,
3207 -+ (void __user *)data);
3208 - }
3209 -
3210 - /* We provide getgeo only to please some old bootloader/partitioning tools */
3211 -diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
3212 -index f997c27..cedb231 100644
3213 ---- a/drivers/cdrom/cdrom.c
3214 -+++ b/drivers/cdrom/cdrom.c
3215 -@@ -2747,12 +2747,11 @@ int cdrom_ioctl(struct cdrom_device_info *cdi, struct block_device *bdev,
3216 - {
3217 - void __user *argp = (void __user *)arg;
3218 - int ret;
3219 -- struct gendisk *disk = bdev->bd_disk;
3220 -
3221 - /*
3222 - * Try the generic SCSI command ioctl's first.
3223 - */
3224 -- ret = scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp);
3225 -+ ret = scsi_cmd_blk_ioctl(bdev, mode, cmd, argp);
3226 - if (ret != -ENOTTY)
3227 - return ret;
3228 -
3229 -diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
3230 -index bfc08f6..31b0d1a 100644
3231 ---- a/drivers/gpu/drm/radeon/r100.c
3232 -+++ b/drivers/gpu/drm/radeon/r100.c
3233 -@@ -2177,6 +2177,7 @@ bool r100_gpu_is_lockup(struct radeon_device *rdev)
3234 - void r100_bm_disable(struct radeon_device *rdev)
3235 - {
3236 - u32 tmp;
3237 -+ u16 tmp16;
3238 -
3239 - /* disable bus mastering */
3240 - tmp = RREG32(R_000030_BUS_CNTL);
3241 -@@ -2187,8 +2188,8 @@ void r100_bm_disable(struct radeon_device *rdev)
3242 - WREG32(R_000030_BUS_CNTL, (tmp & 0xFFFFFFFF) | 0x00000040);
3243 - tmp = RREG32(RADEON_BUS_CNTL);
3244 - mdelay(1);
3245 -- pci_read_config_word(rdev->pdev, 0x4, (u16*)&tmp);
3246 -- pci_write_config_word(rdev->pdev, 0x4, tmp & 0xFFFB);
3247 -+ pci_read_config_word(rdev->pdev, 0x4, &tmp16);
3248 -+ pci_write_config_word(rdev->pdev, 0x4, tmp16 & 0xFFFB);
3249 - mdelay(1);
3250 - }
3251 -
3252 -diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c
3253 -index f5ac7e7..c45d921 100644
3254 ---- a/drivers/gpu/drm/radeon/r600_hdmi.c
3255 -+++ b/drivers/gpu/drm/radeon/r600_hdmi.c
3256 -@@ -196,6 +196,13 @@ static void r600_hdmi_videoinfoframe(
3257 - frame[0xD] = (right_bar >> 8);
3258 -
3259 - r600_hdmi_infoframe_checksum(0x82, 0x02, 0x0D, frame);
3260 -+ /* Our header values (type, version, length) should be alright, Intel
3261 -+ * is using the same. Checksum function also seems to be OK, it works
3262 -+ * fine for audio infoframe. However calculated value is always lower
3263 -+ * by 2 in comparison to fglrx. It breaks displaying anything in case
3264 -+ * of TVs that strictly check the checksum. Hack it manually here to
3265 -+ * workaround this issue. */
3266 -+ frame[0x0] += 2;
3267 -
3268 - WREG32(offset+R600_HDMI_VIDEOINFOFRAME_0,
3269 - frame[0x0] | (frame[0x1] << 8) | (frame[0x2] << 16) | (frame[0x3] << 24));
3270 -diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
3271 -index c4d00a1..9b39145 100644
3272 ---- a/drivers/gpu/drm/radeon/radeon_device.c
3273 -+++ b/drivers/gpu/drm/radeon/radeon_device.c
3274 -@@ -224,8 +224,11 @@ int radeon_wb_init(struct radeon_device *rdev)
3275 - if (radeon_no_wb == 1)
3276 - rdev->wb.enabled = false;
3277 - else {
3278 -- /* often unreliable on AGP */
3279 - if (rdev->flags & RADEON_IS_AGP) {
3280 -+ /* often unreliable on AGP */
3281 -+ rdev->wb.enabled = false;
3282 -+ } else if (rdev->family < CHIP_R300) {
3283 -+ /* often unreliable on pre-r300 */
3284 - rdev->wb.enabled = false;
3285 - } else {
3286 - rdev->wb.enabled = true;
3287 -diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
3288 -index b1053d6..c259e21 100644
3289 ---- a/drivers/gpu/drm/radeon/rs600.c
3290 -+++ b/drivers/gpu/drm/radeon/rs600.c
3291 -@@ -324,10 +324,10 @@ void rs600_hpd_fini(struct radeon_device *rdev)
3292 -
3293 - void rs600_bm_disable(struct radeon_device *rdev)
3294 - {
3295 -- u32 tmp;
3296 -+ u16 tmp;
3297 -
3298 - /* disable bus mastering */
3299 -- pci_read_config_word(rdev->pdev, 0x4, (u16*)&tmp);
3300 -+ pci_read_config_word(rdev->pdev, 0x4, &tmp);
3301 - pci_write_config_word(rdev->pdev, 0x4, tmp & 0xFFFB);
3302 - mdelay(1);
3303 - }
3304 -diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
3305 -index 22a4a05..d21f6d0 100644
3306 ---- a/drivers/hid/Kconfig
3307 -+++ b/drivers/hid/Kconfig
3308 -@@ -335,6 +335,7 @@ config HID_MULTITOUCH
3309 - Say Y here if you have one of the following devices:
3310 - - 3M PCT touch screens
3311 - - ActionStar dual touch panels
3312 -+ - Atmel panels
3313 - - Cando dual touch panels
3314 - - Chunghwa panels
3315 - - CVTouch panels
3316 -@@ -355,6 +356,7 @@ config HID_MULTITOUCH
3317 - - Touch International Panels
3318 - - Unitec Panels
3319 - - XAT optical touch panels
3320 -+ - Xiroku optical touch panels
3321 -
3322 - If unsure, say N.
3323 -
3324 -@@ -620,6 +622,7 @@ config HID_WIIMOTE
3325 - depends on BT_HIDP
3326 - depends on LEDS_CLASS
3327 - select POWER_SUPPLY
3328 -+ select INPUT_FF_MEMLESS
3329 - ---help---
3330 - Support for the Nintendo Wii Remote bluetooth device.
3331 -
3332 -diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
3333 -index af35384..bb656d8 100644
3334 ---- a/drivers/hid/hid-core.c
3335 -+++ b/drivers/hid/hid-core.c
3336 -@@ -362,7 +362,7 @@ static int hid_parser_global(struct hid_parser *parser, struct hid_item *item)
3337 -
3338 - case HID_GLOBAL_ITEM_TAG_REPORT_SIZE:
3339 - parser->global.report_size = item_udata(item);
3340 -- if (parser->global.report_size > 32) {
3341 -+ if (parser->global.report_size > 96) {
3342 - dbg_hid("invalid report_size %d\n",
3343 - parser->global.report_size);
3344 - return -1;
3345 -@@ -1404,11 +1404,13 @@ static const struct hid_device_id hid_have_special_driver[] = {
3346 - { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
3347 - { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0006) },
3348 - { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, 0x0011) },
3349 -- { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) },
3350 -- { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) },
3351 -- { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2) },
3352 -- { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3) },
3353 -- { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4) },
3354 -+ { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) },
3355 -+ { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) },
3356 -+ { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) },
3357 -+ { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) },
3358 -+ { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) },
3359 -+ { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) },
3360 -+ { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) },
3361 - { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) },
3362 - { HID_USB_DEVICE(USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2515) },
3363 - { HID_USB_DEVICE(USB_VENDOR_ID_EMS, USB_DEVICE_ID_EMS_TRIO_LINKER_PLUS_II) },
3364 -@@ -1423,6 +1425,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
3365 - { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) },
3366 - { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) },
3367 - { HID_USB_DEVICE(USB_VENDOR_ID_HANVON, USB_DEVICE_ID_HANVON_MULTITOUCH) },
3368 -+ { HID_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT, USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) },
3369 - { HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM, USB_DEVICE_ID_IDEACOM_IDC6650) },
3370 - { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK, USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP) },
3371 - { HID_USB_DEVICE(USB_VENDOR_ID_ILITEK, USB_DEVICE_ID_ILITEK_MULTITOUCH) },
3372 -@@ -1549,6 +1552,15 @@ static const struct hid_device_id hid_have_special_driver[] = {
3373 - { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) },
3374 - { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) },
3375 - { HID_USB_DEVICE(USB_VENDOR_ID_XAT, USB_DEVICE_ID_XAT_CSR) },
3376 -+ { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_SPX) },
3377 -+ { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_MPX) },
3378 -+ { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_CSR) },
3379 -+ { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_SPX1) },
3380 -+ { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_MPX1) },
3381 -+ { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_CSR1) },
3382 -+ { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_SPX2) },
3383 -+ { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_MPX2) },
3384 -+ { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_CSR2) },
3385 - { HID_USB_DEVICE(USB_VENDOR_ID_X_TENSIONS, USB_DEVICE_ID_SPEEDLINK_VAD_CEZANNE) },
3386 - { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
3387 - { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) },
3388 -diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
3389 -index 4a441a6..00cabb3 100644
3390 ---- a/drivers/hid/hid-ids.h
3391 -+++ b/drivers/hid/hid-ids.h
3392 -@@ -21,6 +21,7 @@
3393 - #define USB_VENDOR_ID_3M 0x0596
3394 - #define USB_DEVICE_ID_3M1968 0x0500
3395 - #define USB_DEVICE_ID_3M2256 0x0502
3396 -+#define USB_DEVICE_ID_3M3266 0x0506
3397 -
3398 - #define USB_VENDOR_ID_A4TECH 0x09da
3399 - #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006
3400 -@@ -145,6 +146,9 @@
3401 - #define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205
3402 - #define USB_DEVICE_ID_ATEN_4PORTKVMC 0x2208
3403 -
3404 -+#define USB_VENDOR_ID_ATMEL 0x03eb
3405 -+#define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c
3406 -+
3407 - #define USB_VENDOR_ID_AVERMEDIA 0x07ca
3408 - #define USB_DEVICE_ID_AVER_FM_MR800 0xb800
3409 -
3410 -@@ -230,11 +234,14 @@
3411 -
3412 - #define USB_VENDOR_ID_DWAV 0x0eef
3413 - #define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER 0x0001
3414 --#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH 0x480d
3415 --#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1 0x720c
3416 --#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2 0x72a1
3417 --#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3 0x480e
3418 --#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4 0x726b
3419 -+#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D 0x480d
3420 -+#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E 0x480e
3421 -+#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C 0x720c
3422 -+#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B 0x726b
3423 -+#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1 0x72a1
3424 -+#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA 0x72fa
3425 -+#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302 0x7302
3426 -+#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001
3427 -
3428 - #define USB_VENDOR_ID_ELECOM 0x056e
3429 - #define USB_DEVICE_ID_ELECOM_BM084 0x0061
3430 -@@ -356,6 +363,9 @@
3431 - #define USB_VENDOR_ID_HANVON 0x20b3
3432 - #define USB_DEVICE_ID_HANVON_MULTITOUCH 0x0a18
3433 -
3434 -+#define USB_VENDOR_ID_HANVON_ALT 0x22ed
3435 -+#define USB_DEVICE_ID_HANVON_ALT_MULTITOUCH 0x1010
3436 -+
3437 - #define USB_VENDOR_ID_HAPP 0x078b
3438 - #define USB_DEVICE_ID_UGCI_DRIVING 0x0010
3439 - #define USB_DEVICE_ID_UGCI_FLYING 0x0020
3440 -@@ -707,6 +717,17 @@
3441 - #define USB_VENDOR_ID_XAT 0x2505
3442 - #define USB_DEVICE_ID_XAT_CSR 0x0220
3443 -
3444 -+#define USB_VENDOR_ID_XIROKU 0x1477
3445 -+#define USB_DEVICE_ID_XIROKU_SPX 0x1006
3446 -+#define USB_DEVICE_ID_XIROKU_MPX 0x1007
3447 -+#define USB_DEVICE_ID_XIROKU_CSR 0x100e
3448 -+#define USB_DEVICE_ID_XIROKU_SPX1 0x1021
3449 -+#define USB_DEVICE_ID_XIROKU_CSR1 0x1022
3450 -+#define USB_DEVICE_ID_XIROKU_MPX1 0x1023
3451 -+#define USB_DEVICE_ID_XIROKU_SPX2 0x1024
3452 -+#define USB_DEVICE_ID_XIROKU_CSR2 0x1025
3453 -+#define USB_DEVICE_ID_XIROKU_MPX2 0x1026
3454 -+
3455 - #define USB_VENDOR_ID_YEALINK 0x6993
3456 - #define USB_DEVICE_ID_YEALINK_P1K_P4K_B2K 0xb001
3457 -
3458 -diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
3459 -index f1c909f..995fc4c 100644
3460 ---- a/drivers/hid/hid-multitouch.c
3461 -+++ b/drivers/hid/hid-multitouch.c
3462 -@@ -609,12 +609,20 @@ static const struct hid_device_id mt_devices[] = {
3463 - { .driver_data = MT_CLS_3M,
3464 - HID_USB_DEVICE(USB_VENDOR_ID_3M,
3465 - USB_DEVICE_ID_3M2256) },
3466 -+ { .driver_data = MT_CLS_3M,
3467 -+ HID_USB_DEVICE(USB_VENDOR_ID_3M,
3468 -+ USB_DEVICE_ID_3M3266) },
3469 -
3470 - /* ActionStar panels */
3471 - { .driver_data = MT_CLS_DEFAULT,
3472 - HID_USB_DEVICE(USB_VENDOR_ID_ACTIONSTAR,
3473 - USB_DEVICE_ID_ACTIONSTAR_1011) },
3474 -
3475 -+ /* Atmel panels */
3476 -+ { .driver_data = MT_CLS_SERIAL,
3477 -+ HID_USB_DEVICE(USB_VENDOR_ID_ATMEL,
3478 -+ USB_DEVICE_ID_ATMEL_MULTITOUCH) },
3479 -+
3480 - /* Cando panels */
3481 - { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTNUMBER,
3482 - HID_USB_DEVICE(USB_VENDOR_ID_CANDO,
3483 -@@ -645,23 +653,32 @@ static const struct hid_device_id mt_devices[] = {
3484 - USB_DEVICE_ID_CYPRESS_TRUETOUCH) },
3485 -
3486 - /* eGalax devices (resistive) */
3487 -- { .driver_data = MT_CLS_EGALAX,
3488 -+ { .driver_data = MT_CLS_EGALAX,
3489 - HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
3490 -- USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH) },
3491 -- { .driver_data = MT_CLS_EGALAX,
3492 -+ USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D) },
3493 -+ { .driver_data = MT_CLS_EGALAX,
3494 - HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
3495 -- USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH3) },
3496 -+ USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E) },
3497 -
3498 - /* eGalax devices (capacitive) */
3499 -- { .driver_data = MT_CLS_EGALAX,
3500 -+ { .driver_data = MT_CLS_EGALAX,
3501 -+ HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
3502 -+ USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_720C) },
3503 -+ { .driver_data = MT_CLS_EGALAX,
3504 - HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
3505 -- USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH1) },
3506 -- { .driver_data = MT_CLS_EGALAX,
3507 -+ USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_726B) },
3508 -+ { .driver_data = MT_CLS_EGALAX,
3509 - HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
3510 -- USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH2) },
3511 -- { .driver_data = MT_CLS_EGALAX,
3512 -+ USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72A1) },
3513 -+ { .driver_data = MT_CLS_EGALAX,
3514 - HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
3515 -- USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH4) },
3516 -+ USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_72FA) },
3517 -+ { .driver_data = MT_CLS_EGALAX,
3518 -+ HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
3519 -+ USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7302) },
3520 -+ { .driver_data = MT_CLS_EGALAX,
3521 -+ HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
3522 -+ USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) },
3523 -
3524 - /* Elo TouchSystems IntelliTouch Plus panel */
3525 - { .driver_data = MT_CLS_DUAL_NSMU_CONTACTID,
3526 -@@ -678,6 +695,11 @@ static const struct hid_device_id mt_devices[] = {
3527 - HID_USB_DEVICE(USB_VENDOR_ID_GOODTOUCH,
3528 - USB_DEVICE_ID_GOODTOUCH_000f) },
3529 -
3530 -+ /* Hanvon panels */
3531 -+ { .driver_data = MT_CLS_DUAL_INRANGE_CONTACTID,
3532 -+ HID_USB_DEVICE(USB_VENDOR_ID_HANVON_ALT,
3533 -+ USB_DEVICE_ID_HANVON_ALT_MULTITOUCH) },
3534 -+
3535 - /* Ideacom panel */
3536 - { .driver_data = MT_CLS_SERIAL,
3537 - HID_USB_DEVICE(USB_VENDOR_ID_IDEACOM,
3538 -@@ -758,6 +780,35 @@ static const struct hid_device_id mt_devices[] = {
3539 - HID_USB_DEVICE(USB_VENDOR_ID_XAT,
3540 - USB_DEVICE_ID_XAT_CSR) },
3541 -
3542 -+ /* Xiroku */
3543 -+ { .driver_data = MT_CLS_DEFAULT,
3544 -+ HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
3545 -+ USB_DEVICE_ID_XIROKU_SPX) },
3546 -+ { .driver_data = MT_CLS_DEFAULT,
3547 -+ HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
3548 -+ USB_DEVICE_ID_XIROKU_MPX) },
3549 -+ { .driver_data = MT_CLS_DEFAULT,
3550 -+ HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
3551 -+ USB_DEVICE_ID_XIROKU_CSR) },
3552 -+ { .driver_data = MT_CLS_DEFAULT,
3553 -+ HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
3554 -+ USB_DEVICE_ID_XIROKU_SPX1) },
3555 -+ { .driver_data = MT_CLS_DEFAULT,
3556 -+ HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
3557 -+ USB_DEVICE_ID_XIROKU_MPX1) },
3558 -+ { .driver_data = MT_CLS_DEFAULT,
3559 -+ HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
3560 -+ USB_DEVICE_ID_XIROKU_CSR1) },
3561 -+ { .driver_data = MT_CLS_DEFAULT,
3562 -+ HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
3563 -+ USB_DEVICE_ID_XIROKU_SPX2) },
3564 -+ { .driver_data = MT_CLS_DEFAULT,
3565 -+ HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
3566 -+ USB_DEVICE_ID_XIROKU_MPX2) },
3567 -+ { .driver_data = MT_CLS_DEFAULT,
3568 -+ HID_USB_DEVICE(USB_VENDOR_ID_XIROKU,
3569 -+ USB_DEVICE_ID_XIROKU_CSR2) },
3570 -+
3571 - { }
3572 - };
3573 - MODULE_DEVICE_TABLE(hid, mt_devices);
3574 -diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c
3575 -index b6807db..5b667e5 100644
3576 ---- a/drivers/i2c/busses/i2c-ali1535.c
3577 -+++ b/drivers/i2c/busses/i2c-ali1535.c
3578 -@@ -140,7 +140,7 @@ static unsigned short ali1535_smba;
3579 - defined to make the transition easier. */
3580 - static int __devinit ali1535_setup(struct pci_dev *dev)
3581 - {
3582 -- int retval = -ENODEV;
3583 -+ int retval;
3584 - unsigned char temp;
3585 -
3586 - /* Check the following things:
3587 -@@ -155,6 +155,7 @@ static int __devinit ali1535_setup(struct pci_dev *dev)
3588 - if (ali1535_smba == 0) {
3589 - dev_warn(&dev->dev,
3590 - "ALI1535_smb region uninitialized - upgrade BIOS?\n");
3591 -+ retval = -ENODEV;
3592 - goto exit;
3593 - }
3594 -
3595 -@@ -167,6 +168,7 @@ static int __devinit ali1535_setup(struct pci_dev *dev)
3596 - ali1535_driver.name)) {
3597 - dev_err(&dev->dev, "ALI1535_smb region 0x%x already in use!\n",
3598 - ali1535_smba);
3599 -+ retval = -EBUSY;
3600 - goto exit;
3601 - }
3602 -
3603 -@@ -174,6 +176,7 @@ static int __devinit ali1535_setup(struct pci_dev *dev)
3604 - pci_read_config_byte(dev, SMBCFG, &temp);
3605 - if ((temp & ALI1535_SMBIO_EN) == 0) {
3606 - dev_err(&dev->dev, "SMB device not enabled - upgrade BIOS?\n");
3607 -+ retval = -ENODEV;
3608 - goto exit_free;
3609 - }
3610 -
3611 -@@ -181,6 +184,7 @@ static int __devinit ali1535_setup(struct pci_dev *dev)
3612 - pci_read_config_byte(dev, SMBHSTCFG, &temp);
3613 - if ((temp & 1) == 0) {
3614 - dev_err(&dev->dev, "SMBus controller not enabled - upgrade BIOS?\n");
3615 -+ retval = -ENODEV;
3616 - goto exit_free;
3617 - }
3618 -
3619 -@@ -198,12 +202,11 @@ static int __devinit ali1535_setup(struct pci_dev *dev)
3620 - dev_dbg(&dev->dev, "SMBREV = 0x%X\n", temp);
3621 - dev_dbg(&dev->dev, "ALI1535_smba = 0x%X\n", ali1535_smba);
3622 -
3623 -- retval = 0;
3624 --exit:
3625 -- return retval;
3626 -+ return 0;
3627 -
3628 - exit_free:
3629 - release_region(ali1535_smba, ALI1535_SMB_IOSIZE);
3630 -+exit:
3631 - return retval;
3632 - }
3633 -
3634 -diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
3635 -index 18936ac..730215e 100644
3636 ---- a/drivers/i2c/busses/i2c-eg20t.c
3637 -+++ b/drivers/i2c/busses/i2c-eg20t.c
3638 -@@ -243,7 +243,7 @@ static void pch_i2c_init(struct i2c_algo_pch_data *adap)
3639 - if (pch_clk > PCH_MAX_CLK)
3640 - pch_clk = 62500;
3641 -
3642 -- pch_i2cbc = (pch_clk + (pch_i2c_speed * 4)) / pch_i2c_speed * 8;
3643 -+ pch_i2cbc = (pch_clk + (pch_i2c_speed * 4)) / (pch_i2c_speed * 8);
3644 - /* Set transfer speed in I2CBC */
3645 - iowrite32(pch_i2cbc, p + PCH_I2CBC);
3646 -
3647 -diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
3648 -index ff1e127..4853b52 100644
3649 ---- a/drivers/i2c/busses/i2c-nforce2.c
3650 -+++ b/drivers/i2c/busses/i2c-nforce2.c
3651 -@@ -356,7 +356,7 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar,
3652 - error = acpi_check_region(smbus->base, smbus->size,
3653 - nforce2_driver.name);
3654 - if (error)
3655 -- return -1;
3656 -+ return error;
3657 -
3658 - if (!request_region(smbus->base, smbus->size, nforce2_driver.name)) {
3659 - dev_err(&smbus->adapter.dev, "Error requesting region %02x .. %02X for %s\n",
3660 -diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
3661 -index fa23faa..257c1a5 100644
3662 ---- a/drivers/i2c/busses/i2c-omap.c
3663 -+++ b/drivers/i2c/busses/i2c-omap.c
3664 -@@ -235,7 +235,7 @@ static const u8 reg_map_ip_v2[] = {
3665 - [OMAP_I2C_BUF_REG] = 0x94,
3666 - [OMAP_I2C_CNT_REG] = 0x98,
3667 - [OMAP_I2C_DATA_REG] = 0x9c,
3668 -- [OMAP_I2C_SYSC_REG] = 0x20,
3669 -+ [OMAP_I2C_SYSC_REG] = 0x10,
3670 - [OMAP_I2C_CON_REG] = 0xa4,
3671 - [OMAP_I2C_OA_REG] = 0xa8,
3672 - [OMAP_I2C_SA_REG] = 0xac,
3673 -diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c
3674 -index 4375866..6d60284 100644
3675 ---- a/drivers/i2c/busses/i2c-sis5595.c
3676 -+++ b/drivers/i2c/busses/i2c-sis5595.c
3677 -@@ -147,7 +147,7 @@ static int __devinit sis5595_setup(struct pci_dev *SIS5595_dev)
3678 - u16 a;
3679 - u8 val;
3680 - int *i;
3681 -- int retval = -ENODEV;
3682 -+ int retval;
3683 -
3684 - /* Look for imposters */
3685 - for (i = blacklist; *i != 0; i++) {
3686 -@@ -223,7 +223,7 @@ static int __devinit sis5595_setup(struct pci_dev *SIS5595_dev)
3687 -
3688 - error:
3689 - release_region(sis5595_base + SMB_INDEX, 2);
3690 -- return retval;
3691 -+ return -ENODEV;
3692 - }
3693 -
3694 - static int sis5595_transaction(struct i2c_adapter *adap)
3695 -diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c
3696 -index e6f539e..b617fd0 100644
3697 ---- a/drivers/i2c/busses/i2c-sis630.c
3698 -+++ b/drivers/i2c/busses/i2c-sis630.c
3699 -@@ -393,7 +393,7 @@ static int __devinit sis630_setup(struct pci_dev *sis630_dev)
3700 - {
3701 - unsigned char b;
3702 - struct pci_dev *dummy = NULL;
3703 -- int retval = -ENODEV, i;
3704 -+ int retval, i;
3705 -
3706 - /* check for supported SiS devices */
3707 - for (i=0; supported[i] > 0 ; i++) {
3708 -@@ -418,18 +418,21 @@ static int __devinit sis630_setup(struct pci_dev *sis630_dev)
3709 - */
3710 - if (pci_read_config_byte(sis630_dev, SIS630_BIOS_CTL_REG,&b)) {
3711 - dev_err(&sis630_dev->dev, "Error: Can't read bios ctl reg\n");
3712 -+ retval = -ENODEV;
3713 - goto exit;
3714 - }
3715 - /* if ACPI already enabled , do nothing */
3716 - if (!(b & 0x80) &&
3717 - pci_write_config_byte(sis630_dev, SIS630_BIOS_CTL_REG, b | 0x80)) {
3718 - dev_err(&sis630_dev->dev, "Error: Can't enable ACPI\n");
3719 -+ retval = -ENODEV;
3720 - goto exit;
3721 - }
3722 -
3723 - /* Determine the ACPI base address */
3724 - if (pci_read_config_word(sis630_dev,SIS630_ACPI_BASE_REG,&acpi_base)) {
3725 - dev_err(&sis630_dev->dev, "Error: Can't determine ACPI base address\n");
3726 -+ retval = -ENODEV;
3727 - goto exit;
3728 - }
3729 -
3730 -@@ -445,6 +448,7 @@ static int __devinit sis630_setup(struct pci_dev *sis630_dev)
3731 - sis630_driver.name)) {
3732 - dev_err(&sis630_dev->dev, "SMBus registers 0x%04x-0x%04x already "
3733 - "in use!\n", acpi_base + SMB_STS, acpi_base + SMB_SAA);
3734 -+ retval = -EBUSY;
3735 - goto exit;
3736 - }
3737 -
3738 -diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c
3739 -index 0b012f1..58261d4 100644
3740 ---- a/drivers/i2c/busses/i2c-viapro.c
3741 -+++ b/drivers/i2c/busses/i2c-viapro.c
3742 -@@ -324,7 +324,7 @@ static int __devinit vt596_probe(struct pci_dev *pdev,
3743 - const struct pci_device_id *id)
3744 - {
3745 - unsigned char temp;
3746 -- int error = -ENODEV;
3747 -+ int error;
3748 -
3749 - /* Determine the address of the SMBus areas */
3750 - if (force_addr) {
3751 -@@ -390,6 +390,7 @@ found:
3752 - dev_err(&pdev->dev, "SMBUS: Error: Host SMBus "
3753 - "controller not enabled! - upgrade BIOS or "
3754 - "use force=1\n");
3755 -+ error = -ENODEV;
3756 - goto release_region;
3757 - }
3758 - }
3759 -@@ -422,9 +423,11 @@ found:
3760 - "SMBus Via Pro adapter at %04x", vt596_smba);
3761 -
3762 - vt596_pdev = pci_dev_get(pdev);
3763 -- if (i2c_add_adapter(&vt596_adapter)) {
3764 -+ error = i2c_add_adapter(&vt596_adapter);
3765 -+ if (error) {
3766 - pci_dev_put(vt596_pdev);
3767 - vt596_pdev = NULL;
3768 -+ goto release_region;
3769 - }
3770 -
3771 - /* Always return failure here. This is to allow other drivers to bind
3772 -diff --git a/drivers/ide/ide-floppy_ioctl.c b/drivers/ide/ide-floppy_ioctl.c
3773 -index d267b7a..a22ca84 100644
3774 ---- a/drivers/ide/ide-floppy_ioctl.c
3775 -+++ b/drivers/ide/ide-floppy_ioctl.c
3776 -@@ -292,8 +292,7 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct block_device *bdev,
3777 - * and CDROM_SEND_PACKET (legacy) ioctls
3778 - */
3779 - if (cmd != CDROM_SEND_PACKET && cmd != SCSI_IOCTL_SEND_COMMAND)
3780 -- err = scsi_cmd_ioctl(bdev->bd_disk->queue, bdev->bd_disk,
3781 -- mode, cmd, argp);
3782 -+ err = scsi_cmd_blk_ioctl(bdev, mode, cmd, argp);
3783 -
3784 - if (err == -ENOTTY)
3785 - err = generic_ide_ioctl(drive, bdev, cmd, arg);
3786 -diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
3787 -index 5d2f8e1..5b39216 100644
3788 ---- a/drivers/idle/intel_idle.c
3789 -+++ b/drivers/idle/intel_idle.c
3790 -@@ -348,7 +348,8 @@ static int intel_idle_probe(void)
3791 - cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &mwait_substates);
3792 -
3793 - if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) ||
3794 -- !(ecx & CPUID5_ECX_INTERRUPT_BREAK))
3795 -+ !(ecx & CPUID5_ECX_INTERRUPT_BREAK) ||
3796 -+ !mwait_substates)
3797 - return -ENODEV;
3798 -
3799 - pr_debug(PREFIX "MWAIT substates: 0x%x\n", mwait_substates);
3800 -@@ -394,7 +395,7 @@ static int intel_idle_probe(void)
3801 - if (boot_cpu_has(X86_FEATURE_ARAT)) /* Always Reliable APIC Timer */
3802 - lapic_timer_reliable_states = LAPIC_TIMER_ALWAYS_RELIABLE;
3803 - else {
3804 -- smp_call_function(__setup_broadcast_timer, (void *)true, 1);
3805 -+ on_each_cpu(__setup_broadcast_timer, (void *)true, 1);
3806 - register_cpu_notifier(&setup_broadcast_notifier);
3807 - }
3808 -
3809 -@@ -471,7 +472,7 @@ static int intel_idle_cpuidle_driver_init(void)
3810 - }
3811 -
3812 - if (auto_demotion_disable_flags)
3813 -- smp_call_function(auto_demotion_disable, NULL, 1);
3814 -+ on_each_cpu(auto_demotion_disable, NULL, 1);
3815 -
3816 - return 0;
3817 - }
3818 -@@ -568,7 +569,7 @@ static void __exit intel_idle_exit(void)
3819 - cpuidle_unregister_driver(&intel_idle_driver);
3820 -
3821 - if (lapic_timer_reliable_states != LAPIC_TIMER_ALWAYS_RELIABLE) {
3822 -- smp_call_function(__setup_broadcast_timer, (void *)false, 1);
3823 -+ on_each_cpu(__setup_broadcast_timer, (void *)false, 1);
3824 - unregister_cpu_notifier(&setup_broadcast_notifier);
3825 - }
3826 -
3827 -diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c
3828 -index f84c080..9fb18c1 100644
3829 ---- a/drivers/md/dm-flakey.c
3830 -+++ b/drivers/md/dm-flakey.c
3831 -@@ -368,8 +368,17 @@ static int flakey_status(struct dm_target *ti, status_type_t type,
3832 - static int flakey_ioctl(struct dm_target *ti, unsigned int cmd, unsigned long arg)
3833 - {
3834 - struct flakey_c *fc = ti->private;
3835 -+ struct dm_dev *dev = fc->dev;
3836 -+ int r = 0;
3837 -
3838 -- return __blkdev_driver_ioctl(fc->dev->bdev, fc->dev->mode, cmd, arg);
3839 -+ /*
3840 -+ * Only pass ioctls through if the device sizes match exactly.
3841 -+ */
3842 -+ if (fc->start ||
3843 -+ ti->len != i_size_read(dev->bdev->bd_inode) >> SECTOR_SHIFT)
3844 -+ r = scsi_verify_blk_ioctl(NULL, cmd);
3845 -+
3846 -+ return r ? : __blkdev_driver_ioctl(dev->bdev, dev->mode, cmd, arg);
3847 - }
3848 -
3849 - static int flakey_merge(struct dm_target *ti, struct bvec_merge_data *bvm,
3850 -diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c
3851 -index 3921e3b..9728839 100644
3852 ---- a/drivers/md/dm-linear.c
3853 -+++ b/drivers/md/dm-linear.c
3854 -@@ -116,7 +116,17 @@ static int linear_ioctl(struct dm_target *ti, unsigned int cmd,
3855 - unsigned long arg)
3856 - {
3857 - struct linear_c *lc = (struct linear_c *) ti->private;
3858 -- return __blkdev_driver_ioctl(lc->dev->bdev, lc->dev->mode, cmd, arg);
3859 -+ struct dm_dev *dev = lc->dev;
3860 -+ int r = 0;
3861 -+
3862 -+ /*
3863 -+ * Only pass ioctls through if the device sizes match exactly.
3864 -+ */
3865 -+ if (lc->start ||
3866 -+ ti->len != i_size_read(dev->bdev->bd_inode) >> SECTOR_SHIFT)
3867 -+ r = scsi_verify_blk_ioctl(NULL, cmd);
3868 -+
3869 -+ return r ? : __blkdev_driver_ioctl(dev->bdev, dev->mode, cmd, arg);
3870 - }
3871 -
3872 - static int linear_merge(struct dm_target *ti, struct bvec_merge_data *bvm,
3873 -diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
3874 -index 5e0090e..801d92d 100644
3875 ---- a/drivers/md/dm-mpath.c
3876 -+++ b/drivers/md/dm-mpath.c
3877 -@@ -1520,6 +1520,12 @@ static int multipath_ioctl(struct dm_target *ti, unsigned int cmd,
3878 -
3879 - spin_unlock_irqrestore(&m->lock, flags);
3880 -
3881 -+ /*
3882 -+ * Only pass ioctls through if the device sizes match exactly.
3883 -+ */
3884 -+ if (!r && ti->len != i_size_read(bdev->bd_inode) >> SECTOR_SHIFT)
3885 -+ r = scsi_verify_blk_ioctl(NULL, cmd);
3886 -+
3887 - return r ? : __blkdev_driver_ioctl(bdev, mode, cmd, arg);
3888 - }
3889 -
3890 -diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
3891 -index ede2461..7d9e071 100644
3892 ---- a/drivers/md/raid1.c
3893 -+++ b/drivers/md/raid1.c
3894 -@@ -525,8 +525,17 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect
3895 - if (test_bit(WriteMostly, &rdev->flags)) {
3896 - /* Don't balance among write-mostly, just
3897 - * use the first as a last resort */
3898 -- if (best_disk < 0)
3899 -+ if (best_disk < 0) {
3900 -+ if (is_badblock(rdev, this_sector, sectors,
3901 -+ &first_bad, &bad_sectors)) {
3902 -+ if (first_bad < this_sector)
3903 -+ /* Cannot use this */
3904 -+ continue;
3905 -+ best_good_sectors = first_bad - this_sector;
3906 -+ } else
3907 -+ best_good_sectors = sectors;
3908 - best_disk = disk;
3909 -+ }
3910 - continue;
3911 - }
3912 - /* This is a reasonable device to use. It might
3913 -diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c
3914 -index bcb45be..f0482b2 100644
3915 ---- a/drivers/media/video/cx23885/cx23885-dvb.c
3916 -+++ b/drivers/media/video/cx23885/cx23885-dvb.c
3917 -@@ -940,6 +940,11 @@ static int dvb_register(struct cx23885_tsport *port)
3918 -
3919 - fe = dvb_attach(xc4000_attach, fe0->dvb.frontend,
3920 - &dev->i2c_bus[1].i2c_adap, &cfg);
3921 -+ if (!fe) {
3922 -+ printk(KERN_ERR "%s/2: xc4000 attach failed\n",
3923 -+ dev->name);
3924 -+ goto frontend_detach;
3925 -+ }
3926 - }
3927 - break;
3928 - case CX23885_BOARD_TBS_6920:
3929 -diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
3930 -index 0d719fa..3929d93 100644
3931 ---- a/drivers/media/video/cx88/cx88-cards.c
3932 -+++ b/drivers/media/video/cx88/cx88-cards.c
3933 -@@ -1573,8 +1573,8 @@ static const struct cx88_board cx88_boards[] = {
3934 - .name = "Pinnacle Hybrid PCTV",
3935 - .tuner_type = TUNER_XC2028,
3936 - .tuner_addr = 0x61,
3937 -- .radio_type = TUNER_XC2028,
3938 -- .radio_addr = 0x61,
3939 -+ .radio_type = UNSET,
3940 -+ .radio_addr = ADDR_UNSET,
3941 - .input = { {
3942 - .type = CX88_VMUX_TELEVISION,
3943 - .vmux = 0,
3944 -@@ -1611,8 +1611,8 @@ static const struct cx88_board cx88_boards[] = {
3945 - .name = "Leadtek TV2000 XP Global",
3946 - .tuner_type = TUNER_XC2028,
3947 - .tuner_addr = 0x61,
3948 -- .radio_type = TUNER_XC2028,
3949 -- .radio_addr = 0x61,
3950 -+ .radio_type = UNSET,
3951 -+ .radio_addr = ADDR_UNSET,
3952 - .input = { {
3953 - .type = CX88_VMUX_TELEVISION,
3954 - .vmux = 0,
3955 -@@ -2043,8 +2043,8 @@ static const struct cx88_board cx88_boards[] = {
3956 - .name = "Terratec Cinergy HT PCI MKII",
3957 - .tuner_type = TUNER_XC2028,
3958 - .tuner_addr = 0x61,
3959 -- .radio_type = TUNER_XC2028,
3960 -- .radio_addr = 0x61,
3961 -+ .radio_type = UNSET,
3962 -+ .radio_addr = ADDR_UNSET,
3963 - .input = { {
3964 - .type = CX88_VMUX_TELEVISION,
3965 - .vmux = 0,
3966 -@@ -2082,9 +2082,9 @@ static const struct cx88_board cx88_boards[] = {
3967 - [CX88_BOARD_WINFAST_DTV1800H] = {
3968 - .name = "Leadtek WinFast DTV1800 Hybrid",
3969 - .tuner_type = TUNER_XC2028,
3970 -- .radio_type = TUNER_XC2028,
3971 -+ .radio_type = UNSET,
3972 - .tuner_addr = 0x61,
3973 -- .radio_addr = 0x61,
3974 -+ .radio_addr = ADDR_UNSET,
3975 - /*
3976 - * GPIO setting
3977 - *
3978 -@@ -2123,9 +2123,9 @@ static const struct cx88_board cx88_boards[] = {
3979 - [CX88_BOARD_WINFAST_DTV1800H_XC4000] = {
3980 - .name = "Leadtek WinFast DTV1800 H (XC4000)",
3981 - .tuner_type = TUNER_XC4000,
3982 -- .radio_type = TUNER_XC4000,
3983 -+ .radio_type = UNSET,
3984 - .tuner_addr = 0x61,
3985 -- .radio_addr = 0x61,
3986 -+ .radio_addr = ADDR_UNSET,
3987 - /*
3988 - * GPIO setting
3989 - *
3990 -@@ -2164,9 +2164,9 @@ static const struct cx88_board cx88_boards[] = {
3991 - [CX88_BOARD_WINFAST_DTV2000H_PLUS] = {
3992 - .name = "Leadtek WinFast DTV2000 H PLUS",
3993 - .tuner_type = TUNER_XC4000,
3994 -- .radio_type = TUNER_XC4000,
3995 -+ .radio_type = UNSET,
3996 - .tuner_addr = 0x61,
3997 -- .radio_addr = 0x61,
3998 -+ .radio_addr = ADDR_UNSET,
3999 - /*
4000 - * GPIO
4001 - * 2: 1: mute audio
4002 -diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c
4003 -index dadf11f..cf7788f 100644
4004 ---- a/drivers/media/video/uvc/uvc_v4l2.c
4005 -+++ b/drivers/media/video/uvc/uvc_v4l2.c
4006 -@@ -58,6 +58,15 @@ static int uvc_ioctl_ctrl_map(struct uvc_video_chain *chain,
4007 - break;
4008 -
4009 - case V4L2_CTRL_TYPE_MENU:
4010 -+ /* Prevent excessive memory consumption, as well as integer
4011 -+ * overflows.
4012 -+ */
4013 -+ if (xmap->menu_count == 0 ||
4014 -+ xmap->menu_count > UVC_MAX_CONTROL_MENU_ENTRIES) {
4015 -+ ret = -EINVAL;
4016 -+ goto done;
4017 -+ }
4018 -+
4019 - size = xmap->menu_count * sizeof(*map->menu_info);
4020 - map->menu_info = kmalloc(size, GFP_KERNEL);
4021 - if (map->menu_info == NULL) {
4022 -diff --git a/drivers/media/video/uvc/uvcvideo.h b/drivers/media/video/uvc/uvcvideo.h
4023 -index 4c1392e..bc446ba 100644
4024 ---- a/drivers/media/video/uvc/uvcvideo.h
4025 -+++ b/drivers/media/video/uvc/uvcvideo.h
4026 -@@ -113,6 +113,7 @@
4027 -
4028 - /* Maximum allowed number of control mappings per device */
4029 - #define UVC_MAX_CONTROL_MAPPINGS 1024
4030 -+#define UVC_MAX_CONTROL_MENU_ENTRIES 32
4031 -
4032 - /* Devices quirks */
4033 - #define UVC_QUIRK_STATUS_INTERVAL 0x00000001
4034 -diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
4035 -index e1da8fc..639abee 100644
4036 ---- a/drivers/media/video/v4l2-ioctl.c
4037 -+++ b/drivers/media/video/v4l2-ioctl.c
4038 -@@ -2226,6 +2226,10 @@ static int check_array_args(unsigned int cmd, void *parg, size_t *array_size,
4039 - struct v4l2_ext_controls *ctrls = parg;
4040 -
4041 - if (ctrls->count != 0) {
4042 -+ if (ctrls->count > V4L2_CID_MAX_CTRLS) {
4043 -+ ret = -EINVAL;
4044 -+ break;
4045 -+ }
4046 - *user_ptr = (void __user *)ctrls->controls;
4047 - *kernel_ptr = (void *)&ctrls->controls;
4048 - *array_size = sizeof(struct v4l2_ext_control)
4049 -diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
4050 -index d240427..fb7c27f 100644
4051 ---- a/drivers/mmc/core/mmc.c
4052 -+++ b/drivers/mmc/core/mmc.c
4053 -@@ -1048,7 +1048,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
4054 - *
4055 - * WARNING: eMMC rules are NOT the same as SD DDR
4056 - */
4057 -- if (ddr == EXT_CSD_CARD_TYPE_DDR_1_2V) {
4058 -+ if (ddr == MMC_1_2V_DDR_MODE) {
4059 - err = mmc_set_signal_voltage(host,
4060 - MMC_SIGNAL_VOLTAGE_120, 0);
4061 - if (err)
4062 -diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
4063 -index 19ed580..6ce32a7 100644
4064 ---- a/drivers/mmc/host/sdhci.c
4065 -+++ b/drivers/mmc/host/sdhci.c
4066 -@@ -1364,8 +1364,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
4067 - if ((ios->timing == MMC_TIMING_UHS_SDR50) ||
4068 - (ios->timing == MMC_TIMING_UHS_SDR104) ||
4069 - (ios->timing == MMC_TIMING_UHS_DDR50) ||
4070 -- (ios->timing == MMC_TIMING_UHS_SDR25) ||
4071 -- (ios->timing == MMC_TIMING_UHS_SDR12))
4072 -+ (ios->timing == MMC_TIMING_UHS_SDR25))
4073 - ctrl |= SDHCI_CTRL_HISPD;
4074 -
4075 - ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2);
4076 -@@ -2336,9 +2335,8 @@ int sdhci_suspend_host(struct sdhci_host *host)
4077 - /* Disable tuning since we are suspending */
4078 - if (host->version >= SDHCI_SPEC_300 && host->tuning_count &&
4079 - host->tuning_mode == SDHCI_TUNING_MODE_1) {
4080 -+ del_timer_sync(&host->tuning_timer);
4081 - host->flags &= ~SDHCI_NEEDS_RETUNING;
4082 -- mod_timer(&host->tuning_timer, jiffies +
4083 -- host->tuning_count * HZ);
4084 - }
4085 -
4086 - ret = mmc_suspend_host(host->mmc);
4087 -diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
4088 -index ed8b5e7..424ca5f 100644
4089 ---- a/drivers/mtd/mtd_blkdevs.c
4090 -+++ b/drivers/mtd/mtd_blkdevs.c
4091 -@@ -215,7 +215,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
4092 -
4093 - mutex_lock(&dev->lock);
4094 -
4095 -- if (dev->open++)
4096 -+ if (dev->open)
4097 - goto unlock;
4098 -
4099 - kref_get(&dev->ref);
4100 -@@ -235,6 +235,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)
4101 - goto error_release;
4102 -
4103 - unlock:
4104 -+ dev->open++;
4105 - mutex_unlock(&dev->lock);
4106 - blktrans_dev_put(dev);
4107 - return ret;
4108 -diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
4109 -index 1e2fa62..f3cdce9 100644
4110 ---- a/drivers/mtd/mtdoops.c
4111 -+++ b/drivers/mtd/mtdoops.c
4112 -@@ -253,6 +253,9 @@ static void find_next_position(struct mtdoops_context *cxt)
4113 - size_t retlen;
4114 -
4115 - for (page = 0; page < cxt->oops_pages; page++) {
4116 -+ if (mtd->block_isbad &&
4117 -+ mtd->block_isbad(mtd, page * record_size))
4118 -+ continue;
4119 - /* Assume the page is used */
4120 - mark_page_used(cxt, page);
4121 - ret = mtd->read(mtd, page * record_size, MTDOOPS_HEADER_SIZE,
4122 -@@ -369,7 +372,7 @@ static void mtdoops_notify_add(struct mtd_info *mtd)
4123 -
4124 - /* oops_page_used is a bit field */
4125 - cxt->oops_page_used = vmalloc(DIV_ROUND_UP(mtdoops_pages,
4126 -- BITS_PER_LONG));
4127 -+ BITS_PER_LONG) * sizeof(unsigned long));
4128 - if (!cxt->oops_page_used) {
4129 - printk(KERN_ERR "mtdoops: could not allocate page array\n");
4130 - return;
4131 -diff --git a/drivers/mtd/tests/mtd_stresstest.c b/drivers/mtd/tests/mtd_stresstest.c
4132 -index 52ffd91..811642f 100644
4133 ---- a/drivers/mtd/tests/mtd_stresstest.c
4134 -+++ b/drivers/mtd/tests/mtd_stresstest.c
4135 -@@ -284,6 +284,12 @@ static int __init mtd_stresstest_init(void)
4136 - (unsigned long long)mtd->size, mtd->erasesize,
4137 - pgsize, ebcnt, pgcnt, mtd->oobsize);
4138 -
4139 -+ if (ebcnt < 2) {
4140 -+ printk(PRINT_PREF "error: need at least 2 eraseblocks\n");
4141 -+ err = -ENOSPC;
4142 -+ goto out_put_mtd;
4143 -+ }
4144 -+
4145 - /* Read or write up 2 eraseblocks at a time */
4146 - bufsize = mtd->erasesize * 2;
4147 -
4148 -@@ -322,6 +328,7 @@ out:
4149 - kfree(bbt);
4150 - vfree(writebuf);
4151 - vfree(readbuf);
4152 -+out_put_mtd:
4153 - put_mtd_device(mtd);
4154 - if (err)
4155 - printk(PRINT_PREF "error %d occurred\n", err);
4156 -diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
4157 -index 3320a50..ad76592 100644
4158 ---- a/drivers/mtd/ubi/cdev.c
4159 -+++ b/drivers/mtd/ubi/cdev.c
4160 -@@ -632,6 +632,9 @@ static int verify_mkvol_req(const struct ubi_device *ubi,
4161 - if (req->alignment != 1 && n)
4162 - goto bad;
4163 -
4164 -+ if (!req->name[0] || !req->name_len)
4165 -+ goto bad;
4166 -+
4167 - if (req->name_len > UBI_VOL_NAME_MAX) {
4168 - err = -ENAMETOOLONG;
4169 - goto bad;
4170 -diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h
4171 -index 64fbb00..ead2cd1 100644
4172 ---- a/drivers/mtd/ubi/debug.h
4173 -+++ b/drivers/mtd/ubi/debug.h
4174 -@@ -43,7 +43,10 @@
4175 - pr_debug("UBI DBG " type ": " fmt "\n", ##__VA_ARGS__)
4176 -
4177 - /* Just a debugging messages not related to any specific UBI subsystem */
4178 --#define dbg_msg(fmt, ...) ubi_dbg_msg("msg", fmt, ##__VA_ARGS__)
4179 -+#define dbg_msg(fmt, ...) \
4180 -+ printk(KERN_DEBUG "UBI DBG (pid %d): %s: " fmt "\n", \
4181 -+ current->pid, __func__, ##__VA_ARGS__)
4182 -+
4183 - /* General debugging messages */
4184 - #define dbg_gen(fmt, ...) ubi_dbg_msg("gen", fmt, ##__VA_ARGS__)
4185 - /* Messages from the eraseblock association sub-system */
4186 -diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
4187 -index fb7f19b..cd26da8 100644
4188 ---- a/drivers/mtd/ubi/eba.c
4189 -+++ b/drivers/mtd/ubi/eba.c
4190 -@@ -1028,12 +1028,14 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,
4191 - * 'ubi_wl_put_peb()' function on the @ubi->move_mutex. In turn, we are
4192 - * holding @ubi->move_mutex and go sleep on the LEB lock. So, if the
4193 - * LEB is already locked, we just do not move it and return
4194 -- * %MOVE_CANCEL_RACE, which means that UBI will re-try, but later.
4195 -+ * %MOVE_RETRY. Note, we do not return %MOVE_CANCEL_RACE here because
4196 -+ * we do not know the reasons of the contention - it may be just a
4197 -+ * normal I/O on this LEB, so we want to re-try.
4198 - */
4199 - err = leb_write_trylock(ubi, vol_id, lnum);
4200 - if (err) {
4201 - dbg_wl("contention on LEB %d:%d, cancel", vol_id, lnum);
4202 -- return MOVE_CANCEL_RACE;
4203 -+ return MOVE_RETRY;
4204 - }
4205 -
4206 - /*
4207 -diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
4208 -index dc64c76..d51d75d 100644
4209 ---- a/drivers/mtd/ubi/ubi.h
4210 -+++ b/drivers/mtd/ubi/ubi.h
4211 -@@ -120,6 +120,7 @@ enum {
4212 - * PEB
4213 - * MOVE_CANCEL_BITFLIPS: canceled because a bit-flip was detected in the
4214 - * target PEB
4215 -+ * MOVE_RETRY: retry scrubbing the PEB
4216 - */
4217 - enum {
4218 - MOVE_CANCEL_RACE = 1,
4219 -@@ -127,6 +128,7 @@ enum {
4220 - MOVE_TARGET_RD_ERR,
4221 - MOVE_TARGET_WR_ERR,
4222 - MOVE_CANCEL_BITFLIPS,
4223 -+ MOVE_RETRY,
4224 - };
4225 -
4226 - /**
4227 -diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
4228 -index 9ad18da..890754c 100644
4229 ---- a/drivers/mtd/ubi/vtbl.c
4230 -+++ b/drivers/mtd/ubi/vtbl.c
4231 -@@ -306,7 +306,7 @@ static int create_vtbl(struct ubi_device *ubi, struct ubi_scan_info *si,
4232 - int copy, void *vtbl)
4233 - {
4234 - int err, tries = 0;
4235 -- static struct ubi_vid_hdr *vid_hdr;
4236 -+ struct ubi_vid_hdr *vid_hdr;
4237 - struct ubi_scan_leb *new_seb;
4238 -
4239 - ubi_msg("create volume table (copy #%d)", copy + 1);
4240 -diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
4241 -index 42c684c..0696e36 100644
4242 ---- a/drivers/mtd/ubi/wl.c
4243 -+++ b/drivers/mtd/ubi/wl.c
4244 -@@ -795,7 +795,10 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,
4245 - protect = 1;
4246 - goto out_not_moved;
4247 - }
4248 --
4249 -+ if (err == MOVE_RETRY) {
4250 -+ scrubbing = 1;
4251 -+ goto out_not_moved;
4252 -+ }
4253 - if (err == MOVE_CANCEL_BITFLIPS || err == MOVE_TARGET_WR_ERR ||
4254 - err == MOVE_TARGET_RD_ERR) {
4255 - /*
4256 -@@ -1049,7 +1052,6 @@ static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,
4257 -
4258 - ubi_err("failed to erase PEB %d, error %d", pnum, err);
4259 - kfree(wl_wrk);
4260 -- kmem_cache_free(ubi_wl_entry_slab, e);
4261 -
4262 - if (err == -EINTR || err == -ENOMEM || err == -EAGAIN ||
4263 - err == -EBUSY) {
4264 -@@ -1062,14 +1064,16 @@ static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,
4265 - goto out_ro;
4266 - }
4267 - return err;
4268 -- } else if (err != -EIO) {
4269 -+ }
4270 -+
4271 -+ kmem_cache_free(ubi_wl_entry_slab, e);
4272 -+ if (err != -EIO)
4273 - /*
4274 - * If this is not %-EIO, we have no idea what to do. Scheduling
4275 - * this physical eraseblock for erasure again would cause
4276 - * errors again and again. Well, lets switch to R/O mode.
4277 - */
4278 - goto out_ro;
4279 -- }
4280 -
4281 - /* It is %-EIO, the PEB went bad */
4282 -
4283 -diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
4284 -index dd2625a..f5e063a 100644
4285 ---- a/drivers/net/usb/asix.c
4286 -+++ b/drivers/net/usb/asix.c
4287 -@@ -974,6 +974,7 @@ static int ax88772_link_reset(struct usbnet *dev)
4288 -
4289 - static int ax88772_reset(struct usbnet *dev)
4290 - {
4291 -+ struct asix_data *data = (struct asix_data *)&dev->data;
4292 - int ret, embd_phy;
4293 - u16 rx_ctl;
4294 -
4295 -@@ -1051,6 +1052,13 @@ static int ax88772_reset(struct usbnet *dev)
4296 - goto out;
4297 - }
4298 -
4299 -+ /* Rewrite MAC address */
4300 -+ memcpy(data->mac_addr, dev->net->dev_addr, ETH_ALEN);
4301 -+ ret = asix_write_cmd(dev, AX_CMD_WRITE_NODE_ID, 0, 0, ETH_ALEN,
4302 -+ data->mac_addr);
4303 -+ if (ret < 0)
4304 -+ goto out;
4305 -+
4306 - /* Set RX_CTL to default values with 2k buffer, and enable cactus */
4307 - ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL);
4308 - if (ret < 0)
4309 -@@ -1316,6 +1324,13 @@ static int ax88178_reset(struct usbnet *dev)
4310 - if (ret < 0)
4311 - return ret;
4312 -
4313 -+ /* Rewrite MAC address */
4314 -+ memcpy(data->mac_addr, dev->net->dev_addr, ETH_ALEN);
4315 -+ ret = asix_write_cmd(dev, AX_CMD_WRITE_NODE_ID, 0, 0, ETH_ALEN,
4316 -+ data->mac_addr);
4317 -+ if (ret < 0)
4318 -+ return ret;
4319 -+
4320 - ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL);
4321 - if (ret < 0)
4322 - return ret;
4323 -diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
4324 -index ccde784..f5ae3c6 100644
4325 ---- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
4326 -+++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
4327 -@@ -526,10 +526,11 @@ int ath9k_hw_process_rxdesc_edma(struct ath_hw *ah, struct ath_rx_status *rxs,
4328 - rxs->rs_status |= ATH9K_RXERR_DECRYPT;
4329 - else if (rxsp->status11 & AR_MichaelErr)
4330 - rxs->rs_status |= ATH9K_RXERR_MIC;
4331 -- if (rxsp->status11 & AR_KeyMiss)
4332 -- rxs->rs_status |= ATH9K_RXERR_KEYMISS;
4333 - }
4334 -
4335 -+ if (rxsp->status11 & AR_KeyMiss)
4336 -+ rxs->rs_status |= ATH9K_RXERR_KEYMISS;
4337 -+
4338 - return 0;
4339 - }
4340 - EXPORT_SYMBOL(ath9k_hw_process_rxdesc_edma);
4341 -diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c
4342 -index 9953881..8ddef3e 100644
4343 ---- a/drivers/net/wireless/ath/ath9k/calib.c
4344 -+++ b/drivers/net/wireless/ath/ath9k/calib.c
4345 -@@ -402,6 +402,7 @@ bool ath9k_hw_getnf(struct ath_hw *ah, struct ath9k_channel *chan)
4346 - ah->noise = ath9k_hw_getchan_noise(ah, chan);
4347 - return true;
4348 - }
4349 -+EXPORT_SYMBOL(ath9k_hw_getnf);
4350 -
4351 - void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah,
4352 - struct ath9k_channel *chan)
4353 -diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
4354 -index ecdb6fd..bbcb777 100644
4355 ---- a/drivers/net/wireless/ath/ath9k/mac.c
4356 -+++ b/drivers/net/wireless/ath/ath9k/mac.c
4357 -@@ -621,10 +621,11 @@ int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
4358 - rs->rs_status |= ATH9K_RXERR_DECRYPT;
4359 - else if (ads.ds_rxstatus8 & AR_MichaelErr)
4360 - rs->rs_status |= ATH9K_RXERR_MIC;
4361 -- if (ads.ds_rxstatus8 & AR_KeyMiss)
4362 -- rs->rs_status |= ATH9K_RXERR_KEYMISS;
4363 - }
4364 -
4365 -+ if (ads.ds_rxstatus8 & AR_KeyMiss)
4366 -+ rs->rs_status |= ATH9K_RXERR_KEYMISS;
4367 -+
4368 - return 0;
4369 - }
4370 - EXPORT_SYMBOL(ath9k_hw_rxprocdesc);
4371 -diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
4372 -index a9c5ae7..f76a814 100644
4373 ---- a/drivers/net/wireless/ath/ath9k/main.c
4374 -+++ b/drivers/net/wireless/ath/ath9k/main.c
4375 -@@ -1667,7 +1667,6 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
4376 -
4377 - if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
4378 - struct ieee80211_channel *curchan = hw->conf.channel;
4379 -- struct ath9k_channel old_chan;
4380 - int pos = curchan->hw_value;
4381 - int old_pos = -1;
4382 - unsigned long flags;
4383 -@@ -1693,11 +1692,8 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
4384 - * Preserve the current channel values, before updating
4385 - * the same channel
4386 - */
4387 -- if (old_pos == pos) {
4388 -- memcpy(&old_chan, &sc->sc_ah->channels[pos],
4389 -- sizeof(struct ath9k_channel));
4390 -- ah->curchan = &old_chan;
4391 -- }
4392 -+ if (ah->curchan && (old_pos == pos))
4393 -+ ath9k_hw_getnf(ah, ah->curchan);
4394 -
4395 - ath9k_cmn_update_ichannel(&sc->sc_ah->channels[pos],
4396 - curchan, conf->channel_type);
4397 -diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
4398 -index b282d86..05f2ad1 100644
4399 ---- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
4400 -+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
4401 -@@ -2656,14 +2656,13 @@ int iwl3945_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
4402 - IWL_WARN(priv, "Invalid scan band\n");
4403 - return -EIO;
4404 - }
4405 --
4406 - /*
4407 -- * If active scaning is requested but a certain channel
4408 -- * is marked passive, we can do active scanning if we
4409 -- * detect transmissions.
4410 -+ * If active scaning is requested but a certain channel is marked
4411 -+ * passive, we can do active scanning if we detect transmissions. For
4412 -+ * passive only scanning disable switching to active on any channel.
4413 - */
4414 - scan->good_CRC_th = is_active ? IWL_GOOD_CRC_TH_DEFAULT :
4415 -- IWL_GOOD_CRC_TH_DISABLED;
4416 -+ IWL_GOOD_CRC_TH_NEVER;
4417 -
4418 - len = iwl_legacy_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data,
4419 - vif->addr, priv->scan_request->ie,
4420 -diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
4421 -index 1a52ed2..6465983 100644
4422 ---- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
4423 -+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
4424 -@@ -827,6 +827,7 @@ static int iwl_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt)
4425 - case IEEE80211_SMPS_STATIC:
4426 - case IEEE80211_SMPS_DYNAMIC:
4427 - return IWL_NUM_IDLE_CHAINS_SINGLE;
4428 -+ case IEEE80211_SMPS_AUTOMATIC:
4429 - case IEEE80211_SMPS_OFF:
4430 - return active_cnt;
4431 - default:
4432 -diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
4433 -index 5c7c17c..d552fa3 100644
4434 ---- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
4435 -+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
4436 -@@ -559,6 +559,9 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)
4437 -
4438 - mutex_lock(&priv->shrd->mutex);
4439 -
4440 -+ if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
4441 -+ goto out;
4442 -+
4443 - if (unlikely(test_bit(STATUS_SCANNING, &priv->shrd->status))) {
4444 - IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
4445 - goto out;
4446 -diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
4447 -index da48c8a..837b460 100644
4448 ---- a/drivers/net/wireless/rt2x00/rt2800pci.c
4449 -+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
4450 -@@ -422,7 +422,6 @@ static int rt2800pci_init_queues(struct rt2x00_dev *rt2x00dev)
4451 - static void rt2800pci_toggle_irq(struct rt2x00_dev *rt2x00dev,
4452 - enum dev_state state)
4453 - {
4454 -- int mask = (state == STATE_RADIO_IRQ_ON);
4455 - u32 reg;
4456 - unsigned long flags;
4457 -
4458 -@@ -436,25 +435,14 @@ static void rt2800pci_toggle_irq(struct rt2x00_dev *rt2x00dev,
4459 - }
4460 -
4461 - spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags);
4462 -- rt2x00pci_register_read(rt2x00dev, INT_MASK_CSR, &reg);
4463 -- rt2x00_set_field32(&reg, INT_MASK_CSR_RXDELAYINT, 0);
4464 -- rt2x00_set_field32(&reg, INT_MASK_CSR_TXDELAYINT, 0);
4465 -- rt2x00_set_field32(&reg, INT_MASK_CSR_RX_DONE, mask);
4466 -- rt2x00_set_field32(&reg, INT_MASK_CSR_AC0_DMA_DONE, 0);
4467 -- rt2x00_set_field32(&reg, INT_MASK_CSR_AC1_DMA_DONE, 0);
4468 -- rt2x00_set_field32(&reg, INT_MASK_CSR_AC2_DMA_DONE, 0);
4469 -- rt2x00_set_field32(&reg, INT_MASK_CSR_AC3_DMA_DONE, 0);
4470 -- rt2x00_set_field32(&reg, INT_MASK_CSR_HCCA_DMA_DONE, 0);
4471 -- rt2x00_set_field32(&reg, INT_MASK_CSR_MGMT_DMA_DONE, 0);
4472 -- rt2x00_set_field32(&reg, INT_MASK_CSR_MCU_COMMAND, 0);
4473 -- rt2x00_set_field32(&reg, INT_MASK_CSR_RXTX_COHERENT, 0);
4474 -- rt2x00_set_field32(&reg, INT_MASK_CSR_TBTT, mask);
4475 -- rt2x00_set_field32(&reg, INT_MASK_CSR_PRE_TBTT, mask);
4476 -- rt2x00_set_field32(&reg, INT_MASK_CSR_TX_FIFO_STATUS, mask);
4477 -- rt2x00_set_field32(&reg, INT_MASK_CSR_AUTO_WAKEUP, mask);
4478 -- rt2x00_set_field32(&reg, INT_MASK_CSR_GPTIMER, 0);
4479 -- rt2x00_set_field32(&reg, INT_MASK_CSR_RX_COHERENT, 0);
4480 -- rt2x00_set_field32(&reg, INT_MASK_CSR_TX_COHERENT, 0);
4481 -+ reg = 0;
4482 -+ if (state == STATE_RADIO_IRQ_ON) {
4483 -+ rt2x00_set_field32(&reg, INT_MASK_CSR_RX_DONE, 1);
4484 -+ rt2x00_set_field32(&reg, INT_MASK_CSR_TBTT, 1);
4485 -+ rt2x00_set_field32(&reg, INT_MASK_CSR_PRE_TBTT, 1);
4486 -+ rt2x00_set_field32(&reg, INT_MASK_CSR_TX_FIFO_STATUS, 1);
4487 -+ rt2x00_set_field32(&reg, INT_MASK_CSR_AUTO_WAKEUP, 1);
4488 -+ }
4489 - rt2x00pci_register_write(rt2x00dev, INT_MASK_CSR, reg);
4490 - spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags);
4491 -
4492 -diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/fw.c b/drivers/net/wireless/rtlwifi/rtl8192se/fw.c
4493 -index 6f91a14..3fda6b1 100644
4494 ---- a/drivers/net/wireless/rtlwifi/rtl8192se/fw.c
4495 -+++ b/drivers/net/wireless/rtlwifi/rtl8192se/fw.c
4496 -@@ -196,6 +196,8 @@ static bool _rtl92s_firmware_downloadcode(struct ieee80211_hw *hw,
4497 - /* Allocate skb buffer to contain firmware */
4498 - /* info and tx descriptor info. */
4499 - skb = dev_alloc_skb(frag_length);
4500 -+ if (!skb)
4501 -+ return false;
4502 - skb_reserve(skb, extra_descoffset);
4503 - seg_ptr = (u8 *)skb_put(skb, (u32)(frag_length -
4504 - extra_descoffset));
4505 -@@ -573,6 +575,8 @@ static bool _rtl92s_firmware_set_h2c_cmd(struct ieee80211_hw *hw, u8 h2c_cmd,
4506 -
4507 - len = _rtl92s_get_h2c_cmdlen(MAX_TRANSMIT_BUFFER_SIZE, 1, &cmd_len);
4508 - skb = dev_alloc_skb(len);
4509 -+ if (!skb)
4510 -+ return false;
4511 - cb_desc = (struct rtl_tcb_desc *)(skb->cb);
4512 - cb_desc->queue_index = TXCMD_QUEUE;
4513 - cb_desc->cmd_or_init = DESC_PACKET_TYPE_NORMAL;
4514 -diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
4515 -index 0e6d04d..e3efb43 100644
4516 ---- a/drivers/pci/msi.c
4517 -+++ b/drivers/pci/msi.c
4518 -@@ -870,5 +870,15 @@ EXPORT_SYMBOL(pci_msi_enabled);
4519 -
4520 - void pci_msi_init_pci_dev(struct pci_dev *dev)
4521 - {
4522 -+ int pos;
4523 - INIT_LIST_HEAD(&dev->msi_list);
4524 -+
4525 -+ /* Disable the msi hardware to avoid screaming interrupts
4526 -+ * during boot. This is the power on reset default so
4527 -+ * usually this should be a noop.
4528 -+ */
4529 -+ pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
4530 -+ if (pos)
4531 -+ msi_set_enable(dev, pos, 0);
4532 -+ msix_set_enable(dev, 0);
4533 - }
4534 -diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
4535 -index dfbd5a6..258fef2 100644
4536 ---- a/drivers/pnp/quirks.c
4537 -+++ b/drivers/pnp/quirks.c
4538 -@@ -295,6 +295,45 @@ static void quirk_system_pci_resources(struct pnp_dev *dev)
4539 - }
4540 - }
4541 -
4542 -+#ifdef CONFIG_AMD_NB
4543 -+
4544 -+#include <asm/amd_nb.h>
4545 -+
4546 -+static void quirk_amd_mmconfig_area(struct pnp_dev *dev)
4547 -+{
4548 -+ resource_size_t start, end;
4549 -+ struct pnp_resource *pnp_res;
4550 -+ struct resource *res;
4551 -+ struct resource mmconfig_res, *mmconfig;
4552 -+
4553 -+ mmconfig = amd_get_mmconfig_range(&mmconfig_res);
4554 -+ if (!mmconfig)
4555 -+ return;
4556 -+
4557 -+ list_for_each_entry(pnp_res, &dev->resources, list) {
4558 -+ res = &pnp_res->res;
4559 -+ if (res->end < mmconfig->start || res->start > mmconfig->end ||
4560 -+ (res->start == mmconfig->start && res->end == mmconfig->end))
4561 -+ continue;
4562 -+
4563 -+ dev_info(&dev->dev, FW_BUG
4564 -+ "%pR covers only part of AMD MMCONFIG area %pR; adding more reservations\n",
4565 -+ res, mmconfig);
4566 -+ if (mmconfig->start < res->start) {
4567 -+ start = mmconfig->start;
4568 -+ end = res->start - 1;
4569 -+ pnp_add_mem_resource(dev, start, end, 0);
4570 -+ }
4571 -+ if (mmconfig->end > res->end) {
4572 -+ start = res->end + 1;
4573 -+ end = mmconfig->end;
4574 -+ pnp_add_mem_resource(dev, start, end, 0);
4575 -+ }
4576 -+ break;
4577 -+ }
4578 -+}
4579 -+#endif
4580 -+
4581 - /*
4582 - * PnP Quirks
4583 - * Cards or devices that need some tweaking due to incomplete resource info
4584 -@@ -322,6 +361,9 @@ static struct pnp_fixup pnp_fixups[] = {
4585 - /* PnP resources that might overlap PCI BARs */
4586 - {"PNP0c01", quirk_system_pci_resources},
4587 - {"PNP0c02", quirk_system_pci_resources},
4588 -+#ifdef CONFIG_AMD_NB
4589 -+ {"PNP0c01", quirk_amd_mmconfig_area},
4590 -+#endif
4591 - {""}
4592 - };
4593 -
4594 -diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
4595 -index 8e28625..8a1c031 100644
4596 ---- a/drivers/rtc/interface.c
4597 -+++ b/drivers/rtc/interface.c
4598 -@@ -228,11 +228,11 @@ int __rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
4599 - alarm->time.tm_hour = now.tm_hour;
4600 -
4601 - /* For simplicity, only support date rollover for now */
4602 -- if (alarm->time.tm_mday == -1) {
4603 -+ if (alarm->time.tm_mday < 1 || alarm->time.tm_mday > 31) {
4604 - alarm->time.tm_mday = now.tm_mday;
4605 - missing = day;
4606 - }
4607 -- if (alarm->time.tm_mon == -1) {
4608 -+ if ((unsigned)alarm->time.tm_mon >= 12) {
4609 - alarm->time.tm_mon = now.tm_mon;
4610 - if (missing == none)
4611 - missing = month;
4612 -diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
4613 -index beda04a..0794c72 100644
4614 ---- a/drivers/scsi/mpt2sas/mpt2sas_base.c
4615 -+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
4616 -@@ -65,6 +65,8 @@ static MPT_CALLBACK mpt_callbacks[MPT_MAX_CALLBACKS];
4617 -
4618 - #define FAULT_POLLING_INTERVAL 1000 /* in milliseconds */
4619 -
4620 -+#define MAX_HBA_QUEUE_DEPTH 30000
4621 -+#define MAX_CHAIN_DEPTH 100000
4622 - static int max_queue_depth = -1;
4623 - module_param(max_queue_depth, int, 0);
4624 - MODULE_PARM_DESC(max_queue_depth, " max controller queue depth ");
4625 -@@ -2311,8 +2313,6 @@ _base_release_memory_pools(struct MPT2SAS_ADAPTER *ioc)
4626 - }
4627 - if (ioc->chain_dma_pool)
4628 - pci_pool_destroy(ioc->chain_dma_pool);
4629 -- }
4630 -- if (ioc->chain_lookup) {
4631 - free_pages((ulong)ioc->chain_lookup, ioc->chain_pages);
4632 - ioc->chain_lookup = NULL;
4633 - }
4634 -@@ -2330,9 +2330,7 @@ static int
4635 - _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
4636 - {
4637 - struct mpt2sas_facts *facts;
4638 -- u32 queue_size, queue_diff;
4639 - u16 max_sge_elements;
4640 -- u16 num_of_reply_frames;
4641 - u16 chains_needed_per_io;
4642 - u32 sz, total_sz, reply_post_free_sz;
4643 - u32 retry_sz;
4644 -@@ -2359,7 +2357,8 @@ _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
4645 - max_request_credit = (max_queue_depth < facts->RequestCredit)
4646 - ? max_queue_depth : facts->RequestCredit;
4647 - else
4648 -- max_request_credit = facts->RequestCredit;
4649 -+ max_request_credit = min_t(u16, facts->RequestCredit,
4650 -+ MAX_HBA_QUEUE_DEPTH);
4651 -
4652 - ioc->hba_queue_depth = max_request_credit;
4653 - ioc->hi_priority_depth = facts->HighPriorityCredit;
4654 -@@ -2400,50 +2399,25 @@ _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
4655 - }
4656 - ioc->chains_needed_per_io = chains_needed_per_io;
4657 -
4658 -- /* reply free queue sizing - taking into account for events */
4659 -- num_of_reply_frames = ioc->hba_queue_depth + 32;
4660 --
4661 -- /* number of replies frames can't be a multiple of 16 */
4662 -- /* decrease number of reply frames by 1 */
4663 -- if (!(num_of_reply_frames % 16))
4664 -- num_of_reply_frames--;
4665 --
4666 -- /* calculate number of reply free queue entries
4667 -- * (must be multiple of 16)
4668 -- */
4669 --
4670 -- /* (we know reply_free_queue_depth is not a multiple of 16) */
4671 -- queue_size = num_of_reply_frames;
4672 -- queue_size += 16 - (queue_size % 16);
4673 -- ioc->reply_free_queue_depth = queue_size;
4674 --
4675 -- /* reply descriptor post queue sizing */
4676 -- /* this size should be the number of request frames + number of reply
4677 -- * frames
4678 -- */
4679 --
4680 -- queue_size = ioc->hba_queue_depth + num_of_reply_frames + 1;
4681 -- /* round up to 16 byte boundary */
4682 -- if (queue_size % 16)
4683 -- queue_size += 16 - (queue_size % 16);
4684 --
4685 -- /* check against IOC maximum reply post queue depth */
4686 -- if (queue_size > facts->MaxReplyDescriptorPostQueueDepth) {
4687 -- queue_diff = queue_size -
4688 -- facts->MaxReplyDescriptorPostQueueDepth;
4689 -+ /* reply free queue sizing - taking into account for 64 FW events */
4690 -+ ioc->reply_free_queue_depth = ioc->hba_queue_depth + 64;
4691 -
4692 -- /* round queue_diff up to multiple of 16 */
4693 -- if (queue_diff % 16)
4694 -- queue_diff += 16 - (queue_diff % 16);
4695 --
4696 -- /* adjust hba_queue_depth, reply_free_queue_depth,
4697 -- * and queue_size
4698 -- */
4699 -- ioc->hba_queue_depth -= (queue_diff / 2);
4700 -- ioc->reply_free_queue_depth -= (queue_diff / 2);
4701 -- queue_size = facts->MaxReplyDescriptorPostQueueDepth;
4702 -+ /* align the reply post queue on the next 16 count boundary */
4703 -+ if (!ioc->reply_free_queue_depth % 16)
4704 -+ ioc->reply_post_queue_depth = ioc->reply_free_queue_depth + 16;
4705 -+ else
4706 -+ ioc->reply_post_queue_depth = ioc->reply_free_queue_depth +
4707 -+ 32 - (ioc->reply_free_queue_depth % 16);
4708 -+ if (ioc->reply_post_queue_depth >
4709 -+ facts->MaxReplyDescriptorPostQueueDepth) {
4710 -+ ioc->reply_post_queue_depth = min_t(u16,
4711 -+ (facts->MaxReplyDescriptorPostQueueDepth -
4712 -+ (facts->MaxReplyDescriptorPostQueueDepth % 16)),
4713 -+ (ioc->hba_queue_depth - (ioc->hba_queue_depth % 16)));
4714 -+ ioc->reply_free_queue_depth = ioc->reply_post_queue_depth - 16;
4715 -+ ioc->hba_queue_depth = ioc->reply_free_queue_depth - 64;
4716 - }
4717 -- ioc->reply_post_queue_depth = queue_size;
4718 -+
4719 -
4720 - dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "scatter gather: "
4721 - "sge_in_main_msg(%d), sge_per_chain(%d), sge_per_io(%d), "
4722 -@@ -2529,15 +2503,12 @@ _base_allocate_memory_pools(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
4723 - "depth(%d)\n", ioc->name, ioc->request,
4724 - ioc->scsiio_depth));
4725 -
4726 -- /* loop till the allocation succeeds */
4727 -- do {
4728 -- sz = ioc->chain_depth * sizeof(struct chain_tracker);
4729 -- ioc->chain_pages = get_order(sz);
4730 -- ioc->chain_lookup = (struct chain_tracker *)__get_free_pages(
4731 -- GFP_KERNEL, ioc->chain_pages);
4732 -- if (ioc->chain_lookup == NULL)
4733 -- ioc->chain_depth -= 100;
4734 -- } while (ioc->chain_lookup == NULL);
4735 -+ ioc->chain_depth = min_t(u32, ioc->chain_depth, MAX_CHAIN_DEPTH);
4736 -+ sz = ioc->chain_depth * sizeof(struct chain_tracker);
4737 -+ ioc->chain_pages = get_order(sz);
4738 -+
4739 -+ ioc->chain_lookup = (struct chain_tracker *)__get_free_pages(
4740 -+ GFP_KERNEL, ioc->chain_pages);
4741 - ioc->chain_dma_pool = pci_pool_create("chain pool", ioc->pdev,
4742 - ioc->request_sz, 16, 0);
4743 - if (!ioc->chain_dma_pool) {
4744 -diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
4745 -index d570573..9bc6fb2 100644
4746 ---- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
4747 -+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
4748 -@@ -1007,8 +1007,8 @@ _scsih_get_chain_buffer_tracker(struct MPT2SAS_ADAPTER *ioc, u16 smid)
4749 - spin_lock_irqsave(&ioc->scsi_lookup_lock, flags);
4750 - if (list_empty(&ioc->free_chain_list)) {
4751 - spin_unlock_irqrestore(&ioc->scsi_lookup_lock, flags);
4752 -- printk(MPT2SAS_WARN_FMT "chain buffers not available\n",
4753 -- ioc->name);
4754 -+ dfailprintk(ioc, printk(MPT2SAS_WARN_FMT "chain buffers not "
4755 -+ "available\n", ioc->name));
4756 - return NULL;
4757 - }
4758 - chain_req = list_entry(ioc->free_chain_list.next,
4759 -@@ -6714,6 +6714,7 @@ _scsih_mark_responding_raid_device(struct MPT2SAS_ADAPTER *ioc, u64 wwid,
4760 - } else
4761 - sas_target_priv_data = NULL;
4762 - raid_device->responding = 1;
4763 -+ spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
4764 - starget_printk(KERN_INFO, raid_device->starget,
4765 - "handle(0x%04x), wwid(0x%016llx)\n", handle,
4766 - (unsigned long long)raid_device->wwid);
4767 -@@ -6724,16 +6725,16 @@ _scsih_mark_responding_raid_device(struct MPT2SAS_ADAPTER *ioc, u64 wwid,
4768 - */
4769 - _scsih_init_warpdrive_properties(ioc, raid_device);
4770 - if (raid_device->handle == handle)
4771 -- goto out;
4772 -+ return;
4773 - printk(KERN_INFO "\thandle changed from(0x%04x)!!!\n",
4774 - raid_device->handle);
4775 - raid_device->handle = handle;
4776 - if (sas_target_priv_data)
4777 - sas_target_priv_data->handle = handle;
4778 -- goto out;
4779 -+ return;
4780 - }
4781 - }
4782 -- out:
4783 -+
4784 - spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
4785 - }
4786 -
4787 -diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
4788 -index fa3a591..4b63c73 100644
4789 ---- a/drivers/scsi/sd.c
4790 -+++ b/drivers/scsi/sd.c
4791 -@@ -1074,6 +1074,10 @@ static int sd_ioctl(struct block_device *bdev, fmode_t mode,
4792 - SCSI_LOG_IOCTL(1, sd_printk(KERN_INFO, sdkp, "sd_ioctl: disk=%s, "
4793 - "cmd=0x%x\n", disk->disk_name, cmd));
4794 -
4795 -+ error = scsi_verify_blk_ioctl(bdev, cmd);
4796 -+ if (error < 0)
4797 -+ return error;
4798 -+
4799 - /*
4800 - * If we are in the middle of error recovery, don't let anyone
4801 - * else try and use this device. Also, if error recovery fails, it
4802 -@@ -1096,7 +1100,7 @@ static int sd_ioctl(struct block_device *bdev, fmode_t mode,
4803 - error = scsi_ioctl(sdp, cmd, p);
4804 - break;
4805 - default:
4806 -- error = scsi_cmd_ioctl(disk->queue, disk, mode, cmd, p);
4807 -+ error = scsi_cmd_blk_ioctl(bdev, mode, cmd, p);
4808 - if (error != -ENOTTY)
4809 - break;
4810 - error = scsi_ioctl(sdp, cmd, p);
4811 -@@ -1266,6 +1270,11 @@ static int sd_compat_ioctl(struct block_device *bdev, fmode_t mode,
4812 - unsigned int cmd, unsigned long arg)
4813 - {
4814 - struct scsi_device *sdev = scsi_disk(bdev->bd_disk)->device;
4815 -+ int ret;
4816 -+
4817 -+ ret = scsi_verify_blk_ioctl(bdev, cmd);
4818 -+ if (ret < 0)
4819 -+ return -ENOIOCTLCMD;
4820 -
4821 - /*
4822 - * If we are in the middle of error recovery, don't let anyone
4823 -@@ -1277,8 +1286,6 @@ static int sd_compat_ioctl(struct block_device *bdev, fmode_t mode,
4824 - return -ENODEV;
4825 -
4826 - if (sdev->host->hostt->compat_ioctl) {
4827 -- int ret;
4828 --
4829 - ret = sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg);
4830 -
4831 - return ret;
4832 -diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c
4833 -index b4543f5..36d1ed7 100644
4834 ---- a/drivers/scsi/sym53c8xx_2/sym_glue.c
4835 -+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
4836 -@@ -839,6 +839,10 @@ static void sym53c8xx_slave_destroy(struct scsi_device *sdev)
4837 - struct sym_lcb *lp = sym_lp(tp, sdev->lun);
4838 - unsigned long flags;
4839 -
4840 -+ /* if slave_alloc returned before allocating a sym_lcb, return */
4841 -+ if (!lp)
4842 -+ return;
4843 -+
4844 - spin_lock_irqsave(np->s.host->host_lock, flags);
4845 -
4846 - if (lp->busy_itlq || lp->busy_itl) {
4847 -diff --git a/drivers/target/target_core_cdb.c b/drivers/target/target_core_cdb.c
4848 -index 831468b..2e8c1be 100644
4849 ---- a/drivers/target/target_core_cdb.c
4850 -+++ b/drivers/target/target_core_cdb.c
4851 -@@ -94,6 +94,18 @@ target_emulate_inquiry_std(struct se_cmd *cmd)
4852 - buf[2] = dev->transport->get_device_rev(dev);
4853 -
4854 - /*
4855 -+ * NORMACA and HISUP = 0, RESPONSE DATA FORMAT = 2
4856 -+ *
4857 -+ * SPC4 says:
4858 -+ * A RESPONSE DATA FORMAT field set to 2h indicates that the
4859 -+ * standard INQUIRY data is in the format defined in this
4860 -+ * standard. Response data format values less than 2h are
4861 -+ * obsolete. Response data format values greater than 2h are
4862 -+ * reserved.
4863 -+ */
4864 -+ buf[3] = 2;
4865 -+
4866 -+ /*
4867 - * Enable SCCS and TPGS fields for Emulated ALUA
4868 - */
4869 - if (dev->se_sub_dev->t10_alua.alua_type == SPC3_ALUA_EMULATED)
4870 -diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
4871 -index 0257658..e87d0eb 100644
4872 ---- a/drivers/target/target_core_transport.c
4873 -+++ b/drivers/target/target_core_transport.c
4874 -@@ -4353,6 +4353,7 @@ int transport_send_check_condition_and_sense(
4875 - case TCM_NON_EXISTENT_LUN:
4876 - /* CURRENT ERROR */
4877 - buffer[offset] = 0x70;
4878 -+ buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
4879 - /* ILLEGAL REQUEST */
4880 - buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
4881 - /* LOGICAL UNIT NOT SUPPORTED */
4882 -@@ -4362,6 +4363,7 @@ int transport_send_check_condition_and_sense(
4883 - case TCM_SECTOR_COUNT_TOO_MANY:
4884 - /* CURRENT ERROR */
4885 - buffer[offset] = 0x70;
4886 -+ buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
4887 - /* ILLEGAL REQUEST */
4888 - buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
4889 - /* INVALID COMMAND OPERATION CODE */
4890 -@@ -4370,6 +4372,7 @@ int transport_send_check_condition_and_sense(
4891 - case TCM_UNKNOWN_MODE_PAGE:
4892 - /* CURRENT ERROR */
4893 - buffer[offset] = 0x70;
4894 -+ buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
4895 - /* ILLEGAL REQUEST */
4896 - buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
4897 - /* INVALID FIELD IN CDB */
4898 -@@ -4378,6 +4381,7 @@ int transport_send_check_condition_and_sense(
4899 - case TCM_CHECK_CONDITION_ABORT_CMD:
4900 - /* CURRENT ERROR */
4901 - buffer[offset] = 0x70;
4902 -+ buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
4903 - /* ABORTED COMMAND */
4904 - buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
4905 - /* BUS DEVICE RESET FUNCTION OCCURRED */
4906 -@@ -4387,6 +4391,7 @@ int transport_send_check_condition_and_sense(
4907 - case TCM_INCORRECT_AMOUNT_OF_DATA:
4908 - /* CURRENT ERROR */
4909 - buffer[offset] = 0x70;
4910 -+ buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
4911 - /* ABORTED COMMAND */
4912 - buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
4913 - /* WRITE ERROR */
4914 -@@ -4397,6 +4402,7 @@ int transport_send_check_condition_and_sense(
4915 - case TCM_INVALID_CDB_FIELD:
4916 - /* CURRENT ERROR */
4917 - buffer[offset] = 0x70;
4918 -+ buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
4919 - /* ABORTED COMMAND */
4920 - buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
4921 - /* INVALID FIELD IN CDB */
4922 -@@ -4405,6 +4411,7 @@ int transport_send_check_condition_and_sense(
4923 - case TCM_INVALID_PARAMETER_LIST:
4924 - /* CURRENT ERROR */
4925 - buffer[offset] = 0x70;
4926 -+ buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
4927 - /* ABORTED COMMAND */
4928 - buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
4929 - /* INVALID FIELD IN PARAMETER LIST */
4930 -@@ -4413,6 +4420,7 @@ int transport_send_check_condition_and_sense(
4931 - case TCM_UNEXPECTED_UNSOLICITED_DATA:
4932 - /* CURRENT ERROR */
4933 - buffer[offset] = 0x70;
4934 -+ buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
4935 - /* ABORTED COMMAND */
4936 - buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
4937 - /* WRITE ERROR */
4938 -@@ -4423,6 +4431,7 @@ int transport_send_check_condition_and_sense(
4939 - case TCM_SERVICE_CRC_ERROR:
4940 - /* CURRENT ERROR */
4941 - buffer[offset] = 0x70;
4942 -+ buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
4943 - /* ABORTED COMMAND */
4944 - buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
4945 - /* PROTOCOL SERVICE CRC ERROR */
4946 -@@ -4433,6 +4442,7 @@ int transport_send_check_condition_and_sense(
4947 - case TCM_SNACK_REJECTED:
4948 - /* CURRENT ERROR */
4949 - buffer[offset] = 0x70;
4950 -+ buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
4951 - /* ABORTED COMMAND */
4952 - buffer[offset+SPC_SENSE_KEY_OFFSET] = ABORTED_COMMAND;
4953 - /* READ ERROR */
4954 -@@ -4443,6 +4453,7 @@ int transport_send_check_condition_and_sense(
4955 - case TCM_WRITE_PROTECTED:
4956 - /* CURRENT ERROR */
4957 - buffer[offset] = 0x70;
4958 -+ buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
4959 - /* DATA PROTECT */
4960 - buffer[offset+SPC_SENSE_KEY_OFFSET] = DATA_PROTECT;
4961 - /* WRITE PROTECTED */
4962 -@@ -4451,6 +4462,7 @@ int transport_send_check_condition_and_sense(
4963 - case TCM_CHECK_CONDITION_UNIT_ATTENTION:
4964 - /* CURRENT ERROR */
4965 - buffer[offset] = 0x70;
4966 -+ buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
4967 - /* UNIT ATTENTION */
4968 - buffer[offset+SPC_SENSE_KEY_OFFSET] = UNIT_ATTENTION;
4969 - core_scsi3_ua_for_check_condition(cmd, &asc, &ascq);
4970 -@@ -4460,6 +4472,7 @@ int transport_send_check_condition_and_sense(
4971 - case TCM_CHECK_CONDITION_NOT_READY:
4972 - /* CURRENT ERROR */
4973 - buffer[offset] = 0x70;
4974 -+ buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
4975 - /* Not Ready */
4976 - buffer[offset+SPC_SENSE_KEY_OFFSET] = NOT_READY;
4977 - transport_get_sense_codes(cmd, &asc, &ascq);
4978 -@@ -4470,6 +4483,7 @@ int transport_send_check_condition_and_sense(
4979 - default:
4980 - /* CURRENT ERROR */
4981 - buffer[offset] = 0x70;
4982 -+ buffer[offset+SPC_ADD_SENSE_LEN_OFFSET] = 10;
4983 - /* ILLEGAL REQUEST */
4984 - buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
4985 - /* LOGICAL UNIT COMMUNICATION FAILURE */
4986 -diff --git a/drivers/xen/xenbus/xenbus_xs.c b/drivers/xen/xenbus/xenbus_xs.c
4987 -index ede860f..a580b17 100644
4988 ---- a/drivers/xen/xenbus/xenbus_xs.c
4989 -+++ b/drivers/xen/xenbus/xenbus_xs.c
4990 -@@ -801,6 +801,12 @@ static int process_msg(void)
4991 - goto out;
4992 - }
4993 -
4994 -+ if (msg->hdr.len > XENSTORE_PAYLOAD_MAX) {
4995 -+ kfree(msg);
4996 -+ err = -EINVAL;
4997 -+ goto out;
4998 -+ }
4999 -+
5000 - body = kmalloc(msg->hdr.len + 1, GFP_NOIO | __GFP_HIGH);
5001 - if (body == NULL) {
5002 - kfree(msg);
5003 -diff --git a/fs/aio.c b/fs/aio.c
5004 -index 78c514c..969beb0 100644
5005 ---- a/fs/aio.c
5006 -+++ b/fs/aio.c
5007 -@@ -476,14 +476,21 @@ static void kiocb_batch_init(struct kiocb_batch *batch, long total)
5008 - batch->count = total;
5009 - }
5010 -
5011 --static void kiocb_batch_free(struct kiocb_batch *batch)
5012 -+static void kiocb_batch_free(struct kioctx *ctx, struct kiocb_batch *batch)
5013 - {
5014 - struct kiocb *req, *n;
5015 -
5016 -+ if (list_empty(&batch->head))
5017 -+ return;
5018 -+
5019 -+ spin_lock_irq(&ctx->ctx_lock);
5020 - list_for_each_entry_safe(req, n, &batch->head, ki_batch) {
5021 - list_del(&req->ki_batch);
5022 -+ list_del(&req->ki_list);
5023 - kmem_cache_free(kiocb_cachep, req);
5024 -+ ctx->reqs_active--;
5025 - }
5026 -+ spin_unlock_irq(&ctx->ctx_lock);
5027 - }
5028 -
5029 - /*
5030 -@@ -1742,7 +1749,7 @@ long do_io_submit(aio_context_t ctx_id, long nr,
5031 - }
5032 - blk_finish_plug(&plug);
5033 -
5034 -- kiocb_batch_free(&batch);
5035 -+ kiocb_batch_free(ctx, &batch);
5036 - put_ioctx(ctx);
5037 - return i ? i : ret;
5038 - }
5039 -diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
5040 -index f3670cf..63e4be4 100644
5041 ---- a/fs/cifs/connect.c
5042 -+++ b/fs/cifs/connect.c
5043 -@@ -2914,18 +2914,33 @@ void cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
5044 - #define CIFS_DEFAULT_IOSIZE (1024 * 1024)
5045 -
5046 - /*
5047 -- * Windows only supports a max of 60k reads. Default to that when posix
5048 -- * extensions aren't in force.
5049 -+ * Windows only supports a max of 60kb reads and 65535 byte writes. Default to
5050 -+ * those values when posix extensions aren't in force. In actuality here, we
5051 -+ * use 65536 to allow for a write that is a multiple of 4k. Most servers seem
5052 -+ * to be ok with the extra byte even though Windows doesn't send writes that
5053 -+ * are that large.
5054 -+ *
5055 -+ * Citation:
5056 -+ *
5057 -+ * http://blogs.msdn.com/b/openspecification/archive/2009/04/10/smb-maximum-transmit-buffer-size-and-performance-tuning.aspx
5058 - */
5059 - #define CIFS_DEFAULT_NON_POSIX_RSIZE (60 * 1024)
5060 -+#define CIFS_DEFAULT_NON_POSIX_WSIZE (65536)
5061 -
5062 - static unsigned int
5063 - cifs_negotiate_wsize(struct cifs_tcon *tcon, struct smb_vol *pvolume_info)
5064 - {
5065 - __u64 unix_cap = le64_to_cpu(tcon->fsUnixInfo.Capability);
5066 - struct TCP_Server_Info *server = tcon->ses->server;
5067 -- unsigned int wsize = pvolume_info->wsize ? pvolume_info->wsize :
5068 -- CIFS_DEFAULT_IOSIZE;
5069 -+ unsigned int wsize;
5070 -+
5071 -+ /* start with specified wsize, or default */
5072 -+ if (pvolume_info->wsize)
5073 -+ wsize = pvolume_info->wsize;
5074 -+ else if (tcon->unix_ext && (unix_cap & CIFS_UNIX_LARGE_WRITE_CAP))
5075 -+ wsize = CIFS_DEFAULT_IOSIZE;
5076 -+ else
5077 -+ wsize = CIFS_DEFAULT_NON_POSIX_WSIZE;
5078 -
5079 - /* can server support 24-bit write sizes? (via UNIX extensions) */
5080 - if (!tcon->unix_ext || !(unix_cap & CIFS_UNIX_LARGE_WRITE_CAP))
5081 -diff --git a/fs/dcache.c b/fs/dcache.c
5082 -index 89509b5..f7908ae 100644
5083 ---- a/fs/dcache.c
5084 -+++ b/fs/dcache.c
5085 -@@ -242,6 +242,7 @@ static void dentry_lru_add(struct dentry *dentry)
5086 - static void __dentry_lru_del(struct dentry *dentry)
5087 - {
5088 - list_del_init(&dentry->d_lru);
5089 -+ dentry->d_flags &= ~DCACHE_SHRINK_LIST;
5090 - dentry->d_sb->s_nr_dentry_unused--;
5091 - dentry_stat.nr_unused--;
5092 - }
5093 -@@ -275,15 +276,15 @@ static void dentry_lru_prune(struct dentry *dentry)
5094 - }
5095 - }
5096 -
5097 --static void dentry_lru_move_tail(struct dentry *dentry)
5098 -+static void dentry_lru_move_list(struct dentry *dentry, struct list_head *list)
5099 - {
5100 - spin_lock(&dcache_lru_lock);
5101 - if (list_empty(&dentry->d_lru)) {
5102 -- list_add_tail(&dentry->d_lru, &dentry->d_sb->s_dentry_lru);
5103 -+ list_add_tail(&dentry->d_lru, list);
5104 - dentry->d_sb->s_nr_dentry_unused++;
5105 - dentry_stat.nr_unused++;
5106 - } else {
5107 -- list_move_tail(&dentry->d_lru, &dentry->d_sb->s_dentry_lru);
5108 -+ list_move_tail(&dentry->d_lru, list);
5109 - }
5110 - spin_unlock(&dcache_lru_lock);
5111 - }
5112 -@@ -769,14 +770,18 @@ static void shrink_dentry_list(struct list_head *list)
5113 - }
5114 -
5115 - /**
5116 -- * __shrink_dcache_sb - shrink the dentry LRU on a given superblock
5117 -- * @sb: superblock to shrink dentry LRU.
5118 -- * @count: number of entries to prune
5119 -- * @flags: flags to control the dentry processing
5120 -+ * prune_dcache_sb - shrink the dcache
5121 -+ * @sb: superblock
5122 -+ * @count: number of entries to try to free
5123 -+ *
5124 -+ * Attempt to shrink the superblock dcache LRU by @count entries. This is
5125 -+ * done when we need more memory an called from the superblock shrinker
5126 -+ * function.
5127 - *
5128 -- * If flags contains DCACHE_REFERENCED reference dentries will not be pruned.
5129 -+ * This function may fail to free any resources if all the dentries are in
5130 -+ * use.
5131 - */
5132 --static void __shrink_dcache_sb(struct super_block *sb, int count, int flags)
5133 -+void prune_dcache_sb(struct super_block *sb, int count)
5134 - {
5135 - struct dentry *dentry;
5136 - LIST_HEAD(referenced);
5137 -@@ -795,18 +800,13 @@ relock:
5138 - goto relock;
5139 - }
5140 -
5141 -- /*
5142 -- * If we are honouring the DCACHE_REFERENCED flag and the
5143 -- * dentry has this flag set, don't free it. Clear the flag
5144 -- * and put it back on the LRU.
5145 -- */
5146 -- if (flags & DCACHE_REFERENCED &&
5147 -- dentry->d_flags & DCACHE_REFERENCED) {
5148 -+ if (dentry->d_flags & DCACHE_REFERENCED) {
5149 - dentry->d_flags &= ~DCACHE_REFERENCED;
5150 - list_move(&dentry->d_lru, &referenced);
5151 - spin_unlock(&dentry->d_lock);
5152 - } else {
5153 - list_move_tail(&dentry->d_lru, &tmp);
5154 -+ dentry->d_flags |= DCACHE_SHRINK_LIST;
5155 - spin_unlock(&dentry->d_lock);
5156 - if (!--count)
5157 - break;
5158 -@@ -821,23 +821,6 @@ relock:
5159 - }
5160 -
5161 - /**
5162 -- * prune_dcache_sb - shrink the dcache
5163 -- * @sb: superblock
5164 -- * @nr_to_scan: number of entries to try to free
5165 -- *
5166 -- * Attempt to shrink the superblock dcache LRU by @nr_to_scan entries. This is
5167 -- * done when we need more memory an called from the superblock shrinker
5168 -- * function.
5169 -- *
5170 -- * This function may fail to free any resources if all the dentries are in
5171 -- * use.
5172 -- */
5173 --void prune_dcache_sb(struct super_block *sb, int nr_to_scan)
5174 --{
5175 -- __shrink_dcache_sb(sb, nr_to_scan, DCACHE_REFERENCED);
5176 --}
5177 --
5178 --/**
5179 - * shrink_dcache_sb - shrink dcache for a superblock
5180 - * @sb: superblock
5181 - *
5182 -@@ -1091,7 +1074,7 @@ EXPORT_SYMBOL(have_submounts);
5183 - * drop the lock and return early due to latency
5184 - * constraints.
5185 - */
5186 --static int select_parent(struct dentry * parent)
5187 -+static int select_parent(struct dentry *parent, struct list_head *dispose)
5188 - {
5189 - struct dentry *this_parent;
5190 - struct list_head *next;
5191 -@@ -1113,17 +1096,21 @@ resume:
5192 -
5193 - spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED);
5194 -
5195 -- /*
5196 -- * move only zero ref count dentries to the end
5197 -- * of the unused list for prune_dcache
5198 -+ /*
5199 -+ * move only zero ref count dentries to the dispose list.
5200 -+ *
5201 -+ * Those which are presently on the shrink list, being processed
5202 -+ * by shrink_dentry_list(), shouldn't be moved. Otherwise the
5203 -+ * loop in shrink_dcache_parent() might not make any progress
5204 -+ * and loop forever.
5205 - */
5206 -- if (!dentry->d_count) {
5207 -- dentry_lru_move_tail(dentry);
5208 -- found++;
5209 -- } else {
5210 -+ if (dentry->d_count) {
5211 - dentry_lru_del(dentry);
5212 -+ } else if (!(dentry->d_flags & DCACHE_SHRINK_LIST)) {
5213 -+ dentry_lru_move_list(dentry, dispose);
5214 -+ dentry->d_flags |= DCACHE_SHRINK_LIST;
5215 -+ found++;
5216 - }
5217 --
5218 - /*
5219 - * We can return to the caller if we have found some (this
5220 - * ensures forward progress). We'll be coming back to find
5221 -@@ -1180,14 +1167,13 @@ rename_retry:
5222 - *
5223 - * Prune the dcache to remove unused children of the parent dentry.
5224 - */
5225 --
5226 - void shrink_dcache_parent(struct dentry * parent)
5227 - {
5228 -- struct super_block *sb = parent->d_sb;
5229 -+ LIST_HEAD(dispose);
5230 - int found;
5231 -
5232 -- while ((found = select_parent(parent)) != 0)
5233 -- __shrink_dcache_sb(sb, found, 0);
5234 -+ while ((found = select_parent(parent, &dispose)) != 0)
5235 -+ shrink_dentry_list(&dispose);
5236 - }
5237 - EXPORT_SYMBOL(shrink_dcache_parent);
5238 -
5239 -diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
5240 -index a567968..ab25f57 100644
5241 ---- a/fs/ext4/ioctl.c
5242 -+++ b/fs/ext4/ioctl.c
5243 -@@ -182,19 +182,22 @@ setversion_out:
5244 - if (err)
5245 - return err;
5246 -
5247 -- if (get_user(n_blocks_count, (__u32 __user *)arg))
5248 -- return -EFAULT;
5249 -+ if (get_user(n_blocks_count, (__u32 __user *)arg)) {
5250 -+ err = -EFAULT;
5251 -+ goto group_extend_out;
5252 -+ }
5253 -
5254 - if (EXT4_HAS_RO_COMPAT_FEATURE(sb,
5255 - EXT4_FEATURE_RO_COMPAT_BIGALLOC)) {
5256 - ext4_msg(sb, KERN_ERR,
5257 - "Online resizing not supported with bigalloc");
5258 -- return -EOPNOTSUPP;
5259 -+ err = -EOPNOTSUPP;
5260 -+ goto group_extend_out;
5261 - }
5262 -
5263 - err = mnt_want_write(filp->f_path.mnt);
5264 - if (err)
5265 -- return err;
5266 -+ goto group_extend_out;
5267 -
5268 - err = ext4_group_extend(sb, EXT4_SB(sb)->s_es, n_blocks_count);
5269 - if (EXT4_SB(sb)->s_journal) {
5270 -@@ -204,9 +207,10 @@ setversion_out:
5271 - }
5272 - if (err == 0)
5273 - err = err2;
5274 -+
5275 - mnt_drop_write(filp->f_path.mnt);
5276 -+group_extend_out:
5277 - ext4_resize_end(sb);
5278 --
5279 - return err;
5280 - }
5281 -
5282 -@@ -267,19 +271,22 @@ mext_out:
5283 - return err;
5284 -
5285 - if (copy_from_user(&input, (struct ext4_new_group_input __user *)arg,
5286 -- sizeof(input)))
5287 -- return -EFAULT;
5288 -+ sizeof(input))) {
5289 -+ err = -EFAULT;
5290 -+ goto group_add_out;
5291 -+ }
5292 -
5293 - if (EXT4_HAS_RO_COMPAT_FEATURE(sb,
5294 - EXT4_FEATURE_RO_COMPAT_BIGALLOC)) {
5295 - ext4_msg(sb, KERN_ERR,
5296 - "Online resizing not supported with bigalloc");
5297 -- return -EOPNOTSUPP;
5298 -+ err = -EOPNOTSUPP;
5299 -+ goto group_add_out;
5300 - }
5301 -
5302 - err = mnt_want_write(filp->f_path.mnt);
5303 - if (err)
5304 -- return err;
5305 -+ goto group_add_out;
5306 -
5307 - err = ext4_group_add(sb, &input);
5308 - if (EXT4_SB(sb)->s_journal) {
5309 -@@ -289,9 +296,10 @@ mext_out:
5310 - }
5311 - if (err == 0)
5312 - err = err2;
5313 -+
5314 - mnt_drop_write(filp->f_path.mnt);
5315 -+group_add_out:
5316 - ext4_resize_end(sb);
5317 --
5318 - return err;
5319 - }
5320 -
5321 -diff --git a/fs/ext4/super.c b/fs/ext4/super.c
5322 -index 3e1329e..9281dbe 100644
5323 ---- a/fs/ext4/super.c
5324 -+++ b/fs/ext4/super.c
5325 -@@ -2006,17 +2006,16 @@ static int ext4_fill_flex_info(struct super_block *sb)
5326 - struct ext4_group_desc *gdp = NULL;
5327 - ext4_group_t flex_group_count;
5328 - ext4_group_t flex_group;
5329 -- int groups_per_flex = 0;
5330 -+ unsigned int groups_per_flex = 0;
5331 - size_t size;
5332 - int i;
5333 -
5334 - sbi->s_log_groups_per_flex = sbi->s_es->s_log_groups_per_flex;
5335 -- groups_per_flex = 1 << sbi->s_log_groups_per_flex;
5336 --
5337 -- if (groups_per_flex < 2) {
5338 -+ if (sbi->s_log_groups_per_flex < 1 || sbi->s_log_groups_per_flex > 31) {
5339 - sbi->s_log_groups_per_flex = 0;
5340 - return 1;
5341 - }
5342 -+ groups_per_flex = 1 << sbi->s_log_groups_per_flex;
5343 -
5344 - /* We allocate both existing and potentially added groups */
5345 - flex_group_count = ((sbi->s_groups_count + groups_per_flex - 1) +
5346 -diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
5347 -index 281ae95..3db6b82 100644
5348 ---- a/fs/nfs/blocklayout/blocklayout.c
5349 -+++ b/fs/nfs/blocklayout/blocklayout.c
5350 -@@ -146,14 +146,19 @@ static struct bio *bl_alloc_init_bio(int npg, sector_t isect,
5351 - {
5352 - struct bio *bio;
5353 -
5354 -+ npg = min(npg, BIO_MAX_PAGES);
5355 - bio = bio_alloc(GFP_NOIO, npg);
5356 -- if (!bio)
5357 -- return NULL;
5358 -+ if (!bio && (current->flags & PF_MEMALLOC)) {
5359 -+ while (!bio && (npg /= 2))
5360 -+ bio = bio_alloc(GFP_NOIO, npg);
5361 -+ }
5362 -
5363 -- bio->bi_sector = isect - be->be_f_offset + be->be_v_offset;
5364 -- bio->bi_bdev = be->be_mdev;
5365 -- bio->bi_end_io = end_io;
5366 -- bio->bi_private = par;
5367 -+ if (bio) {
5368 -+ bio->bi_sector = isect - be->be_f_offset + be->be_v_offset;
5369 -+ bio->bi_bdev = be->be_mdev;
5370 -+ bio->bi_end_io = end_io;
5371 -+ bio->bi_private = par;
5372 -+ }
5373 - return bio;
5374 - }
5375 -
5376 -@@ -779,16 +784,13 @@ bl_cleanup_layoutcommit(struct nfs4_layoutcommit_data *lcdata)
5377 - static void free_blk_mountid(struct block_mount_id *mid)
5378 - {
5379 - if (mid) {
5380 -- struct pnfs_block_dev *dev;
5381 -- spin_lock(&mid->bm_lock);
5382 -- while (!list_empty(&mid->bm_devlist)) {
5383 -- dev = list_first_entry(&mid->bm_devlist,
5384 -- struct pnfs_block_dev,
5385 -- bm_node);
5386 -+ struct pnfs_block_dev *dev, *tmp;
5387 -+
5388 -+ /* No need to take bm_lock as we are last user freeing bm_devlist */
5389 -+ list_for_each_entry_safe(dev, tmp, &mid->bm_devlist, bm_node) {
5390 - list_del(&dev->bm_node);
5391 - bl_free_block_dev(dev);
5392 - }
5393 -- spin_unlock(&mid->bm_lock);
5394 - kfree(mid);
5395 - }
5396 - }
5397 -diff --git a/fs/nfs/blocklayout/extents.c b/fs/nfs/blocklayout/extents.c
5398 -index 19fa7b0..c69682a 100644
5399 ---- a/fs/nfs/blocklayout/extents.c
5400 -+++ b/fs/nfs/blocklayout/extents.c
5401 -@@ -139,11 +139,13 @@ static int _set_range(struct my_tree *tree, int32_t tag, u64 s, u64 length)
5402 - }
5403 -
5404 - /* Ensure that future operations on given range of tree will not malloc */
5405 --static int _preload_range(struct my_tree *tree, u64 offset, u64 length)
5406 -+static int _preload_range(struct pnfs_inval_markings *marks,
5407 -+ u64 offset, u64 length)
5408 - {
5409 - u64 start, end, s;
5410 - int count, i, used = 0, status = -ENOMEM;
5411 - struct pnfs_inval_tracking **storage;
5412 -+ struct my_tree *tree = &marks->im_tree;
5413 -
5414 - dprintk("%s(%llu, %llu) enter\n", __func__, offset, length);
5415 - start = normalize(offset, tree->mtt_step_size);
5416 -@@ -161,12 +163,11 @@ static int _preload_range(struct my_tree *tree, u64 offset, u64 length)
5417 - goto out_cleanup;
5418 - }
5419 -
5420 -- /* Now need lock - HOW??? */
5421 --
5422 -+ spin_lock(&marks->im_lock);
5423 - for (s = start; s < end; s += tree->mtt_step_size)
5424 - used += _add_entry(tree, s, INTERNAL_EXISTS, storage[used]);
5425 -+ spin_unlock(&marks->im_lock);
5426 -
5427 -- /* Unlock - HOW??? */
5428 - status = 0;
5429 -
5430 - out_cleanup:
5431 -@@ -286,7 +287,7 @@ int bl_mark_sectors_init(struct pnfs_inval_markings *marks,
5432 -
5433 - start = normalize(offset, marks->im_block_size);
5434 - end = normalize_up(offset + length, marks->im_block_size);
5435 -- if (_preload_range(&marks->im_tree, start, end - start))
5436 -+ if (_preload_range(marks, start, end - start))
5437 - goto outerr;
5438 -
5439 - spin_lock(&marks->im_lock);
5440 -diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
5441 -index 43926ad..54cea8a 100644
5442 ---- a/fs/nfs/callback_proc.c
5443 -+++ b/fs/nfs/callback_proc.c
5444 -@@ -339,7 +339,7 @@ validate_seqid(struct nfs4_slot_table *tbl, struct cb_sequenceargs * args)
5445 - dprintk("%s enter. slotid %d seqid %d\n",
5446 - __func__, args->csa_slotid, args->csa_sequenceid);
5447 -
5448 -- if (args->csa_slotid > NFS41_BC_MAX_CALLBACKS)
5449 -+ if (args->csa_slotid >= NFS41_BC_MAX_CALLBACKS)
5450 - return htonl(NFS4ERR_BADSLOT);
5451 -
5452 - slot = tbl->slots + args->csa_slotid;
5453 -diff --git a/fs/nfs/file.c b/fs/nfs/file.c
5454 -index 606ef0f..c43a452 100644
5455 ---- a/fs/nfs/file.c
5456 -+++ b/fs/nfs/file.c
5457 -@@ -272,13 +272,13 @@ nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync)
5458 - datasync);
5459 -
5460 - ret = filemap_write_and_wait_range(inode->i_mapping, start, end);
5461 -- if (ret)
5462 -- return ret;
5463 - mutex_lock(&inode->i_mutex);
5464 -
5465 - nfs_inc_stats(inode, NFSIOS_VFSFSYNC);
5466 - have_error = test_and_clear_bit(NFS_CONTEXT_ERROR_WRITE, &ctx->flags);
5467 - status = nfs_commit_inode(inode, FLUSH_SYNC);
5468 -+ if (status >= 0 && ret < 0)
5469 -+ status = ret;
5470 - have_error |= test_bit(NFS_CONTEXT_ERROR_WRITE, &ctx->flags);
5471 - if (have_error)
5472 - ret = xchg(&ctx->error, 0);
5473 -diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
5474 -index d9f4d78..055d702 100644
5475 ---- a/fs/nfs/nfs4proc.c
5476 -+++ b/fs/nfs/nfs4proc.c
5477 -@@ -3430,19 +3430,6 @@ static inline int nfs4_server_supports_acls(struct nfs_server *server)
5478 - */
5479 - #define NFS4ACL_MAXPAGES (XATTR_SIZE_MAX >> PAGE_CACHE_SHIFT)
5480 -
5481 --static void buf_to_pages(const void *buf, size_t buflen,
5482 -- struct page **pages, unsigned int *pgbase)
5483 --{
5484 -- const void *p = buf;
5485 --
5486 -- *pgbase = offset_in_page(buf);
5487 -- p -= *pgbase;
5488 -- while (p < buf + buflen) {
5489 -- *(pages++) = virt_to_page(p);
5490 -- p += PAGE_CACHE_SIZE;
5491 -- }
5492 --}
5493 --
5494 - static int buf_to_pages_noslab(const void *buf, size_t buflen,
5495 - struct page **pages, unsigned int *pgbase)
5496 - {
5497 -@@ -3539,9 +3526,19 @@ out:
5498 - nfs4_set_cached_acl(inode, acl);
5499 - }
5500 -
5501 -+/*
5502 -+ * The getxattr API returns the required buffer length when called with a
5503 -+ * NULL buf. The NFSv4 acl tool then calls getxattr again after allocating
5504 -+ * the required buf. On a NULL buf, we send a page of data to the server
5505 -+ * guessing that the ACL request can be serviced by a page. If so, we cache
5506 -+ * up to the page of ACL data, and the 2nd call to getxattr is serviced by
5507 -+ * the cache. If not so, we throw away the page, and cache the required
5508 -+ * length. The next getxattr call will then produce another round trip to
5509 -+ * the server, this time with the input buf of the required size.
5510 -+ */
5511 - static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t buflen)
5512 - {
5513 -- struct page *pages[NFS4ACL_MAXPAGES];
5514 -+ struct page *pages[NFS4ACL_MAXPAGES] = {NULL, };
5515 - struct nfs_getaclargs args = {
5516 - .fh = NFS_FH(inode),
5517 - .acl_pages = pages,
5518 -@@ -3556,41 +3553,60 @@ static ssize_t __nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t bu
5519 - .rpc_argp = &args,
5520 - .rpc_resp = &res,
5521 - };
5522 -- struct page *localpage = NULL;
5523 -- int ret;
5524 -+ int ret = -ENOMEM, npages, i, acl_len = 0;
5525 -
5526 -- if (buflen < PAGE_SIZE) {
5527 -- /* As long as we're doing a round trip to the server anyway,
5528 -- * let's be prepared for a page of acl data. */
5529 -- localpage = alloc_page(GFP_KERNEL);
5530 -- resp_buf = page_address(localpage);
5531 -- if (localpage == NULL)
5532 -- return -ENOMEM;
5533 -- args.acl_pages[0] = localpage;
5534 -- args.acl_pgbase = 0;
5535 -- args.acl_len = PAGE_SIZE;
5536 -- } else {
5537 -- resp_buf = buf;
5538 -- buf_to_pages(buf, buflen, args.acl_pages, &args.acl_pgbase);
5539 -+ npages = (buflen + PAGE_SIZE - 1) >> PAGE_SHIFT;
5540 -+ /* As long as we're doing a round trip to the server anyway,
5541 -+ * let's be prepared for a page of acl data. */
5542 -+ if (npages == 0)
5543 -+ npages = 1;
5544 -+
5545 -+ for (i = 0; i < npages; i++) {
5546 -+ pages[i] = alloc_page(GFP_KERNEL);
5547 -+ if (!pages[i])
5548 -+ goto out_free;
5549 -+ }
5550 -+ if (npages > 1) {
5551 -+ /* for decoding across pages */
5552 -+ args.acl_scratch = alloc_page(GFP_KERNEL);
5553 -+ if (!args.acl_scratch)
5554 -+ goto out_free;
5555 - }
5556 -- ret = nfs4_call_sync(NFS_SERVER(inode)->client, NFS_SERVER(inode), &msg, &args.seq_args, &res.seq_res, 0);
5557 -+ args.acl_len = npages * PAGE_SIZE;
5558 -+ args.acl_pgbase = 0;
5559 -+ /* Let decode_getfacl know not to fail if the ACL data is larger than
5560 -+ * the page we send as a guess */
5561 -+ if (buf == NULL)
5562 -+ res.acl_flags |= NFS4_ACL_LEN_REQUEST;
5563 -+ resp_buf = page_address(pages[0]);
5564 -+
5565 -+ dprintk("%s buf %p buflen %ld npages %d args.acl_len %ld\n",
5566 -+ __func__, buf, buflen, npages, args.acl_len);
5567 -+ ret = nfs4_call_sync(NFS_SERVER(inode)->client, NFS_SERVER(inode),
5568 -+ &msg, &args.seq_args, &res.seq_res, 0);
5569 - if (ret)
5570 - goto out_free;
5571 -- if (res.acl_len > args.acl_len)
5572 -- nfs4_write_cached_acl(inode, NULL, res.acl_len);
5573 -+
5574 -+ acl_len = res.acl_len - res.acl_data_offset;
5575 -+ if (acl_len > args.acl_len)
5576 -+ nfs4_write_cached_acl(inode, NULL, acl_len);
5577 - else
5578 -- nfs4_write_cached_acl(inode, resp_buf, res.acl_len);
5579 -+ nfs4_write_cached_acl(inode, resp_buf + res.acl_data_offset,
5580 -+ acl_len);
5581 - if (buf) {
5582 - ret = -ERANGE;
5583 -- if (res.acl_len > buflen)
5584 -+ if (acl_len > buflen)
5585 - goto out_free;
5586 -- if (localpage)
5587 -- memcpy(buf, resp_buf, res.acl_len);
5588 -+ _copy_from_pages(buf, pages, res.acl_data_offset,
5589 -+ res.acl_len);
5590 - }
5591 -- ret = res.acl_len;
5592 -+ ret = acl_len;
5593 - out_free:
5594 -- if (localpage)
5595 -- __free_page(localpage);
5596 -+ for (i = 0; i < npages; i++)
5597 -+ if (pages[i])
5598 -+ __free_page(pages[i]);
5599 -+ if (args.acl_scratch)
5600 -+ __free_page(args.acl_scratch);
5601 - return ret;
5602 - }
5603 -
5604 -@@ -3621,6 +3637,8 @@ static ssize_t nfs4_proc_get_acl(struct inode *inode, void *buf, size_t buflen)
5605 - nfs_zap_acl_cache(inode);
5606 - ret = nfs4_read_cached_acl(inode, buf, buflen);
5607 - if (ret != -ENOENT)
5608 -+ /* -ENOENT is returned if there is no ACL or if there is an ACL
5609 -+ * but no cached acl data, just the acl length */
5610 - return ret;
5611 - return nfs4_get_acl_uncached(inode, buf, buflen);
5612 - }
5613 -diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
5614 -index e6161b2..dcaf693 100644
5615 ---- a/fs/nfs/nfs4xdr.c
5616 -+++ b/fs/nfs/nfs4xdr.c
5617 -@@ -2517,11 +2517,13 @@ static void nfs4_xdr_enc_getacl(struct rpc_rqst *req, struct xdr_stream *xdr,
5618 - encode_compound_hdr(xdr, req, &hdr);
5619 - encode_sequence(xdr, &args->seq_args, &hdr);
5620 - encode_putfh(xdr, args->fh, &hdr);
5621 -- replen = hdr.replen + op_decode_hdr_maxsz + nfs4_fattr_bitmap_maxsz + 1;
5622 -+ replen = hdr.replen + op_decode_hdr_maxsz + 1;
5623 - encode_getattr_two(xdr, FATTR4_WORD0_ACL, 0, &hdr);
5624 -
5625 - xdr_inline_pages(&req->rq_rcv_buf, replen << 2,
5626 - args->acl_pages, args->acl_pgbase, args->acl_len);
5627 -+ xdr_set_scratch_buffer(xdr, page_address(args->acl_scratch), PAGE_SIZE);
5628 -+
5629 - encode_nops(&hdr);
5630 - }
5631 -
5632 -@@ -4957,17 +4959,18 @@ decode_restorefh(struct xdr_stream *xdr)
5633 - }
5634 -
5635 - static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req,
5636 -- size_t *acl_len)
5637 -+ struct nfs_getaclres *res)
5638 - {
5639 -- __be32 *savep;
5640 -+ __be32 *savep, *bm_p;
5641 - uint32_t attrlen,
5642 - bitmap[3] = {0};
5643 - struct kvec *iov = req->rq_rcv_buf.head;
5644 - int status;
5645 -
5646 -- *acl_len = 0;
5647 -+ res->acl_len = 0;
5648 - if ((status = decode_op_hdr(xdr, OP_GETATTR)) != 0)
5649 - goto out;
5650 -+ bm_p = xdr->p;
5651 - if ((status = decode_attr_bitmap(xdr, bitmap)) != 0)
5652 - goto out;
5653 - if ((status = decode_attr_length(xdr, &attrlen, &savep)) != 0)
5654 -@@ -4979,18 +4982,30 @@ static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req,
5655 - size_t hdrlen;
5656 - u32 recvd;
5657 -
5658 -+ /* The bitmap (xdr len + bitmaps) and the attr xdr len words
5659 -+ * are stored with the acl data to handle the problem of
5660 -+ * variable length bitmaps.*/
5661 -+ xdr->p = bm_p;
5662 -+ res->acl_data_offset = be32_to_cpup(bm_p) + 2;
5663 -+ res->acl_data_offset <<= 2;
5664 -+
5665 - /* We ignore &savep and don't do consistency checks on
5666 - * the attr length. Let userspace figure it out.... */
5667 - hdrlen = (u8 *)xdr->p - (u8 *)iov->iov_base;
5668 -+ attrlen += res->acl_data_offset;
5669 - recvd = req->rq_rcv_buf.len - hdrlen;
5670 - if (attrlen > recvd) {
5671 -- dprintk("NFS: server cheating in getattr"
5672 -- " acl reply: attrlen %u > recvd %u\n",
5673 -+ if (res->acl_flags & NFS4_ACL_LEN_REQUEST) {
5674 -+ /* getxattr interface called with a NULL buf */
5675 -+ res->acl_len = attrlen;
5676 -+ goto out;
5677 -+ }
5678 -+ dprintk("NFS: acl reply: attrlen %u > recvd %u\n",
5679 - attrlen, recvd);
5680 - return -EINVAL;
5681 - }
5682 - xdr_read_pages(xdr, attrlen);
5683 -- *acl_len = attrlen;
5684 -+ res->acl_len = attrlen;
5685 - } else
5686 - status = -EOPNOTSUPP;
5687 -
5688 -@@ -6028,7 +6043,7 @@ nfs4_xdr_dec_getacl(struct rpc_rqst *rqstp, struct xdr_stream *xdr,
5689 - status = decode_putfh(xdr);
5690 - if (status)
5691 - goto out;
5692 -- status = decode_getacl(xdr, rqstp, &res->acl_len);
5693 -+ status = decode_getacl(xdr, rqstp, res);
5694 -
5695 - out:
5696 - return status;
5697 -diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
5698 -index c807ab9..55d0128 100644
5699 ---- a/fs/nfs/objlayout/objio_osd.c
5700 -+++ b/fs/nfs/objlayout/objio_osd.c
5701 -@@ -551,7 +551,8 @@ static const struct nfs_pageio_ops objio_pg_write_ops = {
5702 - static struct pnfs_layoutdriver_type objlayout_type = {
5703 - .id = LAYOUT_OSD2_OBJECTS,
5704 - .name = "LAYOUT_OSD2_OBJECTS",
5705 -- .flags = PNFS_LAYOUTRET_ON_SETATTR,
5706 -+ .flags = PNFS_LAYOUTRET_ON_SETATTR |
5707 -+ PNFS_LAYOUTRET_ON_ERROR,
5708 -
5709 - .alloc_layout_hdr = objlayout_alloc_layout_hdr,
5710 - .free_layout_hdr = objlayout_free_layout_hdr,
5711 -diff --git a/fs/nfs/objlayout/objlayout.c b/fs/nfs/objlayout/objlayout.c
5712 -index 72074e3..b3c2903 100644
5713 ---- a/fs/nfs/objlayout/objlayout.c
5714 -+++ b/fs/nfs/objlayout/objlayout.c
5715 -@@ -254,6 +254,8 @@ objlayout_read_done(struct objlayout_io_res *oir, ssize_t status, bool sync)
5716 - oir->status = rdata->task.tk_status = status;
5717 - if (status >= 0)
5718 - rdata->res.count = status;
5719 -+ else
5720 -+ rdata->pnfs_error = status;
5721 - objlayout_iodone(oir);
5722 - /* must not use oir after this point */
5723 -
5724 -@@ -334,6 +336,8 @@ objlayout_write_done(struct objlayout_io_res *oir, ssize_t status, bool sync)
5725 - if (status >= 0) {
5726 - wdata->res.count = status;
5727 - wdata->verf.committed = oir->committed;
5728 -+ } else {
5729 -+ wdata->pnfs_error = status;
5730 - }
5731 - objlayout_iodone(oir);
5732 - /* must not use oir after this point */
5733 -diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
5734 -index 8e672a2..f881a63 100644
5735 ---- a/fs/nfs/pnfs.c
5736 -+++ b/fs/nfs/pnfs.c
5737 -@@ -1178,6 +1178,15 @@ void pnfs_ld_write_done(struct nfs_write_data *data)
5738 - put_lseg(data->lseg);
5739 - data->lseg = NULL;
5740 - dprintk("pnfs write error = %d\n", data->pnfs_error);
5741 -+ if (NFS_SERVER(data->inode)->pnfs_curr_ld->flags &
5742 -+ PNFS_LAYOUTRET_ON_ERROR) {
5743 -+ /* Don't lo_commit on error, Server will needs to
5744 -+ * preform a file recovery.
5745 -+ */
5746 -+ clear_bit(NFS_INO_LAYOUTCOMMIT,
5747 -+ &NFS_I(data->inode)->flags);
5748 -+ pnfs_return_layout(data->inode);
5749 -+ }
5750 - }
5751 - data->mds_ops->rpc_release(data);
5752 - }
5753 -@@ -1267,6 +1276,9 @@ static void pnfs_ld_handle_read_error(struct nfs_read_data *data)
5754 - put_lseg(data->lseg);
5755 - data->lseg = NULL;
5756 - dprintk("pnfs write error = %d\n", data->pnfs_error);
5757 -+ if (NFS_SERVER(data->inode)->pnfs_curr_ld->flags &
5758 -+ PNFS_LAYOUTRET_ON_ERROR)
5759 -+ pnfs_return_layout(data->inode);
5760 -
5761 - nfs_pageio_init_read_mds(&pgio, data->inode);
5762 -
5763 -diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
5764 -index 1509530..53d593a 100644
5765 ---- a/fs/nfs/pnfs.h
5766 -+++ b/fs/nfs/pnfs.h
5767 -@@ -68,6 +68,7 @@ enum {
5768 - enum layoutdriver_policy_flags {
5769 - /* Should the pNFS client commit and return the layout upon a setattr */
5770 - PNFS_LAYOUTRET_ON_SETATTR = 1 << 0,
5771 -+ PNFS_LAYOUTRET_ON_ERROR = 1 << 1,
5772 - };
5773 -
5774 - struct nfs4_deviceid_node;
5775 -diff --git a/fs/nfs/super.c b/fs/nfs/super.c
5776 -index 1347774..3ada13c 100644
5777 ---- a/fs/nfs/super.c
5778 -+++ b/fs/nfs/super.c
5779 -@@ -909,10 +909,24 @@ static struct nfs_parsed_mount_data *nfs_alloc_parsed_mount_data(unsigned int ve
5780 - data->auth_flavor_len = 1;
5781 - data->version = version;
5782 - data->minorversion = 0;
5783 -+ security_init_mnt_opts(&data->lsm_opts);
5784 - }
5785 - return data;
5786 - }
5787 -
5788 -+static void nfs_free_parsed_mount_data(struct nfs_parsed_mount_data *data)
5789 -+{
5790 -+ if (data) {
5791 -+ kfree(data->client_address);
5792 -+ kfree(data->mount_server.hostname);
5793 -+ kfree(data->nfs_server.export_path);
5794 -+ kfree(data->nfs_server.hostname);
5795 -+ kfree(data->fscache_uniq);
5796 -+ security_free_mnt_opts(&data->lsm_opts);
5797 -+ kfree(data);
5798 -+ }
5799 -+}
5800 -+
5801 - /*
5802 - * Sanity-check a server address provided by the mount command.
5803 - *
5804 -@@ -2220,9 +2234,7 @@ static struct dentry *nfs_fs_mount(struct file_system_type *fs_type,
5805 - data = nfs_alloc_parsed_mount_data(NFS_DEFAULT_VERSION);
5806 - mntfh = nfs_alloc_fhandle();
5807 - if (data == NULL || mntfh == NULL)
5808 -- goto out_free_fh;
5809 --
5810 -- security_init_mnt_opts(&data->lsm_opts);
5811 -+ goto out;
5812 -
5813 - /* Validate the mount data */
5814 - error = nfs_validate_mount_data(raw_data, data, mntfh, dev_name);
5815 -@@ -2234,8 +2246,6 @@ static struct dentry *nfs_fs_mount(struct file_system_type *fs_type,
5816 - #ifdef CONFIG_NFS_V4
5817 - if (data->version == 4) {
5818 - mntroot = nfs4_try_mount(flags, dev_name, data);
5819 -- kfree(data->client_address);
5820 -- kfree(data->nfs_server.export_path);
5821 - goto out;
5822 - }
5823 - #endif /* CONFIG_NFS_V4 */
5824 -@@ -2290,13 +2300,8 @@ static struct dentry *nfs_fs_mount(struct file_system_type *fs_type,
5825 - s->s_flags |= MS_ACTIVE;
5826 -
5827 - out:
5828 -- kfree(data->nfs_server.hostname);
5829 -- kfree(data->mount_server.hostname);
5830 -- kfree(data->fscache_uniq);
5831 -- security_free_mnt_opts(&data->lsm_opts);
5832 --out_free_fh:
5833 -+ nfs_free_parsed_mount_data(data);
5834 - nfs_free_fhandle(mntfh);
5835 -- kfree(data);
5836 - return mntroot;
5837 -
5838 - out_err_nosb:
5839 -@@ -2623,9 +2628,7 @@ nfs4_remote_mount(struct file_system_type *fs_type, int flags,
5840 -
5841 - mntfh = nfs_alloc_fhandle();
5842 - if (data == NULL || mntfh == NULL)
5843 -- goto out_free_fh;
5844 --
5845 -- security_init_mnt_opts(&data->lsm_opts);
5846 -+ goto out;
5847 -
5848 - /* Get a volume representation */
5849 - server = nfs4_create_server(data, mntfh);
5850 -@@ -2677,13 +2680,10 @@ nfs4_remote_mount(struct file_system_type *fs_type, int flags,
5851 -
5852 - s->s_flags |= MS_ACTIVE;
5853 -
5854 -- security_free_mnt_opts(&data->lsm_opts);
5855 - nfs_free_fhandle(mntfh);
5856 - return mntroot;
5857 -
5858 - out:
5859 -- security_free_mnt_opts(&data->lsm_opts);
5860 --out_free_fh:
5861 - nfs_free_fhandle(mntfh);
5862 - return ERR_PTR(error);
5863 -
5864 -@@ -2838,7 +2838,7 @@ static struct dentry *nfs4_mount(struct file_system_type *fs_type,
5865 -
5866 - data = nfs_alloc_parsed_mount_data(4);
5867 - if (data == NULL)
5868 -- goto out_free_data;
5869 -+ goto out;
5870 -
5871 - /* Validate the mount data */
5872 - error = nfs4_validate_mount_data(raw_data, data, dev_name);
5873 -@@ -2852,12 +2852,7 @@ static struct dentry *nfs4_mount(struct file_system_type *fs_type,
5874 - error = PTR_ERR(res);
5875 -
5876 - out:
5877 -- kfree(data->client_address);
5878 -- kfree(data->nfs_server.export_path);
5879 -- kfree(data->nfs_server.hostname);
5880 -- kfree(data->fscache_uniq);
5881 --out_free_data:
5882 -- kfree(data);
5883 -+ nfs_free_parsed_mount_data(data);
5884 - dprintk("<-- nfs4_mount() = %d%s\n", error,
5885 - error != 0 ? " [error]" : "");
5886 - return res;
5887 -diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
5888 -index 62f3b90..5f312ab 100644
5889 ---- a/fs/nfsd/export.c
5890 -+++ b/fs/nfsd/export.c
5891 -@@ -87,7 +87,7 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
5892 - struct svc_expkey key;
5893 - struct svc_expkey *ek = NULL;
5894 -
5895 -- if (mesg[mlen-1] != '\n')
5896 -+ if (mlen < 1 || mesg[mlen-1] != '\n')
5897 - return -EINVAL;
5898 - mesg[mlen-1] = 0;
5899 -
5900 -diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
5901 -index 47e94e3..5abced7 100644
5902 ---- a/fs/nfsd/nfs4state.c
5903 -+++ b/fs/nfsd/nfs4state.c
5904 -@@ -3809,16 +3809,29 @@ nevermind:
5905 - deny->ld_type = NFS4_WRITE_LT;
5906 - }
5907 -
5908 -+static bool same_lockowner_ino(struct nfs4_lockowner *lo, struct inode *inode, clientid_t *clid, struct xdr_netobj *owner)
5909 -+{
5910 -+ struct nfs4_ol_stateid *lst;
5911 -+
5912 -+ if (!same_owner_str(&lo->lo_owner, owner, clid))
5913 -+ return false;
5914 -+ lst = list_first_entry(&lo->lo_owner.so_stateids,
5915 -+ struct nfs4_ol_stateid, st_perstateowner);
5916 -+ return lst->st_file->fi_inode == inode;
5917 -+}
5918 -+
5919 - static struct nfs4_lockowner *
5920 - find_lockowner_str(struct inode *inode, clientid_t *clid,
5921 - struct xdr_netobj *owner)
5922 - {
5923 - unsigned int hashval = lock_ownerstr_hashval(inode, clid->cl_id, owner);
5924 -+ struct nfs4_lockowner *lo;
5925 - struct nfs4_stateowner *op;
5926 -
5927 - list_for_each_entry(op, &lock_ownerstr_hashtbl[hashval], so_strhash) {
5928 -- if (same_owner_str(op, owner, clid))
5929 -- return lockowner(op);
5930 -+ lo = lockowner(op);
5931 -+ if (same_lockowner_ino(lo, inode, clid, owner))
5932 -+ return lo;
5933 - }
5934 - return NULL;
5935 - }
5936 -diff --git a/fs/notify/mark.c b/fs/notify/mark.c
5937 -index e14587d..f104d56 100644
5938 ---- a/fs/notify/mark.c
5939 -+++ b/fs/notify/mark.c
5940 -@@ -135,9 +135,6 @@ void fsnotify_destroy_mark(struct fsnotify_mark *mark)
5941 -
5942 - mark->flags &= ~FSNOTIFY_MARK_FLAG_ALIVE;
5943 -
5944 -- /* 1 from caller and 1 for being on i_list/g_list */
5945 -- BUG_ON(atomic_read(&mark->refcnt) < 2);
5946 --
5947 - spin_lock(&group->mark_lock);
5948 -
5949 - if (mark->flags & FSNOTIFY_MARK_FLAG_INODE) {
5950 -@@ -182,6 +179,11 @@ void fsnotify_destroy_mark(struct fsnotify_mark *mark)
5951 - iput(inode);
5952 -
5953 - /*
5954 -+ * We don't necessarily have a ref on mark from caller so the above iput
5955 -+ * may have already destroyed it. Don't touch from now on.
5956 -+ */
5957 -+
5958 -+ /*
5959 - * it's possible that this group tried to destroy itself, but this
5960 - * this mark was simultaneously being freed by inode. If that's the
5961 - * case, we finish freeing the group here.
5962 -diff --git a/fs/proc/base.c b/fs/proc/base.c
5963 -index 851ba3d..1fc1dca 100644
5964 ---- a/fs/proc/base.c
5965 -+++ b/fs/proc/base.c
5966 -@@ -194,65 +194,7 @@ static int proc_root_link(struct inode *inode, struct path *path)
5967 - return result;
5968 - }
5969 -
5970 --static struct mm_struct *__check_mem_permission(struct task_struct *task)
5971 --{
5972 -- struct mm_struct *mm;
5973 --
5974 -- mm = get_task_mm(task);
5975 -- if (!mm)
5976 -- return ERR_PTR(-EINVAL);
5977 --
5978 -- /*
5979 -- * A task can always look at itself, in case it chooses
5980 -- * to use system calls instead of load instructions.
5981 -- */
5982 -- if (task == current)
5983 -- return mm;
5984 --
5985 -- /*
5986 -- * If current is actively ptrace'ing, and would also be
5987 -- * permitted to freshly attach with ptrace now, permit it.
5988 -- */
5989 -- if (task_is_stopped_or_traced(task)) {
5990 -- int match;
5991 -- rcu_read_lock();
5992 -- match = (ptrace_parent(task) == current);
5993 -- rcu_read_unlock();
5994 -- if (match && ptrace_may_access(task, PTRACE_MODE_ATTACH))
5995 -- return mm;
5996 -- }
5997 --
5998 -- /*
5999 -- * No one else is allowed.
6000 -- */
6001 -- mmput(mm);
6002 -- return ERR_PTR(-EPERM);
6003 --}
6004 --
6005 --/*
6006 -- * If current may access user memory in @task return a reference to the
6007 -- * corresponding mm, otherwise ERR_PTR.
6008 -- */
6009 --static struct mm_struct *check_mem_permission(struct task_struct *task)
6010 --{
6011 -- struct mm_struct *mm;
6012 -- int err;
6013 --
6014 -- /*
6015 -- * Avoid racing if task exec's as we might get a new mm but validate
6016 -- * against old credentials.
6017 -- */
6018 -- err = mutex_lock_killable(&task->signal->cred_guard_mutex);
6019 -- if (err)
6020 -- return ERR_PTR(err);
6021 --
6022 -- mm = __check_mem_permission(task);
6023 -- mutex_unlock(&task->signal->cred_guard_mutex);
6024 --
6025 -- return mm;
6026 --}
6027 --
6028 --struct mm_struct *mm_for_maps(struct task_struct *task)
6029 -+static struct mm_struct *mm_access(struct task_struct *task, unsigned int mode)
6030 - {
6031 - struct mm_struct *mm;
6032 - int err;
6033 -@@ -263,7 +205,7 @@ struct mm_struct *mm_for_maps(struct task_struct *task)
6034 -
6035 - mm = get_task_mm(task);
6036 - if (mm && mm != current->mm &&
6037 -- !ptrace_may_access(task, PTRACE_MODE_READ)) {
6038 -+ !ptrace_may_access(task, mode)) {
6039 - mmput(mm);
6040 - mm = ERR_PTR(-EACCES);
6041 - }
6042 -@@ -272,6 +214,11 @@ struct mm_struct *mm_for_maps(struct task_struct *task)
6043 - return mm;
6044 - }
6045 -
6046 -+struct mm_struct *mm_for_maps(struct task_struct *task)
6047 -+{
6048 -+ return mm_access(task, PTRACE_MODE_READ);
6049 -+}
6050 -+
6051 - static int proc_pid_cmdline(struct task_struct *task, char * buffer)
6052 - {
6053 - int res = 0;
6054 -@@ -816,38 +763,39 @@ static const struct file_operations proc_single_file_operations = {
6055 -
6056 - static int mem_open(struct inode* inode, struct file* file)
6057 - {
6058 -- file->private_data = (void*)((long)current->self_exec_id);
6059 -+ struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode);
6060 -+ struct mm_struct *mm;
6061 -+
6062 -+ if (!task)
6063 -+ return -ESRCH;
6064 -+
6065 -+ mm = mm_access(task, PTRACE_MODE_ATTACH);
6066 -+ put_task_struct(task);
6067 -+
6068 -+ if (IS_ERR(mm))
6069 -+ return PTR_ERR(mm);
6070 -+
6071 - /* OK to pass negative loff_t, we can catch out-of-range */
6072 - file->f_mode |= FMODE_UNSIGNED_OFFSET;
6073 -+ file->private_data = mm;
6074 -+
6075 - return 0;
6076 - }
6077 -
6078 - static ssize_t mem_read(struct file * file, char __user * buf,
6079 - size_t count, loff_t *ppos)
6080 - {
6081 -- struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode);
6082 -+ int ret;
6083 - char *page;
6084 - unsigned long src = *ppos;
6085 -- int ret = -ESRCH;
6086 -- struct mm_struct *mm;
6087 -+ struct mm_struct *mm = file->private_data;
6088 -
6089 -- if (!task)
6090 -- goto out_no_task;
6091 -+ if (!mm)
6092 -+ return 0;
6093 -
6094 -- ret = -ENOMEM;
6095 - page = (char *)__get_free_page(GFP_TEMPORARY);
6096 - if (!page)
6097 -- goto out;
6098 --
6099 -- mm = check_mem_permission(task);
6100 -- ret = PTR_ERR(mm);
6101 -- if (IS_ERR(mm))
6102 -- goto out_free;
6103 --
6104 -- ret = -EIO;
6105 --
6106 -- if (file->private_data != (void*)((long)current->self_exec_id))
6107 -- goto out_put;
6108 -+ return -ENOMEM;
6109 -
6110 - ret = 0;
6111 -
6112 -@@ -874,13 +822,7 @@ static ssize_t mem_read(struct file * file, char __user * buf,
6113 - }
6114 - *ppos = src;
6115 -
6116 --out_put:
6117 -- mmput(mm);
6118 --out_free:
6119 - free_page((unsigned long) page);
6120 --out:
6121 -- put_task_struct(task);
6122 --out_no_task:
6123 - return ret;
6124 - }
6125 -
6126 -@@ -889,27 +831,15 @@ static ssize_t mem_write(struct file * file, const char __user *buf,
6127 - {
6128 - int copied;
6129 - char *page;
6130 -- struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode);
6131 - unsigned long dst = *ppos;
6132 -- struct mm_struct *mm;
6133 -+ struct mm_struct *mm = file->private_data;
6134 -
6135 -- copied = -ESRCH;
6136 -- if (!task)
6137 -- goto out_no_task;
6138 -+ if (!mm)
6139 -+ return 0;
6140 -
6141 -- copied = -ENOMEM;
6142 - page = (char *)__get_free_page(GFP_TEMPORARY);
6143 - if (!page)
6144 -- goto out_task;
6145 --
6146 -- mm = check_mem_permission(task);
6147 -- copied = PTR_ERR(mm);
6148 -- if (IS_ERR(mm))
6149 -- goto out_free;
6150 --
6151 -- copied = -EIO;
6152 -- if (file->private_data != (void *)((long)current->self_exec_id))
6153 -- goto out_mm;
6154 -+ return -ENOMEM;
6155 -
6156 - copied = 0;
6157 - while (count > 0) {
6158 -@@ -933,13 +863,7 @@ static ssize_t mem_write(struct file * file, const char __user *buf,
6159 - }
6160 - *ppos = dst;
6161 -
6162 --out_mm:
6163 -- mmput(mm);
6164 --out_free:
6165 - free_page((unsigned long) page);
6166 --out_task:
6167 -- put_task_struct(task);
6168 --out_no_task:
6169 - return copied;
6170 - }
6171 -
6172 -@@ -959,11 +883,20 @@ loff_t mem_lseek(struct file *file, loff_t offset, int orig)
6173 - return file->f_pos;
6174 - }
6175 -
6176 -+static int mem_release(struct inode *inode, struct file *file)
6177 -+{
6178 -+ struct mm_struct *mm = file->private_data;
6179 -+
6180 -+ mmput(mm);
6181 -+ return 0;
6182 -+}
6183 -+
6184 - static const struct file_operations proc_mem_operations = {
6185 - .llseek = mem_lseek,
6186 - .read = mem_read,
6187 - .write = mem_write,
6188 - .open = mem_open,
6189 -+ .release = mem_release,
6190 - };
6191 -
6192 - static ssize_t environ_read(struct file *file, char __user *buf,
6193 -diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
6194 -index e418c5a..7dcd2a2 100644
6195 ---- a/fs/proc/task_mmu.c
6196 -+++ b/fs/proc/task_mmu.c
6197 -@@ -518,6 +518,9 @@ static int clear_refs_pte_range(pmd_t *pmd, unsigned long addr,
6198 - if (!page)
6199 - continue;
6200 -
6201 -+ if (PageReserved(page))
6202 -+ continue;
6203 -+
6204 - /* Clear accessed and referenced bits. */
6205 - ptep_test_and_clear_young(vma, addr, pte);
6206 - ClearPageReferenced(page);
6207 -diff --git a/fs/proc/uptime.c b/fs/proc/uptime.c
6208 -index 766b1d4..29166ec 100644
6209 ---- a/fs/proc/uptime.c
6210 -+++ b/fs/proc/uptime.c
6211 -@@ -11,15 +11,20 @@ static int uptime_proc_show(struct seq_file *m, void *v)
6212 - {
6213 - struct timespec uptime;
6214 - struct timespec idle;
6215 -+ cputime64_t idletime;
6216 -+ u64 nsec;
6217 -+ u32 rem;
6218 - int i;
6219 -- cputime_t idletime = cputime_zero;
6220 -
6221 -+ idletime = 0;
6222 - for_each_possible_cpu(i)
6223 - idletime = cputime64_add(idletime, kstat_cpu(i).cpustat.idle);
6224 -
6225 - do_posix_clock_monotonic_gettime(&uptime);
6226 - monotonic_to_bootbased(&uptime);
6227 -- cputime_to_timespec(idletime, &idle);
6228 -+ nsec = cputime64_to_jiffies64(idletime) * TICK_NSEC;
6229 -+ idle.tv_sec = div_u64_rem(nsec, NSEC_PER_SEC, &rem);
6230 -+ idle.tv_nsec = rem;
6231 - seq_printf(m, "%lu.%02lu %lu.%02lu\n",
6232 - (unsigned long) uptime.tv_sec,
6233 - (uptime.tv_nsec / (NSEC_PER_SEC / 100)),
6234 -diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h
6235 -index 8d9c468..c9d2941 100644
6236 ---- a/fs/ubifs/debug.h
6237 -+++ b/fs/ubifs/debug.h
6238 -@@ -175,22 +175,23 @@ const char *dbg_key_str1(const struct ubifs_info *c,
6239 - const union ubifs_key *key);
6240 -
6241 - /*
6242 -- * DBGKEY macros require @dbg_lock to be held, which it is in the dbg message
6243 -- * macros.
6244 -+ * TODO: these macros are now broken because there is no locking around them
6245 -+ * and we use a global buffer for the key string. This means that in case of
6246 -+ * concurrent execution we will end up with incorrect and messy key strings.
6247 - */
6248 - #define DBGKEY(key) dbg_key_str0(c, (key))
6249 - #define DBGKEY1(key) dbg_key_str1(c, (key))
6250 -
6251 - extern spinlock_t dbg_lock;
6252 -
6253 --#define ubifs_dbg_msg(type, fmt, ...) do { \
6254 -- spin_lock(&dbg_lock); \
6255 -- pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__); \
6256 -- spin_unlock(&dbg_lock); \
6257 --} while (0)
6258 -+#define ubifs_dbg_msg(type, fmt, ...) \
6259 -+ pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__)
6260 -
6261 - /* Just a debugging messages not related to any specific UBIFS subsystem */
6262 --#define dbg_msg(fmt, ...) ubifs_dbg_msg("msg", fmt, ##__VA_ARGS__)
6263 -+#define dbg_msg(fmt, ...) \
6264 -+ printk(KERN_DEBUG "UBIFS DBG (pid %d): %s: " fmt "\n", current->pid, \
6265 -+ __func__, ##__VA_ARGS__)
6266 -+
6267 - /* General messages */
6268 - #define dbg_gen(fmt, ...) ubifs_dbg_msg("gen", fmt, ##__VA_ARGS__)
6269 - /* Additional journal messages */
6270 -diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c
6271 -index 8a24f0c..286a051 100644
6272 ---- a/fs/xfs/xfs_discard.c
6273 -+++ b/fs/xfs/xfs_discard.c
6274 -@@ -68,7 +68,7 @@ xfs_trim_extents(
6275 - * Look up the longest btree in the AGF and start with it.
6276 - */
6277 - error = xfs_alloc_lookup_le(cur, 0,
6278 -- XFS_BUF_TO_AGF(agbp)->agf_longest, &i);
6279 -+ be32_to_cpu(XFS_BUF_TO_AGF(agbp)->agf_longest), &i);
6280 - if (error)
6281 - goto out_del_cursor;
6282 -
6283 -@@ -84,7 +84,7 @@ xfs_trim_extents(
6284 - if (error)
6285 - goto out_del_cursor;
6286 - XFS_WANT_CORRUPTED_GOTO(i == 1, out_del_cursor);
6287 -- ASSERT(flen <= XFS_BUF_TO_AGF(agbp)->agf_longest);
6288 -+ ASSERT(flen <= be32_to_cpu(XFS_BUF_TO_AGF(agbp)->agf_longest));
6289 -
6290 - /*
6291 - * Too small? Give up.
6292 -diff --git a/include/acpi/acpi_numa.h b/include/acpi/acpi_numa.h
6293 -index 1739726..451823c 100644
6294 ---- a/include/acpi/acpi_numa.h
6295 -+++ b/include/acpi/acpi_numa.h
6296 -@@ -15,6 +15,7 @@ extern int pxm_to_node(int);
6297 - extern int node_to_pxm(int);
6298 - extern void __acpi_map_pxm_to_node(int, int);
6299 - extern int acpi_map_pxm_to_node(int);
6300 -+extern unsigned char acpi_srat_revision;
6301 -
6302 - #endif /* CONFIG_ACPI_NUMA */
6303 - #endif /* __ACP_NUMA_H */
6304 -diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
6305 -index 94acd81..0ed1eb0 100644
6306 ---- a/include/linux/blkdev.h
6307 -+++ b/include/linux/blkdev.h
6308 -@@ -675,6 +675,9 @@ extern int blk_insert_cloned_request(struct request_queue *q,
6309 - struct request *rq);
6310 - extern void blk_delay_queue(struct request_queue *, unsigned long);
6311 - extern void blk_recount_segments(struct request_queue *, struct bio *);
6312 -+extern int scsi_verify_blk_ioctl(struct block_device *, unsigned int);
6313 -+extern int scsi_cmd_blk_ioctl(struct block_device *, fmode_t,
6314 -+ unsigned int, void __user *);
6315 - extern int scsi_cmd_ioctl(struct request_queue *, struct gendisk *, fmode_t,
6316 - unsigned int, void __user *);
6317 - extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
6318 -diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
6319 -index 5c4abce..b936763 100644
6320 ---- a/include/linux/crash_dump.h
6321 -+++ b/include/linux/crash_dump.h
6322 -@@ -5,6 +5,7 @@
6323 - #include <linux/kexec.h>
6324 - #include <linux/device.h>
6325 - #include <linux/proc_fs.h>
6326 -+#include <linux/elf.h>
6327 -
6328 - #define ELFCORE_ADDR_MAX (-1ULL)
6329 - #define ELFCORE_ADDR_ERR (-2ULL)
6330 -diff --git a/include/linux/dcache.h b/include/linux/dcache.h
6331 -index ed9f74f..4eb8c80 100644
6332 ---- a/include/linux/dcache.h
6333 -+++ b/include/linux/dcache.h
6334 -@@ -203,6 +203,7 @@ struct dentry_operations {
6335 -
6336 - #define DCACHE_CANT_MOUNT 0x0100
6337 - #define DCACHE_GENOCIDE 0x0200
6338 -+#define DCACHE_SHRINK_LIST 0x0400
6339 -
6340 - #define DCACHE_NFSFS_RENAMED 0x1000
6341 - /* this dentry has been "silly renamed" and has to be deleted on the last
6342 -diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
6343 -index b87068a..81572af 100644
6344 ---- a/include/linux/memcontrol.h
6345 -+++ b/include/linux/memcontrol.h
6346 -@@ -119,6 +119,8 @@ struct zone_reclaim_stat*
6347 - mem_cgroup_get_reclaim_stat_from_page(struct page *page);
6348 - extern void mem_cgroup_print_oom_info(struct mem_cgroup *memcg,
6349 - struct task_struct *p);
6350 -+extern void mem_cgroup_replace_page_cache(struct page *oldpage,
6351 -+ struct page *newpage);
6352 -
6353 - #ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
6354 - extern int do_swap_account;
6355 -@@ -366,6 +368,10 @@ static inline
6356 - void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx)
6357 - {
6358 - }
6359 -+static inline void mem_cgroup_replace_page_cache(struct page *oldpage,
6360 -+ struct page *newpage)
6361 -+{
6362 -+}
6363 - #endif /* CONFIG_CGROUP_MEM_CONT */
6364 -
6365 - #if !defined(CONFIG_CGROUP_MEM_RES_CTLR) || !defined(CONFIG_DEBUG_VM)
6366 -diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
6367 -index 2a7c533..6c898af 100644
6368 ---- a/include/linux/nfs_xdr.h
6369 -+++ b/include/linux/nfs_xdr.h
6370 -@@ -602,11 +602,16 @@ struct nfs_getaclargs {
6371 - size_t acl_len;
6372 - unsigned int acl_pgbase;
6373 - struct page ** acl_pages;
6374 -+ struct page * acl_scratch;
6375 - struct nfs4_sequence_args seq_args;
6376 - };
6377 -
6378 -+/* getxattr ACL interface flags */
6379 -+#define NFS4_ACL_LEN_REQUEST 0x0001 /* zero length getxattr buffer */
6380 - struct nfs_getaclres {
6381 - size_t acl_len;
6382 -+ size_t acl_data_offset;
6383 -+ int acl_flags;
6384 - struct nfs4_sequence_res seq_res;
6385 - };
6386 -
6387 -diff --git a/include/linux/pci_regs.h b/include/linux/pci_regs.h
6388 -index b5d9657..411c412 100644
6389 ---- a/include/linux/pci_regs.h
6390 -+++ b/include/linux/pci_regs.h
6391 -@@ -392,7 +392,7 @@
6392 - #define PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */
6393 - #define PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */
6394 - #define PCI_EXP_TYPE_RC_END 0x9 /* Root Complex Integrated Endpoint */
6395 --#define PCI_EXP_TYPE_RC_EC 0x10 /* Root Complex Event Collector */
6396 -+#define PCI_EXP_TYPE_RC_EC 0xa /* Root Complex Event Collector */
6397 - #define PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */
6398 - #define PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */
6399 - #define PCI_EXP_DEVCAP 4 /* Device capabilities */
6400 -diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
6401 -index 9291ac3..6f10c9c 100644
6402 ---- a/include/linux/shmem_fs.h
6403 -+++ b/include/linux/shmem_fs.h
6404 -@@ -48,6 +48,7 @@ extern struct file *shmem_file_setup(const char *name,
6405 - loff_t size, unsigned long flags);
6406 - extern int shmem_zero_setup(struct vm_area_struct *);
6407 - extern int shmem_lock(struct file *file, int lock, struct user_struct *user);
6408 -+extern void shmem_unlock_mapping(struct address_space *mapping);
6409 - extern struct page *shmem_read_mapping_page_gfp(struct address_space *mapping,
6410 - pgoff_t index, gfp_t gfp_mask);
6411 - extern void shmem_truncate_range(struct inode *inode, loff_t start, loff_t end);
6412 -diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
6413 -index 85c50b4..c84e974 100644
6414 ---- a/include/linux/sunrpc/svcsock.h
6415 -+++ b/include/linux/sunrpc/svcsock.h
6416 -@@ -34,7 +34,7 @@ struct svc_sock {
6417 - /*
6418 - * Function prototypes.
6419 - */
6420 --void svc_close_all(struct list_head *);
6421 -+void svc_close_all(struct svc_serv *);
6422 - int svc_recv(struct svc_rqst *, long);
6423 - int svc_send(struct svc_rqst *);
6424 - void svc_drop(struct svc_rqst *);
6425 -diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
6426 -index a20970e..af70af3 100644
6427 ---- a/include/linux/sunrpc/xdr.h
6428 -+++ b/include/linux/sunrpc/xdr.h
6429 -@@ -191,6 +191,8 @@ extern int xdr_decode_array2(struct xdr_buf *buf, unsigned int base,
6430 - struct xdr_array2_desc *desc);
6431 - extern int xdr_encode_array2(struct xdr_buf *buf, unsigned int base,
6432 - struct xdr_array2_desc *desc);
6433 -+extern void _copy_from_pages(char *p, struct page **pages, size_t pgbase,
6434 -+ size_t len);
6435 -
6436 - /*
6437 - * Provide some simple tools for XDR buffer overflow-checking etc.
6438 -diff --git a/include/linux/swap.h b/include/linux/swap.h
6439 -index 1e22e12..67b3fa3 100644
6440 ---- a/include/linux/swap.h
6441 -+++ b/include/linux/swap.h
6442 -@@ -272,7 +272,7 @@ static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
6443 - #endif
6444 -
6445 - extern int page_evictable(struct page *page, struct vm_area_struct *vma);
6446 --extern void scan_mapping_unevictable_pages(struct address_space *);
6447 -+extern void check_move_unevictable_pages(struct page **, int nr_pages);
6448 -
6449 - extern unsigned long scan_unevictable_pages;
6450 - extern int scan_unevictable_handler(struct ctl_table *, int,
6451 -diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
6452 -index 4b752d5..45a7698 100644
6453 ---- a/include/linux/videodev2.h
6454 -+++ b/include/linux/videodev2.h
6455 -@@ -1131,6 +1131,7 @@ struct v4l2_querymenu {
6456 - #define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
6457 -
6458 - /* User-class control IDs defined by V4L2 */
6459 -+#define V4L2_CID_MAX_CTRLS 1024
6460 - #define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900)
6461 - #define V4L2_CID_USER_BASE V4L2_CID_BASE
6462 - /* IDs reserved for driver specific controls */
6463 -diff --git a/include/media/tuner.h b/include/media/tuner.h
6464 -index 89c290b..29e1920 100644
6465 ---- a/include/media/tuner.h
6466 -+++ b/include/media/tuner.h
6467 -@@ -127,7 +127,6 @@
6468 - #define TUNER_PHILIPS_FMD1216MEX_MK3 78
6469 - #define TUNER_PHILIPS_FM1216MK5 79
6470 - #define TUNER_PHILIPS_FQ1216LME_MK3 80 /* Active loopthrough, no FM */
6471 --#define TUNER_XC4000 81 /* Xceive Silicon Tuner */
6472 -
6473 - #define TUNER_PARTSNIC_PTI_5NF05 81
6474 - #define TUNER_PHILIPS_CU1216L 82
6475 -@@ -136,6 +135,8 @@
6476 - #define TUNER_PHILIPS_FQ1236_MK5 85 /* NTSC, TDA9885, no FM radio */
6477 - #define TUNER_TENA_TNF_5337 86
6478 -
6479 -+#define TUNER_XC4000 87 /* Xceive Silicon Tuner */
6480 -+
6481 - /* tv card specific */
6482 - #define TDA9887_PRESENT (1<<0)
6483 - #define TDA9887_PORT1_INACTIVE (1<<1)
6484 -diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h
6485 -index 6873c7d..a79886c 100644
6486 ---- a/include/target/target_core_base.h
6487 -+++ b/include/target/target_core_base.h
6488 -@@ -34,6 +34,7 @@
6489 - #define TRANSPORT_SENSE_BUFFER SCSI_SENSE_BUFFERSIZE
6490 - /* Used by transport_send_check_condition_and_sense() */
6491 - #define SPC_SENSE_KEY_OFFSET 2
6492 -+#define SPC_ADD_SENSE_LEN_OFFSET 7
6493 - #define SPC_ASC_KEY_OFFSET 12
6494 - #define SPC_ASCQ_KEY_OFFSET 13
6495 - #define TRANSPORT_IQN_LEN 224
6496 -diff --git a/include/xen/interface/io/xs_wire.h b/include/xen/interface/io/xs_wire.h
6497 -index f6f07aa..7cdfca2 100644
6498 ---- a/include/xen/interface/io/xs_wire.h
6499 -+++ b/include/xen/interface/io/xs_wire.h
6500 -@@ -87,4 +87,7 @@ struct xenstore_domain_interface {
6501 - XENSTORE_RING_IDX rsp_cons, rsp_prod;
6502 - };
6503 -
6504 -+/* Violating this is very bad. See docs/misc/xenstore.txt. */
6505 -+#define XENSTORE_PAYLOAD_MAX 4096
6506 -+
6507 - #endif /* _XS_WIRE_H */
6508 -diff --git a/init/do_mounts.c b/init/do_mounts.c
6509 -index 0f6e1d9..db6e5ee 100644
6510 ---- a/init/do_mounts.c
6511 -+++ b/init/do_mounts.c
6512 -@@ -398,15 +398,42 @@ out:
6513 - }
6514 -
6515 - #ifdef CONFIG_ROOT_NFS
6516 -+
6517 -+#define NFSROOT_TIMEOUT_MIN 5
6518 -+#define NFSROOT_TIMEOUT_MAX 30
6519 -+#define NFSROOT_RETRY_MAX 5
6520 -+
6521 - static int __init mount_nfs_root(void)
6522 - {
6523 - char *root_dev, *root_data;
6524 -+ unsigned int timeout;
6525 -+ int try, err;
6526 -
6527 -- if (nfs_root_data(&root_dev, &root_data) != 0)
6528 -- return 0;
6529 -- if (do_mount_root(root_dev, "nfs", root_mountflags, root_data) != 0)
6530 -+ err = nfs_root_data(&root_dev, &root_data);
6531 -+ if (err != 0)
6532 - return 0;
6533 -- return 1;
6534 -+
6535 -+ /*
6536 -+ * The server or network may not be ready, so try several
6537 -+ * times. Stop after a few tries in case the client wants
6538 -+ * to fall back to other boot methods.
6539 -+ */
6540 -+ timeout = NFSROOT_TIMEOUT_MIN;
6541 -+ for (try = 1; ; try++) {
6542 -+ err = do_mount_root(root_dev, "nfs",
6543 -+ root_mountflags, root_data);
6544 -+ if (err == 0)
6545 -+ return 1;
6546 -+ if (try > NFSROOT_RETRY_MAX)
6547 -+ break;
6548 -+
6549 -+ /* Wait, in case the server refused us immediately */
6550 -+ ssleep(timeout);
6551 -+ timeout <<= 1;
6552 -+ if (timeout > NFSROOT_TIMEOUT_MAX)
6553 -+ timeout = NFSROOT_TIMEOUT_MAX;
6554 -+ }
6555 -+ return 0;
6556 - }
6557 - #endif
6558 -
6559 -diff --git a/ipc/shm.c b/ipc/shm.c
6560 -index 02ecf2c..b76be5b 100644
6561 ---- a/ipc/shm.c
6562 -+++ b/ipc/shm.c
6563 -@@ -870,9 +870,7 @@ SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf)
6564 - case SHM_LOCK:
6565 - case SHM_UNLOCK:
6566 - {
6567 -- struct file *uninitialized_var(shm_file);
6568 --
6569 -- lru_add_drain_all(); /* drain pagevecs to lru lists */
6570 -+ struct file *shm_file;
6571 -
6572 - shp = shm_lock_check(ns, shmid);
6573 - if (IS_ERR(shp)) {
6574 -@@ -895,22 +893,31 @@ SYSCALL_DEFINE3(shmctl, int, shmid, int, cmd, struct shmid_ds __user *, buf)
6575 - err = security_shm_shmctl(shp, cmd);
6576 - if (err)
6577 - goto out_unlock;
6578 --
6579 -- if(cmd==SHM_LOCK) {
6580 -+
6581 -+ shm_file = shp->shm_file;
6582 -+ if (is_file_hugepages(shm_file))
6583 -+ goto out_unlock;
6584 -+
6585 -+ if (cmd == SHM_LOCK) {
6586 - struct user_struct *user = current_user();
6587 -- if (!is_file_hugepages(shp->shm_file)) {
6588 -- err = shmem_lock(shp->shm_file, 1, user);
6589 -- if (!err && !(shp->shm_perm.mode & SHM_LOCKED)){
6590 -- shp->shm_perm.mode |= SHM_LOCKED;
6591 -- shp->mlock_user = user;
6592 -- }
6593 -+ err = shmem_lock(shm_file, 1, user);
6594 -+ if (!err && !(shp->shm_perm.mode & SHM_LOCKED)) {
6595 -+ shp->shm_perm.mode |= SHM_LOCKED;
6596 -+ shp->mlock_user = user;
6597 - }
6598 -- } else if (!is_file_hugepages(shp->shm_file)) {
6599 -- shmem_lock(shp->shm_file, 0, shp->mlock_user);
6600 -- shp->shm_perm.mode &= ~SHM_LOCKED;
6601 -- shp->mlock_user = NULL;
6602 -+ goto out_unlock;
6603 - }
6604 -+
6605 -+ /* SHM_UNLOCK */
6606 -+ if (!(shp->shm_perm.mode & SHM_LOCKED))
6607 -+ goto out_unlock;
6608 -+ shmem_lock(shm_file, 0, shp->mlock_user);
6609 -+ shp->shm_perm.mode &= ~SHM_LOCKED;
6610 -+ shp->mlock_user = NULL;
6611 -+ get_file(shm_file);
6612 - shm_unlock(shp);
6613 -+ shmem_unlock_mapping(shm_file->f_mapping);
6614 -+ fput(shm_file);
6615 - goto out;
6616 - }
6617 - case IPC_RMID:
6618 -diff --git a/kernel/kprobes.c b/kernel/kprobes.c
6619 -index e5d8464..52fd049 100644
6620 ---- a/kernel/kprobes.c
6621 -+++ b/kernel/kprobes.c
6622 -@@ -1077,6 +1077,7 @@ void __kprobes kprobe_flush_task(struct task_struct *tk)
6623 - /* Early boot. kretprobe_table_locks not yet initialized. */
6624 - return;
6625 -
6626 -+ INIT_HLIST_HEAD(&empty_rp);
6627 - hash = hash_ptr(tk, KPROBE_HASH_BITS);
6628 - head = &kretprobe_inst_table[hash];
6629 - kretprobe_table_lock(hash, &flags);
6630 -@@ -1085,7 +1086,6 @@ void __kprobes kprobe_flush_task(struct task_struct *tk)
6631 - recycle_rp_inst(ri, &empty_rp);
6632 - }
6633 - kretprobe_table_unlock(hash, &flags);
6634 -- INIT_HLIST_HEAD(&empty_rp);
6635 - hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
6636 - hlist_del(&ri->hlist);
6637 - kfree(ri);
6638 -diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
6639 -index b1e8943..25b4f4d 100644
6640 ---- a/kernel/trace/ftrace.c
6641 -+++ b/kernel/trace/ftrace.c
6642 -@@ -948,7 +948,7 @@ struct ftrace_func_probe {
6643 - };
6644 -
6645 - enum {
6646 -- FTRACE_ENABLE_CALLS = (1 << 0),
6647 -+ FTRACE_UPDATE_CALLS = (1 << 0),
6648 - FTRACE_DISABLE_CALLS = (1 << 1),
6649 - FTRACE_UPDATE_TRACE_FUNC = (1 << 2),
6650 - FTRACE_START_FUNC_RET = (1 << 3),
6651 -@@ -1519,7 +1519,7 @@ int ftrace_text_reserved(void *start, void *end)
6652 -
6653 -
6654 - static int
6655 --__ftrace_replace_code(struct dyn_ftrace *rec, int enable)
6656 -+__ftrace_replace_code(struct dyn_ftrace *rec, int update)
6657 - {
6658 - unsigned long ftrace_addr;
6659 - unsigned long flag = 0UL;
6660 -@@ -1527,17 +1527,17 @@ __ftrace_replace_code(struct dyn_ftrace *rec, int enable)
6661 - ftrace_addr = (unsigned long)FTRACE_ADDR;
6662 -
6663 - /*
6664 -- * If we are enabling tracing:
6665 -+ * If we are updating calls:
6666 - *
6667 - * If the record has a ref count, then we need to enable it
6668 - * because someone is using it.
6669 - *
6670 - * Otherwise we make sure its disabled.
6671 - *
6672 -- * If we are disabling tracing, then disable all records that
6673 -+ * If we are disabling calls, then disable all records that
6674 - * are enabled.
6675 - */
6676 -- if (enable && (rec->flags & ~FTRACE_FL_MASK))
6677 -+ if (update && (rec->flags & ~FTRACE_FL_MASK))
6678 - flag = FTRACE_FL_ENABLED;
6679 -
6680 - /* If the state of this record hasn't changed, then do nothing */
6681 -@@ -1553,7 +1553,7 @@ __ftrace_replace_code(struct dyn_ftrace *rec, int enable)
6682 - return ftrace_make_nop(NULL, rec, ftrace_addr);
6683 - }
6684 -
6685 --static void ftrace_replace_code(int enable)
6686 -+static void ftrace_replace_code(int update)
6687 - {
6688 - struct dyn_ftrace *rec;
6689 - struct ftrace_page *pg;
6690 -@@ -1567,7 +1567,7 @@ static void ftrace_replace_code(int enable)
6691 - if (rec->flags & FTRACE_FL_FREE)
6692 - continue;
6693 -
6694 -- failed = __ftrace_replace_code(rec, enable);
6695 -+ failed = __ftrace_replace_code(rec, update);
6696 - if (failed) {
6697 - ftrace_bug(failed, rec->ip);
6698 - /* Stop processing */
6699 -@@ -1623,7 +1623,7 @@ static int __ftrace_modify_code(void *data)
6700 - */
6701 - function_trace_stop++;
6702 -
6703 -- if (*command & FTRACE_ENABLE_CALLS)
6704 -+ if (*command & FTRACE_UPDATE_CALLS)
6705 - ftrace_replace_code(1);
6706 - else if (*command & FTRACE_DISABLE_CALLS)
6707 - ftrace_replace_code(0);
6708 -@@ -1691,7 +1691,7 @@ static int ftrace_startup(struct ftrace_ops *ops, int command)
6709 - return -ENODEV;
6710 -
6711 - ftrace_start_up++;
6712 -- command |= FTRACE_ENABLE_CALLS;
6713 -+ command |= FTRACE_UPDATE_CALLS;
6714 -
6715 - /* ops marked global share the filter hashes */
6716 - if (ops->flags & FTRACE_OPS_FL_GLOBAL) {
6717 -@@ -1743,8 +1743,7 @@ static void ftrace_shutdown(struct ftrace_ops *ops, int command)
6718 - if (ops != &global_ops || !global_start_up)
6719 - ops->flags &= ~FTRACE_OPS_FL_ENABLED;
6720 -
6721 -- if (!ftrace_start_up)
6722 -- command |= FTRACE_DISABLE_CALLS;
6723 -+ command |= FTRACE_UPDATE_CALLS;
6724 -
6725 - if (saved_ftrace_func != ftrace_trace_function) {
6726 - saved_ftrace_func = ftrace_trace_function;
6727 -@@ -1766,7 +1765,7 @@ static void ftrace_startup_sysctl(void)
6728 - saved_ftrace_func = NULL;
6729 - /* ftrace_start_up is true if we want ftrace running */
6730 - if (ftrace_start_up)
6731 -- ftrace_run_update_code(FTRACE_ENABLE_CALLS);
6732 -+ ftrace_run_update_code(FTRACE_UPDATE_CALLS);
6733 - }
6734 -
6735 - static void ftrace_shutdown_sysctl(void)
6736 -@@ -2919,7 +2918,7 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len,
6737 - ret = ftrace_hash_move(ops, enable, orig_hash, hash);
6738 - if (!ret && ops->flags & FTRACE_OPS_FL_ENABLED
6739 - && ftrace_enabled)
6740 -- ftrace_run_update_code(FTRACE_ENABLE_CALLS);
6741 -+ ftrace_run_update_code(FTRACE_UPDATE_CALLS);
6742 -
6743 - mutex_unlock(&ftrace_lock);
6744 -
6745 -@@ -3107,7 +3106,7 @@ ftrace_regex_release(struct inode *inode, struct file *file)
6746 - orig_hash, iter->hash);
6747 - if (!ret && (iter->ops->flags & FTRACE_OPS_FL_ENABLED)
6748 - && ftrace_enabled)
6749 -- ftrace_run_update_code(FTRACE_ENABLE_CALLS);
6750 -+ ftrace_run_update_code(FTRACE_UPDATE_CALLS);
6751 -
6752 - mutex_unlock(&ftrace_lock);
6753 - }
6754 -diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c
6755 -index db110b8..f1539de 100644
6756 ---- a/kernel/tracepoint.c
6757 -+++ b/kernel/tracepoint.c
6758 -@@ -634,10 +634,11 @@ static int tracepoint_module_coming(struct module *mod)
6759 - int ret = 0;
6760 -
6761 - /*
6762 -- * We skip modules that tain the kernel, especially those with different
6763 -- * module header (for forced load), to make sure we don't cause a crash.
6764 -+ * We skip modules that taint the kernel, especially those with different
6765 -+ * module headers (for forced load), to make sure we don't cause a crash.
6766 -+ * Staging and out-of-tree GPL modules are fine.
6767 - */
6768 -- if (mod->taints)
6769 -+ if (mod->taints & ~((1 << TAINT_OOT_MODULE) | (1 << TAINT_CRAP)))
6770 - return 0;
6771 - mutex_lock(&tracepoints_mutex);
6772 - tp_mod = kmalloc(sizeof(struct tp_module), GFP_KERNEL);
6773 -diff --git a/mm/filemap.c b/mm/filemap.c
6774 -index 5f0a3c9..90286a4 100644
6775 ---- a/mm/filemap.c
6776 -+++ b/mm/filemap.c
6777 -@@ -393,24 +393,11 @@ EXPORT_SYMBOL(filemap_write_and_wait_range);
6778 - int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask)
6779 - {
6780 - int error;
6781 -- struct mem_cgroup *memcg = NULL;
6782 -
6783 - VM_BUG_ON(!PageLocked(old));
6784 - VM_BUG_ON(!PageLocked(new));
6785 - VM_BUG_ON(new->mapping);
6786 -
6787 -- /*
6788 -- * This is not page migration, but prepare_migration and
6789 -- * end_migration does enough work for charge replacement.
6790 -- *
6791 -- * In the longer term we probably want a specialized function
6792 -- * for moving the charge from old to new in a more efficient
6793 -- * manner.
6794 -- */
6795 -- error = mem_cgroup_prepare_migration(old, new, &memcg, gfp_mask);
6796 -- if (error)
6797 -- return error;
6798 --
6799 - error = radix_tree_preload(gfp_mask & ~__GFP_HIGHMEM);
6800 - if (!error) {
6801 - struct address_space *mapping = old->mapping;
6802 -@@ -432,13 +419,12 @@ int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask)
6803 - if (PageSwapBacked(new))
6804 - __inc_zone_page_state(new, NR_SHMEM);
6805 - spin_unlock_irq(&mapping->tree_lock);
6806 -+ /* mem_cgroup codes must not be called under tree_lock */
6807 -+ mem_cgroup_replace_page_cache(old, new);
6808 - radix_tree_preload_end();
6809 - if (freepage)
6810 - freepage(old);
6811 - page_cache_release(old);
6812 -- mem_cgroup_end_migration(memcg, old, new, true);
6813 -- } else {
6814 -- mem_cgroup_end_migration(memcg, old, new, false);
6815 - }
6816 -
6817 - return error;
6818 -diff --git a/mm/memcontrol.c b/mm/memcontrol.c
6819 -index b63f5f7..f538e9b 100644
6820 ---- a/mm/memcontrol.c
6821 -+++ b/mm/memcontrol.c
6822 -@@ -3366,6 +3366,50 @@ void mem_cgroup_end_migration(struct mem_cgroup *memcg,
6823 - cgroup_release_and_wakeup_rmdir(&memcg->css);
6824 - }
6825 -
6826 -+/*
6827 -+ * At replace page cache, newpage is not under any memcg but it's on
6828 -+ * LRU. So, this function doesn't touch res_counter but handles LRU
6829 -+ * in correct way. Both pages are locked so we cannot race with uncharge.
6830 -+ */
6831 -+void mem_cgroup_replace_page_cache(struct page *oldpage,
6832 -+ struct page *newpage)
6833 -+{
6834 -+ struct mem_cgroup *memcg;
6835 -+ struct page_cgroup *pc;
6836 -+ struct zone *zone;
6837 -+ enum charge_type type = MEM_CGROUP_CHARGE_TYPE_CACHE;
6838 -+ unsigned long flags;
6839 -+
6840 -+ if (mem_cgroup_disabled())
6841 -+ return;
6842 -+
6843 -+ pc = lookup_page_cgroup(oldpage);
6844 -+ /* fix accounting on old pages */
6845 -+ lock_page_cgroup(pc);
6846 -+ memcg = pc->mem_cgroup;
6847 -+ mem_cgroup_charge_statistics(memcg, PageCgroupCache(pc), -1);
6848 -+ ClearPageCgroupUsed(pc);
6849 -+ unlock_page_cgroup(pc);
6850 -+
6851 -+ if (PageSwapBacked(oldpage))
6852 -+ type = MEM_CGROUP_CHARGE_TYPE_SHMEM;
6853 -+
6854 -+ zone = page_zone(newpage);
6855 -+ pc = lookup_page_cgroup(newpage);
6856 -+ /*
6857 -+ * Even if newpage->mapping was NULL before starting replacement,
6858 -+ * the newpage may be on LRU(or pagevec for LRU) already. We lock
6859 -+ * LRU while we overwrite pc->mem_cgroup.
6860 -+ */
6861 -+ spin_lock_irqsave(&zone->lru_lock, flags);
6862 -+ if (PageLRU(newpage))
6863 -+ del_page_from_lru_list(zone, newpage, page_lru(newpage));
6864 -+ __mem_cgroup_commit_charge(memcg, newpage, 1, pc, type);
6865 -+ if (PageLRU(newpage))
6866 -+ add_page_to_lru_list(zone, newpage, page_lru(newpage));
6867 -+ spin_unlock_irqrestore(&zone->lru_lock, flags);
6868 -+}
6869 -+
6870 - #ifdef CONFIG_DEBUG_VM
6871 - static struct page_cgroup *lookup_page_cgroup_used(struct page *page)
6872 - {
6873 -diff --git a/mm/page_alloc.c b/mm/page_alloc.c
6874 -index 2b8ba3a..485be89 100644
6875 ---- a/mm/page_alloc.c
6876 -+++ b/mm/page_alloc.c
6877 -@@ -5608,6 +5608,17 @@ __count_immobile_pages(struct zone *zone, struct page *page, int count)
6878 - bool is_pageblock_removable_nolock(struct page *page)
6879 - {
6880 - struct zone *zone = page_zone(page);
6881 -+ unsigned long pfn = page_to_pfn(page);
6882 -+
6883 -+ /*
6884 -+ * We have to be careful here because we are iterating over memory
6885 -+ * sections which are not zone aware so we might end up outside of
6886 -+ * the zone but still within the section.
6887 -+ */
6888 -+ if (!zone || zone->zone_start_pfn > pfn ||
6889 -+ zone->zone_start_pfn + zone->spanned_pages <= pfn)
6890 -+ return false;
6891 -+
6892 - return __count_immobile_pages(zone, page, 0);
6893 - }
6894 -
6895 -diff --git a/mm/shmem.c b/mm/shmem.c
6896 -index d672250..6c253f7 100644
6897 ---- a/mm/shmem.c
6898 -+++ b/mm/shmem.c
6899 -@@ -379,7 +379,7 @@ static int shmem_free_swap(struct address_space *mapping,
6900 - /*
6901 - * Pagevec may contain swap entries, so shuffle up pages before releasing.
6902 - */
6903 --static void shmem_pagevec_release(struct pagevec *pvec)
6904 -+static void shmem_deswap_pagevec(struct pagevec *pvec)
6905 - {
6906 - int i, j;
6907 -
6908 -@@ -389,7 +389,36 @@ static void shmem_pagevec_release(struct pagevec *pvec)
6909 - pvec->pages[j++] = page;
6910 - }
6911 - pvec->nr = j;
6912 -- pagevec_release(pvec);
6913 -+}
6914 -+
6915 -+/*
6916 -+ * SysV IPC SHM_UNLOCK restore Unevictable pages to their evictable lists.
6917 -+ */
6918 -+void shmem_unlock_mapping(struct address_space *mapping)
6919 -+{
6920 -+ struct pagevec pvec;
6921 -+ pgoff_t indices[PAGEVEC_SIZE];
6922 -+ pgoff_t index = 0;
6923 -+
6924 -+ pagevec_init(&pvec, 0);
6925 -+ /*
6926 -+ * Minor point, but we might as well stop if someone else SHM_LOCKs it.
6927 -+ */
6928 -+ while (!mapping_unevictable(mapping)) {
6929 -+ /*
6930 -+ * Avoid pagevec_lookup(): find_get_pages() returns 0 as if it
6931 -+ * has finished, if it hits a row of PAGEVEC_SIZE swap entries.
6932 -+ */
6933 -+ pvec.nr = shmem_find_get_pages_and_swap(mapping, index,
6934 -+ PAGEVEC_SIZE, pvec.pages, indices);
6935 -+ if (!pvec.nr)
6936 -+ break;
6937 -+ index = indices[pvec.nr - 1] + 1;
6938 -+ shmem_deswap_pagevec(&pvec);
6939 -+ check_move_unevictable_pages(pvec.pages, pvec.nr);
6940 -+ pagevec_release(&pvec);
6941 -+ cond_resched();
6942 -+ }
6943 - }
6944 -
6945 - /*
6946 -@@ -440,7 +469,8 @@ void shmem_truncate_range(struct inode *inode, loff_t lstart, loff_t lend)
6947 - }
6948 - unlock_page(page);
6949 - }
6950 -- shmem_pagevec_release(&pvec);
6951 -+ shmem_deswap_pagevec(&pvec);
6952 -+ pagevec_release(&pvec);
6953 - mem_cgroup_uncharge_end();
6954 - cond_resched();
6955 - index++;
6956 -@@ -470,7 +500,8 @@ void shmem_truncate_range(struct inode *inode, loff_t lstart, loff_t lend)
6957 - continue;
6958 - }
6959 - if (index == start && indices[0] > end) {
6960 -- shmem_pagevec_release(&pvec);
6961 -+ shmem_deswap_pagevec(&pvec);
6962 -+ pagevec_release(&pvec);
6963 - break;
6964 - }
6965 - mem_cgroup_uncharge_start();
6966 -@@ -494,7 +525,8 @@ void shmem_truncate_range(struct inode *inode, loff_t lstart, loff_t lend)
6967 - }
6968 - unlock_page(page);
6969 - }
6970 -- shmem_pagevec_release(&pvec);
6971 -+ shmem_deswap_pagevec(&pvec);
6972 -+ pagevec_release(&pvec);
6973 - mem_cgroup_uncharge_end();
6974 - index++;
6975 - }
6976 -@@ -1068,13 +1100,6 @@ int shmem_lock(struct file *file, int lock, struct user_struct *user)
6977 - user_shm_unlock(inode->i_size, user);
6978 - info->flags &= ~VM_LOCKED;
6979 - mapping_clear_unevictable(file->f_mapping);
6980 -- /*
6981 -- * Ensure that a racing putback_lru_page() can see
6982 -- * the pages of this mapping are evictable when we
6983 -- * skip them due to !PageLRU during the scan.
6984 -- */
6985 -- smp_mb__after_clear_bit();
6986 -- scan_mapping_unevictable_pages(file->f_mapping);
6987 - }
6988 - retval = 0;
6989 -
6990 -@@ -2446,6 +2471,10 @@ int shmem_lock(struct file *file, int lock, struct user_struct *user)
6991 - return 0;
6992 - }
6993 -
6994 -+void shmem_unlock_mapping(struct address_space *mapping)
6995 -+{
6996 -+}
6997 -+
6998 - void shmem_truncate_range(struct inode *inode, loff_t lstart, loff_t lend)
6999 - {
7000 - truncate_inode_pages_range(inode->i_mapping, lstart, lend);
7001 -diff --git a/mm/slub.c b/mm/slub.c
7002 -index ed3334d..1a919f0 100644
7003 ---- a/mm/slub.c
7004 -+++ b/mm/slub.c
7005 -@@ -2166,6 +2166,11 @@ redo:
7006 - goto new_slab;
7007 - }
7008 -
7009 -+ /* must check again c->freelist in case of cpu migration or IRQ */
7010 -+ object = c->freelist;
7011 -+ if (object)
7012 -+ goto load_freelist;
7013 -+
7014 - stat(s, ALLOC_SLOWPATH);
7015 -
7016 - do {
7017 -diff --git a/mm/vmscan.c b/mm/vmscan.c
7018 -index f54a05b..cb33d9c 100644
7019 ---- a/mm/vmscan.c
7020 -+++ b/mm/vmscan.c
7021 -@@ -636,7 +636,7 @@ redo:
7022 - * When racing with an mlock or AS_UNEVICTABLE clearing
7023 - * (page is unlocked) make sure that if the other thread
7024 - * does not observe our setting of PG_lru and fails
7025 -- * isolation/check_move_unevictable_page,
7026 -+ * isolation/check_move_unevictable_pages,
7027 - * we see PG_mlocked/AS_UNEVICTABLE cleared below and move
7028 - * the page back to the evictable list.
7029 - *
7030 -@@ -3353,97 +3353,59 @@ int page_evictable(struct page *page, struct vm_area_struct *vma)
7031 - return 1;
7032 - }
7033 -
7034 -+#ifdef CONFIG_SHMEM
7035 - /**
7036 -- * check_move_unevictable_page - check page for evictability and move to appropriate zone lru list
7037 -- * @page: page to check evictability and move to appropriate lru list
7038 -- * @zone: zone page is in
7039 -+ * check_move_unevictable_pages - check pages for evictability and move to appropriate zone lru list
7040 -+ * @pages: array of pages to check
7041 -+ * @nr_pages: number of pages to check
7042 - *
7043 -- * Checks a page for evictability and moves the page to the appropriate
7044 -- * zone lru list.
7045 -+ * Checks pages for evictability and moves them to the appropriate lru list.
7046 - *
7047 -- * Restrictions: zone->lru_lock must be held, page must be on LRU and must
7048 -- * have PageUnevictable set.
7049 -+ * This function is only used for SysV IPC SHM_UNLOCK.
7050 - */
7051 --static void check_move_unevictable_page(struct page *page, struct zone *zone)
7052 -+void check_move_unevictable_pages(struct page **pages, int nr_pages)
7053 - {
7054 -- VM_BUG_ON(PageActive(page));
7055 --
7056 --retry:
7057 -- ClearPageUnevictable(page);
7058 -- if (page_evictable(page, NULL)) {
7059 -- enum lru_list l = page_lru_base_type(page);
7060 -+ struct zone *zone = NULL;
7061 -+ int pgscanned = 0;
7062 -+ int pgrescued = 0;
7063 -+ int i;
7064 -
7065 -- __dec_zone_state(zone, NR_UNEVICTABLE);
7066 -- list_move(&page->lru, &zone->lru[l].list);
7067 -- mem_cgroup_move_lists(page, LRU_UNEVICTABLE, l);
7068 -- __inc_zone_state(zone, NR_INACTIVE_ANON + l);
7069 -- __count_vm_event(UNEVICTABLE_PGRESCUED);
7070 -- } else {
7071 -- /*
7072 -- * rotate unevictable list
7073 -- */
7074 -- SetPageUnevictable(page);
7075 -- list_move(&page->lru, &zone->lru[LRU_UNEVICTABLE].list);
7076 -- mem_cgroup_rotate_lru_list(page, LRU_UNEVICTABLE);
7077 -- if (page_evictable(page, NULL))
7078 -- goto retry;
7079 -- }
7080 --}
7081 -+ for (i = 0; i < nr_pages; i++) {
7082 -+ struct page *page = pages[i];
7083 -+ struct zone *pagezone;
7084 -
7085 --/**
7086 -- * scan_mapping_unevictable_pages - scan an address space for evictable pages
7087 -- * @mapping: struct address_space to scan for evictable pages
7088 -- *
7089 -- * Scan all pages in mapping. Check unevictable pages for
7090 -- * evictability and move them to the appropriate zone lru list.
7091 -- */
7092 --void scan_mapping_unevictable_pages(struct address_space *mapping)
7093 --{
7094 -- pgoff_t next = 0;
7095 -- pgoff_t end = (i_size_read(mapping->host) + PAGE_CACHE_SIZE - 1) >>
7096 -- PAGE_CACHE_SHIFT;
7097 -- struct zone *zone;
7098 -- struct pagevec pvec;
7099 -+ pgscanned++;
7100 -+ pagezone = page_zone(page);
7101 -+ if (pagezone != zone) {
7102 -+ if (zone)
7103 -+ spin_unlock_irq(&zone->lru_lock);
7104 -+ zone = pagezone;
7105 -+ spin_lock_irq(&zone->lru_lock);
7106 -+ }
7107 -
7108 -- if (mapping->nrpages == 0)
7109 -- return;
7110 -+ if (!PageLRU(page) || !PageUnevictable(page))
7111 -+ continue;
7112 -
7113 -- pagevec_init(&pvec, 0);
7114 -- while (next < end &&
7115 -- pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) {
7116 -- int i;
7117 -- int pg_scanned = 0;
7118 --
7119 -- zone = NULL;
7120 --
7121 -- for (i = 0; i < pagevec_count(&pvec); i++) {
7122 -- struct page *page = pvec.pages[i];
7123 -- pgoff_t page_index = page->index;
7124 -- struct zone *pagezone = page_zone(page);
7125 --
7126 -- pg_scanned++;
7127 -- if (page_index > next)
7128 -- next = page_index;
7129 -- next++;
7130 --
7131 -- if (pagezone != zone) {
7132 -- if (zone)
7133 -- spin_unlock_irq(&zone->lru_lock);
7134 -- zone = pagezone;
7135 -- spin_lock_irq(&zone->lru_lock);
7136 -- }
7137 -+ if (page_evictable(page, NULL)) {
7138 -+ enum lru_list lru = page_lru_base_type(page);
7139 -
7140 -- if (PageLRU(page) && PageUnevictable(page))
7141 -- check_move_unevictable_page(page, zone);
7142 -+ VM_BUG_ON(PageActive(page));
7143 -+ ClearPageUnevictable(page);
7144 -+ __dec_zone_state(zone, NR_UNEVICTABLE);
7145 -+ list_move(&page->lru, &zone->lru[lru].list);
7146 -+ mem_cgroup_move_lists(page, LRU_UNEVICTABLE, lru);
7147 -+ __inc_zone_state(zone, NR_INACTIVE_ANON + lru);
7148 -+ pgrescued++;
7149 - }
7150 -- if (zone)
7151 -- spin_unlock_irq(&zone->lru_lock);
7152 -- pagevec_release(&pvec);
7153 --
7154 -- count_vm_events(UNEVICTABLE_PGSCANNED, pg_scanned);
7155 - }
7156 -
7157 -+ if (zone) {
7158 -+ __count_vm_events(UNEVICTABLE_PGRESCUED, pgrescued);
7159 -+ __count_vm_events(UNEVICTABLE_PGSCANNED, pgscanned);
7160 -+ spin_unlock_irq(&zone->lru_lock);
7161 -+ }
7162 - }
7163 -+#endif /* CONFIG_SHMEM */
7164 -
7165 - static void warn_scan_unevictable_pages(void)
7166 - {
7167 -diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
7168 -index ea10a51..73495f1 100644
7169 ---- a/net/mac80211/ieee80211_i.h
7170 -+++ b/net/mac80211/ieee80211_i.h
7171 -@@ -702,6 +702,8 @@ struct tpt_led_trigger {
7172 - * well be on the operating channel
7173 - * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to
7174 - * determine if we are on the operating channel or not
7175 -+ * @SCAN_OFF_CHANNEL: We're off our operating channel for scanning,
7176 -+ * gets only set in conjunction with SCAN_SW_SCANNING
7177 - * @SCAN_COMPLETED: Set for our scan work function when the driver reported
7178 - * that the scan completed.
7179 - * @SCAN_ABORTED: Set for our scan work function when the driver reported
7180 -@@ -710,6 +712,7 @@ struct tpt_led_trigger {
7181 - enum {
7182 - SCAN_SW_SCANNING,
7183 - SCAN_HW_SCANNING,
7184 -+ SCAN_OFF_CHANNEL,
7185 - SCAN_COMPLETED,
7186 - SCAN_ABORTED,
7187 - };
7188 -@@ -1140,14 +1143,10 @@ int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata);
7189 - void ieee80211_sched_scan_stopped_work(struct work_struct *work);
7190 -
7191 - /* off-channel helpers */
7192 --bool ieee80211_cfg_on_oper_channel(struct ieee80211_local *local);
7193 --void ieee80211_offchannel_enable_all_ps(struct ieee80211_local *local,
7194 -- bool tell_ap);
7195 --void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local,
7196 -- bool offchannel_ps_enable);
7197 -+void ieee80211_offchannel_stop_beaconing(struct ieee80211_local *local);
7198 -+void ieee80211_offchannel_stop_station(struct ieee80211_local *local);
7199 - void ieee80211_offchannel_return(struct ieee80211_local *local,
7200 -- bool enable_beaconing,
7201 -- bool offchannel_ps_disable);
7202 -+ bool enable_beaconing);
7203 - void ieee80211_hw_roc_setup(struct ieee80211_local *local);
7204 -
7205 - /* interface handling */
7206 -diff --git a/net/mac80211/main.c b/net/mac80211/main.c
7207 -index cae4435..a7536fd 100644
7208 ---- a/net/mac80211/main.c
7209 -+++ b/net/mac80211/main.c
7210 -@@ -92,47 +92,6 @@ static void ieee80211_reconfig_filter(struct work_struct *work)
7211 - ieee80211_configure_filter(local);
7212 - }
7213 -
7214 --/*
7215 -- * Returns true if we are logically configured to be on
7216 -- * the operating channel AND the hardware-conf is currently
7217 -- * configured on the operating channel. Compares channel-type
7218 -- * as well.
7219 -- */
7220 --bool ieee80211_cfg_on_oper_channel(struct ieee80211_local *local)
7221 --{
7222 -- struct ieee80211_channel *chan, *scan_chan;
7223 -- enum nl80211_channel_type channel_type;
7224 --
7225 -- /* This logic needs to match logic in ieee80211_hw_config */
7226 -- if (local->scan_channel) {
7227 -- chan = local->scan_channel;
7228 -- /* If scanning on oper channel, use whatever channel-type
7229 -- * is currently in use.
7230 -- */
7231 -- if (chan == local->oper_channel)
7232 -- channel_type = local->_oper_channel_type;
7233 -- else
7234 -- channel_type = NL80211_CHAN_NO_HT;
7235 -- } else if (local->tmp_channel) {
7236 -- chan = scan_chan = local->tmp_channel;
7237 -- channel_type = local->tmp_channel_type;
7238 -- } else {
7239 -- chan = local->oper_channel;
7240 -- channel_type = local->_oper_channel_type;
7241 -- }
7242 --
7243 -- if (chan != local->oper_channel ||
7244 -- channel_type != local->_oper_channel_type)
7245 -- return false;
7246 --
7247 -- /* Check current hardware-config against oper_channel. */
7248 -- if ((local->oper_channel != local->hw.conf.channel) ||
7249 -- (local->_oper_channel_type != local->hw.conf.channel_type))
7250 -- return false;
7251 --
7252 -- return true;
7253 --}
7254 --
7255 - int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
7256 - {
7257 - struct ieee80211_channel *chan, *scan_chan;
7258 -@@ -145,9 +104,6 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
7259 -
7260 - scan_chan = local->scan_channel;
7261 -
7262 -- /* If this off-channel logic ever changes, ieee80211_on_oper_channel
7263 -- * may need to change as well.
7264 -- */
7265 - offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
7266 - if (scan_chan) {
7267 - chan = scan_chan;
7268 -@@ -158,19 +114,17 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
7269 - channel_type = local->_oper_channel_type;
7270 - else
7271 - channel_type = NL80211_CHAN_NO_HT;
7272 -- } else if (local->tmp_channel) {
7273 -+ local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL;
7274 -+ } else if (local->tmp_channel &&
7275 -+ local->oper_channel != local->tmp_channel) {
7276 - chan = scan_chan = local->tmp_channel;
7277 - channel_type = local->tmp_channel_type;
7278 -+ local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL;
7279 - } else {
7280 - chan = local->oper_channel;
7281 - channel_type = local->_oper_channel_type;
7282 -- }
7283 --
7284 -- if (chan != local->oper_channel ||
7285 -- channel_type != local->_oper_channel_type)
7286 -- local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL;
7287 -- else
7288 - local->hw.conf.flags &= ~IEEE80211_CONF_OFFCHANNEL;
7289 -+ }
7290 -
7291 - offchannel_flag ^= local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
7292 -
7293 -@@ -279,7 +233,7 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
7294 -
7295 - if (changed & BSS_CHANGED_BEACON_ENABLED) {
7296 - if (local->quiescing || !ieee80211_sdata_running(sdata) ||
7297 -- test_bit(SDATA_STATE_OFFCHANNEL, &sdata->state)) {
7298 -+ test_bit(SCAN_SW_SCANNING, &local->scanning)) {
7299 - sdata->vif.bss_conf.enable_beacon = false;
7300 - } else {
7301 - /*
7302 -diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
7303 -index 3d41441..1b239be 100644
7304 ---- a/net/mac80211/offchannel.c
7305 -+++ b/net/mac80211/offchannel.c
7306 -@@ -18,14 +18,10 @@
7307 - #include "driver-trace.h"
7308 -
7309 - /*
7310 -- * Tell our hardware to disable PS.
7311 -- * Optionally inform AP that we will go to sleep so that it will buffer
7312 -- * the frames while we are doing off-channel work. This is optional
7313 -- * because we *may* be doing work on-operating channel, and want our
7314 -- * hardware unconditionally awake, but still let the AP send us normal frames.
7315 -+ * inform AP that we will go to sleep so that it will buffer the frames
7316 -+ * while we scan
7317 - */
7318 --static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata,
7319 -- bool tell_ap)
7320 -+static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata)
7321 - {
7322 - struct ieee80211_local *local = sdata->local;
7323 - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
7324 -@@ -46,8 +42,8 @@ static void ieee80211_offchannel_ps_enable(struct ieee80211_sub_if_data *sdata,
7325 - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
7326 - }
7327 -
7328 -- if (tell_ap && (!local->offchannel_ps_enabled ||
7329 -- !(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)))
7330 -+ if (!(local->offchannel_ps_enabled) ||
7331 -+ !(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK))
7332 - /*
7333 - * If power save was enabled, no need to send a nullfunc
7334 - * frame because AP knows that we are sleeping. But if the
7335 -@@ -82,9 +78,6 @@ static void ieee80211_offchannel_ps_disable(struct ieee80211_sub_if_data *sdata)
7336 - * we are sleeping, let's just enable power save mode in
7337 - * hardware.
7338 - */
7339 -- /* TODO: Only set hardware if CONF_PS changed?
7340 -- * TODO: Should we set offchannel_ps_enabled to false?
7341 -- */
7342 - local->hw.conf.flags |= IEEE80211_CONF_PS;
7343 - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
7344 - } else if (local->hw.conf.dynamic_ps_timeout > 0) {
7345 -@@ -103,61 +96,63 @@ static void ieee80211_offchannel_ps_disable(struct ieee80211_sub_if_data *sdata)
7346 - ieee80211_sta_reset_conn_monitor(sdata);
7347 - }
7348 -
7349 --void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local,
7350 -- bool offchannel_ps_enable)
7351 -+void ieee80211_offchannel_stop_beaconing(struct ieee80211_local *local)
7352 - {
7353 - struct ieee80211_sub_if_data *sdata;
7354 -
7355 -- /*
7356 -- * notify the AP about us leaving the channel and stop all
7357 -- * STA interfaces.
7358 -- */
7359 - mutex_lock(&local->iflist_mtx);
7360 - list_for_each_entry(sdata, &local->interfaces, list) {
7361 - if (!ieee80211_sdata_running(sdata))
7362 - continue;
7363 -
7364 -- if (sdata->vif.type != NL80211_IFTYPE_MONITOR)
7365 -- set_bit(SDATA_STATE_OFFCHANNEL, &sdata->state);
7366 --
7367 -- /* Check to see if we should disable beaconing. */
7368 -+ /* disable beaconing */
7369 - if (sdata->vif.type == NL80211_IFTYPE_AP ||
7370 - sdata->vif.type == NL80211_IFTYPE_ADHOC ||
7371 - sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
7372 - ieee80211_bss_info_change_notify(
7373 - sdata, BSS_CHANGED_BEACON_ENABLED);
7374 -
7375 -- if (sdata->vif.type != NL80211_IFTYPE_MONITOR) {
7376 -+ /*
7377 -+ * only handle non-STA interfaces here, STA interfaces
7378 -+ * are handled in ieee80211_offchannel_stop_station(),
7379 -+ * e.g., from the background scan state machine.
7380 -+ *
7381 -+ * In addition, do not stop monitor interface to allow it to be
7382 -+ * used from user space controlled off-channel operations.
7383 -+ */
7384 -+ if (sdata->vif.type != NL80211_IFTYPE_STATION &&
7385 -+ sdata->vif.type != NL80211_IFTYPE_MONITOR) {
7386 -+ set_bit(SDATA_STATE_OFFCHANNEL, &sdata->state);
7387 - netif_tx_stop_all_queues(sdata->dev);
7388 -- if (offchannel_ps_enable &&
7389 -- (sdata->vif.type == NL80211_IFTYPE_STATION) &&
7390 -- sdata->u.mgd.associated)
7391 -- ieee80211_offchannel_ps_enable(sdata, true);
7392 - }
7393 - }
7394 - mutex_unlock(&local->iflist_mtx);
7395 - }
7396 -
7397 --void ieee80211_offchannel_enable_all_ps(struct ieee80211_local *local,
7398 -- bool tell_ap)
7399 -+void ieee80211_offchannel_stop_station(struct ieee80211_local *local)
7400 - {
7401 - struct ieee80211_sub_if_data *sdata;
7402 -
7403 -+ /*
7404 -+ * notify the AP about us leaving the channel and stop all STA interfaces
7405 -+ */
7406 - mutex_lock(&local->iflist_mtx);
7407 - list_for_each_entry(sdata, &local->interfaces, list) {
7408 - if (!ieee80211_sdata_running(sdata))
7409 - continue;
7410 -
7411 -- if (sdata->vif.type == NL80211_IFTYPE_STATION &&
7412 -- sdata->u.mgd.associated)
7413 -- ieee80211_offchannel_ps_enable(sdata, tell_ap);
7414 -+ if (sdata->vif.type == NL80211_IFTYPE_STATION) {
7415 -+ set_bit(SDATA_STATE_OFFCHANNEL, &sdata->state);
7416 -+ netif_tx_stop_all_queues(sdata->dev);
7417 -+ if (sdata->u.mgd.associated)
7418 -+ ieee80211_offchannel_ps_enable(sdata);
7419 -+ }
7420 - }
7421 - mutex_unlock(&local->iflist_mtx);
7422 - }
7423 -
7424 - void ieee80211_offchannel_return(struct ieee80211_local *local,
7425 -- bool enable_beaconing,
7426 -- bool offchannel_ps_disable)
7427 -+ bool enable_beaconing)
7428 - {
7429 - struct ieee80211_sub_if_data *sdata;
7430 -
7431 -@@ -167,8 +162,7 @@ void ieee80211_offchannel_return(struct ieee80211_local *local,
7432 - continue;
7433 -
7434 - /* Tell AP we're back */
7435 -- if (offchannel_ps_disable &&
7436 -- sdata->vif.type == NL80211_IFTYPE_STATION) {
7437 -+ if (sdata->vif.type == NL80211_IFTYPE_STATION) {
7438 - if (sdata->u.mgd.associated)
7439 - ieee80211_offchannel_ps_disable(sdata);
7440 - }
7441 -@@ -188,7 +182,7 @@ void ieee80211_offchannel_return(struct ieee80211_local *local,
7442 - netif_tx_wake_all_queues(sdata->dev);
7443 - }
7444 -
7445 -- /* Check to see if we should re-enable beaconing */
7446 -+ /* re-enable beaconing */
7447 - if (enable_beaconing &&
7448 - (sdata->vif.type == NL80211_IFTYPE_AP ||
7449 - sdata->vif.type == NL80211_IFTYPE_ADHOC ||
7450 -diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
7451 -index fb123e2..5c51607 100644
7452 ---- a/net/mac80211/rx.c
7453 -+++ b/net/mac80211/rx.c
7454 -@@ -421,10 +421,16 @@ ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx)
7455 - return RX_CONTINUE;
7456 -
7457 - if (test_bit(SCAN_HW_SCANNING, &local->scanning) ||
7458 -- test_bit(SCAN_SW_SCANNING, &local->scanning) ||
7459 - local->sched_scanning)
7460 - return ieee80211_scan_rx(rx->sdata, skb);
7461 -
7462 -+ if (test_bit(SCAN_SW_SCANNING, &local->scanning)) {
7463 -+ /* drop all the other packets during a software scan anyway */
7464 -+ if (ieee80211_scan_rx(rx->sdata, skb) != RX_QUEUED)
7465 -+ dev_kfree_skb(skb);
7466 -+ return RX_QUEUED;
7467 -+ }
7468 -+
7469 - /* scanning finished during invoking of handlers */
7470 - I802_DEBUG_INC(local->rx_handlers_drop_passive_scan);
7471 - return RX_DROP_UNUSABLE;
7472 -@@ -2858,7 +2864,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
7473 - local->dot11ReceivedFragmentCount++;
7474 -
7475 - if (unlikely(test_bit(SCAN_HW_SCANNING, &local->scanning) ||
7476 -- test_bit(SCAN_SW_SCANNING, &local->scanning)))
7477 -+ test_bit(SCAN_OFF_CHANNEL, &local->scanning)))
7478 - status->rx_flags |= IEEE80211_RX_IN_SCAN;
7479 -
7480 - if (ieee80211_is_mgmt(fc))
7481 -diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
7482 -index 105436d..5279300 100644
7483 ---- a/net/mac80211/scan.c
7484 -+++ b/net/mac80211/scan.c
7485 -@@ -213,14 +213,6 @@ ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
7486 - if (bss)
7487 - ieee80211_rx_bss_put(sdata->local, bss);
7488 -
7489 -- /* If we are on-operating-channel, and this packet is for the
7490 -- * current channel, pass the pkt on up the stack so that
7491 -- * the rest of the stack can make use of it.
7492 -- */
7493 -- if (ieee80211_cfg_on_oper_channel(sdata->local)
7494 -- && (channel == sdata->local->oper_channel))
7495 -- return RX_CONTINUE;
7496 --
7497 - dev_kfree_skb(skb);
7498 - return RX_QUEUED;
7499 - }
7500 -@@ -264,8 +256,6 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted,
7501 - bool was_hw_scan)
7502 - {
7503 - struct ieee80211_local *local = hw_to_local(hw);
7504 -- bool on_oper_chan;
7505 -- bool enable_beacons = false;
7506 -
7507 - lockdep_assert_held(&local->mtx);
7508 -
7509 -@@ -298,25 +288,11 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted,
7510 - local->scanning = 0;
7511 - local->scan_channel = NULL;
7512 -
7513 -- on_oper_chan = ieee80211_cfg_on_oper_channel(local);
7514 --
7515 -- if (was_hw_scan || !on_oper_chan)
7516 -- ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
7517 -- else
7518 -- /* Set power back to normal operating levels. */
7519 -- ieee80211_hw_config(local, 0);
7520 --
7521 -+ ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
7522 - if (!was_hw_scan) {
7523 -- bool on_oper_chan2;
7524 - ieee80211_configure_filter(local);
7525 - drv_sw_scan_complete(local);
7526 -- on_oper_chan2 = ieee80211_cfg_on_oper_channel(local);
7527 -- /* We should always be on-channel at this point. */
7528 -- WARN_ON(!on_oper_chan2);
7529 -- if (on_oper_chan2 && (on_oper_chan != on_oper_chan2))
7530 -- enable_beacons = true;
7531 --
7532 -- ieee80211_offchannel_return(local, enable_beacons, true);
7533 -+ ieee80211_offchannel_return(local, true);
7534 - }
7535 -
7536 - ieee80211_recalc_idle(local);
7537 -@@ -357,15 +333,13 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local)
7538 - */
7539 - drv_sw_scan_start(local);
7540 -
7541 -+ ieee80211_offchannel_stop_beaconing(local);
7542 -+
7543 - local->leave_oper_channel_time = 0;
7544 - local->next_scan_state = SCAN_DECISION;
7545 - local->scan_channel_idx = 0;
7546 -
7547 -- /* We always want to use off-channel PS, even if we
7548 -- * are not really leaving oper-channel. Don't
7549 -- * tell the AP though, as long as we are on-channel.
7550 -- */
7551 -- ieee80211_offchannel_enable_all_ps(local, false);
7552 -+ drv_flush(local, false);
7553 -
7554 - ieee80211_configure_filter(local);
7555 -
7556 -@@ -508,20 +482,7 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local,
7557 - }
7558 - mutex_unlock(&local->iflist_mtx);
7559 -
7560 -- next_chan = local->scan_req->channels[local->scan_channel_idx];
7561 --
7562 -- if (ieee80211_cfg_on_oper_channel(local)) {
7563 -- /* We're currently on operating channel. */
7564 -- if (next_chan == local->oper_channel)
7565 -- /* We don't need to move off of operating channel. */
7566 -- local->next_scan_state = SCAN_SET_CHANNEL;
7567 -- else
7568 -- /*
7569 -- * We do need to leave operating channel, as next
7570 -- * scan is somewhere else.
7571 -- */
7572 -- local->next_scan_state = SCAN_LEAVE_OPER_CHANNEL;
7573 -- } else {
7574 -+ if (local->scan_channel) {
7575 - /*
7576 - * we're currently scanning a different channel, let's
7577 - * see if we can scan another channel without interfering
7578 -@@ -537,6 +498,7 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local,
7579 - *
7580 - * Otherwise switch back to the operating channel.
7581 - */
7582 -+ next_chan = local->scan_req->channels[local->scan_channel_idx];
7583 -
7584 - bad_latency = time_after(jiffies +
7585 - ieee80211_scan_get_channel_time(next_chan),
7586 -@@ -554,6 +516,12 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local,
7587 - local->next_scan_state = SCAN_ENTER_OPER_CHANNEL;
7588 - else
7589 - local->next_scan_state = SCAN_SET_CHANNEL;
7590 -+ } else {
7591 -+ /*
7592 -+ * we're on the operating channel currently, let's
7593 -+ * leave that channel now to scan another one
7594 -+ */
7595 -+ local->next_scan_state = SCAN_LEAVE_OPER_CHANNEL;
7596 - }
7597 -
7598 - *next_delay = 0;
7599 -@@ -562,10 +530,9 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local,
7600 - static void ieee80211_scan_state_leave_oper_channel(struct ieee80211_local *local,
7601 - unsigned long *next_delay)
7602 - {
7603 -- /* PS will already be in off-channel mode,
7604 -- * we do that once at the beginning of scanning.
7605 -- */
7606 -- ieee80211_offchannel_stop_vifs(local, false);
7607 -+ ieee80211_offchannel_stop_station(local);
7608 -+
7609 -+ __set_bit(SCAN_OFF_CHANNEL, &local->scanning);
7610 -
7611 - /*
7612 - * What if the nullfunc frames didn't arrive?
7613 -@@ -588,15 +555,15 @@ static void ieee80211_scan_state_enter_oper_channel(struct ieee80211_local *loca
7614 - {
7615 - /* switch back to the operating channel */
7616 - local->scan_channel = NULL;
7617 -- if (!ieee80211_cfg_on_oper_channel(local))
7618 -- ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
7619 -+ ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
7620 -
7621 - /*
7622 -- * Re-enable vifs and beaconing. Leave PS
7623 -- * in off-channel state..will put that back
7624 -- * on-channel at the end of scanning.
7625 -+ * Only re-enable station mode interface now; beaconing will be
7626 -+ * re-enabled once the full scan has been completed.
7627 - */
7628 -- ieee80211_offchannel_return(local, true, false);
7629 -+ ieee80211_offchannel_return(local, false);
7630 -+
7631 -+ __clear_bit(SCAN_OFF_CHANNEL, &local->scanning);
7632 -
7633 - *next_delay = HZ / 5;
7634 - local->next_scan_state = SCAN_DECISION;
7635 -diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
7636 -index 1f8b120..eff1f4e 100644
7637 ---- a/net/mac80211/tx.c
7638 -+++ b/net/mac80211/tx.c
7639 -@@ -259,8 +259,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
7640 - if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED))
7641 - return TX_CONTINUE;
7642 -
7643 -- if (unlikely(test_bit(SCAN_SW_SCANNING, &tx->local->scanning)) &&
7644 -- test_bit(SDATA_STATE_OFFCHANNEL, &tx->sdata->state) &&
7645 -+ if (unlikely(test_bit(SCAN_OFF_CHANNEL, &tx->local->scanning)) &&
7646 - !ieee80211_is_probe_req(hdr->frame_control) &&
7647 - !ieee80211_is_nullfunc(hdr->frame_control))
7648 - /*
7649 -diff --git a/net/mac80211/work.c b/net/mac80211/work.c
7650 -index 6c53b6d..99165ef 100644
7651 ---- a/net/mac80211/work.c
7652 -+++ b/net/mac80211/work.c
7653 -@@ -899,26 +899,6 @@ static bool ieee80211_work_ct_coexists(enum nl80211_channel_type wk_ct,
7654 - return false;
7655 - }
7656 -
7657 --static enum nl80211_channel_type
7658 --ieee80211_calc_ct(enum nl80211_channel_type wk_ct,
7659 -- enum nl80211_channel_type oper_ct)
7660 --{
7661 -- switch (wk_ct) {
7662 -- case NL80211_CHAN_NO_HT:
7663 -- return oper_ct;
7664 -- case NL80211_CHAN_HT20:
7665 -- if (oper_ct != NL80211_CHAN_NO_HT)
7666 -- return oper_ct;
7667 -- return wk_ct;
7668 -- case NL80211_CHAN_HT40MINUS:
7669 -- case NL80211_CHAN_HT40PLUS:
7670 -- return wk_ct;
7671 -- }
7672 -- WARN_ON(1); /* shouldn't get here */
7673 -- return wk_ct;
7674 --}
7675 --
7676 --
7677 - static void ieee80211_work_timer(unsigned long data)
7678 - {
7679 - struct ieee80211_local *local = (void *) data;
7680 -@@ -969,52 +949,18 @@ static void ieee80211_work_work(struct work_struct *work)
7681 - }
7682 -
7683 - if (!started && !local->tmp_channel) {
7684 -- bool on_oper_chan;
7685 -- bool tmp_chan_changed = false;
7686 -- bool on_oper_chan2;
7687 -- enum nl80211_channel_type wk_ct;
7688 -- on_oper_chan = ieee80211_cfg_on_oper_channel(local);
7689 --
7690 -- /* Work with existing channel type if possible. */
7691 -- wk_ct = wk->chan_type;
7692 -- if (wk->chan == local->hw.conf.channel)
7693 -- wk_ct = ieee80211_calc_ct(wk->chan_type,
7694 -- local->hw.conf.channel_type);
7695 --
7696 -- if (local->tmp_channel)
7697 -- if ((local->tmp_channel != wk->chan) ||
7698 -- (local->tmp_channel_type != wk_ct))
7699 -- tmp_chan_changed = true;
7700 --
7701 -- local->tmp_channel = wk->chan;
7702 -- local->tmp_channel_type = wk_ct;
7703 - /*
7704 -- * Leave the station vifs in awake mode if they
7705 -- * happen to be on the same channel as
7706 -- * the requested channel.
7707 -+ * TODO: could optimize this by leaving the
7708 -+ * station vifs in awake mode if they
7709 -+ * happen to be on the same channel as
7710 -+ * the requested channel
7711 - */
7712 -- on_oper_chan2 = ieee80211_cfg_on_oper_channel(local);
7713 -- if (on_oper_chan != on_oper_chan2) {
7714 -- if (on_oper_chan2) {
7715 -- /* going off oper channel, PS too */
7716 -- ieee80211_offchannel_stop_vifs(local,
7717 -- true);
7718 -- ieee80211_hw_config(local, 0);
7719 -- } else {
7720 -- /* going on channel, but leave PS
7721 -- * off-channel. */
7722 -- ieee80211_hw_config(local, 0);
7723 -- ieee80211_offchannel_return(local,
7724 -- true,
7725 -- false);
7726 -- }
7727 -- } else if (tmp_chan_changed)
7728 -- /* Still off-channel, but on some other
7729 -- * channel, so update hardware.
7730 -- * PS should already be off-channel.
7731 -- */
7732 -- ieee80211_hw_config(local, 0);
7733 -+ ieee80211_offchannel_stop_beaconing(local);
7734 -+ ieee80211_offchannel_stop_station(local);
7735 -
7736 -+ local->tmp_channel = wk->chan;
7737 -+ local->tmp_channel_type = wk->chan_type;
7738 -+ ieee80211_hw_config(local, 0);
7739 - started = true;
7740 - wk->timeout = jiffies;
7741 - }
7742 -@@ -1100,8 +1046,7 @@ static void ieee80211_work_work(struct work_struct *work)
7743 - * we still need to do a hardware config. Currently,
7744 - * we cannot be here while scanning, however.
7745 - */
7746 -- if (!ieee80211_cfg_on_oper_channel(local))
7747 -- ieee80211_hw_config(local, 0);
7748 -+ ieee80211_hw_config(local, 0);
7749 -
7750 - /* At the least, we need to disable offchannel_ps,
7751 - * so just go ahead and run the entire offchannel
7752 -@@ -1109,7 +1054,7 @@ static void ieee80211_work_work(struct work_struct *work)
7753 - * beaconing if we were already on-oper-channel
7754 - * as a future optimization.
7755 - */
7756 -- ieee80211_offchannel_return(local, true, true);
7757 -+ ieee80211_offchannel_return(local, true);
7758 -
7759 - /* give connection some time to breathe */
7760 - run_again(local, jiffies + HZ/2);
7761 -diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
7762 -index f614ce7..28a39bb 100644
7763 ---- a/net/mac80211/wpa.c
7764 -+++ b/net/mac80211/wpa.c
7765 -@@ -106,7 +106,7 @@ ieee80211_rx_h_michael_mic_verify(struct ieee80211_rx_data *rx)
7766 - if (status->flag & RX_FLAG_MMIC_ERROR)
7767 - goto mic_fail;
7768 -
7769 -- if (!(status->flag & RX_FLAG_IV_STRIPPED))
7770 -+ if (!(status->flag & RX_FLAG_IV_STRIPPED) && rx->key)
7771 - goto update_iv;
7772 -
7773 - return RX_CONTINUE;
7774 -diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
7775 -index 6e03888..d4ad50e 100644
7776 ---- a/net/sunrpc/svc.c
7777 -+++ b/net/sunrpc/svc.c
7778 -@@ -167,6 +167,7 @@ svc_pool_map_alloc_arrays(struct svc_pool_map *m, unsigned int maxpools)
7779 -
7780 - fail_free:
7781 - kfree(m->to_pool);
7782 -+ m->to_pool = NULL;
7783 - fail:
7784 - return -ENOMEM;
7785 - }
7786 -@@ -287,7 +288,9 @@ svc_pool_map_put(void)
7787 - if (!--m->count) {
7788 - m->mode = SVC_POOL_DEFAULT;
7789 - kfree(m->to_pool);
7790 -+ m->to_pool = NULL;
7791 - kfree(m->pool_to);
7792 -+ m->pool_to = NULL;
7793 - m->npools = 0;
7794 - }
7795 -
7796 -@@ -527,17 +530,20 @@ svc_destroy(struct svc_serv *serv)
7797 - printk("svc_destroy: no threads for serv=%p!\n", serv);
7798 -
7799 - del_timer_sync(&serv->sv_temptimer);
7800 --
7801 -- svc_close_all(&serv->sv_tempsocks);
7802 -+ /*
7803 -+ * The set of xprts (contained in the sv_tempsocks and
7804 -+ * sv_permsocks lists) is now constant, since it is modified
7805 -+ * only by accepting new sockets (done by service threads in
7806 -+ * svc_recv) or aging old ones (done by sv_temptimer), or
7807 -+ * configuration changes (excluded by whatever locking the
7808 -+ * caller is using--nfsd_mutex in the case of nfsd). So it's
7809 -+ * safe to traverse those lists and shut everything down:
7810 -+ */
7811 -+ svc_close_all(serv);
7812 -
7813 - if (serv->sv_shutdown)
7814 - serv->sv_shutdown(serv);
7815 -
7816 -- svc_close_all(&serv->sv_permsocks);
7817 --
7818 -- BUG_ON(!list_empty(&serv->sv_permsocks));
7819 -- BUG_ON(!list_empty(&serv->sv_tempsocks));
7820 --
7821 - cache_clean_deferred(serv);
7822 -
7823 - if (svc_serv_is_pooled(serv))
7824 -diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
7825 -index 447cd0e..9ed2cd0 100644
7826 ---- a/net/sunrpc/svc_xprt.c
7827 -+++ b/net/sunrpc/svc_xprt.c
7828 -@@ -893,14 +893,7 @@ void svc_delete_xprt(struct svc_xprt *xprt)
7829 - spin_lock_bh(&serv->sv_lock);
7830 - if (!test_and_set_bit(XPT_DETACHED, &xprt->xpt_flags))
7831 - list_del_init(&xprt->xpt_list);
7832 -- /*
7833 -- * The only time we're called while xpt_ready is still on a list
7834 -- * is while the list itself is about to be destroyed (in
7835 -- * svc_destroy). BUT svc_xprt_enqueue could still be attempting
7836 -- * to add new entries to the sp_sockets list, so we can't leave
7837 -- * a freed xprt on it.
7838 -- */
7839 -- list_del_init(&xprt->xpt_ready);
7840 -+ BUG_ON(!list_empty(&xprt->xpt_ready));
7841 - if (test_bit(XPT_TEMP, &xprt->xpt_flags))
7842 - serv->sv_tmpcnt--;
7843 - spin_unlock_bh(&serv->sv_lock);
7844 -@@ -928,22 +921,48 @@ void svc_close_xprt(struct svc_xprt *xprt)
7845 - }
7846 - EXPORT_SYMBOL_GPL(svc_close_xprt);
7847 -
7848 --void svc_close_all(struct list_head *xprt_list)
7849 -+static void svc_close_list(struct list_head *xprt_list)
7850 -+{
7851 -+ struct svc_xprt *xprt;
7852 -+
7853 -+ list_for_each_entry(xprt, xprt_list, xpt_list) {
7854 -+ set_bit(XPT_CLOSE, &xprt->xpt_flags);
7855 -+ set_bit(XPT_BUSY, &xprt->xpt_flags);
7856 -+ }
7857 -+}
7858 -+
7859 -+void svc_close_all(struct svc_serv *serv)
7860 - {
7861 -+ struct svc_pool *pool;
7862 - struct svc_xprt *xprt;
7863 - struct svc_xprt *tmp;
7864 -+ int i;
7865 -+
7866 -+ svc_close_list(&serv->sv_tempsocks);
7867 -+ svc_close_list(&serv->sv_permsocks);
7868 -
7869 -+ for (i = 0; i < serv->sv_nrpools; i++) {
7870 -+ pool = &serv->sv_pools[i];
7871 -+
7872 -+ spin_lock_bh(&pool->sp_lock);
7873 -+ while (!list_empty(&pool->sp_sockets)) {
7874 -+ xprt = list_first_entry(&pool->sp_sockets, struct svc_xprt, xpt_ready);
7875 -+ list_del_init(&xprt->xpt_ready);
7876 -+ }
7877 -+ spin_unlock_bh(&pool->sp_lock);
7878 -+ }
7879 - /*
7880 -- * The server is shutting down, and no more threads are running.
7881 -- * svc_xprt_enqueue() might still be running, but at worst it
7882 -- * will re-add the xprt to sp_sockets, which will soon get
7883 -- * freed. So we don't bother with any more locking, and don't
7884 -- * leave the close to the (nonexistent) server threads:
7885 -+ * At this point the sp_sockets lists will stay empty, since
7886 -+ * svc_enqueue will not add new entries without taking the
7887 -+ * sp_lock and checking XPT_BUSY.
7888 - */
7889 -- list_for_each_entry_safe(xprt, tmp, xprt_list, xpt_list) {
7890 -- set_bit(XPT_CLOSE, &xprt->xpt_flags);
7891 -+ list_for_each_entry_safe(xprt, tmp, &serv->sv_tempsocks, xpt_list)
7892 - svc_delete_xprt(xprt);
7893 -- }
7894 -+ list_for_each_entry_safe(xprt, tmp, &serv->sv_permsocks, xpt_list)
7895 -+ svc_delete_xprt(xprt);
7896 -+
7897 -+ BUG_ON(!list_empty(&serv->sv_permsocks));
7898 -+ BUG_ON(!list_empty(&serv->sv_tempsocks));
7899 - }
7900 -
7901 - /*
7902 -diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
7903 -index 277ebd4..593f4c6 100644
7904 ---- a/net/sunrpc/xdr.c
7905 -+++ b/net/sunrpc/xdr.c
7906 -@@ -296,7 +296,7 @@ _copy_to_pages(struct page **pages, size_t pgbase, const char *p, size_t len)
7907 - * Copies data into an arbitrary memory location from an array of pages
7908 - * The copy is assumed to be non-overlapping.
7909 - */
7910 --static void
7911 -+void
7912 - _copy_from_pages(char *p, struct page **pages, size_t pgbase, size_t len)
7913 - {
7914 - struct page **pgfrom;
7915 -@@ -324,6 +324,7 @@ _copy_from_pages(char *p, struct page **pages, size_t pgbase, size_t len)
7916 -
7917 - } while ((len -= copy) != 0);
7918 - }
7919 -+EXPORT_SYMBOL_GPL(_copy_from_pages);
7920 -
7921 - /*
7922 - * xdr_shrink_bufhead
7923 -diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
7924 -index ec7afce..bccf07d 100644
7925 ---- a/scripts/kconfig/streamline_config.pl
7926 -+++ b/scripts/kconfig/streamline_config.pl
7927 -@@ -250,33 +250,61 @@ if ($kconfig) {
7928 - read_kconfig($kconfig);
7929 - }
7930 -
7931 -+sub convert_vars {
7932 -+ my ($line, %vars) = @_;
7933 -+
7934 -+ my $process = "";
7935 -+
7936 -+ while ($line =~ s/^(.*?)(\$\((.*?)\))//) {
7937 -+ my $start = $1;
7938 -+ my $variable = $2;
7939 -+ my $var = $3;
7940 -+
7941 -+ if (defined($vars{$var})) {
7942 -+ $process .= $start . $vars{$var};
7943 -+ } else {
7944 -+ $process .= $start . $variable;
7945 -+ }
7946 -+ }
7947 -+
7948 -+ $process .= $line;
7949 -+
7950 -+ return $process;
7951 -+}
7952 -+
7953 - # Read all Makefiles to map the configs to the objects
7954 - foreach my $makefile (@makefiles) {
7955 -
7956 -- my $cont = 0;
7957 -+ my $line = "";
7958 -+ my %make_vars;
7959 -
7960 - open(MIN,$makefile) || die "Can't open $makefile";
7961 - while (<MIN>) {
7962 -+ # if this line ends with a backslash, continue
7963 -+ chomp;
7964 -+ if (/^(.*)\\$/) {
7965 -+ $line .= $1;
7966 -+ next;
7967 -+ }
7968 -+
7969 -+ $line .= $_;
7970 -+ $_ = $line;
7971 -+ $line = "";
7972 -+
7973 - my $objs;
7974 -
7975 -- # is this a line after a line with a backslash?
7976 -- if ($cont && /(\S.*)$/) {
7977 -- $objs = $1;
7978 -- }
7979 -- $cont = 0;
7980 -+ $_ = convert_vars($_, %make_vars);
7981 -
7982 - # collect objects after obj-$(CONFIG_FOO_BAR)
7983 - if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) {
7984 - $var = $1;
7985 - $objs = $2;
7986 -+
7987 -+ # check if variables are set
7988 -+ } elsif (/^\s*(\S+)\s*[:]?=\s*(.*\S)/) {
7989 -+ $make_vars{$1} = $2;
7990 - }
7991 - if (defined($objs)) {
7992 -- # test if the line ends with a backslash
7993 -- if ($objs =~ m,(.*)\\$,) {
7994 -- $objs = $1;
7995 -- $cont = 1;
7996 -- }
7997 --
7998 - foreach my $obj (split /\s+/,$objs) {
7999 - $obj =~ s/-/_/g;
8000 - if ($obj =~ /(.*)\.o$/) {
8001 -diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
8002 -index f40a6af6..54e35c1 100644
8003 ---- a/scripts/recordmcount.h
8004 -+++ b/scripts/recordmcount.h
8005 -@@ -462,7 +462,7 @@ __has_rel_mcount(Elf_Shdr const *const relhdr, /* is SHT_REL or SHT_RELA */
8006 - succeed_file();
8007 - }
8008 - if (w(txthdr->sh_type) != SHT_PROGBITS ||
8009 -- !(w(txthdr->sh_flags) & SHF_EXECINSTR))
8010 -+ !(_w(txthdr->sh_flags) & SHF_EXECINSTR))
8011 - return NULL;
8012 - return txtname;
8013 - }
8014 -diff --git a/security/integrity/ima/ima_api.c b/security/integrity/ima/ima_api.c
8015 -index 0d50df0..88a2788 100644
8016 ---- a/security/integrity/ima/ima_api.c
8017 -+++ b/security/integrity/ima/ima_api.c
8018 -@@ -178,8 +178,8 @@ void ima_store_measurement(struct integrity_iint_cache *iint,
8019 - strncpy(entry->template.file_name, filename, IMA_EVENT_NAME_LEN_MAX);
8020 -
8021 - result = ima_store_template(entry, violation, inode);
8022 -- if (!result)
8023 -+ if (!result || result == -EEXIST)
8024 - iint->flags |= IMA_MEASURED;
8025 -- else
8026 -+ if (result < 0)
8027 - kfree(entry);
8028 - }
8029 -diff --git a/security/integrity/ima/ima_queue.c b/security/integrity/ima/ima_queue.c
8030 -index 8e28f04..55a6271 100644
8031 ---- a/security/integrity/ima/ima_queue.c
8032 -+++ b/security/integrity/ima/ima_queue.c
8033 -@@ -23,6 +23,8 @@
8034 - #include <linux/slab.h>
8035 - #include "ima.h"
8036 -
8037 -+#define AUDIT_CAUSE_LEN_MAX 32
8038 -+
8039 - LIST_HEAD(ima_measurements); /* list of all measurements */
8040 -
8041 - /* key: inode (before secure-hashing a file) */
8042 -@@ -94,7 +96,8 @@ static int ima_pcr_extend(const u8 *hash)
8043 -
8044 - result = tpm_pcr_extend(TPM_ANY_NUM, CONFIG_IMA_MEASURE_PCR_IDX, hash);
8045 - if (result != 0)
8046 -- pr_err("IMA: Error Communicating to TPM chip\n");
8047 -+ pr_err("IMA: Error Communicating to TPM chip, result: %d\n",
8048 -+ result);
8049 - return result;
8050 - }
8051 -
8052 -@@ -106,14 +109,16 @@ int ima_add_template_entry(struct ima_template_entry *entry, int violation,
8053 - {
8054 - u8 digest[IMA_DIGEST_SIZE];
8055 - const char *audit_cause = "hash_added";
8056 -+ char tpm_audit_cause[AUDIT_CAUSE_LEN_MAX];
8057 - int audit_info = 1;
8058 -- int result = 0;
8059 -+ int result = 0, tpmresult = 0;
8060 -
8061 - mutex_lock(&ima_extend_list_mutex);
8062 - if (!violation) {
8063 - memcpy(digest, entry->digest, sizeof digest);
8064 - if (ima_lookup_digest_entry(digest)) {
8065 - audit_cause = "hash_exists";
8066 -+ result = -EEXIST;
8067 - goto out;
8068 - }
8069 - }
8070 -@@ -128,9 +133,11 @@ int ima_add_template_entry(struct ima_template_entry *entry, int violation,
8071 - if (violation) /* invalidate pcr */
8072 - memset(digest, 0xff, sizeof digest);
8073 -
8074 -- result = ima_pcr_extend(digest);
8075 -- if (result != 0) {
8076 -- audit_cause = "TPM error";
8077 -+ tpmresult = ima_pcr_extend(digest);
8078 -+ if (tpmresult != 0) {
8079 -+ snprintf(tpm_audit_cause, AUDIT_CAUSE_LEN_MAX, "TPM_error(%d)",
8080 -+ tpmresult);
8081 -+ audit_cause = tpm_audit_cause;
8082 - audit_info = 0;
8083 - }
8084 - out:
8085 -diff --git a/security/tomoyo/util.c b/security/tomoyo/util.c
8086 -index 4a9b4b2..867558c 100644
8087 ---- a/security/tomoyo/util.c
8088 -+++ b/security/tomoyo/util.c
8089 -@@ -492,13 +492,13 @@ static bool tomoyo_correct_word2(const char *string, size_t len)
8090 - if (d < '0' || d > '7' || e < '0' || e > '7')
8091 - break;
8092 - c = tomoyo_make_byte(c, d, e);
8093 -- if (tomoyo_invalid(c))
8094 -- continue; /* pattern is not \000 */
8095 -+ if (c <= ' ' || c >= 127)
8096 -+ continue;
8097 - }
8098 - goto out;
8099 - } else if (in_repetition && c == '/') {
8100 - goto out;
8101 -- } else if (tomoyo_invalid(c)) {
8102 -+ } else if (c <= ' ' || c >= 127) {
8103 - goto out;
8104 - }
8105 - }
8106 -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
8107 -index c2f79e6..5b2b75b 100644
8108 ---- a/sound/pci/hda/hda_intel.c
8109 -+++ b/sound/pci/hda/hda_intel.c
8110 -@@ -2509,6 +2509,7 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = {
8111 - SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB),
8112 - SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS 1101HA", POS_FIX_LPIB),
8113 - SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB),
8114 -+ SND_PCI_QUIRK(0x10de, 0xcb89, "Macbook Pro 7,1", POS_FIX_LPIB),
8115 - SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB),
8116 - SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB),
8117 - SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB),
8118 -diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
8119 -index 618ddad..368f0c5 100644
8120 ---- a/sound/pci/hda/hda_local.h
8121 -+++ b/sound/pci/hda/hda_local.h
8122 -@@ -487,7 +487,12 @@ static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid)
8123 - }
8124 -
8125 - /* get the widget type from widget capability bits */
8126 --#define get_wcaps_type(wcaps) (((wcaps) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT)
8127 -+static inline int get_wcaps_type(unsigned int wcaps)
8128 -+{
8129 -+ if (!wcaps)
8130 -+ return -1; /* invalid type */
8131 -+ return (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
8132 -+}
8133 -
8134 - static inline unsigned int get_wcaps_channels(u32 wcaps)
8135 - {
8136 -diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
8137 -index 2c981b5..254ab52 100644
8138 ---- a/sound/pci/hda/hda_proc.c
8139 -+++ b/sound/pci/hda/hda_proc.c
8140 -@@ -54,6 +54,8 @@ static const char *get_wid_type_name(unsigned int wid_value)
8141 - [AC_WID_BEEP] = "Beep Generator Widget",
8142 - [AC_WID_VENDOR] = "Vendor Defined Widget",
8143 - };
8144 -+ if (wid_value == -1)
8145 -+ return "UNKNOWN Widget";
8146 - wid_value &= 0xf;
8147 - if (names[wid_value])
8148 - return names[wid_value];
8149 -diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
8150 -index 70a7abd..5b0a9bb 100644
8151 ---- a/sound/pci/hda/patch_cirrus.c
8152 -+++ b/sound/pci/hda/patch_cirrus.c
8153 -@@ -920,16 +920,14 @@ static void cs_automute(struct hda_codec *codec)
8154 -
8155 - /* mute speakers if spdif or hp jack is plugged in */
8156 - for (i = 0; i < cfg->speaker_outs; i++) {
8157 -+ int pin_ctl = hp_present ? 0 : PIN_OUT;
8158 -+ /* detect on spdif is specific to CS421x */
8159 -+ if (spdif_present && (spec->vendor_nid == CS421X_VENDOR_NID))
8160 -+ pin_ctl = 0;
8161 -+
8162 - nid = cfg->speaker_pins[i];
8163 - snd_hda_codec_write(codec, nid, 0,
8164 -- AC_VERB_SET_PIN_WIDGET_CONTROL,
8165 -- hp_present ? 0 : PIN_OUT);
8166 -- /* detect on spdif is specific to CS421x */
8167 -- if (spec->vendor_nid == CS421X_VENDOR_NID) {
8168 -- snd_hda_codec_write(codec, nid, 0,
8169 -- AC_VERB_SET_PIN_WIDGET_CONTROL,
8170 -- spdif_present ? 0 : PIN_OUT);
8171 -- }
8172 -+ AC_VERB_SET_PIN_WIDGET_CONTROL, pin_ctl);
8173 - }
8174 - if (spec->gpio_eapd_hp) {
8175 - unsigned int gpio = hp_present ?
8176 -@@ -1771,30 +1769,19 @@ static int build_cs421x_output(struct hda_codec *codec)
8177 - struct auto_pin_cfg *cfg = &spec->autocfg;
8178 - struct snd_kcontrol *kctl;
8179 - int err;
8180 -- char *name = "HP/Speakers";
8181 -+ char *name = "Master";
8182 -
8183 - fix_volume_caps(codec, dac);
8184 -- if (!spec->vmaster_sw) {
8185 -- err = add_vmaster(codec, dac);
8186 -- if (err < 0)
8187 -- return err;
8188 -- }
8189 -
8190 - err = add_mute(codec, name, 0,
8191 - HDA_COMPOSE_AMP_VAL(dac, 3, 0, HDA_OUTPUT), 0, &kctl);
8192 - if (err < 0)
8193 - return err;
8194 -- err = snd_ctl_add_slave(spec->vmaster_sw, kctl);
8195 -- if (err < 0)
8196 -- return err;
8197 -
8198 - err = add_volume(codec, name, 0,
8199 - HDA_COMPOSE_AMP_VAL(dac, 3, 0, HDA_OUTPUT), 0, &kctl);
8200 - if (err < 0)
8201 - return err;
8202 -- err = snd_ctl_add_slave(spec->vmaster_vol, kctl);
8203 -- if (err < 0)
8204 -- return err;
8205 -
8206 - if (cfg->speaker_outs) {
8207 - err = snd_hda_ctl_add(codec, 0,
8208 -diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
8209 -index 0de2119..7072251 100644
8210 ---- a/sound/pci/hda/patch_conexant.c
8211 -+++ b/sound/pci/hda/patch_conexant.c
8212 -@@ -1120,8 +1120,6 @@ static const char * const cxt5045_models[CXT5045_MODELS] = {
8213 -
8214 - static const struct snd_pci_quirk cxt5045_cfg_tbl[] = {
8215 - SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT5045_LAPTOP_HP530),
8216 -- SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP DV Series",
8217 -- CXT5045_LAPTOP_HPSENSE),
8218 - SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P105", CXT5045_LAPTOP_MICSENSE),
8219 - SND_PCI_QUIRK(0x152d, 0x0753, "Benq R55E", CXT5045_BENQ),
8220 - SND_PCI_QUIRK(0x1734, 0x10ad, "Fujitsu Si1520", CXT5045_LAPTOP_MICSENSE),
8221 -diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
8222 -index 616678f..f3c73a9 100644
8223 ---- a/sound/pci/hda/patch_sigmatel.c
8224 -+++ b/sound/pci/hda/patch_sigmatel.c
8225 -@@ -1631,7 +1631,7 @@ static const struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
8226 - SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02bd,
8227 - "Dell Studio 1557", STAC_DELL_M6_DMIC),
8228 - SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe,
8229 -- "Dell Studio XPS 1645", STAC_DELL_M6_BOTH),
8230 -+ "Dell Studio XPS 1645", STAC_DELL_M6_DMIC),
8231 - SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413,
8232 - "Dell Studio 1558", STAC_DELL_M6_DMIC),
8233 - {} /* terminator */
8234 -@@ -4326,6 +4326,27 @@ static void stac_store_hints(struct hda_codec *codec)
8235 - }
8236 - }
8237 -
8238 -+static void stac_issue_unsol_events(struct hda_codec *codec, int num_pins,
8239 -+ const hda_nid_t *pins)
8240 -+{
8241 -+ while (num_pins--)
8242 -+ stac_issue_unsol_event(codec, *pins++);
8243 -+}
8244 -+
8245 -+/* fake event to set up pins */
8246 -+static void stac_fake_hp_events(struct hda_codec *codec)
8247 -+{
8248 -+ struct sigmatel_spec *spec = codec->spec;
8249 -+
8250 -+ if (spec->autocfg.hp_outs)
8251 -+ stac_issue_unsol_events(codec, spec->autocfg.hp_outs,
8252 -+ spec->autocfg.hp_pins);
8253 -+ if (spec->autocfg.line_outs &&
8254 -+ spec->autocfg.line_out_pins[0] != spec->autocfg.hp_pins[0])
8255 -+ stac_issue_unsol_events(codec, spec->autocfg.line_outs,
8256 -+ spec->autocfg.line_out_pins);
8257 -+}
8258 -+
8259 - static int stac92xx_init(struct hda_codec *codec)
8260 - {
8261 - struct sigmatel_spec *spec = codec->spec;
8262 -@@ -4376,10 +4397,7 @@ static int stac92xx_init(struct hda_codec *codec)
8263 - stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0],
8264 - AC_PINCTL_OUT_EN);
8265 - /* fake event to set up pins */
8266 -- if (cfg->hp_pins[0])
8267 -- stac_issue_unsol_event(codec, cfg->hp_pins[0]);
8268 -- else if (cfg->line_out_pins[0])
8269 -- stac_issue_unsol_event(codec, cfg->line_out_pins[0]);
8270 -+ stac_fake_hp_events(codec);
8271 - } else {
8272 - stac92xx_auto_init_multi_out(codec);
8273 - stac92xx_auto_init_hp_out(codec);
8274 -@@ -5028,19 +5046,11 @@ static void stac927x_proc_hook(struct snd_info_buffer *buffer,
8275 - #ifdef CONFIG_PM
8276 - static int stac92xx_resume(struct hda_codec *codec)
8277 - {
8278 -- struct sigmatel_spec *spec = codec->spec;
8279 --
8280 - stac92xx_init(codec);
8281 - snd_hda_codec_resume_amp(codec);
8282 - snd_hda_codec_resume_cache(codec);
8283 - /* fake event to set up pins again to override cached values */
8284 -- if (spec->hp_detect) {
8285 -- if (spec->autocfg.hp_pins[0])
8286 -- stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0]);
8287 -- else if (spec->autocfg.line_out_pins[0])
8288 -- stac_issue_unsol_event(codec,
8289 -- spec->autocfg.line_out_pins[0]);
8290 -- }
8291 -+ stac_fake_hp_events(codec);
8292 - return 0;
8293 - }
8294 -
8295 -diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
8296 -index b513762..8d69e59 100644
8297 ---- a/sound/pci/hda/patch_via.c
8298 -+++ b/sound/pci/hda/patch_via.c
8299 -@@ -2200,7 +2200,10 @@ static int via_auto_create_loopback_switch(struct hda_codec *codec)
8300 - {
8301 - struct via_spec *spec = codec->spec;
8302 -
8303 -- if (!spec->aa_mix_nid || !spec->out_mix_path.depth)
8304 -+ if (!spec->aa_mix_nid)
8305 -+ return 0; /* no loopback switching available */
8306 -+ if (!(spec->out_mix_path.depth || spec->hp_mix_path.depth ||
8307 -+ spec->speaker_path.depth))
8308 - return 0; /* no loopback switching available */
8309 - if (!via_clone_control(spec, &via_aamix_ctl_enum))
8310 - return -ENOMEM;
8311 -diff --git a/sound/pci/ice1712/amp.c b/sound/pci/ice1712/amp.c
8312 -index e328cfb..e525da2 100644
8313 ---- a/sound/pci/ice1712/amp.c
8314 -+++ b/sound/pci/ice1712/amp.c
8315 -@@ -68,8 +68,11 @@ static int __devinit snd_vt1724_amp_init(struct snd_ice1712 *ice)
8316 -
8317 - static int __devinit snd_vt1724_amp_add_controls(struct snd_ice1712 *ice)
8318 - {
8319 -- /* we use pins 39 and 41 of the VT1616 for left and right read outputs */
8320 -- snd_ac97_write_cache(ice->ac97, 0x5a, snd_ac97_read(ice->ac97, 0x5a) & ~0x8000);
8321 -+ if (ice->ac97)
8322 -+ /* we use pins 39 and 41 of the VT1616 for left and right
8323 -+ read outputs */
8324 -+ snd_ac97_write_cache(ice->ac97, 0x5a,
8325 -+ snd_ac97_read(ice->ac97, 0x5a) & ~0x8000);
8326 - return 0;
8327 - }
8328 -
8329 -diff --git a/sound/pci/oxygen/xonar_wm87x6.c b/sound/pci/oxygen/xonar_wm87x6.c
8330 -index 42d1ab1..915546a 100644
8331 ---- a/sound/pci/oxygen/xonar_wm87x6.c
8332 -+++ b/sound/pci/oxygen/xonar_wm87x6.c
8333 -@@ -177,6 +177,7 @@ static void wm8776_registers_init(struct oxygen *chip)
8334 - struct xonar_wm87x6 *data = chip->model_data;
8335 -
8336 - wm8776_write(chip, WM8776_RESET, 0);
8337 -+ wm8776_write(chip, WM8776_PHASESWAP, WM8776_PH_MASK);
8338 - wm8776_write(chip, WM8776_DACCTRL1, WM8776_DZCEN |
8339 - WM8776_PL_LEFT_LEFT | WM8776_PL_RIGHT_RIGHT);
8340 - wm8776_write(chip, WM8776_DACMUTE, chip->dac_mute ? WM8776_DMUTE : 0);
8341 -diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
8342 -index 81c6ede..08dcce5 100644
8343 ---- a/sound/usb/endpoint.c
8344 -+++ b/sound/usb/endpoint.c
8345 -@@ -17,6 +17,7 @@
8346 -
8347 - #include <linux/gfp.h>
8348 - #include <linux/init.h>
8349 -+#include <linux/ratelimit.h>
8350 - #include <linux/usb.h>
8351 - #include <linux/usb/audio.h>
8352 -
8353 -@@ -458,8 +459,8 @@ static int retire_capture_urb(struct snd_usb_substream *subs,
8354 -
8355 - for (i = 0; i < urb->number_of_packets; i++) {
8356 - cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset;
8357 -- if (urb->iso_frame_desc[i].status) {
8358 -- snd_printd(KERN_ERR "frame %d active: %d\n", i, urb->iso_frame_desc[i].status);
8359 -+ if (urb->iso_frame_desc[i].status && printk_ratelimit()) {
8360 -+ snd_printdd("frame %d active: %d\n", i, urb->iso_frame_desc[i].status);
8361 - // continue;
8362 - }
8363 - bytes = urb->iso_frame_desc[i].actual_length;
8364 -diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c
8365 -index c400ade..1e7a47a 100644
8366 ---- a/sound/usb/usx2y/usb_stream.c
8367 -+++ b/sound/usb/usx2y/usb_stream.c
8368 -@@ -674,7 +674,7 @@ dotry:
8369 - inurb->transfer_buffer_length =
8370 - inurb->number_of_packets *
8371 - inurb->iso_frame_desc[0].length;
8372 -- preempt_disable();
8373 -+
8374 - if (u == 0) {
8375 - int now;
8376 - struct usb_device *dev = inurb->dev;
8377 -@@ -686,19 +686,17 @@ dotry:
8378 - }
8379 - err = usb_submit_urb(inurb, GFP_ATOMIC);
8380 - if (err < 0) {
8381 -- preempt_enable();
8382 - snd_printk(KERN_ERR"usb_submit_urb(sk->inurb[%i])"
8383 - " returned %i\n", u, err);
8384 - return err;
8385 - }
8386 - err = usb_submit_urb(outurb, GFP_ATOMIC);
8387 - if (err < 0) {
8388 -- preempt_enable();
8389 - snd_printk(KERN_ERR"usb_submit_urb(sk->outurb[%i])"
8390 - " returned %i\n", u, err);
8391 - return err;
8392 - }
8393 -- preempt_enable();
8394 -+
8395 - if (inurb->start_frame != outurb->start_frame) {
8396 - snd_printd(KERN_DEBUG
8397 - "u[%i] start_frames differ in:%u out:%u\n",
8398
8399 Deleted: genpatches-2.6/trunk/3.3/1002_linux-3.2.3.patch
8400 ===================================================================
8401 --- genpatches-2.6/trunk/3.3/1002_linux-3.2.3.patch 2012-02-07 13:46:33 UTC (rev 2082)
8402 +++ genpatches-2.6/trunk/3.3/1002_linux-3.2.3.patch 2012-02-07 13:47:50 UTC (rev 2083)
8403 @@ -1,3760 +0,0 @@
8404 -diff --git a/Makefile b/Makefile
8405 -index 2f684da..d45e887 100644
8406 ---- a/Makefile
8407 -+++ b/Makefile
8408 -@@ -1,6 +1,6 @@
8409 - VERSION = 3
8410 - PATCHLEVEL = 2
8411 --SUBLEVEL = 2
8412 -+SUBLEVEL = 3
8413 - EXTRAVERSION =
8414 - NAME = Saber-toothed Squirrel
8415 -
8416 -diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
8417 -index aa64294..f5bbe0ef 100644
8418 ---- a/arch/arm/mach-at91/setup.c
8419 -+++ b/arch/arm/mach-at91/setup.c
8420 -@@ -27,9 +27,12 @@ EXPORT_SYMBOL(at91_soc_initdata);
8421 - void __init at91rm9200_set_type(int type)
8422 - {
8423 - if (type == ARCH_REVISON_9200_PQFP)
8424 -- at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
8425 -- else
8426 - at91_soc_initdata.subtype = AT91_SOC_RM9200_PQFP;
8427 -+ else
8428 -+ at91_soc_initdata.subtype = AT91_SOC_RM9200_BGA;
8429 -+
8430 -+ pr_info("AT91: filled in soc subtype: %s\n",
8431 -+ at91_get_soc_subtype(&at91_soc_initdata));
8432 - }
8433 -
8434 - void __init at91_init_irq_default(void)
8435 -diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
8436 -index a3e0c86..52af004 100644
8437 ---- a/arch/arm/mach-ux500/Kconfig
8438 -+++ b/arch/arm/mach-ux500/Kconfig
8439 -@@ -7,6 +7,7 @@ config UX500_SOC_COMMON
8440 - select HAS_MTU
8441 - select ARM_ERRATA_753970
8442 - select ARM_ERRATA_754322
8443 -+ select ARM_ERRATA_764369
8444 -
8445 - menu "Ux500 SoC"
8446 -
8447 -diff --git a/arch/arm/mach-ux500/board-mop500-sdi.c b/arch/arm/mach-ux500/board-mop500-sdi.c
8448 -index 6826fae..306cff0 100644
8449 ---- a/arch/arm/mach-ux500/board-mop500-sdi.c
8450 -+++ b/arch/arm/mach-ux500/board-mop500-sdi.c
8451 -@@ -233,6 +233,8 @@ void __init snowball_sdi_init(void)
8452 - {
8453 - u32 periphid = 0x10480180;
8454 -
8455 -+ /* On Snowball MMC_CAP_SD_HIGHSPEED isn't supported on sdi0 */
8456 -+ mop500_sdi0_data.capabilities &= ~MMC_CAP_SD_HIGHSPEED;
8457 - mop500_sdi2_data.capabilities |= MMC_CAP_MMC_HIGHSPEED;
8458 -
8459 - /* On-board eMMC */
8460 -diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
8461 -index e70a737..40cc7aa 100644
8462 ---- a/arch/arm/mm/proc-v7.S
8463 -+++ b/arch/arm/mm/proc-v7.S
8464 -@@ -271,10 +271,6 @@ ENDPROC(cpu_v7_do_resume)
8465 - * Initialise TLB, Caches, and MMU state ready to switch the MMU
8466 - * on. Return in r0 the new CP15 C1 control register setting.
8467 - *
8468 -- * We automatically detect if we have a Harvard cache, and use the
8469 -- * Harvard cache control instructions insead of the unified cache
8470 -- * control instructions.
8471 -- *
8472 - * This should be able to cover all ARMv7 cores.
8473 - *
8474 - * It is assumed that:
8475 -@@ -373,9 +369,7 @@ __v7_setup:
8476 - #endif
8477 -
8478 - 3: mov r10, #0
8479 --#ifdef HARVARD_CACHE
8480 - mcr p15, 0, r10, c7, c5, 0 @ I+BTB cache invalidate
8481 --#endif
8482 - dsb
8483 - #ifdef CONFIG_MMU
8484 - mcr p15, 0, r10, c8, c7, 0 @ invalidate I + D TLBs
8485 -diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
8486 -index 4203d10..c4ac15c 100644
8487 ---- a/arch/m68k/atari/config.c
8488 -+++ b/arch/m68k/atari/config.c
8489 -@@ -414,9 +414,9 @@ void __init config_atari(void)
8490 - * FDC val = 4 -> Supervisor only */
8491 - asm volatile ("\n"
8492 - " .chip 68030\n"
8493 -- " pmove %0@,%/tt1\n"
8494 -+ " pmove %0,%/tt1\n"
8495 - " .chip 68k"
8496 -- : : "a" (&tt1_val));
8497 -+ : : "m" (tt1_val));
8498 - } else {
8499 - asm volatile ("\n"
8500 - " .chip 68040\n"
8501 -@@ -569,10 +569,10 @@ static void atari_reset(void)
8502 - : "d0");
8503 - } else
8504 - asm volatile ("\n"
8505 -- " pmove %0@,%%tc\n"
8506 -+ " pmove %0,%%tc\n"
8507 - " jmp %1@"
8508 - : /* no outputs */
8509 -- : "a" (&tc_val), "a" (reset_addr));
8510 -+ : "m" (tc_val), "a" (reset_addr));
8511 - }
8512 -
8513 -
8514 -diff --git a/arch/m68k/kernel/process_mm.c b/arch/m68k/kernel/process_mm.c
8515 -index 1bc223a..aa4ffb8 100644
8516 ---- a/arch/m68k/kernel/process_mm.c
8517 -+++ b/arch/m68k/kernel/process_mm.c
8518 -@@ -189,8 +189,8 @@ void flush_thread(void)
8519 - current->thread.fs = __USER_DS;
8520 - if (!FPU_IS_EMU)
8521 - asm volatile (".chip 68k/68881\n\t"
8522 -- "frestore %0@\n\t"
8523 -- ".chip 68k" : : "a" (&zero));
8524 -+ "frestore %0\n\t"
8525 -+ ".chip 68k" : : "m" (zero));
8526 - }
8527 -
8528 - /*
8529 -diff --git a/arch/m68k/kernel/process_no.c b/arch/m68k/kernel/process_no.c
8530 -index 69c1803..5e1078c 100644
8531 ---- a/arch/m68k/kernel/process_no.c
8532 -+++ b/arch/m68k/kernel/process_no.c
8533 -@@ -163,8 +163,8 @@ void flush_thread(void)
8534 - #ifdef CONFIG_FPU
8535 - if (!FPU_IS_EMU)
8536 - asm volatile (".chip 68k/68881\n\t"
8537 -- "frestore %0@\n\t"
8538 -- ".chip 68k" : : "a" (&zero));
8539 -+ "frestore %0\n\t"
8540 -+ ".chip 68k" : : "m" (zero));
8541 - #endif
8542 - }
8543 -
8544 -diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
8545 -index 89362f2..eb67469 100644
8546 ---- a/arch/m68k/kernel/traps.c
8547 -+++ b/arch/m68k/kernel/traps.c
8548 -@@ -552,13 +552,13 @@ static inline void bus_error030 (struct frame *fp)
8549 -
8550 - #ifdef DEBUG
8551 - asm volatile ("ptestr %3,%2@,#7,%0\n\t"
8552 -- "pmove %%psr,%1@"
8553 -- : "=a&" (desc)
8554 -- : "a" (&temp), "a" (addr), "d" (ssw));
8555 -+ "pmove %%psr,%1"
8556 -+ : "=a&" (desc), "=m" (temp)
8557 -+ : "a" (addr), "d" (ssw));
8558 - #else
8559 - asm volatile ("ptestr %2,%1@,#7\n\t"
8560 -- "pmove %%psr,%0@"
8561 -- : : "a" (&temp), "a" (addr), "d" (ssw));
8562 -+ "pmove %%psr,%0"
8563 -+ : "=m" (temp) : "a" (addr), "d" (ssw));
8564 - #endif
8565 - mmusr = temp;
8566 -
8567 -@@ -605,20 +605,18 @@ static inline void bus_error030 (struct frame *fp)
8568 - !(ssw & RW) ? "write" : "read", addr,
8569 - fp->ptregs.pc, ssw);
8570 - asm volatile ("ptestr #1,%1@,#0\n\t"
8571 -- "pmove %%psr,%0@"
8572 -- : /* no outputs */
8573 -- : "a" (&temp), "a" (addr));
8574 -+ "pmove %%psr,%0"
8575 -+ : "=m" (temp)
8576 -+ : "a" (addr));
8577 - mmusr = temp;
8578 -
8579 - printk ("level 0 mmusr is %#x\n", mmusr);
8580 - #if 0
8581 -- asm volatile ("pmove %%tt0,%0@"
8582 -- : /* no outputs */
8583 -- : "a" (&tlong));
8584 -+ asm volatile ("pmove %%tt0,%0"
8585 -+ : "=m" (tlong));
8586 - printk("tt0 is %#lx, ", tlong);
8587 -- asm volatile ("pmove %%tt1,%0@"
8588 -- : /* no outputs */
8589 -- : "a" (&tlong));
8590 -+ asm volatile ("pmove %%tt1,%0"
8591 -+ : "=m" (tlong));
8592 - printk("tt1 is %#lx\n", tlong);
8593 - #endif
8594 - #ifdef DEBUG
8595 -@@ -668,13 +666,13 @@ static inline void bus_error030 (struct frame *fp)
8596 -
8597 - #ifdef DEBUG
8598 - asm volatile ("ptestr #1,%2@,#7,%0\n\t"
8599 -- "pmove %%psr,%1@"
8600 -- : "=a&" (desc)
8601 -- : "a" (&temp), "a" (addr));
8602 -+ "pmove %%psr,%1"
8603 -+ : "=a&" (desc), "=m" (temp)
8604 -+ : "a" (addr));
8605 - #else
8606 - asm volatile ("ptestr #1,%1@,#7\n\t"
8607 -- "pmove %%psr,%0@"
8608 -- : : "a" (&temp), "a" (addr));
8609 -+ "pmove %%psr,%0"
8610 -+ : "=m" (temp) : "a" (addr));
8611 - #endif
8612 - mmusr = temp;
8613 -
8614 -diff --git a/arch/m68k/mm/cache.c b/arch/m68k/mm/cache.c
8615 -index 5437fff..5550aa4 100644
8616 ---- a/arch/m68k/mm/cache.c
8617 -+++ b/arch/m68k/mm/cache.c
8618 -@@ -52,9 +52,9 @@ static unsigned long virt_to_phys_slow(unsigned long vaddr)
8619 - unsigned long *descaddr;
8620 -
8621 - asm volatile ("ptestr %3,%2@,#7,%0\n\t"
8622 -- "pmove %%psr,%1@"
8623 -- : "=a&" (descaddr)
8624 -- : "a" (&mmusr), "a" (vaddr), "d" (get_fs().seg));
8625 -+ "pmove %%psr,%1"
8626 -+ : "=a&" (descaddr), "=m" (mmusr)
8627 -+ : "a" (vaddr), "d" (get_fs().seg));
8628 - if (mmusr & (MMU_I|MMU_B|MMU_L))
8629 - return 0;
8630 - descaddr = phys_to_virt((unsigned long)descaddr);
8631 -diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h
8632 -index 54a13aa..21f7385 100644
8633 ---- a/arch/x86/include/asm/uv/uv_hub.h
8634 -+++ b/arch/x86/include/asm/uv/uv_hub.h
8635 -@@ -318,13 +318,13 @@ uv_gpa_in_mmr_space(unsigned long gpa)
8636 - /* UV global physical address --> socket phys RAM */
8637 - static inline unsigned long uv_gpa_to_soc_phys_ram(unsigned long gpa)
8638 - {
8639 -- unsigned long paddr = gpa & uv_hub_info->gpa_mask;
8640 -+ unsigned long paddr;
8641 - unsigned long remap_base = uv_hub_info->lowmem_remap_base;
8642 - unsigned long remap_top = uv_hub_info->lowmem_remap_top;
8643 -
8644 - gpa = ((gpa << uv_hub_info->m_shift) >> uv_hub_info->m_shift) |
8645 - ((gpa >> uv_hub_info->n_lshift) << uv_hub_info->m_val);
8646 -- gpa = gpa & uv_hub_info->gpa_mask;
8647 -+ paddr = gpa & uv_hub_info->gpa_mask;
8648 - if (paddr >= remap_base && paddr < remap_base + remap_top)
8649 - paddr -= remap_base;
8650 - return paddr;
8651 -diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
8652 -index d494799..ac52c15 100644
8653 ---- a/arch/x86/kernel/microcode_amd.c
8654 -+++ b/arch/x86/kernel/microcode_amd.c
8655 -@@ -300,13 +300,33 @@ free_table:
8656 - return state;
8657 - }
8658 -
8659 -+/*
8660 -+ * AMD microcode firmware naming convention, up to family 15h they are in
8661 -+ * the legacy file:
8662 -+ *
8663 -+ * amd-ucode/microcode_amd.bin
8664 -+ *
8665 -+ * This legacy file is always smaller than 2K in size.
8666 -+ *
8667 -+ * Starting at family 15h they are in family specific firmware files:
8668 -+ *
8669 -+ * amd-ucode/microcode_amd_fam15h.bin
8670 -+ * amd-ucode/microcode_amd_fam16h.bin
8671 -+ * ...
8672 -+ *
8673 -+ * These might be larger than 2K.
8674 -+ */
8675 - static enum ucode_state request_microcode_amd(int cpu, struct device *device)
8676 - {
8677 -- const char *fw_name = "amd-ucode/microcode_amd.bin";
8678 -+ char fw_name[36] = "amd-ucode/microcode_amd.bin";
8679 - const struct firmware *fw;
8680 - enum ucode_state ret = UCODE_NFOUND;
8681 -+ struct cpuinfo_x86 *c = &cpu_data(cpu);
8682 -+
8683 -+ if (c->x86 >= 0x15)
8684 -+ snprintf(fw_name, sizeof(fw_name), "amd-ucode/microcode_amd_fam%.2xh.bin", c->x86);
8685 -
8686 -- if (request_firmware(&fw, fw_name, device)) {
8687 -+ if (request_firmware(&fw, (const char *)fw_name, device)) {
8688 - pr_err("failed to load file %s\n", fw_name);
8689 - goto out;
8690 - }
8691 -diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
8692 -index 7b65f75..7c1b765 100644
8693 ---- a/arch/x86/net/bpf_jit_comp.c
8694 -+++ b/arch/x86/net/bpf_jit_comp.c
8695 -@@ -151,17 +151,18 @@ void bpf_jit_compile(struct sk_filter *fp)
8696 - cleanup_addr = proglen; /* epilogue address */
8697 -
8698 - for (pass = 0; pass < 10; pass++) {
8699 -+ u8 seen_or_pass0 = (pass == 0) ? (SEEN_XREG | SEEN_DATAREF | SEEN_MEM) : seen;
8700 - /* no prologue/epilogue for trivial filters (RET something) */
8701 - proglen = 0;
8702 - prog = temp;
8703 -
8704 -- if (seen) {
8705 -+ if (seen_or_pass0) {
8706 - EMIT4(0x55, 0x48, 0x89, 0xe5); /* push %rbp; mov %rsp,%rbp */
8707 - EMIT4(0x48, 0x83, 0xec, 96); /* subq $96,%rsp */
8708 - /* note : must save %rbx in case bpf_error is hit */
8709 -- if (seen & (SEEN_XREG | SEEN_DATAREF))
8710 -+ if (seen_or_pass0 & (SEEN_XREG | SEEN_DATAREF))
8711 - EMIT4(0x48, 0x89, 0x5d, 0xf8); /* mov %rbx, -8(%rbp) */
8712 -- if (seen & SEEN_XREG)
8713 -+ if (seen_or_pass0 & SEEN_XREG)
8714 - CLEAR_X(); /* make sure we dont leek kernel memory */
8715 -
8716 - /*
8717 -@@ -170,7 +171,7 @@ void bpf_jit_compile(struct sk_filter *fp)
8718 - * r9 = skb->len - skb->data_len
8719 - * r8 = skb->data
8720 - */
8721 -- if (seen & SEEN_DATAREF) {
8722 -+ if (seen_or_pass0 & SEEN_DATAREF) {
8723 - if (offsetof(struct sk_buff, len) <= 127)
8724 - /* mov off8(%rdi),%r9d */
8725 - EMIT4(0x44, 0x8b, 0x4f, offsetof(struct sk_buff, len));
8726 -@@ -260,9 +261,14 @@ void bpf_jit_compile(struct sk_filter *fp)
8727 - case BPF_S_ALU_DIV_X: /* A /= X; */
8728 - seen |= SEEN_XREG;
8729 - EMIT2(0x85, 0xdb); /* test %ebx,%ebx */
8730 -- if (pc_ret0 != -1)
8731 -- EMIT_COND_JMP(X86_JE, addrs[pc_ret0] - (addrs[i] - 4));
8732 -- else {
8733 -+ if (pc_ret0 > 0) {
8734 -+ /* addrs[pc_ret0 - 1] is start address of target
8735 -+ * (addrs[i] - 4) is the address following this jmp
8736 -+ * ("xor %edx,%edx; div %ebx" being 4 bytes long)
8737 -+ */
8738 -+ EMIT_COND_JMP(X86_JE, addrs[pc_ret0 - 1] -
8739 -+ (addrs[i] - 4));
8740 -+ } else {
8741 - EMIT_COND_JMP(X86_JNE, 2 + 5);
8742 - CLEAR_A();
8743 - EMIT1_off32(0xe9, cleanup_addr - (addrs[i] - 4)); /* jmp .+off32 */
8744 -@@ -335,12 +341,12 @@ void bpf_jit_compile(struct sk_filter *fp)
8745 - }
8746 - /* fallinto */
8747 - case BPF_S_RET_A:
8748 -- if (seen) {
8749 -+ if (seen_or_pass0) {
8750 - if (i != flen - 1) {
8751 - EMIT_JMP(cleanup_addr - addrs[i]);
8752 - break;
8753 - }
8754 -- if (seen & SEEN_XREG)
8755 -+ if (seen_or_pass0 & SEEN_XREG)
8756 - EMIT4(0x48, 0x8b, 0x5d, 0xf8); /* mov -8(%rbp),%rbx */
8757 - EMIT1(0xc9); /* leaveq */
8758 - }
8759 -@@ -483,8 +489,9 @@ common_load: seen |= SEEN_DATAREF;
8760 - goto common_load;
8761 - case BPF_S_LDX_B_MSH:
8762 - if ((int)K < 0) {
8763 -- if (pc_ret0 != -1) {
8764 -- EMIT_JMP(addrs[pc_ret0] - addrs[i]);
8765 -+ if (pc_ret0 > 0) {
8766 -+ /* addrs[pc_ret0 - 1] is the start address */
8767 -+ EMIT_JMP(addrs[pc_ret0 - 1] - addrs[i]);
8768 - break;
8769 - }
8770 - CLEAR_A();
8771 -@@ -599,13 +606,14 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
8772 - * use it to give the cleanup instruction(s) addr
8773 - */
8774 - cleanup_addr = proglen - 1; /* ret */
8775 -- if (seen)
8776 -+ if (seen_or_pass0)
8777 - cleanup_addr -= 1; /* leaveq */
8778 -- if (seen & SEEN_XREG)
8779 -+ if (seen_or_pass0 & SEEN_XREG)
8780 - cleanup_addr -= 4; /* mov -8(%rbp),%rbx */
8781 -
8782 - if (image) {
8783 -- WARN_ON(proglen != oldproglen);
8784 -+ if (proglen != oldproglen)
8785 -+ pr_err("bpb_jit_compile proglen=%u != oldproglen=%u\n", proglen, oldproglen);
8786 - break;
8787 - }
8788 - if (proglen == oldproglen) {
8789 -diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
8790 -index 9010ca7..81aee5a 100644
8791 ---- a/arch/x86/platform/uv/tlb_uv.c
8792 -+++ b/arch/x86/platform/uv/tlb_uv.c
8793 -@@ -1860,6 +1860,8 @@ static void __init init_per_cpu_tunables(void)
8794 - bcp->cong_reps = congested_reps;
8795 - bcp->cong_period = congested_period;
8796 - bcp->clocks_per_100_usec = usec_2_cycles(100);
8797 -+ spin_lock_init(&bcp->queue_lock);
8798 -+ spin_lock_init(&bcp->uvhub_lock);
8799 - }
8800 - }
8801 -
8802 -diff --git a/arch/x86/platform/uv/uv_irq.c b/arch/x86/platform/uv/uv_irq.c
8803 -index 374a05d..f25c276 100644
8804 ---- a/arch/x86/platform/uv/uv_irq.c
8805 -+++ b/arch/x86/platform/uv/uv_irq.c
8806 -@@ -25,7 +25,7 @@ struct uv_irq_2_mmr_pnode{
8807 - int irq;
8808 - };
8809 -
8810 --static spinlock_t uv_irq_lock;
8811 -+static DEFINE_SPINLOCK(uv_irq_lock);
8812 - static struct rb_root uv_irq_root;
8813 -
8814 - static int uv_set_irq_affinity(struct irq_data *, const struct cpumask *, bool);
8815 -diff --git a/arch/x86/xen/spinlock.c b/arch/x86/xen/spinlock.c
8816 -index cc9b1e1..d69cc6c 100644
8817 ---- a/arch/x86/xen/spinlock.c
8818 -+++ b/arch/x86/xen/spinlock.c
8819 -@@ -116,9 +116,26 @@ static inline void spin_time_accum_blocked(u64 start)
8820 - }
8821 - #endif /* CONFIG_XEN_DEBUG_FS */
8822 -
8823 -+/*
8824 -+ * Size struct xen_spinlock so it's the same as arch_spinlock_t.
8825 -+ */
8826 -+#if NR_CPUS < 256
8827 -+typedef u8 xen_spinners_t;
8828 -+# define inc_spinners(xl) \
8829 -+ asm(LOCK_PREFIX " incb %0" : "+m" ((xl)->spinners) : : "memory");
8830 -+# define dec_spinners(xl) \
8831 -+ asm(LOCK_PREFIX " decb %0" : "+m" ((xl)->spinners) : : "memory");
8832 -+#else
8833 -+typedef u16 xen_spinners_t;
8834 -+# define inc_spinners(xl) \
8835 -+ asm(LOCK_PREFIX " incw %0" : "+m" ((xl)->spinners) : : "memory");
8836 -+# define dec_spinners(xl) \
8837 -+ asm(LOCK_PREFIX " decw %0" : "+m" ((xl)->spinners) : : "memory");
8838 -+#endif
8839 -+
8840 - struct xen_spinlock {
8841 - unsigned char lock; /* 0 -> free; 1 -> locked */
8842 -- unsigned short spinners; /* count of waiting cpus */
8843 -+ xen_spinners_t spinners; /* count of waiting cpus */
8844 - };
8845 -
8846 - static int xen_spin_is_locked(struct arch_spinlock *lock)
8847 -@@ -164,8 +181,7 @@ static inline struct xen_spinlock *spinning_lock(struct xen_spinlock *xl)
8848 -
8849 - wmb(); /* set lock of interest before count */
8850 -
8851 -- asm(LOCK_PREFIX " incw %0"
8852 -- : "+m" (xl->spinners) : : "memory");
8853 -+ inc_spinners(xl);
8854 -
8855 - return prev;
8856 - }
8857 -@@ -176,8 +192,7 @@ static inline struct xen_spinlock *spinning_lock(struct xen_spinlock *xl)
8858 - */
8859 - static inline void unspinning_lock(struct xen_spinlock *xl, struct xen_spinlock *prev)
8860 - {
8861 -- asm(LOCK_PREFIX " decw %0"
8862 -- : "+m" (xl->spinners) : : "memory");
8863 -+ dec_spinners(xl);
8864 - wmb(); /* decrement count before restoring lock */
8865 - __this_cpu_write(lock_spinners, prev);
8866 - }
8867 -@@ -373,6 +388,8 @@ void xen_uninit_lock_cpu(int cpu)
8868 -
8869 - void __init xen_init_spinlocks(void)
8870 - {
8871 -+ BUILD_BUG_ON(sizeof(struct xen_spinlock) > sizeof(arch_spinlock_t));
8872 -+
8873 - pv_lock_ops.spin_is_locked = xen_spin_is_locked;
8874 - pv_lock_ops.spin_is_contended = xen_spin_is_contended;
8875 - pv_lock_ops.spin_lock = xen_spin_lock;
8876 -diff --git a/crypto/sha512_generic.c b/crypto/sha512_generic.c
8877 -index 9ed9f60..88f160b 100644
8878 ---- a/crypto/sha512_generic.c
8879 -+++ b/crypto/sha512_generic.c
8880 -@@ -21,8 +21,6 @@
8881 - #include <linux/percpu.h>
8882 - #include <asm/byteorder.h>
8883 -
8884 --static DEFINE_PER_CPU(u64[80], msg_schedule);
8885 --
8886 - static inline u64 Ch(u64 x, u64 y, u64 z)
8887 - {
8888 - return z ^ (x & (y ^ z));
8889 -@@ -80,7 +78,7 @@ static inline void LOAD_OP(int I, u64 *W, const u8 *input)
8890 -
8891 - static inline void BLEND_OP(int I, u64 *W)
8892 - {
8893 -- W[I] = s1(W[I-2]) + W[I-7] + s0(W[I-15]) + W[I-16];
8894 -+ W[I % 16] += s1(W[(I-2) % 16]) + W[(I-7) % 16] + s0(W[(I-15) % 16]);
8895 - }
8896 -
8897 - static void
8898 -@@ -89,38 +87,48 @@ sha512_transform(u64 *state, const u8 *input)
8899 - u64 a, b, c, d, e, f, g, h, t1, t2;
8900 -
8901 - int i;
8902 -- u64 *W = get_cpu_var(msg_schedule);
8903 -+ u64 W[16];
8904 -
8905 - /* load the input */
8906 - for (i = 0; i < 16; i++)
8907 - LOAD_OP(i, W, input);
8908 -
8909 -- for (i = 16; i < 80; i++) {
8910 -- BLEND_OP(i, W);
8911 -- }
8912 --
8913 - /* load the state into our registers */
8914 - a=state[0]; b=state[1]; c=state[2]; d=state[3];
8915 - e=state[4]; f=state[5]; g=state[6]; h=state[7];
8916 -
8917 -- /* now iterate */
8918 -- for (i=0; i<80; i+=8) {
8919 -- t1 = h + e1(e) + Ch(e,f,g) + sha512_K[i ] + W[i ];
8920 -- t2 = e0(a) + Maj(a,b,c); d+=t1; h=t1+t2;
8921 -- t1 = g + e1(d) + Ch(d,e,f) + sha512_K[i+1] + W[i+1];
8922 -- t2 = e0(h) + Maj(h,a,b); c+=t1; g=t1+t2;
8923 -- t1 = f + e1(c) + Ch(c,d,e) + sha512_K[i+2] + W[i+2];
8924 -- t2 = e0(g) + Maj(g,h,a); b+=t1; f=t1+t2;
8925 -- t1 = e + e1(b) + Ch(b,c,d) + sha512_K[i+3] + W[i+3];
8926 -- t2 = e0(f) + Maj(f,g,h); a+=t1; e=t1+t2;
8927 -- t1 = d + e1(a) + Ch(a,b,c) + sha512_K[i+4] + W[i+4];
8928 -- t2 = e0(e) + Maj(e,f,g); h+=t1; d=t1+t2;
8929 -- t1 = c + e1(h) + Ch(h,a,b) + sha512_K[i+5] + W[i+5];
8930 -- t2 = e0(d) + Maj(d,e,f); g+=t1; c=t1+t2;
8931 -- t1 = b + e1(g) + Ch(g,h,a) + sha512_K[i+6] + W[i+6];
8932 -- t2 = e0(c) + Maj(c,d,e); f+=t1; b=t1+t2;
8933 -- t1 = a + e1(f) + Ch(f,g,h) + sha512_K[i+7] + W[i+7];
8934 -- t2 = e0(b) + Maj(b,c,d); e+=t1; a=t1+t2;
8935 -+#define SHA512_0_15(i, a, b, c, d, e, f, g, h) \
8936 -+ t1 = h + e1(e) + Ch(e, f, g) + sha512_K[i] + W[i]; \
8937 -+ t2 = e0(a) + Maj(a, b, c); \
8938 -+ d += t1; \
8939 -+ h = t1 + t2
8940 -+
8941 -+#define SHA512_16_79(i, a, b, c, d, e, f, g, h) \
8942 -+ BLEND_OP(i, W); \
8943 -+ t1 = h + e1(e) + Ch(e, f, g) + sha512_K[i] + W[(i)%16]; \
8944 -+ t2 = e0(a) + Maj(a, b, c); \
8945 -+ d += t1; \
8946 -+ h = t1 + t2
8947 -+
8948 -+ for (i = 0; i < 16; i += 8) {
8949 -+ SHA512_0_15(i, a, b, c, d, e, f, g, h);
8950 -+ SHA512_0_15(i + 1, h, a, b, c, d, e, f, g);
8951 -+ SHA512_0_15(i + 2, g, h, a, b, c, d, e, f);
8952 -+ SHA512_0_15(i + 3, f, g, h, a, b, c, d, e);
8953 -+ SHA512_0_15(i + 4, e, f, g, h, a, b, c, d);
8954 -+ SHA512_0_15(i + 5, d, e, f, g, h, a, b, c);
8955 -+ SHA512_0_15(i + 6, c, d, e, f, g, h, a, b);
8956 -+ SHA512_0_15(i + 7, b, c, d, e, f, g, h, a);
8957 -+ }
8958 -+ for (i = 16; i < 80; i += 8) {
8959 -+ SHA512_16_79(i, a, b, c, d, e, f, g, h);
8960 -+ SHA512_16_79(i + 1, h, a, b, c, d, e, f, g);
8961 -+ SHA512_16_79(i + 2, g, h, a, b, c, d, e, f);
8962 -+ SHA512_16_79(i + 3, f, g, h, a, b, c, d, e);
8963 -+ SHA512_16_79(i + 4, e, f, g, h, a, b, c, d);
8964 -+ SHA512_16_79(i + 5, d, e, f, g, h, a, b, c);
8965 -+ SHA512_16_79(i + 6, c, d, e, f, g, h, a, b);
8966 -+ SHA512_16_79(i + 7, b, c, d, e, f, g, h, a);
8967 - }
8968 -
8969 - state[0] += a; state[1] += b; state[2] += c; state[3] += d;
8970 -@@ -128,8 +136,6 @@ sha512_transform(u64 *state, const u8 *input)
8971 -
8972 - /* erase our data */
8973 - a = b = c = d = e = f = g = h = t1 = t2 = 0;
8974 -- memset(W, 0, sizeof(__get_cpu_var(msg_schedule)));
8975 -- put_cpu_var(msg_schedule);
8976 - }
8977 -
8978 - static int
8979 -diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
8980 -index 3f4051a..c7e5282 100644
8981 ---- a/drivers/char/tpm/tpm_tis.c
8982 -+++ b/drivers/char/tpm/tpm_tis.c
8983 -@@ -432,6 +432,9 @@ static int probe_itpm(struct tpm_chip *chip)
8984 - out:
8985 - itpm = rem_itpm;
8986 - tpm_tis_ready(chip);
8987 -+ /* some TPMs need a break here otherwise they will not work
8988 -+ * correctly on the immediately subsequent command */
8989 -+ msleep(chip->vendor.timeout_b);
8990 - release_locality(chip, chip->vendor.locality, 0);
8991 -
8992 - return rc;
8993 -diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
8994 -index 3f46772..ba23790 100644
8995 ---- a/drivers/gpu/drm/drm_auth.c
8996 -+++ b/drivers/gpu/drm/drm_auth.c
8997 -@@ -101,7 +101,7 @@ static int drm_add_magic(struct drm_master *master, struct drm_file *priv,
8998 - * Searches and unlinks the entry in drm_device::magiclist with the magic
8999 - * number hash key, while holding the drm_device::struct_mutex lock.
9000 - */
9001 --static int drm_remove_magic(struct drm_master *master, drm_magic_t magic)
9002 -+int drm_remove_magic(struct drm_master *master, drm_magic_t magic)
9003 - {
9004 - struct drm_magic_entry *pt;
9005 - struct drm_hash_item *hash;
9006 -@@ -136,6 +136,8 @@ static int drm_remove_magic(struct drm_master *master, drm_magic_t magic)
9007 - * If there is a magic number in drm_file::magic then use it, otherwise
9008 - * searches an unique non-zero magic number and add it associating it with \p
9009 - * file_priv.
9010 -+ * This ioctl needs protection by the drm_global_mutex, which protects
9011 -+ * struct drm_file::magic and struct drm_magic_entry::priv.
9012 - */
9013 - int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
9014 - {
9015 -@@ -173,6 +175,8 @@ int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
9016 - * \return zero if authentication successed, or a negative number otherwise.
9017 - *
9018 - * Checks if \p file_priv is associated with the magic number passed in \arg.
9019 -+ * This ioctl needs protection by the drm_global_mutex, which protects
9020 -+ * struct drm_file::magic and struct drm_magic_entry::priv.
9021 - */
9022 - int drm_authmagic(struct drm_device *dev, void *data,
9023 - struct drm_file *file_priv)
9024 -diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
9025 -index 4911e1d..828bf65 100644
9026 ---- a/drivers/gpu/drm/drm_fops.c
9027 -+++ b/drivers/gpu/drm/drm_fops.c
9028 -@@ -487,6 +487,11 @@ int drm_release(struct inode *inode, struct file *filp)
9029 - (long)old_encode_dev(file_priv->minor->device),
9030 - dev->open_count);
9031 -
9032 -+ /* Release any auth tokens that might point to this file_priv,
9033 -+ (do that under the drm_global_mutex) */
9034 -+ if (file_priv->magic)
9035 -+ (void) drm_remove_magic(file_priv->master, file_priv->magic);
9036 -+
9037 - /* if the master has gone away we can't do anything with the lock */
9038 - if (file_priv->minor->master)
9039 - drm_master_release(dev, filp);
9040 -diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
9041 -index 7886e4f..43cbafe 100644
9042 ---- a/drivers/gpu/drm/i915/i915_suspend.c
9043 -+++ b/drivers/gpu/drm/i915/i915_suspend.c
9044 -@@ -822,7 +822,7 @@ int i915_save_state(struct drm_device *dev)
9045 -
9046 - if (IS_IRONLAKE_M(dev))
9047 - ironlake_disable_drps(dev);
9048 -- if (IS_GEN6(dev))
9049 -+ if (INTEL_INFO(dev)->gen >= 6)
9050 - gen6_disable_rps(dev);
9051 -
9052 - /* Cache mode state */
9053 -@@ -881,7 +881,7 @@ int i915_restore_state(struct drm_device *dev)
9054 - intel_init_emon(dev);
9055 - }
9056 -
9057 -- if (IS_GEN6(dev)) {
9058 -+ if (INTEL_INFO(dev)->gen >= 6) {
9059 - gen6_enable_rps(dev_priv);
9060 - gen6_update_ring_freq(dev_priv);
9061 - }
9062 -diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
9063 -index ca70e2f..30a9af9 100644
9064 ---- a/drivers/gpu/drm/i915/intel_ringbuffer.c
9065 -+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
9066 -@@ -631,6 +631,19 @@ render_ring_add_request(struct intel_ring_buffer *ring,
9067 - }
9068 -
9069 - static u32
9070 -+gen6_ring_get_seqno(struct intel_ring_buffer *ring)
9071 -+{
9072 -+ struct drm_device *dev = ring->dev;
9073 -+
9074 -+ /* Workaround to force correct ordering between irq and seqno writes on
9075 -+ * ivb (and maybe also on snb) by reading from a CS register (like
9076 -+ * ACTHD) before reading the status page. */
9077 -+ if (IS_GEN7(dev))
9078 -+ intel_ring_get_active_head(ring);
9079 -+ return intel_read_status_page(ring, I915_GEM_HWS_INDEX);
9080 -+}
9081 -+
9082 -+static u32
9083 - ring_get_seqno(struct intel_ring_buffer *ring)
9084 - {
9085 - return intel_read_status_page(ring, I915_GEM_HWS_INDEX);
9086 -@@ -795,6 +808,12 @@ gen6_ring_get_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag)
9087 - if (!dev->irq_enabled)
9088 - return false;
9089 -
9090 -+ /* It looks like we need to prevent the gt from suspending while waiting
9091 -+ * for an notifiy irq, otherwise irqs seem to get lost on at least the
9092 -+ * blt/bsd rings on ivb. */
9093 -+ if (IS_GEN7(dev))
9094 -+ gen6_gt_force_wake_get(dev_priv);
9095 -+
9096 - spin_lock(&ring->irq_lock);
9097 - if (ring->irq_refcount++ == 0) {
9098 - ring->irq_mask &= ~rflag;
9099 -@@ -819,6 +838,9 @@ gen6_ring_put_irq(struct intel_ring_buffer *ring, u32 gflag, u32 rflag)
9100 - ironlake_disable_irq(dev_priv, gflag);
9101 - }
9102 - spin_unlock(&ring->irq_lock);
9103 -+
9104 -+ if (IS_GEN7(dev))
9105 -+ gen6_gt_force_wake_put(dev_priv);
9106 - }
9107 -
9108 - static bool
9109 -@@ -1316,7 +1338,7 @@ static const struct intel_ring_buffer gen6_bsd_ring = {
9110 - .write_tail = gen6_bsd_ring_write_tail,
9111 - .flush = gen6_ring_flush,
9112 - .add_request = gen6_add_request,
9113 -- .get_seqno = ring_get_seqno,
9114 -+ .get_seqno = gen6_ring_get_seqno,
9115 - .irq_get = gen6_bsd_ring_get_irq,
9116 - .irq_put = gen6_bsd_ring_put_irq,
9117 - .dispatch_execbuffer = gen6_ring_dispatch_execbuffer,
9118 -@@ -1451,7 +1473,7 @@ static const struct intel_ring_buffer gen6_blt_ring = {
9119 - .write_tail = ring_write_tail,
9120 - .flush = blt_ring_flush,
9121 - .add_request = gen6_add_request,
9122 -- .get_seqno = ring_get_seqno,
9123 -+ .get_seqno = gen6_ring_get_seqno,
9124 - .irq_get = blt_ring_get_irq,
9125 - .irq_put = blt_ring_put_irq,
9126 - .dispatch_execbuffer = gen6_ring_dispatch_execbuffer,
9127 -@@ -1474,6 +1496,7 @@ int intel_init_render_ring_buffer(struct drm_device *dev)
9128 - ring->flush = gen6_render_ring_flush;
9129 - ring->irq_get = gen6_render_ring_get_irq;
9130 - ring->irq_put = gen6_render_ring_put_irq;
9131 -+ ring->get_seqno = gen6_ring_get_seqno;
9132 - } else if (IS_GEN5(dev)) {
9133 - ring->add_request = pc_render_add_request;
9134 - ring->get_seqno = pc_render_get_seqno;
9135 -diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
9136 -index f7b9268..e334ec3 100644
9137 ---- a/drivers/gpu/drm/i915/intel_sdvo.c
9138 -+++ b/drivers/gpu/drm/i915/intel_sdvo.c
9139 -@@ -1066,15 +1066,13 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
9140 -
9141 - /* Set the SDVO control regs. */
9142 - if (INTEL_INFO(dev)->gen >= 4) {
9143 -- sdvox = 0;
9144 -+ /* The real mode polarity is set by the SDVO commands, using
9145 -+ * struct intel_sdvo_dtd. */
9146 -+ sdvox = SDVO_VSYNC_ACTIVE_HIGH | SDVO_HSYNC_ACTIVE_HIGH;
9147 - if (intel_sdvo->is_hdmi)
9148 - sdvox |= intel_sdvo->color_range;
9149 - if (INTEL_INFO(dev)->gen < 5)
9150 - sdvox |= SDVO_BORDER_ENABLE;
9151 -- if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
9152 -- sdvox |= SDVO_VSYNC_ACTIVE_HIGH;
9153 -- if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
9154 -- sdvox |= SDVO_HSYNC_ACTIVE_HIGH;
9155 - } else {
9156 - sdvox = I915_READ(intel_sdvo->sdvo_reg);
9157 - switch (intel_sdvo->sdvo_reg) {
9158 -diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
9159 -index 6fb335a..a71557c 100644
9160 ---- a/drivers/gpu/drm/radeon/atombios_dp.c
9161 -+++ b/drivers/gpu/drm/radeon/atombios_dp.c
9162 -@@ -549,8 +549,8 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector)
9163 - return false;
9164 - }
9165 -
9166 --static void radeon_dp_set_panel_mode(struct drm_encoder *encoder,
9167 -- struct drm_connector *connector)
9168 -+int radeon_dp_get_panel_mode(struct drm_encoder *encoder,
9169 -+ struct drm_connector *connector)
9170 - {
9171 - struct drm_device *dev = encoder->dev;
9172 - struct radeon_device *rdev = dev->dev_private;
9173 -@@ -558,7 +558,7 @@ static void radeon_dp_set_panel_mode(struct drm_encoder *encoder,
9174 - int panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE;
9175 -
9176 - if (!ASIC_IS_DCE4(rdev))
9177 -- return;
9178 -+ return panel_mode;
9179 -
9180 - if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) ==
9181 - ENCODER_OBJECT_ID_NUTMEG)
9182 -@@ -572,14 +572,7 @@ static void radeon_dp_set_panel_mode(struct drm_encoder *encoder,
9183 - panel_mode = DP_PANEL_MODE_INTERNAL_DP2_MODE;
9184 - }
9185 -
9186 -- atombios_dig_encoder_setup(encoder,
9187 -- ATOM_ENCODER_CMD_SETUP_PANEL_MODE,
9188 -- panel_mode);
9189 --
9190 -- if ((connector->connector_type == DRM_MODE_CONNECTOR_eDP) &&
9191 -- (panel_mode == DP_PANEL_MODE_INTERNAL_DP2_MODE)) {
9192 -- radeon_write_dpcd_reg(radeon_connector, DP_EDP_CONFIGURATION_SET, 1);
9193 -- }
9194 -+ return panel_mode;
9195 - }
9196 -
9197 - void radeon_dp_set_link_config(struct drm_connector *connector,
9198 -@@ -717,6 +710,8 @@ static void radeon_dp_set_tp(struct radeon_dp_link_train_info *dp_info, int tp)
9199 -
9200 - static int radeon_dp_link_train_init(struct radeon_dp_link_train_info *dp_info)
9201 - {
9202 -+ struct radeon_encoder *radeon_encoder = to_radeon_encoder(dp_info->encoder);
9203 -+ struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
9204 - u8 tmp;
9205 -
9206 - /* power up the sink */
9207 -@@ -732,7 +727,10 @@ static int radeon_dp_link_train_init(struct radeon_dp_link_train_info *dp_info)
9208 - radeon_write_dpcd_reg(dp_info->radeon_connector,
9209 - DP_DOWNSPREAD_CTRL, 0);
9210 -
9211 -- radeon_dp_set_panel_mode(dp_info->encoder, dp_info->connector);
9212 -+ if ((dp_info->connector->connector_type == DRM_MODE_CONNECTOR_eDP) &&
9213 -+ (dig->panel_mode == DP_PANEL_MODE_INTERNAL_DP2_MODE)) {
9214 -+ radeon_write_dpcd_reg(dp_info->radeon_connector, DP_EDP_CONFIGURATION_SET, 1);
9215 -+ }
9216 -
9217 - /* set the lane count on the sink */
9218 - tmp = dp_info->dp_lane_count;
9219 -diff --git a/drivers/gpu/drm/radeon/atombios_encoders.c b/drivers/gpu/drm/radeon/atombios_encoders.c
9220 -index 39c04c1..0f8eb48 100644
9221 ---- a/drivers/gpu/drm/radeon/atombios_encoders.c
9222 -+++ b/drivers/gpu/drm/radeon/atombios_encoders.c
9223 -@@ -1352,7 +1352,8 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode)
9224 - switch (mode) {
9225 - case DRM_MODE_DPMS_ON:
9226 - /* some early dce3.2 boards have a bug in their transmitter control table */
9227 -- if ((rdev->family == CHIP_RV710) || (rdev->family == CHIP_RV730))
9228 -+ if ((rdev->family == CHIP_RV710) || (rdev->family == CHIP_RV730) ||
9229 -+ ASIC_IS_DCE41(rdev) || ASIC_IS_DCE5(rdev))
9230 - atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0);
9231 - else
9232 - atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0);
9233 -@@ -1362,8 +1363,6 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode)
9234 - ATOM_TRANSMITTER_ACTION_POWER_ON);
9235 - radeon_dig_connector->edp_on = true;
9236 - }
9237 -- if (ASIC_IS_DCE4(rdev))
9238 -- atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_OFF, 0);
9239 - radeon_dp_link_train(encoder, connector);
9240 - if (ASIC_IS_DCE4(rdev))
9241 - atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON, 0);
9242 -@@ -1374,7 +1373,10 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode)
9243 - case DRM_MODE_DPMS_STANDBY:
9244 - case DRM_MODE_DPMS_SUSPEND:
9245 - case DRM_MODE_DPMS_OFF:
9246 -- atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT, 0, 0);
9247 -+ if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE5(rdev))
9248 -+ atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0);
9249 -+ else
9250 -+ atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT, 0, 0);
9251 - if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(encoder)) && connector) {
9252 - if (ASIC_IS_DCE4(rdev))
9253 - atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_DP_VIDEO_OFF, 0);
9254 -@@ -1821,7 +1823,21 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
9255 - case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
9256 - case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
9257 - case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
9258 -- if (ASIC_IS_DCE4(rdev)) {
9259 -+ if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE5(rdev)) {
9260 -+ struct drm_connector *connector = radeon_get_connector_for_encoder(encoder);
9261 -+ struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
9262 -+
9263 -+ if (!connector)
9264 -+ dig->panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE;
9265 -+ else
9266 -+ dig->panel_mode = radeon_dp_get_panel_mode(encoder, connector);
9267 -+
9268 -+ /* setup and enable the encoder */
9269 -+ atombios_dig_encoder_setup(encoder, ATOM_ENCODER_CMD_SETUP, 0);
9270 -+ atombios_dig_encoder_setup(encoder,
9271 -+ ATOM_ENCODER_CMD_SETUP_PANEL_MODE,
9272 -+ dig->panel_mode);
9273 -+ } else if (ASIC_IS_DCE4(rdev)) {
9274 - /* disable the transmitter */
9275 - atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_DISABLE, 0, 0);
9276 - /* setup and enable the encoder */
9277 -diff --git a/drivers/gpu/drm/radeon/radeon_irq_kms.c b/drivers/gpu/drm/radeon/radeon_irq_kms.c
9278 -index 8f86aeb..e7ddb49 100644
9279 ---- a/drivers/gpu/drm/radeon/radeon_irq_kms.c
9280 -+++ b/drivers/gpu/drm/radeon/radeon_irq_kms.c
9281 -@@ -134,6 +134,12 @@ static bool radeon_msi_ok(struct radeon_device *rdev)
9282 - /* Dell RS690 only seems to work with MSIs. */
9283 - if ((rdev->pdev->device == 0x791f) &&
9284 - (rdev->pdev->subsystem_vendor == 0x1028) &&
9285 -+ (rdev->pdev->subsystem_device == 0x01fc))
9286 -+ return true;
9287 -+
9288 -+ /* Dell RS690 only seems to work with MSIs. */
9289 -+ if ((rdev->pdev->device == 0x791f) &&
9290 -+ (rdev->pdev->subsystem_vendor == 0x1028) &&
9291 - (rdev->pdev->subsystem_device == 0x01fd))
9292 - return true;
9293 -
9294 -diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
9295 -index 2c2e75e..8254d5a 100644
9296 ---- a/drivers/gpu/drm/radeon/radeon_mode.h
9297 -+++ b/drivers/gpu/drm/radeon/radeon_mode.h
9298 -@@ -362,6 +362,7 @@ struct radeon_encoder_atom_dig {
9299 - struct backlight_device *bl_dev;
9300 - int dpms_mode;
9301 - uint8_t backlight_level;
9302 -+ int panel_mode;
9303 - };
9304 -
9305 - struct radeon_encoder_atom_dac {
9306 -@@ -482,6 +483,8 @@ extern void radeon_dp_link_train(struct drm_encoder *encoder,
9307 - extern bool radeon_dp_needs_link_train(struct radeon_connector *radeon_connector);
9308 - extern u8 radeon_dp_getsinktype(struct radeon_connector *radeon_connector);
9309 - extern bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector);
9310 -+extern int radeon_dp_get_panel_mode(struct drm_encoder *encoder,
9311 -+ struct drm_connector *connector);
9312 - extern void atombios_dig_encoder_setup(struct drm_encoder *encoder, int action, int panel_mode);
9313 - extern void radeon_atom_encoder_init(struct radeon_device *rdev);
9314 - extern void atombios_dig_transmitter_setup(struct drm_encoder *encoder,
9315 -diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
9316 -index f94b33a..7c88f1f 100644
9317 ---- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
9318 -+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
9319 -@@ -378,7 +378,7 @@ int vmw_framebuffer_create_handle(struct drm_framebuffer *fb,
9320 - unsigned int *handle)
9321 - {
9322 - if (handle)
9323 -- handle = 0;
9324 -+ *handle = 0;
9325 -
9326 - return 0;
9327 - }
9328 -diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c
9329 -index 92f9497..6dbfd3e 100644
9330 ---- a/drivers/hwmon/f71805f.c
9331 -+++ b/drivers/hwmon/f71805f.c
9332 -@@ -283,11 +283,11 @@ static inline long temp_from_reg(u8 reg)
9333 -
9334 - static inline u8 temp_to_reg(long val)
9335 - {
9336 -- if (val < 0)
9337 -- val = 0;
9338 -- else if (val > 1000 * 0xff)
9339 -- val = 0xff;
9340 -- return ((val + 500) / 1000);
9341 -+ if (val <= 0)
9342 -+ return 0;
9343 -+ if (val >= 1000 * 0xff)
9344 -+ return 0xff;
9345 -+ return (val + 500) / 1000;
9346 - }
9347 -
9348 - /*
9349 -diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
9350 -index fe4104c..5357925 100644
9351 ---- a/drivers/hwmon/sht15.c
9352 -+++ b/drivers/hwmon/sht15.c
9353 -@@ -883,7 +883,7 @@ static int sht15_invalidate_voltage(struct notifier_block *nb,
9354 -
9355 - static int __devinit sht15_probe(struct platform_device *pdev)
9356 - {
9357 -- int ret = 0;
9358 -+ int ret;
9359 - struct sht15_data *data = kzalloc(sizeof(*data), GFP_KERNEL);
9360 - u8 status = 0;
9361 -
9362 -@@ -901,6 +901,7 @@ static int __devinit sht15_probe(struct platform_device *pdev)
9363 - init_waitqueue_head(&data->wait_queue);
9364 -
9365 - if (pdev->dev.platform_data == NULL) {
9366 -+ ret = -EINVAL;
9367 - dev_err(&pdev->dev, "no platform data supplied\n");
9368 - goto err_free_data;
9369 - }
9370 -diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c
9371 -index 93f5fc7..4b57ab6 100644
9372 ---- a/drivers/hwmon/w83627ehf.c
9373 -+++ b/drivers/hwmon/w83627ehf.c
9374 -@@ -1319,6 +1319,7 @@ store_pwm_mode(struct device *dev, struct device_attribute *attr,
9375 - {
9376 - struct w83627ehf_data *data = dev_get_drvdata(dev);
9377 - struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
9378 -+ struct w83627ehf_sio_data *sio_data = dev->platform_data;
9379 - int nr = sensor_attr->index;
9380 - unsigned long val;
9381 - int err;
9382 -@@ -1330,6 +1331,11 @@ store_pwm_mode(struct device *dev, struct device_attribute *attr,
9383 -
9384 - if (val > 1)
9385 - return -EINVAL;
9386 -+
9387 -+ /* On NCT67766F, DC mode is only supported for pwm1 */
9388 -+ if (sio_data->kind == nct6776 && nr && val != 1)
9389 -+ return -EINVAL;
9390 -+
9391 - mutex_lock(&data->update_lock);
9392 - reg = w83627ehf_read_value(data, W83627EHF_REG_PWM_ENABLE[nr]);
9393 - data->pwm_mode[nr] = val;
9394 -diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
9395 -index 106b88a..30431d8 100644
9396 ---- a/drivers/net/bonding/bond_alb.c
9397 -+++ b/drivers/net/bonding/bond_alb.c
9398 -@@ -871,16 +871,12 @@ static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[])
9399 - }
9400 - }
9401 -
9402 --/* hw is a boolean parameter that determines whether we should try and
9403 -- * set the hw address of the device as well as the hw address of the
9404 -- * net_device
9405 -- */
9406 --static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[], int hw)
9407 -+static int alb_set_slave_mac_addr(struct slave *slave, u8 addr[])
9408 - {
9409 - struct net_device *dev = slave->dev;
9410 - struct sockaddr s_addr;
9411 -
9412 -- if (!hw) {
9413 -+ if (slave->bond->params.mode == BOND_MODE_TLB) {
9414 - memcpy(dev->dev_addr, addr, dev->addr_len);
9415 - return 0;
9416 - }
9417 -@@ -910,8 +906,8 @@ static void alb_swap_mac_addr(struct bonding *bond, struct slave *slave1, struct
9418 - u8 tmp_mac_addr[ETH_ALEN];
9419 -
9420 - memcpy(tmp_mac_addr, slave1->dev->dev_addr, ETH_ALEN);
9421 -- alb_set_slave_mac_addr(slave1, slave2->dev->dev_addr, bond->alb_info.rlb_enabled);
9422 -- alb_set_slave_mac_addr(slave2, tmp_mac_addr, bond->alb_info.rlb_enabled);
9423 -+ alb_set_slave_mac_addr(slave1, slave2->dev->dev_addr);
9424 -+ alb_set_slave_mac_addr(slave2, tmp_mac_addr);
9425 -
9426 - }
9427 -
9428 -@@ -1058,8 +1054,7 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav
9429 -
9430 - /* Try setting slave mac to bond address and fall-through
9431 - to code handling that situation below... */
9432 -- alb_set_slave_mac_addr(slave, bond->dev->dev_addr,
9433 -- bond->alb_info.rlb_enabled);
9434 -+ alb_set_slave_mac_addr(slave, bond->dev->dev_addr);
9435 - }
9436 -
9437 - /* The slave's address is equal to the address of the bond.
9438 -@@ -1095,8 +1090,7 @@ static int alb_handle_addr_collision_on_attach(struct bonding *bond, struct slav
9439 - }
9440 -
9441 - if (free_mac_slave) {
9442 -- alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr,
9443 -- bond->alb_info.rlb_enabled);
9444 -+ alb_set_slave_mac_addr(slave, free_mac_slave->perm_hwaddr);
9445 -
9446 - pr_warning("%s: Warning: the hw address of slave %s is in use by the bond; giving it the hw address of %s\n",
9447 - bond->dev->name, slave->dev->name,
9448 -@@ -1451,8 +1445,7 @@ int bond_alb_init_slave(struct bonding *bond, struct slave *slave)
9449 - {
9450 - int res;
9451 -
9452 -- res = alb_set_slave_mac_addr(slave, slave->perm_hwaddr,
9453 -- bond->alb_info.rlb_enabled);
9454 -+ res = alb_set_slave_mac_addr(slave, slave->perm_hwaddr);
9455 - if (res) {
9456 - return res;
9457 - }
9458 -@@ -1603,8 +1596,7 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
9459 - alb_swap_mac_addr(bond, swap_slave, new_slave);
9460 - } else {
9461 - /* set the new_slave to the bond mac address */
9462 -- alb_set_slave_mac_addr(new_slave, bond->dev->dev_addr,
9463 -- bond->alb_info.rlb_enabled);
9464 -+ alb_set_slave_mac_addr(new_slave, bond->dev->dev_addr);
9465 - }
9466 -
9467 - if (swap_slave) {
9468 -@@ -1664,8 +1656,7 @@ int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
9469 - alb_swap_mac_addr(bond, swap_slave, bond->curr_active_slave);
9470 - alb_fasten_mac_swap(bond, swap_slave, bond->curr_active_slave);
9471 - } else {
9472 -- alb_set_slave_mac_addr(bond->curr_active_slave, bond_dev->dev_addr,
9473 -- bond->alb_info.rlb_enabled);
9474 -+ alb_set_slave_mac_addr(bond->curr_active_slave, bond_dev->dev_addr);
9475 -
9476 - read_lock(&bond->lock);
9477 - alb_send_learning_packets(bond->curr_active_slave, bond_dev->dev_addr);
9478 -diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
9479 -index 7413497..959d448 100644
9480 ---- a/drivers/net/macvlan.c
9481 -+++ b/drivers/net/macvlan.c
9482 -@@ -172,6 +172,7 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
9483 - skb = ip_check_defrag(skb, IP_DEFRAG_MACVLAN);
9484 - if (!skb)
9485 - return RX_HANDLER_CONSUMED;
9486 -+ eth = eth_hdr(skb);
9487 - src = macvlan_hash_lookup(port, eth->h_source);
9488 - if (!src)
9489 - /* frame comes from an external address */
9490 -diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
9491 -index 510e9bb..453f58e 100644
9492 ---- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
9493 -+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
9494 -@@ -8217,13 +8217,21 @@ int brcms_c_get_curband(struct brcms_c_info *wlc)
9495 -
9496 - void brcms_c_wait_for_tx_completion(struct brcms_c_info *wlc, bool drop)
9497 - {
9498 -+ int timeout = 20;
9499 -+
9500 - /* flush packet queue when requested */
9501 - if (drop)
9502 - brcmu_pktq_flush(&wlc->pkt_queue->q, false, NULL, NULL);
9503 -
9504 - /* wait for queue and DMA fifos to run dry */
9505 -- while (!pktq_empty(&wlc->pkt_queue->q) || brcms_txpktpendtot(wlc) > 0)
9506 -+ while (!pktq_empty(&wlc->pkt_queue->q) || brcms_txpktpendtot(wlc) > 0) {
9507 - brcms_msleep(wlc->wl, 1);
9508 -+
9509 -+ if (--timeout == 0)
9510 -+ break;
9511 -+ }
9512 -+
9513 -+ WARN_ON_ONCE(timeout == 0);
9514 - }
9515 -
9516 - void brcms_c_set_beacon_listen_interval(struct brcms_c_info *wlc, u8 interval)
9517 -diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
9518 -index 1920237..1daf01e 100644
9519 ---- a/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
9520 -+++ b/drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c
9521 -@@ -957,11 +957,11 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
9522 - }
9523 - #endif
9524 -
9525 -- spin_unlock_irqrestore(&trans->shrd->lock, flags);
9526 --
9527 - /* saved interrupt in inta variable now we can reset trans_pcie->inta */
9528 - trans_pcie->inta = 0;
9529 -
9530 -+ spin_unlock_irqrestore(&trans->shrd->lock, flags);
9531 -+
9532 - /* Now service all interrupt bits discovered above. */
9533 - if (inta & CSR_INT_BIT_HW_ERR) {
9534 - IWL_ERR(trans, "Hardware error detected. Restarting.\n");
9535 -diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
9536 -index 0794c72..b1ddfef 100644
9537 ---- a/drivers/scsi/mpt2sas/mpt2sas_base.c
9538 -+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
9539 -@@ -4033,7 +4033,8 @@ _base_make_ioc_operational(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
9540 - ioc->reply_free[i] = cpu_to_le32(reply_address);
9541 -
9542 - /* initialize reply queues */
9543 -- _base_assign_reply_queues(ioc);
9544 -+ if (ioc->is_driver_loading)
9545 -+ _base_assign_reply_queues(ioc);
9546 -
9547 - /* initialize Reply Post Free Queue */
9548 - reply_post_free = (long)ioc->reply_post_free;
9549 -@@ -4081,24 +4082,17 @@ _base_make_ioc_operational(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
9550 -
9551 -
9552 - if (ioc->is_driver_loading) {
9553 --
9554 --
9555 --
9556 -- ioc->wait_for_discovery_to_complete =
9557 -- _base_determine_wait_on_discovery(ioc);
9558 -- return r; /* scan_start and scan_finished support */
9559 -- }
9560 --
9561 --
9562 -- if (ioc->wait_for_discovery_to_complete && ioc->is_warpdrive) {
9563 -- if (ioc->manu_pg10.OEMIdentifier == 0x80) {
9564 -+ if (ioc->is_warpdrive && ioc->manu_pg10.OEMIdentifier
9565 -+ == 0x80) {
9566 - hide_flag = (u8) (ioc->manu_pg10.OEMSpecificFlags0 &
9567 - MFG_PAGE10_HIDE_SSDS_MASK);
9568 - if (hide_flag != MFG_PAGE10_HIDE_SSDS_MASK)
9569 - ioc->mfg_pg10_hide_flag = hide_flag;
9570 - }
9571 -+ ioc->wait_for_discovery_to_complete =
9572 -+ _base_determine_wait_on_discovery(ioc);
9573 -+ return r; /* scan_start and scan_finished support */
9574 - }
9575 --
9576 - r = _base_send_port_enable(ioc, sleep_flag);
9577 - if (r)
9578 - return r;
9579 -diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
9580 -index 9bc6fb2..2824a90 100644
9581 ---- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
9582 -+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
9583 -@@ -8001,7 +8001,6 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
9584 - goto out_attach_fail;
9585 - }
9586 -
9587 -- scsi_scan_host(shost);
9588 - if (ioc->is_warpdrive) {
9589 - if (ioc->mfg_pg10_hide_flag == MFG_PAGE10_EXPOSE_ALL_DISKS)
9590 - ioc->hide_drives = 0;
9591 -@@ -8015,8 +8014,8 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
9592 - }
9593 - } else
9594 - ioc->hide_drives = 0;
9595 -+ scsi_scan_host(shost);
9596 -
9597 -- _scsih_probe_devices(ioc);
9598 - return 0;
9599 -
9600 - out_attach_fail:
9601 -diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
9602 -index 00233af..8e00926 100644
9603 ---- a/drivers/tty/serial/amba-pl011.c
9604 -+++ b/drivers/tty/serial/amba-pl011.c
9605 -@@ -1740,9 +1740,19 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)
9606 - {
9607 - struct uart_amba_port *uap = amba_ports[co->index];
9608 - unsigned int status, old_cr, new_cr;
9609 -+ unsigned long flags;
9610 -+ int locked = 1;
9611 -
9612 - clk_enable(uap->clk);
9613 -
9614 -+ local_irq_save(flags);
9615 -+ if (uap->port.sysrq)
9616 -+ locked = 0;
9617 -+ else if (oops_in_progress)
9618 -+ locked = spin_trylock(&uap->port.lock);
9619 -+ else
9620 -+ spin_lock(&uap->port.lock);
9621 -+
9622 - /*
9623 - * First save the CR then disable the interrupts
9624 - */
9625 -@@ -1762,6 +1772,10 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)
9626 - } while (status & UART01x_FR_BUSY);
9627 - writew(old_cr, uap->port.membase + UART011_CR);
9628 -
9629 -+ if (locked)
9630 -+ spin_unlock(&uap->port.lock);
9631 -+ local_irq_restore(flags);
9632 -+
9633 - clk_disable(uap->clk);
9634 - }
9635 -
9636 -diff --git a/drivers/tty/serial/jsm/jsm_driver.c b/drivers/tty/serial/jsm/jsm_driver.c
9637 -index 7c867a0..7545fe1 100644
9638 ---- a/drivers/tty/serial/jsm/jsm_driver.c
9639 -+++ b/drivers/tty/serial/jsm/jsm_driver.c
9640 -@@ -251,6 +251,7 @@ static void jsm_io_resume(struct pci_dev *pdev)
9641 - struct jsm_board *brd = pci_get_drvdata(pdev);
9642 -
9643 - pci_restore_state(pdev);
9644 -+ pci_save_state(pdev);
9645 -
9646 - jsm_uart_port_init(brd);
9647 - }
9648 -diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
9649 -index ef9dd62..bf6e238 100644
9650 ---- a/drivers/tty/tty_port.c
9651 -+++ b/drivers/tty/tty_port.c
9652 -@@ -227,7 +227,6 @@ int tty_port_block_til_ready(struct tty_port *port,
9653 - int do_clocal = 0, retval;
9654 - unsigned long flags;
9655 - DEFINE_WAIT(wait);
9656 -- int cd;
9657 -
9658 - /* block if port is in the process of being closed */
9659 - if (tty_hung_up_p(filp) || port->flags & ASYNC_CLOSING) {
9660 -@@ -284,11 +283,14 @@ int tty_port_block_til_ready(struct tty_port *port,
9661 - retval = -ERESTARTSYS;
9662 - break;
9663 - }
9664 -- /* Probe the carrier. For devices with no carrier detect this
9665 -- will always return true */
9666 -- cd = tty_port_carrier_raised(port);
9667 -+ /*
9668 -+ * Probe the carrier. For devices with no carrier detect
9669 -+ * tty_port_carrier_raised will always return true.
9670 -+ * Never ask drivers if CLOCAL is set, this causes troubles
9671 -+ * on some hardware.
9672 -+ */
9673 - if (!(port->flags & ASYNC_CLOSING) &&
9674 -- (do_clocal || cd))
9675 -+ (do_clocal || tty_port_carrier_raised(port)))
9676 - break;
9677 - if (signal_pending(current)) {
9678 - retval = -ERESTARTSYS;
9679 -diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
9680 -index efe6849..fd4aee1 100644
9681 ---- a/drivers/usb/class/cdc-wdm.c
9682 -+++ b/drivers/usb/class/cdc-wdm.c
9683 -@@ -57,6 +57,8 @@ MODULE_DEVICE_TABLE (usb, wdm_ids);
9684 -
9685 - #define WDM_MAX 16
9686 -
9687 -+/* CDC-WMC r1.1 requires wMaxCommand to be "at least 256 decimal (0x100)" */
9688 -+#define WDM_DEFAULT_BUFSIZE 256
9689 -
9690 - static DEFINE_MUTEX(wdm_mutex);
9691 -
9692 -@@ -88,7 +90,8 @@ struct wdm_device {
9693 - int count;
9694 - dma_addr_t shandle;
9695 - dma_addr_t ihandle;
9696 -- struct mutex lock;
9697 -+ struct mutex wlock;
9698 -+ struct mutex rlock;
9699 - wait_queue_head_t wait;
9700 - struct work_struct rxwork;
9701 - int werr;
9702 -@@ -323,7 +326,7 @@ static ssize_t wdm_write
9703 - }
9704 -
9705 - /* concurrent writes and disconnect */
9706 -- r = mutex_lock_interruptible(&desc->lock);
9707 -+ r = mutex_lock_interruptible(&desc->wlock);
9708 - rv = -ERESTARTSYS;
9709 - if (r) {
9710 - kfree(buf);
9711 -@@ -386,7 +389,7 @@ static ssize_t wdm_write
9712 - out:
9713 - usb_autopm_put_interface(desc->intf);
9714 - outnp:
9715 -- mutex_unlock(&desc->lock);
9716 -+ mutex_unlock(&desc->wlock);
9717 - outnl:
9718 - return rv < 0 ? rv : count;
9719 - }
9720 -@@ -399,7 +402,7 @@ static ssize_t wdm_read
9721 - struct wdm_device *desc = file->private_data;
9722 -
9723 -
9724 -- rv = mutex_lock_interruptible(&desc->lock); /*concurrent reads */
9725 -+ rv = mutex_lock_interruptible(&desc->rlock); /*concurrent reads */
9726 - if (rv < 0)
9727 - return -ERESTARTSYS;
9728 -
9729 -@@ -467,14 +470,16 @@ retry:
9730 - for (i = 0; i < desc->length - cntr; i++)
9731 - desc->ubuf[i] = desc->ubuf[i + cntr];
9732 -
9733 -+ spin_lock_irq(&desc->iuspin);
9734 - desc->length -= cntr;
9735 -+ spin_unlock_irq(&desc->iuspin);
9736 - /* in case we had outstanding data */
9737 - if (!desc->length)
9738 - clear_bit(WDM_READ, &desc->flags);
9739 - rv = cntr;
9740 -
9741 - err:
9742 -- mutex_unlock(&desc->lock);
9743 -+ mutex_unlock(&desc->rlock);
9744 - return rv;
9745 - }
9746 -
9747 -@@ -540,7 +545,8 @@ static int wdm_open(struct inode *inode, struct file *file)
9748 - }
9749 - intf->needs_remote_wakeup = 1;
9750 -
9751 -- mutex_lock(&desc->lock);
9752 -+ /* using write lock to protect desc->count */
9753 -+ mutex_lock(&desc->wlock);
9754 - if (!desc->count++) {
9755 - desc->werr = 0;
9756 - desc->rerr = 0;
9757 -@@ -553,7 +559,7 @@ static int wdm_open(struct inode *inode, struct file *file)
9758 - } else {
9759 - rv = 0;
9760 - }
9761 -- mutex_unlock(&desc->lock);
9762 -+ mutex_unlock(&desc->wlock);
9763 - usb_autopm_put_interface(desc->intf);
9764 - out:
9765 - mutex_unlock(&wdm_mutex);
9766 -@@ -565,9 +571,11 @@ static int wdm_release(struct inode *inode, struct file *file)
9767 - struct wdm_device *desc = file->private_data;
9768 -
9769 - mutex_lock(&wdm_mutex);
9770 -- mutex_lock(&desc->lock);
9771 -+
9772 -+ /* using write lock to protect desc->count */
9773 -+ mutex_lock(&desc->wlock);
9774 - desc->count--;
9775 -- mutex_unlock(&desc->lock);
9776 -+ mutex_unlock(&desc->wlock);
9777 -
9778 - if (!desc->count) {
9779 - dev_dbg(&desc->intf->dev, "wdm_release: cleanup");
9780 -@@ -630,7 +638,7 @@ static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id)
9781 - struct usb_cdc_dmm_desc *dmhd;
9782 - u8 *buffer = intf->altsetting->extra;
9783 - int buflen = intf->altsetting->extralen;
9784 -- u16 maxcom = 0;
9785 -+ u16 maxcom = WDM_DEFAULT_BUFSIZE;
9786 -
9787 - if (!buffer)
9788 - goto out;
9789 -@@ -665,7 +673,8 @@ next_desc:
9790 - desc = kzalloc(sizeof(struct wdm_device), GFP_KERNEL);
9791 - if (!desc)
9792 - goto out;
9793 -- mutex_init(&desc->lock);
9794 -+ mutex_init(&desc->rlock);
9795 -+ mutex_init(&desc->wlock);
9796 - spin_lock_init(&desc->iuspin);
9797 - init_waitqueue_head(&desc->wait);
9798 - desc->wMaxCommand = maxcom;
9799 -@@ -716,7 +725,7 @@ next_desc:
9800 - goto err;
9801 -
9802 - desc->inbuf = usb_alloc_coherent(interface_to_usbdev(intf),
9803 -- desc->bMaxPacketSize0,
9804 -+ desc->wMaxCommand,
9805 - GFP_KERNEL,
9806 - &desc->response->transfer_dma);
9807 - if (!desc->inbuf)
9808 -@@ -779,11 +788,13 @@ static void wdm_disconnect(struct usb_interface *intf)
9809 - /* to terminate pending flushes */
9810 - clear_bit(WDM_IN_USE, &desc->flags);
9811 - spin_unlock_irqrestore(&desc->iuspin, flags);
9812 -- mutex_lock(&desc->lock);
9813 -+ wake_up_all(&desc->wait);
9814 -+ mutex_lock(&desc->rlock);
9815 -+ mutex_lock(&desc->wlock);
9816 - kill_urbs(desc);
9817 - cancel_work_sync(&desc->rxwork);
9818 -- mutex_unlock(&desc->lock);
9819 -- wake_up_all(&desc->wait);
9820 -+ mutex_unlock(&desc->wlock);
9821 -+ mutex_unlock(&desc->rlock);
9822 - if (!desc->count)
9823 - cleanup(desc);
9824 - mutex_unlock(&wdm_mutex);
9825 -@@ -798,8 +809,10 @@ static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
9826 - dev_dbg(&desc->intf->dev, "wdm%d_suspend\n", intf->minor);
9827 -
9828 - /* if this is an autosuspend the caller does the locking */
9829 -- if (!PMSG_IS_AUTO(message))
9830 -- mutex_lock(&desc->lock);
9831 -+ if (!PMSG_IS_AUTO(message)) {
9832 -+ mutex_lock(&desc->rlock);
9833 -+ mutex_lock(&desc->wlock);
9834 -+ }
9835 - spin_lock_irq(&desc->iuspin);
9836 -
9837 - if (PMSG_IS_AUTO(message) &&
9838 -@@ -815,8 +828,10 @@ static int wdm_suspend(struct usb_interface *intf, pm_message_t message)
9839 - kill_urbs(desc);
9840 - cancel_work_sync(&desc->rxwork);
9841 - }
9842 -- if (!PMSG_IS_AUTO(message))
9843 -- mutex_unlock(&desc->lock);
9844 -+ if (!PMSG_IS_AUTO(message)) {
9845 -+ mutex_unlock(&desc->wlock);
9846 -+ mutex_unlock(&desc->rlock);
9847 -+ }
9848 -
9849 - return rv;
9850 - }
9851 -@@ -854,7 +869,8 @@ static int wdm_pre_reset(struct usb_interface *intf)
9852 - {
9853 - struct wdm_device *desc = usb_get_intfdata(intf);
9854 -
9855 -- mutex_lock(&desc->lock);
9856 -+ mutex_lock(&desc->rlock);
9857 -+ mutex_lock(&desc->wlock);
9858 - kill_urbs(desc);
9859 -
9860 - /*
9861 -@@ -876,7 +892,8 @@ static int wdm_post_reset(struct usb_interface *intf)
9862 - int rv;
9863 -
9864 - rv = recover_from_urb_loss(desc);
9865 -- mutex_unlock(&desc->lock);
9866 -+ mutex_unlock(&desc->wlock);
9867 -+ mutex_unlock(&desc->rlock);
9868 - return 0;
9869 - }
9870 -
9871 -diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
9872 -index 69a4e43..27bd50a 100644
9873 ---- a/drivers/usb/dwc3/ep0.c
9874 -+++ b/drivers/usb/dwc3/ep0.c
9875 -@@ -149,20 +149,14 @@ static int __dwc3_gadget_ep0_queue(struct dwc3_ep *dep,
9876 -
9877 - direction = !!(dep->flags & DWC3_EP0_DIR_IN);
9878 -
9879 -- if (dwc->ep0state == EP0_STATUS_PHASE) {
9880 -- type = dwc->three_stage_setup
9881 -- ? DWC3_TRBCTL_CONTROL_STATUS3
9882 -- : DWC3_TRBCTL_CONTROL_STATUS2;
9883 -- } else if (dwc->ep0state == EP0_DATA_PHASE) {
9884 -- type = DWC3_TRBCTL_CONTROL_DATA;
9885 -- } else {
9886 -- /* should never happen */
9887 -- WARN_ON(1);
9888 -+ if (dwc->ep0state != EP0_DATA_PHASE) {
9889 -+ dev_WARN(dwc->dev, "Unexpected pending request\n");
9890 - return 0;
9891 - }
9892 -
9893 - ret = dwc3_ep0_start_trans(dwc, direction,
9894 -- req->request.dma, req->request.length, type);
9895 -+ req->request.dma, req->request.length,
9896 -+ DWC3_TRBCTL_CONTROL_DATA);
9897 - dep->flags &= ~(DWC3_EP_PENDING_REQUEST |
9898 - DWC3_EP0_DIR_IN);
9899 - }
9900 -diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c
9901 -index c9fa3bf..6ad0ad6 100644
9902 ---- a/drivers/usb/gadget/langwell_udc.c
9903 -+++ b/drivers/usb/gadget/langwell_udc.c
9904 -@@ -1522,8 +1522,7 @@ static void langwell_udc_stop(struct langwell_udc *dev)
9905 -
9906 -
9907 - /* stop all USB activities */
9908 --static void stop_activity(struct langwell_udc *dev,
9909 -- struct usb_gadget_driver *driver)
9910 -+static void stop_activity(struct langwell_udc *dev)
9911 - {
9912 - struct langwell_ep *ep;
9913 - dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__);
9914 -@@ -1535,9 +1534,9 @@ static void stop_activity(struct langwell_udc *dev,
9915 - }
9916 -
9917 - /* report disconnect; the driver is already quiesced */
9918 -- if (driver) {
9919 -+ if (dev->driver) {
9920 - spin_unlock(&dev->lock);
9921 -- driver->disconnect(&dev->gadget);
9922 -+ dev->driver->disconnect(&dev->gadget);
9923 - spin_lock(&dev->lock);
9924 - }
9925 -
9926 -@@ -1925,11 +1924,10 @@ static int langwell_stop(struct usb_gadget *g,
9927 -
9928 - /* stop all usb activities */
9929 - dev->gadget.speed = USB_SPEED_UNKNOWN;
9930 -- stop_activity(dev, driver);
9931 -- spin_unlock_irqrestore(&dev->lock, flags);
9932 --
9933 - dev->gadget.dev.driver = NULL;
9934 - dev->driver = NULL;
9935 -+ stop_activity(dev);
9936 -+ spin_unlock_irqrestore(&dev->lock, flags);
9937 -
9938 - device_remove_file(&dev->pdev->dev, &dev_attr_function);
9939 -
9940 -@@ -2733,7 +2731,7 @@ static void handle_usb_reset(struct langwell_udc *dev)
9941 - dev->bus_reset = 1;
9942 -
9943 - /* reset all the queues, stop all USB activities */
9944 -- stop_activity(dev, dev->driver);
9945 -+ stop_activity(dev);
9946 - dev->usb_state = USB_STATE_DEFAULT;
9947 - } else {
9948 - dev_vdbg(&dev->pdev->dev, "device controller reset\n");
9949 -@@ -2741,7 +2739,7 @@ static void handle_usb_reset(struct langwell_udc *dev)
9950 - langwell_udc_reset(dev);
9951 -
9952 - /* reset all the queues, stop all USB activities */
9953 -- stop_activity(dev, dev->driver);
9954 -+ stop_activity(dev);
9955 -
9956 - /* reset ep0 dQH and endptctrl */
9957 - ep0_reset(dev);
9958 -@@ -3367,7 +3365,7 @@ static int langwell_udc_suspend(struct pci_dev *pdev, pm_message_t state)
9959 -
9960 - spin_lock_irq(&dev->lock);
9961 - /* stop all usb activities */
9962 -- stop_activity(dev, dev->driver);
9963 -+ stop_activity(dev);
9964 - spin_unlock_irq(&dev->lock);
9965 -
9966 - /* free dTD dma_pool and dQH */
9967 -diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c
9968 -index c7f291a..85ea14e 100644
9969 ---- a/drivers/usb/gadget/storage_common.c
9970 -+++ b/drivers/usb/gadget/storage_common.c
9971 -@@ -598,16 +598,16 @@ static __maybe_unused struct usb_ss_cap_descriptor fsg_ss_cap_desc = {
9972 - | USB_5GBPS_OPERATION),
9973 - .bFunctionalitySupport = USB_LOW_SPEED_OPERATION,
9974 - .bU1devExitLat = USB_DEFAULT_U1_DEV_EXIT_LAT,
9975 -- .bU2DevExitLat = USB_DEFAULT_U2_DEV_EXIT_LAT,
9976 -+ .bU2DevExitLat = cpu_to_le16(USB_DEFAULT_U2_DEV_EXIT_LAT),
9977 - };
9978 -
9979 - static __maybe_unused struct usb_bos_descriptor fsg_bos_desc = {
9980 - .bLength = USB_DT_BOS_SIZE,
9981 - .bDescriptorType = USB_DT_BOS,
9982 -
9983 -- .wTotalLength = USB_DT_BOS_SIZE
9984 -+ .wTotalLength = cpu_to_le16(USB_DT_BOS_SIZE
9985 - + USB_DT_USB_EXT_CAP_SIZE
9986 -- + USB_DT_USB_SS_CAP_SIZE,
9987 -+ + USB_DT_USB_SS_CAP_SIZE),
9988 -
9989 - .bNumDeviceCaps = 2,
9990 - };
9991 -diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
9992 -index e90344a..b556a72 100644
9993 ---- a/drivers/usb/host/ehci-fsl.c
9994 -+++ b/drivers/usb/host/ehci-fsl.c
9995 -@@ -125,7 +125,7 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
9996 - */
9997 - if (pdata->init && pdata->init(pdev)) {
9998 - retval = -ENODEV;
9999 -- goto err3;
10000 -+ goto err4;
10001 - }
10002 -
10003 - /* Enable USB controller, 83xx or 8536 */
10004 -diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
10005 -index d28c586..ae92dc4 100644
10006 ---- a/drivers/usb/host/xhci-ring.c
10007 -+++ b/drivers/usb/host/xhci-ring.c
10008 -@@ -1215,6 +1215,7 @@ static void handle_vendor_event(struct xhci_hcd *xhci,
10009 - *
10010 - * Returns a zero-based port number, which is suitable for indexing into each of
10011 - * the split roothubs' port arrays and bus state arrays.
10012 -+ * Add one to it in order to call xhci_find_slot_id_by_port.
10013 - */
10014 - static unsigned int find_faked_portnum_from_hw_portnum(struct usb_hcd *hcd,
10015 - struct xhci_hcd *xhci, u32 port_id)
10016 -@@ -1335,7 +1336,7 @@ static void handle_port_status(struct xhci_hcd *xhci,
10017 - xhci_set_link_state(xhci, port_array, faked_port_index,
10018 - XDEV_U0);
10019 - slot_id = xhci_find_slot_id_by_port(hcd, xhci,
10020 -- faked_port_index);
10021 -+ faked_port_index + 1);
10022 - if (!slot_id) {
10023 - xhci_dbg(xhci, "slot_id is zero\n");
10024 - goto cleanup;
10025 -@@ -3372,7 +3373,8 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
10026 - /* Check TD length */
10027 - if (running_total != td_len) {
10028 - xhci_err(xhci, "ISOC TD length unmatch\n");
10029 -- return -EINVAL;
10030 -+ ret = -EINVAL;
10031 -+ goto cleanup;
10032 - }
10033 - }
10034 -
10035 -diff --git a/drivers/usb/misc/usbsevseg.c b/drivers/usb/misc/usbsevseg.c
10036 -index 417b8f2..59689fa 100644
10037 ---- a/drivers/usb/misc/usbsevseg.c
10038 -+++ b/drivers/usb/misc/usbsevseg.c
10039 -@@ -24,7 +24,7 @@
10040 -
10041 - #define VENDOR_ID 0x0fc5
10042 - #define PRODUCT_ID 0x1227
10043 --#define MAXLEN 6
10044 -+#define MAXLEN 8
10045 -
10046 - /* table of devices that work with this driver */
10047 - static const struct usb_device_id id_table[] = {
10048 -diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
10049 -index f9a3f62..7c569f5 100644
10050 ---- a/drivers/usb/musb/davinci.c
10051 -+++ b/drivers/usb/musb/davinci.c
10052 -@@ -33,9 +33,6 @@
10053 - #include <linux/platform_device.h>
10054 - #include <linux/dma-mapping.h>
10055 -
10056 --#include <mach/hardware.h>
10057 --#include <mach/memory.h>
10058 --#include <asm/gpio.h>
10059 - #include <mach/cputype.h>
10060 -
10061 - #include <asm/mach-types.h>
10062 -diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
10063 -index a1a324b..a515237 100644
10064 ---- a/drivers/usb/serial/cp210x.c
10065 -+++ b/drivers/usb/serial/cp210x.c
10066 -@@ -39,6 +39,8 @@ static void cp210x_get_termios(struct tty_struct *,
10067 - struct usb_serial_port *port);
10068 - static void cp210x_get_termios_port(struct usb_serial_port *port,
10069 - unsigned int *cflagp, unsigned int *baudp);
10070 -+static void cp210x_change_speed(struct tty_struct *, struct usb_serial_port *,
10071 -+ struct ktermios *);
10072 - static void cp210x_set_termios(struct tty_struct *, struct usb_serial_port *,
10073 - struct ktermios*);
10074 - static int cp210x_tiocmget(struct tty_struct *);
10075 -@@ -138,6 +140,7 @@ static const struct usb_device_id id_table[] = {
10076 - { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
10077 - { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
10078 - { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */
10079 -+ { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */
10080 - { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */
10081 - { } /* Terminating Entry */
10082 - };
10083 -@@ -201,6 +204,8 @@ static struct usb_serial_driver cp210x_device = {
10084 - #define CP210X_EMBED_EVENTS 0x15
10085 - #define CP210X_GET_EVENTSTATE 0x16
10086 - #define CP210X_SET_CHARS 0x19
10087 -+#define CP210X_GET_BAUDRATE 0x1D
10088 -+#define CP210X_SET_BAUDRATE 0x1E
10089 -
10090 - /* CP210X_IFC_ENABLE */
10091 - #define UART_ENABLE 0x0001
10092 -@@ -354,8 +359,8 @@ static inline int cp210x_set_config_single(struct usb_serial_port *port,
10093 - * Quantises the baud rate as per AN205 Table 1
10094 - */
10095 - static unsigned int cp210x_quantise_baudrate(unsigned int baud) {
10096 -- if (baud <= 56) baud = 0;
10097 -- else if (baud <= 300) baud = 300;
10098 -+ if (baud <= 300)
10099 -+ baud = 300;
10100 - else if (baud <= 600) baud = 600;
10101 - else if (baud <= 1200) baud = 1200;
10102 - else if (baud <= 1800) baud = 1800;
10103 -@@ -383,17 +388,15 @@ static unsigned int cp210x_quantise_baudrate(unsigned int baud) {
10104 - else if (baud <= 491520) baud = 460800;
10105 - else if (baud <= 567138) baud = 500000;
10106 - else if (baud <= 670254) baud = 576000;
10107 -- else if (baud <= 1053257) baud = 921600;
10108 -- else if (baud <= 1474560) baud = 1228800;
10109 -- else if (baud <= 2457600) baud = 1843200;
10110 -- else baud = 3686400;
10111 -+ else if (baud < 1000000)
10112 -+ baud = 921600;
10113 -+ else if (baud > 2000000)
10114 -+ baud = 2000000;
10115 - return baud;
10116 - }
10117 -
10118 - static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *port)
10119 - {
10120 -- int result;
10121 --
10122 - dbg("%s - port %d", __func__, port->number);
10123 -
10124 - if (cp210x_set_config_single(port, CP210X_IFC_ENABLE, UART_ENABLE)) {
10125 -@@ -402,13 +405,14 @@ static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *port)
10126 - return -EPROTO;
10127 - }
10128 -
10129 -- result = usb_serial_generic_open(tty, port);
10130 -- if (result)
10131 -- return result;
10132 --
10133 - /* Configure the termios structure */
10134 - cp210x_get_termios(tty, port);
10135 -- return 0;
10136 -+
10137 -+ /* The baud rate must be initialised on cp2104 */
10138 -+ if (tty)
10139 -+ cp210x_change_speed(tty, port, NULL);
10140 -+
10141 -+ return usb_serial_generic_open(tty, port);
10142 - }
10143 -
10144 - static void cp210x_close(struct usb_serial_port *port)
10145 -@@ -460,10 +464,7 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
10146 -
10147 - dbg("%s - port %d", __func__, port->number);
10148 -
10149 -- cp210x_get_config(port, CP210X_GET_BAUDDIV, &baud, 2);
10150 -- /* Convert to baudrate */
10151 -- if (baud)
10152 -- baud = cp210x_quantise_baudrate((BAUD_RATE_GEN_FREQ + baud/2)/ baud);
10153 -+ cp210x_get_config(port, CP210X_GET_BAUDRATE, &baud, 4);
10154 -
10155 - dbg("%s - baud rate = %d", __func__, baud);
10156 - *baudp = baud;
10157 -@@ -577,11 +578,64 @@ static void cp210x_get_termios_port(struct usb_serial_port *port,
10158 - *cflagp = cflag;
10159 - }
10160 -
10161 -+/*
10162 -+ * CP2101 supports the following baud rates:
10163 -+ *
10164 -+ * 300, 600, 1200, 1800, 2400, 4800, 7200, 9600, 14400, 19200, 28800,
10165 -+ * 38400, 56000, 57600, 115200, 128000, 230400, 460800, 921600
10166 -+ *
10167 -+ * CP2102 and CP2103 support the following additional rates:
10168 -+ *
10169 -+ * 4000, 16000, 51200, 64000, 76800, 153600, 250000, 256000, 500000,
10170 -+ * 576000
10171 -+ *
10172 -+ * The device will map a requested rate to a supported one, but the result
10173 -+ * of requests for rates greater than 1053257 is undefined (see AN205).
10174 -+ *
10175 -+ * CP2104, CP2105 and CP2110 support most rates up to 2M, 921k and 1M baud,
10176 -+ * respectively, with an error less than 1%. The actual rates are determined
10177 -+ * by
10178 -+ *
10179 -+ * div = round(freq / (2 x prescale x request))
10180 -+ * actual = freq / (2 x prescale x div)
10181 -+ *
10182 -+ * For CP2104 and CP2105 freq is 48Mhz and prescale is 4 for request <= 365bps
10183 -+ * or 1 otherwise.
10184 -+ * For CP2110 freq is 24Mhz and prescale is 4 for request <= 300bps or 1
10185 -+ * otherwise.
10186 -+ */
10187 -+static void cp210x_change_speed(struct tty_struct *tty,
10188 -+ struct usb_serial_port *port, struct ktermios *old_termios)
10189 -+{
10190 -+ u32 baud;
10191 -+
10192 -+ baud = tty->termios->c_ospeed;
10193 -+
10194 -+ /* This maps the requested rate to a rate valid on cp2102 or cp2103,
10195 -+ * or to an arbitrary rate in [1M,2M].
10196 -+ *
10197 -+ * NOTE: B0 is not implemented.
10198 -+ */
10199 -+ baud = cp210x_quantise_baudrate(baud);
10200 -+
10201 -+ dbg("%s - setting baud rate to %u", __func__, baud);
10202 -+ if (cp210x_set_config(port, CP210X_SET_BAUDRATE, &baud,
10203 -+ sizeof(baud))) {
10204 -+ dev_warn(&port->dev, "failed to set baud rate to %u\n", baud);
10205 -+ if (old_termios)
10206 -+ baud = old_termios->c_ospeed;
10207 -+ else
10208 -+ baud = 9600;
10209 -+ }
10210 -+
10211 -+ tty_encode_baud_rate(tty, baud, baud);
10212 -+}
10213 -+
10214 - static void cp210x_set_termios(struct tty_struct *tty,
10215 - struct usb_serial_port *port, struct ktermios *old_termios)
10216 - {
10217 - unsigned int cflag, old_cflag;
10218 -- unsigned int baud = 0, bits;
10219 -+ unsigned int bits;
10220 - unsigned int modem_ctl[4];
10221 -
10222 - dbg("%s - port %d", __func__, port->number);
10223 -@@ -592,20 +646,9 @@ static void cp210x_set_termios(struct tty_struct *tty,
10224 - tty->termios->c_cflag &= ~CMSPAR;
10225 - cflag = tty->termios->c_cflag;
10226 - old_cflag = old_termios->c_cflag;
10227 -- baud = cp210x_quantise_baudrate(tty_get_baud_rate(tty));
10228 --
10229 -- /* If the baud rate is to be updated*/
10230 -- if (baud != tty_termios_baud_rate(old_termios) && baud != 0) {
10231 -- dbg("%s - Setting baud rate to %d baud", __func__,
10232 -- baud);
10233 -- if (cp210x_set_config_single(port, CP210X_SET_BAUDDIV,
10234 -- ((BAUD_RATE_GEN_FREQ + baud/2) / baud))) {
10235 -- dbg("Baud rate requested not supported by device");
10236 -- baud = tty_termios_baud_rate(old_termios);
10237 -- }
10238 -- }
10239 -- /* Report back the resulting baud rate */
10240 -- tty_encode_baud_rate(tty, baud, baud);
10241 -+
10242 -+ if (tty->termios->c_ospeed != old_termios->c_ospeed)
10243 -+ cp210x_change_speed(tty, port, old_termios);
10244 -
10245 - /* If the number of data bits is to be updated */
10246 - if ((cflag & CSIZE) != (old_cflag & CSIZE)) {
10247 -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
10248 -index ff3db5d..058b92c 100644
10249 ---- a/drivers/usb/serial/ftdi_sio.c
10250 -+++ b/drivers/usb/serial/ftdi_sio.c
10251 -@@ -797,6 +797,7 @@ static struct usb_device_id id_table_combined [] = {
10252 - .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
10253 - { USB_DEVICE(ADI_VID, ADI_GNICEPLUS_PID),
10254 - .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
10255 -+ { USB_DEVICE(HORNBY_VID, HORNBY_ELITE_PID) },
10256 - { USB_DEVICE(JETI_VID, JETI_SPC1201_PID) },
10257 - { USB_DEVICE(MARVELL_VID, MARVELL_SHEEVAPLUG_PID),
10258 - .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
10259 -@@ -805,6 +806,8 @@ static struct usb_device_id id_table_combined [] = {
10260 - { USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) },
10261 - { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID),
10262 - .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
10263 -+ { USB_DEVICE(FTDI_VID, TI_XDS100V2_PID),
10264 -+ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
10265 - { USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) },
10266 - { USB_DEVICE(FTDI_VID, HAMEG_HO720_PID) },
10267 - { USB_DEVICE(FTDI_VID, HAMEG_HO730_PID) },
10268 -@@ -841,6 +844,7 @@ static struct usb_device_id id_table_combined [] = {
10269 - .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
10270 - { USB_DEVICE(ST_VID, ST_STMCLT1030_PID),
10271 - .driver_info = (kernel_ulong_t)&ftdi_stmclite_quirk },
10272 -+ { USB_DEVICE(FTDI_VID, FTDI_RF_R106) },
10273 - { }, /* Optional parameter entry */
10274 - { } /* Terminating entry */
10275 - };
10276 -@@ -1333,8 +1337,7 @@ static int set_serial_info(struct tty_struct *tty,
10277 - goto check_and_exit;
10278 - }
10279 -
10280 -- if ((new_serial.baud_base != priv->baud_base) &&
10281 -- (new_serial.baud_base < 9600)) {
10282 -+ if (new_serial.baud_base != priv->baud_base) {
10283 - mutex_unlock(&priv->cfg_lock);
10284 - return -EINVAL;
10285 - }
10286 -@@ -1824,6 +1827,7 @@ static int ftdi_sio_port_remove(struct usb_serial_port *port)
10287 -
10288 - static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port)
10289 - {
10290 -+ struct ktermios dummy;
10291 - struct usb_device *dev = port->serial->dev;
10292 - struct ftdi_private *priv = usb_get_serial_port_data(port);
10293 - int result;
10294 -@@ -1842,8 +1846,10 @@ static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port)
10295 - This is same behaviour as serial.c/rs_open() - Kuba */
10296 -
10297 - /* ftdi_set_termios will send usb control messages */
10298 -- if (tty)
10299 -- ftdi_set_termios(tty, port, tty->termios);
10300 -+ if (tty) {
10301 -+ memset(&dummy, 0, sizeof(dummy));
10302 -+ ftdi_set_termios(tty, port, &dummy);
10303 -+ }
10304 -
10305 - /* Start reading from the device */
10306 - result = usb_serial_generic_open(tty, port);
10307 -diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
10308 -index 055b64e..76d4f31 100644
10309 ---- a/drivers/usb/serial/ftdi_sio_ids.h
10310 -+++ b/drivers/usb/serial/ftdi_sio_ids.h
10311 -@@ -39,6 +39,13 @@
10312 - /* www.candapter.com Ewert Energy Systems CANdapter device */
10313 - #define FTDI_CANDAPTER_PID 0x9F80 /* Product Id */
10314 -
10315 -+/*
10316 -+ * Texas Instruments XDS100v2 JTAG / BeagleBone A3
10317 -+ * http://processors.wiki.ti.com/index.php/XDS100
10318 -+ * http://beagleboard.org/bone
10319 -+ */
10320 -+#define TI_XDS100V2_PID 0xa6d0
10321 -+
10322 - #define FTDI_NXTCAM_PID 0xABB8 /* NXTCam for Mindstorms NXT */
10323 -
10324 - /* US Interface Navigator (http://www.usinterface.com/) */
10325 -@@ -525,6 +532,12 @@
10326 - #define ADI_GNICEPLUS_PID 0xF001
10327 -
10328 - /*
10329 -+ * Hornby Elite
10330 -+ */
10331 -+#define HORNBY_VID 0x04D8
10332 -+#define HORNBY_ELITE_PID 0x000A
10333 -+
10334 -+/*
10335 - * RATOC REX-USB60F
10336 - */
10337 - #define RATOC_VENDOR_ID 0x0584
10338 -@@ -1168,3 +1181,9 @@
10339 - */
10340 - /* TagTracer MIFARE*/
10341 - #define FTDI_ZEITCONTROL_TAGTRACE_MIFARE_PID 0xF7C0
10342 -+
10343 -+/*
10344 -+ * Rainforest Automation
10345 -+ */
10346 -+/* ZigBee controller */
10347 -+#define FTDI_RF_R106 0x8A28
10348 -diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
10349 -index 0aac00a..8a90d58 100644
10350 ---- a/drivers/usb/serial/io_ti.c
10351 -+++ b/drivers/usb/serial/io_ti.c
10352 -@@ -2677,15 +2677,7 @@ cleanup:
10353 -
10354 - static void edge_disconnect(struct usb_serial *serial)
10355 - {
10356 -- int i;
10357 -- struct edgeport_port *edge_port;
10358 --
10359 - dbg("%s", __func__);
10360 --
10361 -- for (i = 0; i < serial->num_ports; ++i) {
10362 -- edge_port = usb_get_serial_port_data(serial->port[i]);
10363 -- edge_remove_sysfs_attrs(edge_port->port);
10364 -- }
10365 - }
10366 -
10367 - static void edge_release(struct usb_serial *serial)
10368 -@@ -2764,6 +2756,7 @@ static struct usb_serial_driver edgeport_1port_device = {
10369 - .disconnect = edge_disconnect,
10370 - .release = edge_release,
10371 - .port_probe = edge_create_sysfs_attrs,
10372 -+ .port_remove = edge_remove_sysfs_attrs,
10373 - .ioctl = edge_ioctl,
10374 - .set_termios = edge_set_termios,
10375 - .tiocmget = edge_tiocmget,
10376 -@@ -2795,6 +2788,7 @@ static struct usb_serial_driver edgeport_2port_device = {
10377 - .disconnect = edge_disconnect,
10378 - .release = edge_release,
10379 - .port_probe = edge_create_sysfs_attrs,
10380 -+ .port_remove = edge_remove_sysfs_attrs,
10381 - .ioctl = edge_ioctl,
10382 - .set_termios = edge_set_termios,
10383 - .tiocmget = edge_tiocmget,
10384 -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
10385 -index c96b6b6..2a9ed6e 100644
10386 ---- a/drivers/usb/serial/option.c
10387 -+++ b/drivers/usb/serial/option.c
10388 -@@ -480,6 +480,10 @@ static void option_instat_callback(struct urb *urb);
10389 - #define ZD_VENDOR_ID 0x0685
10390 - #define ZD_PRODUCT_7000 0x7000
10391 -
10392 -+/* LG products */
10393 -+#define LG_VENDOR_ID 0x1004
10394 -+#define LG_PRODUCT_L02C 0x618f
10395 -+
10396 - /* some devices interfaces need special handling due to a number of reasons */
10397 - enum option_blacklist_reason {
10398 - OPTION_BLACKLIST_NONE = 0,
10399 -@@ -1183,6 +1187,7 @@ static const struct usb_device_id option_ids[] = {
10400 - { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU526) },
10401 - { USB_DEVICE_AND_INTERFACE_INFO(VIETTEL_VENDOR_ID, VIETTEL_PRODUCT_VT1000, 0xff, 0xff, 0xff) },
10402 - { USB_DEVICE_AND_INTERFACE_INFO(ZD_VENDOR_ID, ZD_PRODUCT_7000, 0xff, 0xff, 0xff) },
10403 -+ { USB_DEVICE(LG_VENDOR_ID, LG_PRODUCT_L02C) }, /* docomo L-02C modem */
10404 - { } /* Terminating entry */
10405 - };
10406 - MODULE_DEVICE_TABLE(usb, option_ids);
10407 -diff --git a/drivers/usb/serial/qcaux.c b/drivers/usb/serial/qcaux.c
10408 -index 30b73e6..a348198 100644
10409 ---- a/drivers/usb/serial/qcaux.c
10410 -+++ b/drivers/usb/serial/qcaux.c
10411 -@@ -36,6 +36,7 @@
10412 - #define UTSTARCOM_PRODUCT_UM175_V1 0x3712
10413 - #define UTSTARCOM_PRODUCT_UM175_V2 0x3714
10414 - #define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715
10415 -+#define PANTECH_PRODUCT_UML190_VZW 0x3716
10416 - #define PANTECH_PRODUCT_UML290_VZW 0x3718
10417 -
10418 - /* CMOTECH devices */
10419 -@@ -67,7 +68,11 @@ static struct usb_device_id id_table[] = {
10420 - { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) },
10421 - { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) },
10422 - { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) },
10423 -- { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xff, 0xff) },
10424 -+ { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML190_VZW, 0xff, 0xff, 0xff) },
10425 -+ { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML190_VZW, 0xff, 0xfe, 0xff) },
10426 -+ { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xfd, 0xff) }, /* NMEA */
10427 -+ { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xfe, 0xff) }, /* WMC */
10428 -+ { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xff, 0xff) }, /* DIAG */
10429 - { },
10430 - };
10431 - MODULE_DEVICE_TABLE(usb, id_table);
10432 -diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
10433 -index 0ce5f79..32c93d7 100644
10434 ---- a/drivers/usb/storage/realtek_cr.c
10435 -+++ b/drivers/usb/storage/realtek_cr.c
10436 -@@ -791,7 +791,7 @@ static void rts51x_suspend_timer_fn(unsigned long data)
10437 - rts51x_set_stat(chip, RTS51X_STAT_SS);
10438 - /* ignore mass storage interface's children */
10439 - pm_suspend_ignore_children(&us->pusb_intf->dev, true);
10440 -- usb_autopm_put_interface(us->pusb_intf);
10441 -+ usb_autopm_put_interface_async(us->pusb_intf);
10442 - US_DEBUGP("%s: RTS51X_STAT_SS 01,"
10443 - "intf->pm_usage_cnt:%d, power.usage:%d\n",
10444 - __func__,
10445 -diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
10446 -index 2a83425..68b19ab 100644
10447 ---- a/fs/ecryptfs/crypto.c
10448 -+++ b/fs/ecryptfs/crypto.c
10449 -@@ -417,17 +417,6 @@ static int ecryptfs_encrypt_extent(struct page *enc_extent_page,
10450 - (unsigned long long)(extent_base + extent_offset), rc);
10451 - goto out;
10452 - }
10453 -- if (unlikely(ecryptfs_verbosity > 0)) {
10454 -- ecryptfs_printk(KERN_DEBUG, "Encrypting extent "
10455 -- "with iv:\n");
10456 -- ecryptfs_dump_hex(extent_iv, crypt_stat->iv_bytes);
10457 -- ecryptfs_printk(KERN_DEBUG, "First 8 bytes before "
10458 -- "encryption:\n");
10459 -- ecryptfs_dump_hex((char *)
10460 -- (page_address(page)
10461 -- + (extent_offset * crypt_stat->extent_size)),
10462 -- 8);
10463 -- }
10464 - rc = ecryptfs_encrypt_page_offset(crypt_stat, enc_extent_page, 0,
10465 - page, (extent_offset
10466 - * crypt_stat->extent_size),
10467 -@@ -440,14 +429,6 @@ static int ecryptfs_encrypt_extent(struct page *enc_extent_page,
10468 - goto out;
10469 - }
10470 - rc = 0;
10471 -- if (unlikely(ecryptfs_verbosity > 0)) {
10472 -- ecryptfs_printk(KERN_DEBUG, "Encrypt extent [0x%.16llx]; "
10473 -- "rc = [%d]\n",
10474 -- (unsigned long long)(extent_base + extent_offset), rc);
10475 -- ecryptfs_printk(KERN_DEBUG, "First 8 bytes after "
10476 -- "encryption:\n");
10477 -- ecryptfs_dump_hex((char *)(page_address(enc_extent_page)), 8);
10478 -- }
10479 - out:
10480 - return rc;
10481 - }
10482 -@@ -543,17 +524,6 @@ static int ecryptfs_decrypt_extent(struct page *page,
10483 - (unsigned long long)(extent_base + extent_offset), rc);
10484 - goto out;
10485 - }
10486 -- if (unlikely(ecryptfs_verbosity > 0)) {
10487 -- ecryptfs_printk(KERN_DEBUG, "Decrypting extent "
10488 -- "with iv:\n");
10489 -- ecryptfs_dump_hex(extent_iv, crypt_stat->iv_bytes);
10490 -- ecryptfs_printk(KERN_DEBUG, "First 8 bytes before "
10491 -- "decryption:\n");
10492 -- ecryptfs_dump_hex((char *)
10493 -- (page_address(enc_extent_page)
10494 -- + (extent_offset * crypt_stat->extent_size)),
10495 -- 8);
10496 -- }
10497 - rc = ecryptfs_decrypt_page_offset(crypt_stat, page,
10498 - (extent_offset
10499 - * crypt_stat->extent_size),
10500 -@@ -567,16 +537,6 @@ static int ecryptfs_decrypt_extent(struct page *page,
10501 - goto out;
10502 - }
10503 - rc = 0;
10504 -- if (unlikely(ecryptfs_verbosity > 0)) {
10505 -- ecryptfs_printk(KERN_DEBUG, "Decrypt extent [0x%.16llx]; "
10506 -- "rc = [%d]\n",
10507 -- (unsigned long long)(extent_base + extent_offset), rc);
10508 -- ecryptfs_printk(KERN_DEBUG, "First 8 bytes after "
10509 -- "decryption:\n");
10510 -- ecryptfs_dump_hex((char *)(page_address(page)
10511 -- + (extent_offset
10512 -- * crypt_stat->extent_size)), 8);
10513 -- }
10514 - out:
10515 - return rc;
10516 - }
10517 -@@ -1620,7 +1580,8 @@ int ecryptfs_read_metadata(struct dentry *ecryptfs_dentry)
10518 - rc = ecryptfs_read_xattr_region(page_virt, ecryptfs_inode);
10519 - if (rc) {
10520 - printk(KERN_DEBUG "Valid eCryptfs headers not found in "
10521 -- "file header region or xattr region\n");
10522 -+ "file header region or xattr region, inode %lu\n",
10523 -+ ecryptfs_inode->i_ino);
10524 - rc = -EINVAL;
10525 - goto out;
10526 - }
10527 -@@ -1629,7 +1590,8 @@ int ecryptfs_read_metadata(struct dentry *ecryptfs_dentry)
10528 - ECRYPTFS_DONT_VALIDATE_HEADER_SIZE);
10529 - if (rc) {
10530 - printk(KERN_DEBUG "Valid eCryptfs headers not found in "
10531 -- "file xattr region either\n");
10532 -+ "file xattr region either, inode %lu\n",
10533 -+ ecryptfs_inode->i_ino);
10534 - rc = -EINVAL;
10535 - }
10536 - if (crypt_stat->mount_crypt_stat->flags
10537 -@@ -1640,7 +1602,8 @@ int ecryptfs_read_metadata(struct dentry *ecryptfs_dentry)
10538 - "crypto metadata only in the extended attribute "
10539 - "region, but eCryptfs was mounted without "
10540 - "xattr support enabled. eCryptfs will not treat "
10541 -- "this like an encrypted file.\n");
10542 -+ "this like an encrypted file, inode %lu\n",
10543 -+ ecryptfs_inode->i_ino);
10544 - rc = -EINVAL;
10545 - }
10546 - }
10547 -diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
10548 -index 32f90a3..d2039ca 100644
10549 ---- a/fs/ecryptfs/inode.c
10550 -+++ b/fs/ecryptfs/inode.c
10551 -@@ -841,18 +841,6 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia,
10552 - size_t num_zeros = (PAGE_CACHE_SIZE
10553 - - (ia->ia_size & ~PAGE_CACHE_MASK));
10554 -
10555 --
10556 -- /*
10557 -- * XXX(truncate) this should really happen at the begginning
10558 -- * of ->setattr. But the code is too messy to that as part
10559 -- * of a larger patch. ecryptfs is also totally missing out
10560 -- * on the inode_change_ok check at the beginning of
10561 -- * ->setattr while would include this.
10562 -- */
10563 -- rc = inode_newsize_ok(inode, ia->ia_size);
10564 -- if (rc)
10565 -- goto out;
10566 --
10567 - if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) {
10568 - truncate_setsize(inode, ia->ia_size);
10569 - lower_ia->ia_size = ia->ia_size;
10570 -@@ -902,6 +890,28 @@ out:
10571 - return rc;
10572 - }
10573 -
10574 -+static int ecryptfs_inode_newsize_ok(struct inode *inode, loff_t offset)
10575 -+{
10576 -+ struct ecryptfs_crypt_stat *crypt_stat;
10577 -+ loff_t lower_oldsize, lower_newsize;
10578 -+
10579 -+ crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat;
10580 -+ lower_oldsize = upper_size_to_lower_size(crypt_stat,
10581 -+ i_size_read(inode));
10582 -+ lower_newsize = upper_size_to_lower_size(crypt_stat, offset);
10583 -+ if (lower_newsize > lower_oldsize) {
10584 -+ /*
10585 -+ * The eCryptfs inode and the new *lower* size are mixed here
10586 -+ * because we may not have the lower i_mutex held and/or it may
10587 -+ * not be appropriate to call inode_newsize_ok() with inodes
10588 -+ * from other filesystems.
10589 -+ */
10590 -+ return inode_newsize_ok(inode, lower_newsize);
10591 -+ }
10592 -+
10593 -+ return 0;
10594 -+}
10595 -+
10596 - /**
10597 - * ecryptfs_truncate
10598 - * @dentry: The ecryptfs layer dentry
10599 -@@ -918,6 +928,10 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
10600 - struct iattr lower_ia = { .ia_valid = 0 };
10601 - int rc;
10602 -
10603 -+ rc = ecryptfs_inode_newsize_ok(dentry->d_inode, new_length);
10604 -+ if (rc)
10605 -+ return rc;
10606 -+
10607 - rc = truncate_upper(dentry, &ia, &lower_ia);
10608 - if (!rc && lower_ia.ia_valid & ATTR_SIZE) {
10609 - struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
10610 -@@ -997,6 +1011,16 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
10611 - }
10612 - }
10613 - mutex_unlock(&crypt_stat->cs_mutex);
10614 -+
10615 -+ rc = inode_change_ok(inode, ia);
10616 -+ if (rc)
10617 -+ goto out;
10618 -+ if (ia->ia_valid & ATTR_SIZE) {
10619 -+ rc = ecryptfs_inode_newsize_ok(inode, ia->ia_size);
10620 -+ if (rc)
10621 -+ goto out;
10622 -+ }
10623 -+
10624 - if (S_ISREG(inode->i_mode)) {
10625 - rc = filemap_write_and_wait(inode->i_mapping);
10626 - if (rc)
10627 -diff --git a/fs/ecryptfs/miscdev.c b/fs/ecryptfs/miscdev.c
10628 -index 940a82e..0dc5a3d 100644
10629 ---- a/fs/ecryptfs/miscdev.c
10630 -+++ b/fs/ecryptfs/miscdev.c
10631 -@@ -409,11 +409,47 @@ ecryptfs_miscdev_write(struct file *file, const char __user *buf,
10632 - ssize_t sz = 0;
10633 - char *data;
10634 - uid_t euid = current_euid();
10635 -+ unsigned char packet_size_peek[3];
10636 - int rc;
10637 -
10638 -- if (count == 0)
10639 -+ if (count == 0) {
10640 - goto out;
10641 -+ } else if (count == (1 + 4)) {
10642 -+ /* Likely a harmless MSG_HELO or MSG_QUIT - no packet length */
10643 -+ goto memdup;
10644 -+ } else if (count < (1 + 4 + 1)
10645 -+ || count > (1 + 4 + 2 + sizeof(struct ecryptfs_message) + 4
10646 -+ + ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES)) {
10647 -+ printk(KERN_WARNING "%s: Acceptable packet size range is "
10648 -+ "[%d-%lu], but amount of data written is [%zu].",
10649 -+ __func__, (1 + 4 + 1),
10650 -+ (1 + 4 + 2 + sizeof(struct ecryptfs_message) + 4
10651 -+ + ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES), count);
10652 -+ return -EINVAL;
10653 -+ }
10654 -+
10655 -+ if (copy_from_user(packet_size_peek, (buf + 1 + 4),
10656 -+ sizeof(packet_size_peek))) {
10657 -+ printk(KERN_WARNING "%s: Error while inspecting packet size\n",
10658 -+ __func__);
10659 -+ return -EFAULT;
10660 -+ }
10661 -+
10662 -+ rc = ecryptfs_parse_packet_length(packet_size_peek, &packet_size,
10663 -+ &packet_size_length);
10664 -+ if (rc) {
10665 -+ printk(KERN_WARNING "%s: Error parsing packet length; "
10666 -+ "rc = [%d]\n", __func__, rc);
10667 -+ return rc;
10668 -+ }
10669 -+
10670 -+ if ((1 + 4 + packet_size_length + packet_size) != count) {
10671 -+ printk(KERN_WARNING "%s: Invalid packet size [%zu]\n", __func__,
10672 -+ packet_size);
10673 -+ return -EINVAL;
10674 -+ }
10675 -
10676 -+memdup:
10677 - data = memdup_user(buf, count);
10678 - if (IS_ERR(data)) {
10679 - printk(KERN_ERR "%s: memdup_user returned error [%ld]\n",
10680 -@@ -435,23 +471,7 @@ ecryptfs_miscdev_write(struct file *file, const char __user *buf,
10681 - }
10682 - memcpy(&counter_nbo, &data[i], 4);
10683 - seq = be32_to_cpu(counter_nbo);
10684 -- i += 4;
10685 -- rc = ecryptfs_parse_packet_length(&data[i], &packet_size,
10686 -- &packet_size_length);
10687 -- if (rc) {
10688 -- printk(KERN_WARNING "%s: Error parsing packet length; "
10689 -- "rc = [%d]\n", __func__, rc);
10690 -- goto out_free;
10691 -- }
10692 -- i += packet_size_length;
10693 -- if ((1 + 4 + packet_size_length + packet_size) != count) {
10694 -- printk(KERN_WARNING "%s: (1 + packet_size_length([%zd])"
10695 -- " + packet_size([%zd]))([%zd]) != "
10696 -- "count([%zd]). Invalid packet format.\n",
10697 -- __func__, packet_size_length, packet_size,
10698 -- (1 + packet_size_length + packet_size), count);
10699 -- goto out_free;
10700 -- }
10701 -+ i += 4 + packet_size_length;
10702 - rc = ecryptfs_miscdev_response(&data[i], packet_size,
10703 - euid, current_user_ns(),
10704 - task_pid(current), seq);
10705 -diff --git a/fs/ecryptfs/read_write.c b/fs/ecryptfs/read_write.c
10706 -index 3745f7c..54eb14c 100644
10707 ---- a/fs/ecryptfs/read_write.c
10708 -+++ b/fs/ecryptfs/read_write.c
10709 -@@ -132,6 +132,11 @@ int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset,
10710 - size_t num_bytes = (PAGE_CACHE_SIZE - start_offset_in_page);
10711 - size_t total_remaining_bytes = ((offset + size) - pos);
10712 -
10713 -+ if (fatal_signal_pending(current)) {
10714 -+ rc = -EINTR;
10715 -+ break;
10716 -+ }
10717 -+
10718 - if (num_bytes > total_remaining_bytes)
10719 - num_bytes = total_remaining_bytes;
10720 - if (pos < offset) {
10721 -@@ -193,15 +198,19 @@ int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset,
10722 - }
10723 - pos += num_bytes;
10724 - }
10725 -- if ((offset + size) > ecryptfs_file_size) {
10726 -- i_size_write(ecryptfs_inode, (offset + size));
10727 -+ if (pos > ecryptfs_file_size) {
10728 -+ i_size_write(ecryptfs_inode, pos);
10729 - if (crypt_stat->flags & ECRYPTFS_ENCRYPTED) {
10730 -- rc = ecryptfs_write_inode_size_to_metadata(
10731 -+ int rc2;
10732 -+
10733 -+ rc2 = ecryptfs_write_inode_size_to_metadata(
10734 - ecryptfs_inode);
10735 -- if (rc) {
10736 -+ if (rc2) {
10737 - printk(KERN_ERR "Problem with "
10738 - "ecryptfs_write_inode_size_to_metadata; "
10739 -- "rc = [%d]\n", rc);
10740 -+ "rc = [%d]\n", rc2);
10741 -+ if (!rc)
10742 -+ rc = rc2;
10743 - goto out;
10744 - }
10745 - }
10746 -diff --git a/fs/jbd/checkpoint.c b/fs/jbd/checkpoint.c
10747 -index f94fc48..5c93ffc 100644
10748 ---- a/fs/jbd/checkpoint.c
10749 -+++ b/fs/jbd/checkpoint.c
10750 -@@ -453,8 +453,6 @@ out:
10751 - *
10752 - * Return <0 on error, 0 on success, 1 if there was nothing to clean up.
10753 - *
10754 -- * Called with the journal lock held.
10755 -- *
10756 - * This is the only part of the journaling code which really needs to be
10757 - * aware of transaction aborts. Checkpointing involves writing to the
10758 - * main filesystem area rather than to the journal, so it can proceed
10759 -@@ -472,13 +470,14 @@ int cleanup_journal_tail(journal_t *journal)
10760 - if (is_journal_aborted(journal))
10761 - return 1;
10762 -
10763 -- /* OK, work out the oldest transaction remaining in the log, and
10764 -+ /*
10765 -+ * OK, work out the oldest transaction remaining in the log, and
10766 - * the log block it starts at.
10767 - *
10768 - * If the log is now empty, we need to work out which is the
10769 - * next transaction ID we will write, and where it will
10770 -- * start. */
10771 --
10772 -+ * start.
10773 -+ */
10774 - spin_lock(&journal->j_state_lock);
10775 - spin_lock(&journal->j_list_lock);
10776 - transaction = journal->j_checkpoint_transactions;
10777 -@@ -504,7 +503,25 @@ int cleanup_journal_tail(journal_t *journal)
10778 - spin_unlock(&journal->j_state_lock);
10779 - return 1;
10780 - }
10781 -+ spin_unlock(&journal->j_state_lock);
10782 -+
10783 -+ /*
10784 -+ * We need to make sure that any blocks that were recently written out
10785 -+ * --- perhaps by log_do_checkpoint() --- are flushed out before we
10786 -+ * drop the transactions from the journal. It's unlikely this will be
10787 -+ * necessary, especially with an appropriately sized journal, but we
10788 -+ * need this to guarantee correctness. Fortunately
10789 -+ * cleanup_journal_tail() doesn't get called all that often.
10790 -+ */
10791 -+ if (journal->j_flags & JFS_BARRIER)
10792 -+ blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL);
10793 -
10794 -+ spin_lock(&journal->j_state_lock);
10795 -+ if (!tid_gt(first_tid, journal->j_tail_sequence)) {
10796 -+ spin_unlock(&journal->j_state_lock);
10797 -+ /* Someone else cleaned up journal so return 0 */
10798 -+ return 0;
10799 -+ }
10800 - /* OK, update the superblock to recover the freed space.
10801 - * Physical blocks come first: have we wrapped beyond the end of
10802 - * the log? */
10803 -diff --git a/fs/jbd/recovery.c b/fs/jbd/recovery.c
10804 -index 5b43e96..008bf06 100644
10805 ---- a/fs/jbd/recovery.c
10806 -+++ b/fs/jbd/recovery.c
10807 -@@ -20,6 +20,7 @@
10808 - #include <linux/fs.h>
10809 - #include <linux/jbd.h>
10810 - #include <linux/errno.h>
10811 -+#include <linux/blkdev.h>
10812 - #endif
10813 -
10814 - /*
10815 -@@ -263,6 +264,9 @@ int journal_recover(journal_t *journal)
10816 - err2 = sync_blockdev(journal->j_fs_dev);
10817 - if (!err)
10818 - err = err2;
10819 -+ /* Flush disk caches to get replayed data on the permanent storage */
10820 -+ if (journal->j_flags & JFS_BARRIER)
10821 -+ blkdev_issue_flush(journal->j_fs_dev, GFP_KERNEL, NULL);
10822 -
10823 - return err;
10824 - }
10825 -diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
10826 -index d4e6080b..779789a 100644
10827 ---- a/fs/sysfs/file.c
10828 -+++ b/fs/sysfs/file.c
10829 -@@ -493,6 +493,12 @@ int sysfs_attr_ns(struct kobject *kobj, const struct attribute *attr,
10830 - const void *ns = NULL;
10831 - int err;
10832 -
10833 -+ if (!dir_sd) {
10834 -+ WARN(1, KERN_ERR "sysfs: kobject %s without dirent\n",
10835 -+ kobject_name(kobj));
10836 -+ return -ENOENT;
10837 -+ }
10838 -+
10839 - err = 0;
10840 - if (!sysfs_ns_type(dir_sd))
10841 - goto out;
10842 -diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
10843 -index c81b22f..deb804b 100644
10844 ---- a/fs/sysfs/inode.c
10845 -+++ b/fs/sysfs/inode.c
10846 -@@ -318,8 +318,11 @@ int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const void *ns, const cha
10847 - struct sysfs_addrm_cxt acxt;
10848 - struct sysfs_dirent *sd;
10849 -
10850 -- if (!dir_sd)
10851 -+ if (!dir_sd) {
10852 -+ WARN(1, KERN_WARNING "sysfs: can not remove '%s', no directory\n",
10853 -+ name);
10854 - return -ENOENT;
10855 -+ }
10856 -
10857 - sysfs_addrm_start(&acxt, dir_sd);
10858 -
10859 -diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
10860 -index ce9268a..ee98d0b 100644
10861 ---- a/fs/xfs/xfs_vnodeops.c
10862 -+++ b/fs/xfs/xfs_vnodeops.c
10863 -@@ -131,7 +131,8 @@ xfs_readlink(
10864 - __func__, (unsigned long long) ip->i_ino,
10865 - (long long) pathlen);
10866 - ASSERT(0);
10867 -- return XFS_ERROR(EFSCORRUPTED);
10868 -+ error = XFS_ERROR(EFSCORRUPTED);
10869 -+ goto out;
10870 - }
10871 -
10872 -
10873 -diff --git a/include/drm/drmP.h b/include/drm/drmP.h
10874 -index 1f9e951..bf4b2dc 100644
10875 ---- a/include/drm/drmP.h
10876 -+++ b/include/drm/drmP.h
10877 -@@ -1328,6 +1328,7 @@ extern int drm_getmagic(struct drm_device *dev, void *data,
10878 - struct drm_file *file_priv);
10879 - extern int drm_authmagic(struct drm_device *dev, void *data,
10880 - struct drm_file *file_priv);
10881 -+extern int drm_remove_magic(struct drm_master *master, drm_magic_t magic);
10882 -
10883 - /* Cache management (drm_cache.c) */
10884 - void drm_clflush_pages(struct page *pages[], unsigned long num_pages);
10885 -diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h
10886 -index 3419bf5..d55f434 100644
10887 ---- a/include/net/netns/generic.h
10888 -+++ b/include/net/netns/generic.h
10889 -@@ -41,6 +41,7 @@ static inline void *net_generic(const struct net *net, int id)
10890 - ptr = ng->ptr[id - 1];
10891 - rcu_read_unlock();
10892 -
10893 -+ BUG_ON(!ptr);
10894 - return ptr;
10895 - }
10896 - #endif
10897 -diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c
10898 -index f1fa1f6..68223e4 100644
10899 ---- a/net/caif/caif_dev.c
10900 -+++ b/net/caif/caif_dev.c
10901 -@@ -53,7 +53,6 @@ struct cfcnfg *get_cfcnfg(struct net *net)
10902 - struct caif_net *caifn;
10903 - BUG_ON(!net);
10904 - caifn = net_generic(net, caif_net_id);
10905 -- BUG_ON(!caifn);
10906 - return caifn->cfg;
10907 - }
10908 - EXPORT_SYMBOL(get_cfcnfg);
10909 -@@ -63,7 +62,6 @@ static struct caif_device_entry_list *caif_device_list(struct net *net)
10910 - struct caif_net *caifn;
10911 - BUG_ON(!net);
10912 - caifn = net_generic(net, caif_net_id);
10913 -- BUG_ON(!caifn);
10914 - return &caifn->caifdevs;
10915 - }
10916 -
10917 -@@ -92,7 +90,6 @@ static struct caif_device_entry *caif_device_alloc(struct net_device *dev)
10918 - struct caif_device_entry *caifd;
10919 -
10920 - caifdevs = caif_device_list(dev_net(dev));
10921 -- BUG_ON(!caifdevs);
10922 -
10923 - caifd = kzalloc(sizeof(*caifd), GFP_KERNEL);
10924 - if (!caifd)
10925 -@@ -112,7 +109,7 @@ static struct caif_device_entry *caif_get(struct net_device *dev)
10926 - struct caif_device_entry_list *caifdevs =
10927 - caif_device_list(dev_net(dev));
10928 - struct caif_device_entry *caifd;
10929 -- BUG_ON(!caifdevs);
10930 -+
10931 - list_for_each_entry_rcu(caifd, &caifdevs->list, list) {
10932 - if (caifd->netdev == dev)
10933 - return caifd;
10934 -@@ -353,7 +350,7 @@ static struct notifier_block caif_device_notifier = {
10935 - static int caif_init_net(struct net *net)
10936 - {
10937 - struct caif_net *caifn = net_generic(net, caif_net_id);
10938 -- BUG_ON(!caifn);
10939 -+
10940 - INIT_LIST_HEAD(&caifn->caifdevs.list);
10941 - mutex_init(&caifn->caifdevs.lock);
10942 -
10943 -@@ -418,7 +415,7 @@ static int __init caif_device_init(void)
10944 - {
10945 - int result;
10946 -
10947 -- result = register_pernet_device(&caif_net_ops);
10948 -+ result = register_pernet_subsys(&caif_net_ops);
10949 -
10950 - if (result)
10951 - return result;
10952 -@@ -431,7 +428,7 @@ static int __init caif_device_init(void)
10953 -
10954 - static void __exit caif_device_exit(void)
10955 - {
10956 -- unregister_pernet_device(&caif_net_ops);
10957 -+ unregister_pernet_subsys(&caif_net_ops);
10958 - unregister_netdevice_notifier(&caif_device_notifier);
10959 - dev_remove_pack(&caif_packet_type);
10960 - }
10961 -diff --git a/net/caif/cfcnfg.c b/net/caif/cfcnfg.c
10962 -index 00523ec..86ff37c 100644
10963 ---- a/net/caif/cfcnfg.c
10964 -+++ b/net/caif/cfcnfg.c
10965 -@@ -309,7 +309,6 @@ int caif_connect_client(struct net *net, struct caif_connect_request *conn_req,
10966 - int err;
10967 - struct cfctrl_link_param param;
10968 - struct cfcnfg *cfg = get_cfcnfg(net);
10969 -- caif_assert(cfg != NULL);
10970 -
10971 - rcu_read_lock();
10972 - err = caif_connect_req_to_link_param(cfg, conn_req, &param);
10973 -diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
10974 -index 385aefe..0329404 100644
10975 ---- a/net/core/net-sysfs.c
10976 -+++ b/net/core/net-sysfs.c
10977 -@@ -990,9 +990,9 @@ static ssize_t store_xps_map(struct netdev_queue *queue,
10978 - nonempty = 1;
10979 - }
10980 -
10981 -- if (nonempty)
10982 -- RCU_INIT_POINTER(dev->xps_maps, new_dev_maps);
10983 -- else {
10984 -+ if (nonempty) {
10985 -+ rcu_assign_pointer(dev->xps_maps, new_dev_maps);
10986 -+ } else {
10987 - kfree(new_dev_maps);
10988 - RCU_INIT_POINTER(dev->xps_maps, NULL);
10989 - }
10990 -diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
10991 -index aefcd7a..0e950fd 100644
10992 ---- a/net/core/net_namespace.c
10993 -+++ b/net/core/net_namespace.c
10994 -@@ -30,6 +30,20 @@ EXPORT_SYMBOL(init_net);
10995 -
10996 - #define INITIAL_NET_GEN_PTRS 13 /* +1 for len +2 for rcu_head */
10997 -
10998 -+static unsigned int max_gen_ptrs = INITIAL_NET_GEN_PTRS;
10999 -+
11000 -+static struct net_generic *net_alloc_generic(void)
11001 -+{
11002 -+ struct net_generic *ng;
11003 -+ size_t generic_size = offsetof(struct net_generic, ptr[max_gen_ptrs]);
11004 -+
11005 -+ ng = kzalloc(generic_size, GFP_KERNEL);
11006 -+ if (ng)
11007 -+ ng->len = max_gen_ptrs;
11008 -+
11009 -+ return ng;
11010 -+}
11011 -+
11012 - static int net_assign_generic(struct net *net, int id, void *data)
11013 - {
11014 - struct net_generic *ng, *old_ng;
11015 -@@ -43,8 +57,7 @@ static int net_assign_generic(struct net *net, int id, void *data)
11016 - if (old_ng->len >= id)
11017 - goto assign;
11018 -
11019 -- ng = kzalloc(sizeof(struct net_generic) +
11020 -- id * sizeof(void *), GFP_KERNEL);
11021 -+ ng = net_alloc_generic();
11022 - if (ng == NULL)
11023 - return -ENOMEM;
11024 -
11025 -@@ -59,7 +72,6 @@ static int net_assign_generic(struct net *net, int id, void *data)
11026 - * the old copy for kfree after a grace period.
11027 - */
11028 -
11029 -- ng->len = id;
11030 - memcpy(&ng->ptr, &old_ng->ptr, old_ng->len * sizeof(void*));
11031 -
11032 - rcu_assign_pointer(net->gen, ng);
11033 -@@ -161,18 +173,6 @@ out_undo:
11034 - goto out;
11035 - }
11036 -
11037 --static struct net_generic *net_alloc_generic(void)
11038 --{
11039 -- struct net_generic *ng;
11040 -- size_t generic_size = sizeof(struct net_generic) +
11041 -- INITIAL_NET_GEN_PTRS * sizeof(void *);
11042 --
11043 -- ng = kzalloc(generic_size, GFP_KERNEL);
11044 -- if (ng)
11045 -- ng->len = INITIAL_NET_GEN_PTRS;
11046 --
11047 -- return ng;
11048 --}
11049 -
11050 - #ifdef CONFIG_NET_NS
11051 - static struct kmem_cache *net_cachep;
11052 -@@ -483,6 +483,7 @@ again:
11053 - }
11054 - return error;
11055 - }
11056 -+ max_gen_ptrs = max_t(unsigned int, max_gen_ptrs, *ops->id);
11057 - }
11058 - error = __register_pernet_operations(list, ops);
11059 - if (error) {
11060 -diff --git a/net/core/netpoll.c b/net/core/netpoll.c
11061 -index cf64c1f..5d4d896 100644
11062 ---- a/net/core/netpoll.c
11063 -+++ b/net/core/netpoll.c
11064 -@@ -763,7 +763,7 @@ int __netpoll_setup(struct netpoll *np)
11065 - }
11066 -
11067 - /* last thing to do is link it to the net device structure */
11068 -- RCU_INIT_POINTER(ndev->npinfo, npinfo);
11069 -+ rcu_assign_pointer(ndev->npinfo, npinfo);
11070 -
11071 - return 0;
11072 -
11073 -diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
11074 -index 2ab16e1..74d321a 100644
11075 ---- a/net/decnet/dn_dev.c
11076 -+++ b/net/decnet/dn_dev.c
11077 -@@ -388,7 +388,7 @@ static int dn_dev_insert_ifa(struct dn_dev *dn_db, struct dn_ifaddr *ifa)
11078 - }
11079 -
11080 - ifa->ifa_next = dn_db->ifa_list;
11081 -- RCU_INIT_POINTER(dn_db->ifa_list, ifa);
11082 -+ rcu_assign_pointer(dn_db->ifa_list, ifa);
11083 -
11084 - dn_ifaddr_notify(RTM_NEWADDR, ifa);
11085 - blocking_notifier_call_chain(&dnaddr_chain, NETDEV_UP, ifa);
11086 -@@ -1093,7 +1093,7 @@ static struct dn_dev *dn_dev_create(struct net_device *dev, int *err)
11087 -
11088 - memcpy(&dn_db->parms, p, sizeof(struct dn_dev_parms));
11089 -
11090 -- RCU_INIT_POINTER(dev->dn_ptr, dn_db);
11091 -+ rcu_assign_pointer(dev->dn_ptr, dn_db);
11092 - dn_db->dev = dev;
11093 - init_timer(&dn_db->timer);
11094 -
11095 -diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
11096 -index 65f01dc..e41c40f 100644
11097 ---- a/net/ipv4/devinet.c
11098 -+++ b/net/ipv4/devinet.c
11099 -@@ -258,7 +258,7 @@ static struct in_device *inetdev_init(struct net_device *dev)
11100 - ip_mc_up(in_dev);
11101 -
11102 - /* we can receive as soon as ip_ptr is set -- do this last */
11103 -- RCU_INIT_POINTER(dev->ip_ptr, in_dev);
11104 -+ rcu_assign_pointer(dev->ip_ptr, in_dev);
11105 - out:
11106 - return in_dev;
11107 - out_kfree:
11108 -diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
11109 -index 37b6711..3ce23f9 100644
11110 ---- a/net/ipv4/fib_trie.c
11111 -+++ b/net/ipv4/fib_trie.c
11112 -@@ -205,7 +205,7 @@ static inline struct tnode *node_parent_rcu(const struct rt_trie_node *node)
11113 - return (struct tnode *)(parent & ~NODE_TYPE_MASK);
11114 - }
11115 -
11116 --/* Same as RCU_INIT_POINTER
11117 -+/* Same as rcu_assign_pointer
11118 - * but that macro() assumes that value is a pointer.
11119 - */
11120 - static inline void node_set_parent(struct rt_trie_node *node, struct tnode *ptr)
11121 -@@ -529,7 +529,7 @@ static void tnode_put_child_reorg(struct tnode *tn, int i, struct rt_trie_node *
11122 - if (n)
11123 - node_set_parent(n, tn);
11124 -
11125 -- RCU_INIT_POINTER(tn->child[i], n);
11126 -+ rcu_assign_pointer(tn->child[i], n);
11127 - }
11128 -
11129 - #define MAX_WORK 10
11130 -@@ -1015,7 +1015,7 @@ static void trie_rebalance(struct trie *t, struct tnode *tn)
11131 -
11132 - tp = node_parent((struct rt_trie_node *) tn);
11133 - if (!tp)
11134 -- RCU_INIT_POINTER(t->trie, (struct rt_trie_node *)tn);
11135 -+ rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn);
11136 -
11137 - tnode_free_flush();
11138 - if (!tp)
11139 -@@ -1027,7 +1027,7 @@ static void trie_rebalance(struct trie *t, struct tnode *tn)
11140 - if (IS_TNODE(tn))
11141 - tn = (struct tnode *)resize(t, (struct tnode *)tn);
11142 -
11143 -- RCU_INIT_POINTER(t->trie, (struct rt_trie_node *)tn);
11144 -+ rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn);
11145 - tnode_free_flush();
11146 - }
11147 -
11148 -@@ -1164,7 +1164,7 @@ static struct list_head *fib_insert_node(struct trie *t, u32 key, int plen)
11149 - put_child(t, (struct tnode *)tp, cindex,
11150 - (struct rt_trie_node *)tn);
11151 - } else {
11152 -- RCU_INIT_POINTER(t->trie, (struct rt_trie_node *)tn);
11153 -+ rcu_assign_pointer(t->trie, (struct rt_trie_node *)tn);
11154 - tp = tn;
11155 - }
11156 - }
11157 -diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c
11158 -index c3cc64c..c8989a7 100644
11159 ---- a/net/ipv4/igmp.c
11160 -+++ b/net/ipv4/igmp.c
11161 -@@ -1244,7 +1244,7 @@ void ip_mc_inc_group(struct in_device *in_dev, __be32 addr)
11162 -
11163 - im->next_rcu = in_dev->mc_list;
11164 - in_dev->mc_count++;
11165 -- RCU_INIT_POINTER(in_dev->mc_list, im);
11166 -+ rcu_assign_pointer(in_dev->mc_list, im);
11167 -
11168 - #ifdef CONFIG_IP_MULTICAST
11169 - igmpv3_del_delrec(in_dev, im->multiaddr);
11170 -@@ -1816,7 +1816,7 @@ int ip_mc_join_group(struct sock *sk , struct ip_mreqn *imr)
11171 - iml->next_rcu = inet->mc_list;
11172 - iml->sflist = NULL;
11173 - iml->sfmode = MCAST_EXCLUDE;
11174 -- RCU_INIT_POINTER(inet->mc_list, iml);
11175 -+ rcu_assign_pointer(inet->mc_list, iml);
11176 - ip_mc_inc_group(in_dev, addr);
11177 - err = 0;
11178 - done:
11179 -@@ -2003,7 +2003,7 @@ int ip_mc_source(int add, int omode, struct sock *sk, struct
11180 - atomic_sub(IP_SFLSIZE(psl->sl_max), &sk->sk_omem_alloc);
11181 - kfree_rcu(psl, rcu);
11182 - }
11183 -- RCU_INIT_POINTER(pmc->sflist, newpsl);
11184 -+ rcu_assign_pointer(pmc->sflist, newpsl);
11185 - psl = newpsl;
11186 - }
11187 - rv = 1; /* > 0 for insert logic below if sl_count is 0 */
11188 -@@ -2106,7 +2106,7 @@ int ip_mc_msfilter(struct sock *sk, struct ip_msfilter *msf, int ifindex)
11189 - } else
11190 - (void) ip_mc_del_src(in_dev, &msf->imsf_multiaddr, pmc->sfmode,
11191 - 0, NULL, 0);
11192 -- RCU_INIT_POINTER(pmc->sflist, newpsl);
11193 -+ rcu_assign_pointer(pmc->sflist, newpsl);
11194 - pmc->sfmode = msf->imsf_fmode;
11195 - err = 0;
11196 - done:
11197 -diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
11198 -index 0b2e732..17ad951 100644
11199 ---- a/net/ipv4/ipip.c
11200 -+++ b/net/ipv4/ipip.c
11201 -@@ -231,7 +231,7 @@ static void ipip_tunnel_unlink(struct ipip_net *ipn, struct ip_tunnel *t)
11202 - (iter = rtnl_dereference(*tp)) != NULL;
11203 - tp = &iter->next) {
11204 - if (t == iter) {
11205 -- RCU_INIT_POINTER(*tp, t->next);
11206 -+ rcu_assign_pointer(*tp, t->next);
11207 - break;
11208 - }
11209 - }
11210 -@@ -241,8 +241,8 @@ static void ipip_tunnel_link(struct ipip_net *ipn, struct ip_tunnel *t)
11211 - {
11212 - struct ip_tunnel __rcu **tp = ipip_bucket(ipn, t);
11213 -
11214 -- RCU_INIT_POINTER(t->next, rtnl_dereference(*tp));
11215 -- RCU_INIT_POINTER(*tp, t);
11216 -+ rcu_assign_pointer(t->next, rtnl_dereference(*tp));
11217 -+ rcu_assign_pointer(*tp, t);
11218 - }
11219 -
11220 - static struct ip_tunnel * ipip_tunnel_locate(struct net *net,
11221 -@@ -792,7 +792,7 @@ static int __net_init ipip_fb_tunnel_init(struct net_device *dev)
11222 - return -ENOMEM;
11223 -
11224 - dev_hold(dev);
11225 -- RCU_INIT_POINTER(ipn->tunnels_wc[0], tunnel);
11226 -+ rcu_assign_pointer(ipn->tunnels_wc[0], tunnel);
11227 - return 0;
11228 - }
11229 -
11230 -diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
11231 -index 76a7f07..d2aae27 100644
11232 ---- a/net/ipv4/ipmr.c
11233 -+++ b/net/ipv4/ipmr.c
11234 -@@ -1225,7 +1225,7 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, unsi
11235 -
11236 - ret = ip_ra_control(sk, 1, mrtsock_destruct);
11237 - if (ret == 0) {
11238 -- RCU_INIT_POINTER(mrt->mroute_sk, sk);
11239 -+ rcu_assign_pointer(mrt->mroute_sk, sk);
11240 - IPV4_DEVCONF_ALL(net, MC_FORWARDING)++;
11241 - }
11242 - rtnl_unlock();
11243 -diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
11244 -index a9db4b1..c89e354 100644
11245 ---- a/net/ipv4/tcp_ipv4.c
11246 -+++ b/net/ipv4/tcp_ipv4.c
11247 -@@ -630,7 +630,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
11248 - arg.iov[0].iov_len = sizeof(rep.th);
11249 -
11250 - #ifdef CONFIG_TCP_MD5SIG
11251 -- key = sk ? tcp_v4_md5_do_lookup(sk, ip_hdr(skb)->daddr) : NULL;
11252 -+ key = sk ? tcp_v4_md5_do_lookup(sk, ip_hdr(skb)->saddr) : NULL;
11253 - if (key) {
11254 - rep.opt[0] = htonl((TCPOPT_NOP << 24) |
11255 - (TCPOPT_NOP << 16) |
11256 -diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
11257 -index 63170e2..097e0c7 100644
11258 ---- a/net/ipv4/tcp_output.c
11259 -+++ b/net/ipv4/tcp_output.c
11260 -@@ -1138,11 +1138,9 @@ int tcp_trim_head(struct sock *sk, struct sk_buff *skb, u32 len)
11261 - sk_mem_uncharge(sk, len);
11262 - sock_set_flag(sk, SOCK_QUEUE_SHRUNK);
11263 -
11264 -- /* Any change of skb->len requires recalculation of tso
11265 -- * factor and mss.
11266 -- */
11267 -+ /* Any change of skb->len requires recalculation of tso factor. */
11268 - if (tcp_skb_pcount(skb) > 1)
11269 -- tcp_set_skb_tso_segs(sk, skb, tcp_current_mss(sk));
11270 -+ tcp_set_skb_tso_segs(sk, skb, tcp_skb_mss(skb));
11271 -
11272 - return 0;
11273 - }
11274 -diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
11275 -index 36806de..836c4ea 100644
11276 ---- a/net/ipv6/addrconf.c
11277 -+++ b/net/ipv6/addrconf.c
11278 -@@ -429,7 +429,7 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev)
11279 - ndev->tstamp = jiffies;
11280 - addrconf_sysctl_register(ndev);
11281 - /* protected by rtnl_lock */
11282 -- RCU_INIT_POINTER(dev->ip6_ptr, ndev);
11283 -+ rcu_assign_pointer(dev->ip6_ptr, ndev);
11284 -
11285 - /* Join all-node multicast group */
11286 - ipv6_dev_mc_inc(dev, &in6addr_linklocal_allnodes);
11287 -diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
11288 -index 4e2e9ff..d19f499 100644
11289 ---- a/net/ipv6/ip6_tunnel.c
11290 -+++ b/net/ipv6/ip6_tunnel.c
11291 -@@ -218,8 +218,8 @@ ip6_tnl_link(struct ip6_tnl_net *ip6n, struct ip6_tnl *t)
11292 - {
11293 - struct ip6_tnl __rcu **tp = ip6_tnl_bucket(ip6n, &t->parms);
11294 -
11295 -- RCU_INIT_POINTER(t->next , rtnl_dereference(*tp));
11296 -- RCU_INIT_POINTER(*tp, t);
11297 -+ rcu_assign_pointer(t->next , rtnl_dereference(*tp));
11298 -+ rcu_assign_pointer(*tp, t);
11299 - }
11300 -
11301 - /**
11302 -@@ -237,7 +237,7 @@ ip6_tnl_unlink(struct ip6_tnl_net *ip6n, struct ip6_tnl *t)
11303 - (iter = rtnl_dereference(*tp)) != NULL;
11304 - tp = &iter->next) {
11305 - if (t == iter) {
11306 -- RCU_INIT_POINTER(*tp, t->next);
11307 -+ rcu_assign_pointer(*tp, t->next);
11308 - break;
11309 - }
11310 - }
11311 -@@ -1450,7 +1450,7 @@ static int __net_init ip6_fb_tnl_dev_init(struct net_device *dev)
11312 -
11313 - t->parms.proto = IPPROTO_IPV6;
11314 - dev_hold(dev);
11315 -- RCU_INIT_POINTER(ip6n->tnls_wc[0], t);
11316 -+ rcu_assign_pointer(ip6n->tnls_wc[0], t);
11317 - return 0;
11318 - }
11319 -
11320 -diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
11321 -index 331af3b..361ebf3 100644
11322 ---- a/net/ipv6/raw.c
11323 -+++ b/net/ipv6/raw.c
11324 -@@ -131,7 +131,7 @@ static mh_filter_t __rcu *mh_filter __read_mostly;
11325 -
11326 - int rawv6_mh_filter_register(mh_filter_t filter)
11327 - {
11328 -- RCU_INIT_POINTER(mh_filter, filter);
11329 -+ rcu_assign_pointer(mh_filter, filter);
11330 - return 0;
11331 - }
11332 - EXPORT_SYMBOL(rawv6_mh_filter_register);
11333 -diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
11334 -index 96f3623..72a939d 100644
11335 ---- a/net/ipv6/sit.c
11336 -+++ b/net/ipv6/sit.c
11337 -@@ -182,7 +182,7 @@ static void ipip6_tunnel_unlink(struct sit_net *sitn, struct ip_tunnel *t)
11338 - (iter = rtnl_dereference(*tp)) != NULL;
11339 - tp = &iter->next) {
11340 - if (t == iter) {
11341 -- RCU_INIT_POINTER(*tp, t->next);
11342 -+ rcu_assign_pointer(*tp, t->next);
11343 - break;
11344 - }
11345 - }
11346 -@@ -192,8 +192,8 @@ static void ipip6_tunnel_link(struct sit_net *sitn, struct ip_tunnel *t)
11347 - {
11348 - struct ip_tunnel __rcu **tp = ipip6_bucket(sitn, t);
11349 -
11350 -- RCU_INIT_POINTER(t->next, rtnl_dereference(*tp));
11351 -- RCU_INIT_POINTER(*tp, t);
11352 -+ rcu_assign_pointer(t->next, rtnl_dereference(*tp));
11353 -+ rcu_assign_pointer(*tp, t);
11354 - }
11355 -
11356 - static void ipip6_tunnel_clone_6rd(struct net_device *dev, struct sit_net *sitn)
11357 -@@ -393,7 +393,7 @@ ipip6_tunnel_add_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a, int chg)
11358 - p->addr = a->addr;
11359 - p->flags = a->flags;
11360 - t->prl_count++;
11361 -- RCU_INIT_POINTER(t->prl, p);
11362 -+ rcu_assign_pointer(t->prl, p);
11363 - out:
11364 - return err;
11365 - }
11366 -@@ -1177,7 +1177,7 @@ static int __net_init ipip6_fb_tunnel_init(struct net_device *dev)
11367 - if (!dev->tstats)
11368 - return -ENOMEM;
11369 - dev_hold(dev);
11370 -- RCU_INIT_POINTER(sitn->tunnels_wc[0], tunnel);
11371 -+ rcu_assign_pointer(sitn->tunnels_wc[0], tunnel);
11372 - return 0;
11373 - }
11374 -
11375 -diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
11376 -index 2dea4bb..b859e4a 100644
11377 ---- a/net/ipv6/tcp_ipv6.c
11378 -+++ b/net/ipv6/tcp_ipv6.c
11379 -@@ -1084,7 +1084,7 @@ static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb)
11380 -
11381 - #ifdef CONFIG_TCP_MD5SIG
11382 - if (sk)
11383 -- key = tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->daddr);
11384 -+ key = tcp_v6_md5_do_lookup(sk, &ipv6_hdr(skb)->saddr);
11385 - #endif
11386 -
11387 - if (th->ack)
11388 -diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
11389 -index d21e7eb..55670ec 100644
11390 ---- a/net/l2tp/l2tp_ip.c
11391 -+++ b/net/l2tp/l2tp_ip.c
11392 -@@ -393,11 +393,6 @@ static int l2tp_ip_backlog_recv(struct sock *sk, struct sk_buff *skb)
11393 - {
11394 - int rc;
11395 -
11396 -- if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))
11397 -- goto drop;
11398 --
11399 -- nf_reset(skb);
11400 --
11401 - /* Charge it to the socket, dropping if the queue is full. */
11402 - rc = sock_queue_rcv_skb(sk, skb);
11403 - if (rc < 0)
11404 -diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
11405 -index 93b2434..41c2310 100644
11406 ---- a/net/mac80211/agg-rx.c
11407 -+++ b/net/mac80211/agg-rx.c
11408 -@@ -326,7 +326,7 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
11409 - status = WLAN_STATUS_SUCCESS;
11410 -
11411 - /* activate it for RX */
11412 -- RCU_INIT_POINTER(sta->ampdu_mlme.tid_rx[tid], tid_agg_rx);
11413 -+ rcu_assign_pointer(sta->ampdu_mlme.tid_rx[tid], tid_agg_rx);
11414 -
11415 - if (timeout)
11416 - mod_timer(&tid_agg_rx->session_timer, TU_TO_EXP_TIME(timeout));
11417 -diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
11418 -index d06c65f..11cee76 100644
11419 ---- a/net/mac80211/cfg.c
11420 -+++ b/net/mac80211/cfg.c
11421 -@@ -575,7 +575,7 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
11422 -
11423 - sdata->vif.bss_conf.dtim_period = new->dtim_period;
11424 -
11425 -- RCU_INIT_POINTER(sdata->u.ap.beacon, new);
11426 -+ rcu_assign_pointer(sdata->u.ap.beacon, new);
11427 -
11428 - synchronize_rcu();
11429 -
11430 -@@ -922,7 +922,7 @@ static int ieee80211_change_station(struct wiphy *wiphy,
11431 - return -EBUSY;
11432 - }
11433 -
11434 -- RCU_INIT_POINTER(vlansdata->u.vlan.sta, sta);
11435 -+ rcu_assign_pointer(vlansdata->u.vlan.sta, sta);
11436 - }
11437 -
11438 - sta->sdata = vlansdata;
11439 -diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
11440 -index ede9a8b..3ece106 100644
11441 ---- a/net/mac80211/ibss.c
11442 -+++ b/net/mac80211/ibss.c
11443 -@@ -184,7 +184,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
11444 - *pos++ = 0; /* U-APSD no in use */
11445 - }
11446 -
11447 -- RCU_INIT_POINTER(ifibss->presp, skb);
11448 -+ rcu_assign_pointer(ifibss->presp, skb);
11449 -
11450 - sdata->vif.bss_conf.beacon_int = beacon_int;
11451 - sdata->vif.bss_conf.basic_rates = basic_rates;
11452 -diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
11453 -index b1b1bb3..9da8626 100644
11454 ---- a/net/mac80211/mlme.c
11455 -+++ b/net/mac80211/mlme.c
11456 -@@ -2719,7 +2719,6 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
11457 - {
11458 - struct ieee80211_local *local = sdata->local;
11459 - struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
11460 -- struct ieee80211_work *wk;
11461 - u8 bssid[ETH_ALEN];
11462 - bool assoc_bss = false;
11463 -
11464 -@@ -2732,30 +2731,47 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
11465 - assoc_bss = true;
11466 - } else {
11467 - bool not_auth_yet = false;
11468 -+ struct ieee80211_work *tmp, *wk = NULL;
11469 -
11470 - mutex_unlock(&ifmgd->mtx);
11471 -
11472 - mutex_lock(&local->mtx);
11473 -- list_for_each_entry(wk, &local->work_list, list) {
11474 -- if (wk->sdata != sdata)
11475 -+ list_for_each_entry(tmp, &local->work_list, list) {
11476 -+ if (tmp->sdata != sdata)
11477 - continue;
11478 -
11479 -- if (wk->type != IEEE80211_WORK_DIRECT_PROBE &&
11480 -- wk->type != IEEE80211_WORK_AUTH &&
11481 -- wk->type != IEEE80211_WORK_ASSOC &&
11482 -- wk->type != IEEE80211_WORK_ASSOC_BEACON_WAIT)
11483 -+ if (tmp->type != IEEE80211_WORK_DIRECT_PROBE &&
11484 -+ tmp->type != IEEE80211_WORK_AUTH &&
11485 -+ tmp->type != IEEE80211_WORK_ASSOC &&
11486 -+ tmp->type != IEEE80211_WORK_ASSOC_BEACON_WAIT)
11487 - continue;
11488 -
11489 -- if (memcmp(req->bss->bssid, wk->filter_ta, ETH_ALEN))
11490 -+ if (memcmp(req->bss->bssid, tmp->filter_ta, ETH_ALEN))
11491 - continue;
11492 -
11493 -- not_auth_yet = wk->type == IEEE80211_WORK_DIRECT_PROBE;
11494 -- list_del_rcu(&wk->list);
11495 -- free_work(wk);
11496 -+ not_auth_yet = tmp->type == IEEE80211_WORK_DIRECT_PROBE;
11497 -+ list_del_rcu(&tmp->list);
11498 -+ synchronize_rcu();
11499 -+ wk = tmp;
11500 - break;
11501 - }
11502 - mutex_unlock(&local->mtx);
11503 -
11504 -+ if (wk && wk->type == IEEE80211_WORK_ASSOC) {
11505 -+ /* clean up dummy sta & TX sync */
11506 -+ sta_info_destroy_addr(wk->sdata, wk->filter_ta);
11507 -+ if (wk->assoc.synced)
11508 -+ drv_finish_tx_sync(local, wk->sdata,
11509 -+ wk->filter_ta,
11510 -+ IEEE80211_TX_SYNC_ASSOC);
11511 -+ } else if (wk && wk->type == IEEE80211_WORK_AUTH) {
11512 -+ if (wk->probe_auth.synced)
11513 -+ drv_finish_tx_sync(local, wk->sdata,
11514 -+ wk->filter_ta,
11515 -+ IEEE80211_TX_SYNC_AUTH);
11516 -+ }
11517 -+ kfree(wk);
11518 -+
11519 - /*
11520 - * If somebody requests authentication and we haven't
11521 - * sent out an auth frame yet there's no need to send
11522 -diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
11523 -index 8eaa746..1fdd8ff 100644
11524 ---- a/net/mac80211/sta_info.c
11525 -+++ b/net/mac80211/sta_info.c
11526 -@@ -73,7 +73,7 @@ static int sta_info_hash_del(struct ieee80211_local *local,
11527 - if (!s)
11528 - return -ENOENT;
11529 - if (s == sta) {
11530 -- RCU_INIT_POINTER(local->sta_hash[STA_HASH(sta->sta.addr)],
11531 -+ rcu_assign_pointer(local->sta_hash[STA_HASH(sta->sta.addr)],
11532 - s->hnext);
11533 - return 0;
11534 - }
11535 -@@ -83,7 +83,7 @@ static int sta_info_hash_del(struct ieee80211_local *local,
11536 - s = rcu_dereference_protected(s->hnext,
11537 - lockdep_is_held(&local->sta_lock));
11538 - if (rcu_access_pointer(s->hnext)) {
11539 -- RCU_INIT_POINTER(s->hnext, sta->hnext);
11540 -+ rcu_assign_pointer(s->hnext, sta->hnext);
11541 - return 0;
11542 - }
11543 -
11544 -@@ -232,7 +232,7 @@ static void sta_info_hash_add(struct ieee80211_local *local,
11545 - struct sta_info *sta)
11546 - {
11547 - sta->hnext = local->sta_hash[STA_HASH(sta->sta.addr)];
11548 -- RCU_INIT_POINTER(local->sta_hash[STA_HASH(sta->sta.addr)], sta);
11549 -+ rcu_assign_pointer(local->sta_hash[STA_HASH(sta->sta.addr)], sta);
11550 - }
11551 -
11552 - static void sta_unblock(struct work_struct *wk)
11553 -diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
11554 -index 7202b06..1d15193 100644
11555 ---- a/net/netfilter/nf_conntrack_core.c
11556 -+++ b/net/netfilter/nf_conntrack_core.c
11557 -@@ -776,7 +776,7 @@ init_conntrack(struct net *net, struct nf_conn *tmpl,
11558 - if (exp->helper) {
11559 - help = nf_ct_helper_ext_add(ct, GFP_ATOMIC);
11560 - if (help)
11561 -- RCU_INIT_POINTER(help->helper, exp->helper);
11562 -+ rcu_assign_pointer(help->helper, exp->helper);
11563 - }
11564 -
11565 - #ifdef CONFIG_NF_CONNTRACK_MARK
11566 -diff --git a/net/netfilter/nf_conntrack_ecache.c b/net/netfilter/nf_conntrack_ecache.c
11567 -index b62c414..14af632 100644
11568 ---- a/net/netfilter/nf_conntrack_ecache.c
11569 -+++ b/net/netfilter/nf_conntrack_ecache.c
11570 -@@ -91,7 +91,7 @@ int nf_conntrack_register_notifier(struct net *net,
11571 - ret = -EBUSY;
11572 - goto out_unlock;
11573 - }
11574 -- RCU_INIT_POINTER(net->ct.nf_conntrack_event_cb, new);
11575 -+ rcu_assign_pointer(net->ct.nf_conntrack_event_cb, new);
11576 - mutex_unlock(&nf_ct_ecache_mutex);
11577 - return ret;
11578 -
11579 -@@ -128,7 +128,7 @@ int nf_ct_expect_register_notifier(struct net *net,
11580 - ret = -EBUSY;
11581 - goto out_unlock;
11582 - }
11583 -- RCU_INIT_POINTER(net->ct.nf_expect_event_cb, new);
11584 -+ rcu_assign_pointer(net->ct.nf_expect_event_cb, new);
11585 - mutex_unlock(&nf_ct_ecache_mutex);
11586 - return ret;
11587 -
11588 -diff --git a/net/netfilter/nf_conntrack_extend.c b/net/netfilter/nf_conntrack_extend.c
11589 -index 4605c94..641ff5f 100644
11590 ---- a/net/netfilter/nf_conntrack_extend.c
11591 -+++ b/net/netfilter/nf_conntrack_extend.c
11592 -@@ -169,7 +169,7 @@ int nf_ct_extend_register(struct nf_ct_ext_type *type)
11593 - before updating alloc_size */
11594 - type->alloc_size = ALIGN(sizeof(struct nf_ct_ext), type->align)
11595 - + type->len;
11596 -- RCU_INIT_POINTER(nf_ct_ext_types[type->id], type);
11597 -+ rcu_assign_pointer(nf_ct_ext_types[type->id], type);
11598 - update_alloc_size(type);
11599 - out:
11600 - mutex_unlock(&nf_ct_ext_type_mutex);
11601 -diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
11602 -index 93c4bdb..bbe23ba 100644
11603 ---- a/net/netfilter/nf_conntrack_helper.c
11604 -+++ b/net/netfilter/nf_conntrack_helper.c
11605 -@@ -145,7 +145,7 @@ int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
11606 - memset(&help->help, 0, sizeof(help->help));
11607 - }
11608 -
11609 -- RCU_INIT_POINTER(help->helper, helper);
11610 -+ rcu_assign_pointer(help->helper, helper);
11611 - out:
11612 - return ret;
11613 - }
11614 -diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
11615 -index 257e772..782cdcd 100644
11616 ---- a/net/netfilter/nf_conntrack_netlink.c
11617 -+++ b/net/netfilter/nf_conntrack_netlink.c
11618 -@@ -1163,7 +1163,7 @@ ctnetlink_change_helper(struct nf_conn *ct, const struct nlattr * const cda[])
11619 - return -EOPNOTSUPP;
11620 - }
11621 -
11622 -- RCU_INIT_POINTER(help->helper, helper);
11623 -+ rcu_assign_pointer(help->helper, helper);
11624 -
11625 - return 0;
11626 - }
11627 -diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
11628 -index ce0c406..957374a 100644
11629 ---- a/net/netfilter/nf_log.c
11630 -+++ b/net/netfilter/nf_log.c
11631 -@@ -55,7 +55,7 @@ int nf_log_register(u_int8_t pf, struct nf_logger *logger)
11632 - llog = rcu_dereference_protected(nf_loggers[pf],
11633 - lockdep_is_held(&nf_log_mutex));
11634 - if (llog == NULL)
11635 -- RCU_INIT_POINTER(nf_loggers[pf], logger);
11636 -+ rcu_assign_pointer(nf_loggers[pf], logger);
11637 - }
11638 -
11639 - mutex_unlock(&nf_log_mutex);
11640 -@@ -92,7 +92,7 @@ int nf_log_bind_pf(u_int8_t pf, const struct nf_logger *logger)
11641 - mutex_unlock(&nf_log_mutex);
11642 - return -ENOENT;
11643 - }
11644 -- RCU_INIT_POINTER(nf_loggers[pf], logger);
11645 -+ rcu_assign_pointer(nf_loggers[pf], logger);
11646 - mutex_unlock(&nf_log_mutex);
11647 - return 0;
11648 - }
11649 -@@ -250,7 +250,7 @@ static int nf_log_proc_dostring(ctl_table *table, int write,
11650 - mutex_unlock(&nf_log_mutex);
11651 - return -ENOENT;
11652 - }
11653 -- RCU_INIT_POINTER(nf_loggers[tindex], logger);
11654 -+ rcu_assign_pointer(nf_loggers[tindex], logger);
11655 - mutex_unlock(&nf_log_mutex);
11656 - } else {
11657 - mutex_lock(&nf_log_mutex);
11658 -diff --git a/net/netfilter/nf_queue.c b/net/netfilter/nf_queue.c
11659 -index 99ffd28..b3a7db6 100644
11660 ---- a/net/netfilter/nf_queue.c
11661 -+++ b/net/netfilter/nf_queue.c
11662 -@@ -40,7 +40,7 @@ int nf_register_queue_handler(u_int8_t pf, const struct nf_queue_handler *qh)
11663 - else if (old)
11664 - ret = -EBUSY;
11665 - else {
11666 -- RCU_INIT_POINTER(queue_handler[pf], qh);
11667 -+ rcu_assign_pointer(queue_handler[pf], qh);
11668 - ret = 0;
11669 - }
11670 - mutex_unlock(&queue_handler_mutex);
11671 -diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
11672 -index c879c1a..b4f8d84 100644
11673 ---- a/net/netfilter/nfnetlink.c
11674 -+++ b/net/netfilter/nfnetlink.c
11675 -@@ -59,7 +59,7 @@ int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n)
11676 - nfnl_unlock();
11677 - return -EBUSY;
11678 - }
11679 -- RCU_INIT_POINTER(subsys_table[n->subsys_id], n);
11680 -+ rcu_assign_pointer(subsys_table[n->subsys_id], n);
11681 - nfnl_unlock();
11682 -
11683 - return 0;
11684 -@@ -210,7 +210,7 @@ static int __net_init nfnetlink_net_init(struct net *net)
11685 - if (!nfnl)
11686 - return -ENOMEM;
11687 - net->nfnl_stash = nfnl;
11688 -- RCU_INIT_POINTER(net->nfnl, nfnl);
11689 -+ rcu_assign_pointer(net->nfnl, nfnl);
11690 - return 0;
11691 - }
11692 -
11693 -diff --git a/net/netlabel/netlabel_domainhash.c b/net/netlabel/netlabel_domainhash.c
11694 -index 3f905e5..e5330ed 100644
11695 ---- a/net/netlabel/netlabel_domainhash.c
11696 -+++ b/net/netlabel/netlabel_domainhash.c
11697 -@@ -282,7 +282,7 @@ int __init netlbl_domhsh_init(u32 size)
11698 - INIT_LIST_HEAD(&hsh_tbl->tbl[iter]);
11699 -
11700 - spin_lock(&netlbl_domhsh_lock);
11701 -- RCU_INIT_POINTER(netlbl_domhsh, hsh_tbl);
11702 -+ rcu_assign_pointer(netlbl_domhsh, hsh_tbl);
11703 - spin_unlock(&netlbl_domhsh_lock);
11704 -
11705 - return 0;
11706 -@@ -330,7 +330,7 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry,
11707 - &rcu_dereference(netlbl_domhsh)->tbl[bkt]);
11708 - } else {
11709 - INIT_LIST_HEAD(&entry->list);
11710 -- RCU_INIT_POINTER(netlbl_domhsh_def, entry);
11711 -+ rcu_assign_pointer(netlbl_domhsh_def, entry);
11712 - }
11713 -
11714 - if (entry->type == NETLBL_NLTYPE_ADDRSELECT) {
11715 -diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c
11716 -index e251c2c..d463f5a 100644
11717 ---- a/net/netlabel/netlabel_unlabeled.c
11718 -+++ b/net/netlabel/netlabel_unlabeled.c
11719 -@@ -354,7 +354,7 @@ static struct netlbl_unlhsh_iface *netlbl_unlhsh_add_iface(int ifindex)
11720 - INIT_LIST_HEAD(&iface->list);
11721 - if (netlbl_unlhsh_rcu_deref(netlbl_unlhsh_def) != NULL)
11722 - goto add_iface_failure;
11723 -- RCU_INIT_POINTER(netlbl_unlhsh_def, iface);
11724 -+ rcu_assign_pointer(netlbl_unlhsh_def, iface);
11725 - }
11726 - spin_unlock(&netlbl_unlhsh_lock);
11727 -
11728 -@@ -1447,11 +1447,9 @@ int __init netlbl_unlabel_init(u32 size)
11729 - for (iter = 0; iter < hsh_tbl->size; iter++)
11730 - INIT_LIST_HEAD(&hsh_tbl->tbl[iter]);
11731 -
11732 -- rcu_read_lock();
11733 - spin_lock(&netlbl_unlhsh_lock);
11734 -- RCU_INIT_POINTER(netlbl_unlhsh, hsh_tbl);
11735 -+ rcu_assign_pointer(netlbl_unlhsh, hsh_tbl);
11736 - spin_unlock(&netlbl_unlhsh_lock);
11737 -- rcu_read_unlock();
11738 -
11739 - register_netdevice_notifier(&netlbl_unlhsh_netdev_notifier);
11740 -
11741 -diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c
11742 -index bf10ea8..d65f699 100644
11743 ---- a/net/phonet/af_phonet.c
11744 -+++ b/net/phonet/af_phonet.c
11745 -@@ -480,7 +480,7 @@ int __init_or_module phonet_proto_register(unsigned int protocol,
11746 - if (proto_tab[protocol])
11747 - err = -EBUSY;
11748 - else
11749 -- RCU_INIT_POINTER(proto_tab[protocol], pp);
11750 -+ rcu_assign_pointer(proto_tab[protocol], pp);
11751 - mutex_unlock(&proto_tab_lock);
11752 -
11753 - return err;
11754 -diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
11755 -index c582761..9b9a85e 100644
11756 ---- a/net/phonet/pn_dev.c
11757 -+++ b/net/phonet/pn_dev.c
11758 -@@ -390,7 +390,7 @@ int phonet_route_add(struct net_device *dev, u8 daddr)
11759 - daddr = daddr >> 2;
11760 - mutex_lock(&routes->lock);
11761 - if (routes->table[daddr] == NULL) {
11762 -- RCU_INIT_POINTER(routes->table[daddr], dev);
11763 -+ rcu_assign_pointer(routes->table[daddr], dev);
11764 - dev_hold(dev);
11765 - err = 0;
11766 - }
11767 -diff --git a/net/phonet/socket.c b/net/phonet/socket.c
11768 -index 3f8d0b1..4c7eff3 100644
11769 ---- a/net/phonet/socket.c
11770 -+++ b/net/phonet/socket.c
11771 -@@ -680,7 +680,7 @@ int pn_sock_bind_res(struct sock *sk, u8 res)
11772 - mutex_lock(&resource_mutex);
11773 - if (pnres.sk[res] == NULL) {
11774 - sock_hold(sk);
11775 -- RCU_INIT_POINTER(pnres.sk[res], sk);
11776 -+ rcu_assign_pointer(pnres.sk[res], sk);
11777 - ret = 0;
11778 - }
11779 - mutex_unlock(&resource_mutex);
11780 -diff --git a/net/rds/af_rds.c b/net/rds/af_rds.c
11781 -index bb6ad81..424ff62 100644
11782 ---- a/net/rds/af_rds.c
11783 -+++ b/net/rds/af_rds.c
11784 -@@ -68,7 +68,6 @@ static int rds_release(struct socket *sock)
11785 - {
11786 - struct sock *sk = sock->sk;
11787 - struct rds_sock *rs;
11788 -- unsigned long flags;
11789 -
11790 - if (!sk)
11791 - goto out;
11792 -@@ -94,10 +93,10 @@ static int rds_release(struct socket *sock)
11793 - rds_rdma_drop_keys(rs);
11794 - rds_notify_queue_get(rs, NULL);
11795 -
11796 -- spin_lock_irqsave(&rds_sock_lock, flags);
11797 -+ spin_lock_bh(&rds_sock_lock);
11798 - list_del_init(&rs->rs_item);
11799 - rds_sock_count--;
11800 -- spin_unlock_irqrestore(&rds_sock_lock, flags);
11801 -+ spin_unlock_bh(&rds_sock_lock);
11802 -
11803 - rds_trans_put(rs->rs_transport);
11804 -
11805 -@@ -409,7 +408,6 @@ static const struct proto_ops rds_proto_ops = {
11806 -
11807 - static int __rds_create(struct socket *sock, struct sock *sk, int protocol)
11808 - {
11809 -- unsigned long flags;
11810 - struct rds_sock *rs;
11811 -
11812 - sock_init_data(sock, sk);
11813 -@@ -426,10 +424,10 @@ static int __rds_create(struct socket *sock, struct sock *sk, int protocol)
11814 - spin_lock_init(&rs->rs_rdma_lock);
11815 - rs->rs_rdma_keys = RB_ROOT;
11816 -
11817 -- spin_lock_irqsave(&rds_sock_lock, flags);
11818 -+ spin_lock_bh(&rds_sock_lock);
11819 - list_add_tail(&rs->rs_item, &rds_sock_list);
11820 - rds_sock_count++;
11821 -- spin_unlock_irqrestore(&rds_sock_lock, flags);
11822 -+ spin_unlock_bh(&rds_sock_lock);
11823 -
11824 - return 0;
11825 - }
11826 -@@ -471,12 +469,11 @@ static void rds_sock_inc_info(struct socket *sock, unsigned int len,
11827 - {
11828 - struct rds_sock *rs;
11829 - struct rds_incoming *inc;
11830 -- unsigned long flags;
11831 - unsigned int total = 0;
11832 -
11833 - len /= sizeof(struct rds_info_message);
11834 -
11835 -- spin_lock_irqsave(&rds_sock_lock, flags);
11836 -+ spin_lock_bh(&rds_sock_lock);
11837 -
11838 - list_for_each_entry(rs, &rds_sock_list, rs_item) {
11839 - read_lock(&rs->rs_recv_lock);
11840 -@@ -492,7 +489,7 @@ static void rds_sock_inc_info(struct socket *sock, unsigned int len,
11841 - read_unlock(&rs->rs_recv_lock);
11842 - }
11843 -
11844 -- spin_unlock_irqrestore(&rds_sock_lock, flags);
11845 -+ spin_unlock_bh(&rds_sock_lock);
11846 -
11847 - lens->nr = total;
11848 - lens->each = sizeof(struct rds_info_message);
11849 -@@ -504,11 +501,10 @@ static void rds_sock_info(struct socket *sock, unsigned int len,
11850 - {
11851 - struct rds_info_socket sinfo;
11852 - struct rds_sock *rs;
11853 -- unsigned long flags;
11854 -
11855 - len /= sizeof(struct rds_info_socket);
11856 -
11857 -- spin_lock_irqsave(&rds_sock_lock, flags);
11858 -+ spin_lock_bh(&rds_sock_lock);
11859 -
11860 - if (len < rds_sock_count)
11861 - goto out;
11862 -@@ -529,7 +525,7 @@ out:
11863 - lens->nr = rds_sock_count;
11864 - lens->each = sizeof(struct rds_info_socket);
11865 -
11866 -- spin_unlock_irqrestore(&rds_sock_lock, flags);
11867 -+ spin_unlock_bh(&rds_sock_lock);
11868 - }
11869 -
11870 - static void rds_exit(void)
11871 -diff --git a/net/socket.c b/net/socket.c
11872 -index 2877647..2dce67a 100644
11873 ---- a/net/socket.c
11874 -+++ b/net/socket.c
11875 -@@ -2472,7 +2472,7 @@ int sock_register(const struct net_proto_family *ops)
11876 - lockdep_is_held(&net_family_lock)))
11877 - err = -EEXIST;
11878 - else {
11879 -- RCU_INIT_POINTER(net_families[ops->family], ops);
11880 -+ rcu_assign_pointer(net_families[ops->family], ops);
11881 - err = 0;
11882 - }
11883 - spin_unlock(&net_family_lock);
11884 -diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
11885 -index afb5655..db0efde 100644
11886 ---- a/net/sunrpc/auth_gss/auth_gss.c
11887 -+++ b/net/sunrpc/auth_gss/auth_gss.c
11888 -@@ -122,7 +122,7 @@ gss_cred_set_ctx(struct rpc_cred *cred, struct gss_cl_ctx *ctx)
11889 - if (!test_bit(RPCAUTH_CRED_NEW, &cred->cr_flags))
11890 - return;
11891 - gss_get_ctx(ctx);
11892 -- RCU_INIT_POINTER(gss_cred->gc_ctx, ctx);
11893 -+ rcu_assign_pointer(gss_cred->gc_ctx, ctx);
11894 - set_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
11895 - smp_mb__before_clear_bit();
11896 - clear_bit(RPCAUTH_CRED_NEW, &cred->cr_flags);
11897 -diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
11898 -index b595a3d..d99678a 100644
11899 ---- a/net/unix/af_unix.c
11900 -+++ b/net/unix/af_unix.c
11901 -@@ -1915,7 +1915,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
11902 - struct sk_buff *skb;
11903 -
11904 - unix_state_lock(sk);
11905 -- skb = skb_dequeue(&sk->sk_receive_queue);
11906 -+ skb = skb_peek(&sk->sk_receive_queue);
11907 - if (skb == NULL) {
11908 - unix_sk(sk)->recursion_level = 0;
11909 - if (copied >= target)
11910 -@@ -1955,11 +1955,8 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
11911 - if (check_creds) {
11912 - /* Never glue messages from different writers */
11913 - if ((UNIXCB(skb).pid != siocb->scm->pid) ||
11914 -- (UNIXCB(skb).cred != siocb->scm->cred)) {
11915 -- skb_queue_head(&sk->sk_receive_queue, skb);
11916 -- sk->sk_data_ready(sk, skb->len);
11917 -+ (UNIXCB(skb).cred != siocb->scm->cred))
11918 - break;
11919 -- }
11920 - } else {
11921 - /* Copy credentials */
11922 - scm_set_cred(siocb->scm, UNIXCB(skb).pid, UNIXCB(skb).cred);
11923 -@@ -1974,8 +1971,6 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
11924 -
11925 - chunk = min_t(unsigned int, skb->len, size);
11926 - if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) {
11927 -- skb_queue_head(&sk->sk_receive_queue, skb);
11928 -- sk->sk_data_ready(sk, skb->len);
11929 - if (copied == 0)
11930 - copied = -EFAULT;
11931 - break;
11932 -@@ -1990,13 +1985,10 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
11933 - if (UNIXCB(skb).fp)
11934 - unix_detach_fds(siocb->scm, skb);
11935 -
11936 -- /* put the skb back if we didn't use it up.. */
11937 -- if (skb->len) {
11938 -- skb_queue_head(&sk->sk_receive_queue, skb);
11939 -- sk->sk_data_ready(sk, skb->len);
11940 -+ if (skb->len)
11941 - break;
11942 -- }
11943 -
11944 -+ skb_unlink(skb, &sk->sk_receive_queue);
11945 - consume_skb(skb);
11946 -
11947 - if (siocb->scm->fp)
11948 -@@ -2007,9 +1999,6 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
11949 - if (UNIXCB(skb).fp)
11950 - siocb->scm->fp = scm_fp_dup(UNIXCB(skb).fp);
11951 -
11952 -- /* put message back and return */
11953 -- skb_queue_head(&sk->sk_receive_queue, skb);
11954 -- sk->sk_data_ready(sk, skb->len);
11955 - break;
11956 - }
11957 - } while (size);
11958 -diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
11959 -index d0a42df..7cae73e 100644
11960 ---- a/net/xfrm/xfrm_user.c
11961 -+++ b/net/xfrm/xfrm_user.c
11962 -@@ -2927,7 +2927,7 @@ static int __net_init xfrm_user_net_init(struct net *net)
11963 - if (nlsk == NULL)
11964 - return -ENOMEM;
11965 - net->xfrm.nlsk_stash = nlsk; /* Don't set to NULL */
11966 -- RCU_INIT_POINTER(net->xfrm.nlsk, nlsk);
11967 -+ rcu_assign_pointer(net->xfrm.nlsk, nlsk);
11968 - return 0;
11969 - }
11970 -
11971 -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
11972 -index 5b2b75b..192e6c0 100644
11973 ---- a/sound/pci/hda/hda_intel.c
11974 -+++ b/sound/pci/hda/hda_intel.c
11975 -@@ -461,6 +461,7 @@ struct azx {
11976 - unsigned int irq_pending_warned :1;
11977 - unsigned int probing :1; /* codec probing phase */
11978 - unsigned int snoop:1;
11979 -+ unsigned int align_buffer_size:1;
11980 -
11981 - /* for debugging */
11982 - unsigned int last_cmd[AZX_MAX_CODECS];
11983 -@@ -1697,7 +1698,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
11984 - runtime->hw.rates = hinfo->rates;
11985 - snd_pcm_limit_hw_rates(runtime);
11986 - snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
11987 -- if (align_buffer_size)
11988 -+ if (chip->align_buffer_size)
11989 - /* constrain buffer sizes to be multiple of 128
11990 - bytes. This is more efficient in terms of memory
11991 - access but isn't required by the HDA spec and
11992 -@@ -2753,8 +2754,9 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
11993 - }
11994 -
11995 - /* disable buffer size rounding to 128-byte multiples if supported */
11996 -+ chip->align_buffer_size = align_buffer_size;
11997 - if (chip->driver_caps & AZX_DCAPS_BUFSIZE)
11998 -- align_buffer_size = 0;
11999 -+ chip->align_buffer_size = 0;
12000 -
12001 - /* allow 64bit DMA address if supported by H/W */
12002 - if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64)))
12003 -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
12004 -index 1d07e8f..5f03c40 100644
12005 ---- a/sound/pci/hda/patch_realtek.c
12006 -+++ b/sound/pci/hda/patch_realtek.c
12007 -@@ -5223,6 +5223,7 @@ static const struct hda_amp_list alc861_loopbacks[] = {
12008 - /* Pin config fixes */
12009 - enum {
12010 - PINFIX_FSC_AMILO_PI1505,
12011 -+ PINFIX_ASUS_A6RP,
12012 - };
12013 -
12014 - static const struct alc_fixup alc861_fixups[] = {
12015 -@@ -5234,9 +5235,19 @@ static const struct alc_fixup alc861_fixups[] = {
12016 - { }
12017 - }
12018 - },
12019 -+ [PINFIX_ASUS_A6RP] = {
12020 -+ .type = ALC_FIXUP_VERBS,
12021 -+ .v.verbs = (const struct hda_verb[]) {
12022 -+ /* node 0x0f VREF seems controlling the master output */
12023 -+ { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
12024 -+ { }
12025 -+ },
12026 -+ },
12027 - };
12028 -
12029 - static const struct snd_pci_quirk alc861_fixup_tbl[] = {
12030 -+ SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", PINFIX_ASUS_A6RP),
12031 -+ SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", PINFIX_ASUS_A6RP),
12032 - SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", PINFIX_FSC_AMILO_PI1505),
12033 - {}
12034 - };
12035 -diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
12036 -index f3c73a9..ccdac27 100644
12037 ---- a/sound/pci/hda/patch_sigmatel.c
12038 -+++ b/sound/pci/hda/patch_sigmatel.c
12039 -@@ -4253,13 +4253,15 @@ static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
12040 - return 1;
12041 - }
12042 -
12043 --static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid)
12044 -+static int is_nid_out_jack_pin(struct auto_pin_cfg *cfg, hda_nid_t nid)
12045 - {
12046 - int i;
12047 - for (i = 0; i < cfg->hp_outs; i++)
12048 - if (cfg->hp_pins[i] == nid)
12049 - return 1; /* nid is a HP-Out */
12050 --
12051 -+ for (i = 0; i < cfg->line_outs; i++)
12052 -+ if (cfg->line_out_pins[i] == nid)
12053 -+ return 1; /* nid is a line-Out */
12054 - return 0; /* nid is not a HP-Out */
12055 - };
12056 -
12057 -@@ -4465,7 +4467,7 @@ static int stac92xx_init(struct hda_codec *codec)
12058 - continue;
12059 - }
12060 -
12061 -- if (is_nid_hp_pin(cfg, nid))
12062 -+ if (is_nid_out_jack_pin(cfg, nid))
12063 - continue; /* already has an unsol event */
12064 -
12065 - pinctl = snd_hda_codec_read(codec, nid, 0,
12066 -@@ -4950,7 +4952,14 @@ static int find_mute_led_gpio(struct hda_codec *codec, int default_polarity)
12067 - /* BIOS bug: unfilled OEM string */
12068 - if (strstr(dev->name, "HP_Mute_LED_P_G")) {
12069 - set_hp_led_gpio(codec);
12070 -- spec->gpio_led_polarity = 1;
12071 -+ switch (codec->subsystem_id) {
12072 -+ case 0x103c148a:
12073 -+ spec->gpio_led_polarity = 0;
12074 -+ break;
12075 -+ default:
12076 -+ spec->gpio_led_polarity = 1;
12077 -+ break;
12078 -+ }
12079 - return 1;
12080 - }
12081 - }
12082 -diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c
12083 -index 42d9039..d0beeec 100644
12084 ---- a/sound/soc/codecs/wm5100.c
12085 -+++ b/sound/soc/codecs/wm5100.c
12086 -@@ -1379,6 +1379,7 @@ static int wm5100_set_bias_level(struct snd_soc_codec *codec,
12087 -
12088 - switch (wm5100->rev) {
12089 - case 0:
12090 -+ regcache_cache_bypass(wm5100->regmap, true);
12091 - snd_soc_write(codec, 0x11, 0x3);
12092 - snd_soc_write(codec, 0x203, 0xc);
12093 - snd_soc_write(codec, 0x206, 0);
12094 -@@ -1394,6 +1395,7 @@ static int wm5100_set_bias_level(struct snd_soc_codec *codec,
12095 - snd_soc_write(codec,
12096 - wm5100_reva_patches[i].reg,
12097 - wm5100_reva_patches[i].val);
12098 -+ regcache_cache_bypass(wm5100->regmap, false);
12099 - break;
12100 - default:
12101 - break;
12102 -@@ -1404,6 +1406,7 @@ static int wm5100_set_bias_level(struct snd_soc_codec *codec,
12103 - break;
12104 -
12105 - case SND_SOC_BIAS_OFF:
12106 -+ regcache_cache_only(wm5100->regmap, true);
12107 - if (wm5100->pdata.ldo_ena)
12108 - gpio_set_value_cansleep(wm5100->pdata.ldo_ena, 0);
12109 - regulator_bulk_disable(ARRAY_SIZE(wm5100->core_supplies),
12110 -diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c
12111 -index a33b04d..6d98a57 100644
12112 ---- a/sound/soc/codecs/wm8996.c
12113 -+++ b/sound/soc/codecs/wm8996.c
12114 -@@ -1049,7 +1049,8 @@ SND_SOC_DAPM_SUPPLY_S("SYSCLK", 1, WM8996_AIF_CLOCKING_1, 0, 0, NULL, 0),
12115 - SND_SOC_DAPM_SUPPLY_S("SYSDSPCLK", 2, WM8996_CLOCKING_1, 1, 0, NULL, 0),
12116 - SND_SOC_DAPM_SUPPLY_S("AIFCLK", 2, WM8996_CLOCKING_1, 2, 0, NULL, 0),
12117 - SND_SOC_DAPM_SUPPLY_S("Charge Pump", 2, WM8996_CHARGE_PUMP_1, 15, 0, cp_event,
12118 -- SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
12119 -+ SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
12120 -+ SND_SOC_DAPM_POST_PMD),
12121 - SND_SOC_DAPM_SUPPLY("Bandgap", SND_SOC_NOPM, 0, 0, bg_event,
12122 - SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
12123 - SND_SOC_DAPM_SUPPLY("LDO2", WM8996_POWER_MANAGEMENT_2, 1, 0, NULL, 0),
12124 -@@ -1932,6 +1933,7 @@ static int wm8996_set_sysclk(struct snd_soc_dai *dai,
12125 - struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec);
12126 - int lfclk = 0;
12127 - int ratediv = 0;
12128 -+ int sync = WM8996_REG_SYNC;
12129 - int src;
12130 - int old;
12131 -
12132 -@@ -1976,6 +1978,7 @@ static int wm8996_set_sysclk(struct snd_soc_dai *dai,
12133 - case 32000:
12134 - case 32768:
12135 - lfclk = WM8996_LFCLK_ENA;
12136 -+ sync = 0;
12137 - break;
12138 - default:
12139 - dev_warn(codec->dev, "Unsupported clock rate %dHz\n",
12140 -@@ -1989,6 +1992,8 @@ static int wm8996_set_sysclk(struct snd_soc_dai *dai,
12141 - WM8996_SYSCLK_SRC_MASK | WM8996_SYSCLK_DIV_MASK,
12142 - src << WM8996_SYSCLK_SRC_SHIFT | ratediv);
12143 - snd_soc_update_bits(codec, WM8996_CLOCKING_1, WM8996_LFCLK_ENA, lfclk);
12144 -+ snd_soc_update_bits(codec, WM8996_CONTROL_INTERFACE_1,
12145 -+ WM8996_REG_SYNC, sync);
12146 - snd_soc_update_bits(codec, WM8996_AIF_CLOCKING_1,
12147 - WM8996_SYSCLK_ENA, old);
12148 -
12149 -diff --git a/sound/soc/codecs/wm8996.h b/sound/soc/codecs/wm8996.h
12150 -index 0fde643..de9ac3e 100644
12151 ---- a/sound/soc/codecs/wm8996.h
12152 -+++ b/sound/soc/codecs/wm8996.h
12153 -@@ -1567,6 +1567,10 @@ int wm8996_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
12154 - /*
12155 - * R257 (0x101) - Control Interface (1)
12156 - */
12157 -+#define WM8996_REG_SYNC 0x8000 /* REG_SYNC */
12158 -+#define WM8996_REG_SYNC_MASK 0x8000 /* REG_SYNC */
12159 -+#define WM8996_REG_SYNC_SHIFT 15 /* REG_SYNC */
12160 -+#define WM8996_REG_SYNC_WIDTH 1 /* REG_SYNC */
12161 - #define WM8996_AUTO_INC 0x0004 /* AUTO_INC */
12162 - #define WM8996_AUTO_INC_MASK 0x0004 /* AUTO_INC */
12163 - #define WM8996_AUTO_INC_SHIFT 2 /* AUTO_INC */
12164
12165 Deleted: genpatches-2.6/trunk/3.3/1003_linux-3.2.4.patch
12166 ===================================================================
12167 --- genpatches-2.6/trunk/3.3/1003_linux-3.2.4.patch 2012-02-07 13:46:33 UTC (rev 2082)
12168 +++ genpatches-2.6/trunk/3.3/1003_linux-3.2.4.patch 2012-02-07 13:47:50 UTC (rev 2083)
12169 @@ -1,40 +0,0 @@
12170 -diff --git a/Makefile b/Makefile
12171 -index d45e887..c8e187e 100644
12172 ---- a/Makefile
12173 -+++ b/Makefile
12174 -@@ -1,6 +1,6 @@
12175 - VERSION = 3
12176 - PATCHLEVEL = 2
12177 --SUBLEVEL = 3
12178 -+SUBLEVEL = 4
12179 - EXTRAVERSION =
12180 - NAME = Saber-toothed Squirrel
12181 -
12182 -diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c
12183 -index d0beeec..42d9039 100644
12184 ---- a/sound/soc/codecs/wm5100.c
12185 -+++ b/sound/soc/codecs/wm5100.c
12186 -@@ -1379,7 +1379,6 @@ static int wm5100_set_bias_level(struct snd_soc_codec *codec,
12187 -
12188 - switch (wm5100->rev) {
12189 - case 0:
12190 -- regcache_cache_bypass(wm5100->regmap, true);
12191 - snd_soc_write(codec, 0x11, 0x3);
12192 - snd_soc_write(codec, 0x203, 0xc);
12193 - snd_soc_write(codec, 0x206, 0);
12194 -@@ -1395,7 +1394,6 @@ static int wm5100_set_bias_level(struct snd_soc_codec *codec,
12195 - snd_soc_write(codec,
12196 - wm5100_reva_patches[i].reg,
12197 - wm5100_reva_patches[i].val);
12198 -- regcache_cache_bypass(wm5100->regmap, false);
12199 - break;
12200 - default:
12201 - break;
12202 -@@ -1406,7 +1404,6 @@ static int wm5100_set_bias_level(struct snd_soc_codec *codec,
12203 - break;
12204 -
12205 - case SND_SOC_BIAS_OFF:
12206 -- regcache_cache_only(wm5100->regmap, true);
12207 - if (wm5100->pdata.ldo_ena)
12208 - gpio_set_value_cansleep(wm5100->pdata.ldo_ena, 0);
12209 - regulator_bulk_disable(ARRAY_SIZE(wm5100->core_supplies),
12210
12211 Deleted: genpatches-2.6/trunk/3.3/1004_linux-3.2.5.patch
12212 ===================================================================
12213 --- genpatches-2.6/trunk/3.3/1004_linux-3.2.5.patch 2012-02-07 13:46:33 UTC (rev 2082)
12214 +++ genpatches-2.6/trunk/3.3/1004_linux-3.2.5.patch 2012-02-07 13:47:50 UTC (rev 2083)
12215 @@ -1,205 +0,0 @@
12216 -diff --git a/Makefile b/Makefile
12217 -index c8e187e..e9dd0ff 100644
12218 ---- a/Makefile
12219 -+++ b/Makefile
12220 -@@ -1,6 +1,6 @@
12221 - VERSION = 3
12222 - PATCHLEVEL = 2
12223 --SUBLEVEL = 4
12224 -+SUBLEVEL = 5
12225 - EXTRAVERSION =
12226 - NAME = Saber-toothed Squirrel
12227 -
12228 -diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
12229 -index 2672c79..7aff631 100644
12230 ---- a/drivers/acpi/pci_root.c
12231 -+++ b/drivers/acpi/pci_root.c
12232 -@@ -596,6 +596,13 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
12233 - if (ACPI_SUCCESS(status)) {
12234 - dev_info(root->bus->bridge,
12235 - "ACPI _OSC control (0x%02x) granted\n", flags);
12236 -+ if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) {
12237 -+ /*
12238 -+ * We have ASPM control, but the FADT indicates
12239 -+ * that it's unsupported. Clear it.
12240 -+ */
12241 -+ pcie_clear_aspm(root->bus);
12242 -+ }
12243 - } else {
12244 - dev_info(root->bus->bridge,
12245 - "ACPI _OSC request failed (%s), "
12246 -diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
12247 -index 4ecb640..c8e7585 100644
12248 ---- a/drivers/pci/pci-acpi.c
12249 -+++ b/drivers/pci/pci-acpi.c
12250 -@@ -395,7 +395,6 @@ static int __init acpi_pci_init(void)
12251 -
12252 - if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) {
12253 - printk(KERN_INFO"ACPI FADT declares the system doesn't support PCIe ASPM, so disable it\n");
12254 -- pcie_clear_aspm();
12255 - pcie_no_aspm();
12256 - }
12257 -
12258 -diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
12259 -index cbfbab1..1cfbf22 100644
12260 ---- a/drivers/pci/pcie/aspm.c
12261 -+++ b/drivers/pci/pcie/aspm.c
12262 -@@ -68,7 +68,7 @@ struct pcie_link_state {
12263 - struct aspm_latency acceptable[8];
12264 - };
12265 -
12266 --static int aspm_disabled, aspm_force, aspm_clear_state;
12267 -+static int aspm_disabled, aspm_force;
12268 - static bool aspm_support_enabled = true;
12269 - static DEFINE_MUTEX(aspm_lock);
12270 - static LIST_HEAD(link_list);
12271 -@@ -500,9 +500,6 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev)
12272 - int pos;
12273 - u32 reg32;
12274 -
12275 -- if (aspm_clear_state)
12276 -- return -EINVAL;
12277 --
12278 - /*
12279 - * Some functions in a slot might not all be PCIe functions,
12280 - * very strange. Disable ASPM for the whole slot
12281 -@@ -574,9 +571,6 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev)
12282 - pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM)
12283 - return;
12284 -
12285 -- if (aspm_disabled && !aspm_clear_state)
12286 -- return;
12287 --
12288 - /* VIA has a strange chipset, root port is under a bridge */
12289 - if (pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT &&
12290 - pdev->bus->self)
12291 -@@ -608,7 +602,7 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev)
12292 - * the BIOS's expectation, we'll do so once pci_enable_device() is
12293 - * called.
12294 - */
12295 -- if (aspm_policy != POLICY_POWERSAVE || aspm_clear_state) {
12296 -+ if (aspm_policy != POLICY_POWERSAVE) {
12297 - pcie_config_aspm_path(link);
12298 - pcie_set_clkpm(link, policy_to_clkpm_state(link));
12299 - }
12300 -@@ -649,8 +643,7 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)
12301 - struct pci_dev *parent = pdev->bus->self;
12302 - struct pcie_link_state *link, *root, *parent_link;
12303 -
12304 -- if ((aspm_disabled && !aspm_clear_state) || !pci_is_pcie(pdev) ||
12305 -- !parent || !parent->link_state)
12306 -+ if (!pci_is_pcie(pdev) || !parent || !parent->link_state)
12307 - return;
12308 - if ((parent->pcie_type != PCI_EXP_TYPE_ROOT_PORT) &&
12309 - (parent->pcie_type != PCI_EXP_TYPE_DOWNSTREAM))
12310 -@@ -734,13 +727,18 @@ void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
12311 - * pci_disable_link_state - disable pci device's link state, so the link will
12312 - * never enter specific states
12313 - */
12314 --static void __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem)
12315 -+static void __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem,
12316 -+ bool force)
12317 - {
12318 - struct pci_dev *parent = pdev->bus->self;
12319 - struct pcie_link_state *link;
12320 -
12321 -- if (aspm_disabled || !pci_is_pcie(pdev))
12322 -+ if (aspm_disabled && !force)
12323 -+ return;
12324 -+
12325 -+ if (!pci_is_pcie(pdev))
12326 - return;
12327 -+
12328 - if (pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT ||
12329 - pdev->pcie_type == PCI_EXP_TYPE_DOWNSTREAM)
12330 - parent = pdev;
12331 -@@ -768,16 +766,31 @@ static void __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem)
12332 -
12333 - void pci_disable_link_state_locked(struct pci_dev *pdev, int state)
12334 - {
12335 -- __pci_disable_link_state(pdev, state, false);
12336 -+ __pci_disable_link_state(pdev, state, false, false);
12337 - }
12338 - EXPORT_SYMBOL(pci_disable_link_state_locked);
12339 -
12340 - void pci_disable_link_state(struct pci_dev *pdev, int state)
12341 - {
12342 -- __pci_disable_link_state(pdev, state, true);
12343 -+ __pci_disable_link_state(pdev, state, true, false);
12344 - }
12345 - EXPORT_SYMBOL(pci_disable_link_state);
12346 -
12347 -+void pcie_clear_aspm(struct pci_bus *bus)
12348 -+{
12349 -+ struct pci_dev *child;
12350 -+
12351 -+ /*
12352 -+ * Clear any ASPM setup that the firmware has carried out on this bus
12353 -+ */
12354 -+ list_for_each_entry(child, &bus->devices, bus_list) {
12355 -+ __pci_disable_link_state(child, PCIE_LINK_STATE_L0S |
12356 -+ PCIE_LINK_STATE_L1 |
12357 -+ PCIE_LINK_STATE_CLKPM,
12358 -+ false, true);
12359 -+ }
12360 -+}
12361 -+
12362 - static int pcie_aspm_set_policy(const char *val, struct kernel_param *kp)
12363 - {
12364 - int i;
12365 -@@ -935,6 +948,7 @@ void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev)
12366 - static int __init pcie_aspm_disable(char *str)
12367 - {
12368 - if (!strcmp(str, "off")) {
12369 -+ aspm_policy = POLICY_DEFAULT;
12370 - aspm_disabled = 1;
12371 - aspm_support_enabled = false;
12372 - printk(KERN_INFO "PCIe ASPM is disabled\n");
12373 -@@ -947,16 +961,18 @@ static int __init pcie_aspm_disable(char *str)
12374 -
12375 - __setup("pcie_aspm=", pcie_aspm_disable);
12376 -
12377 --void pcie_clear_aspm(void)
12378 --{
12379 -- if (!aspm_force)
12380 -- aspm_clear_state = 1;
12381 --}
12382 --
12383 - void pcie_no_aspm(void)
12384 - {
12385 -- if (!aspm_force)
12386 -+ /*
12387 -+ * Disabling ASPM is intended to prevent the kernel from modifying
12388 -+ * existing hardware state, not to clear existing state. To that end:
12389 -+ * (a) set policy to POLICY_DEFAULT in order to avoid changing state
12390 -+ * (b) prevent userspace from changing policy
12391 -+ */
12392 -+ if (!aspm_force) {
12393 -+ aspm_policy = POLICY_DEFAULT;
12394 - aspm_disabled = 1;
12395 -+ }
12396 - }
12397 -
12398 - /**
12399 -diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
12400 -index 7cea7b6..c832014 100644
12401 ---- a/include/linux/pci-aspm.h
12402 -+++ b/include/linux/pci-aspm.h
12403 -@@ -29,7 +29,7 @@ extern void pcie_aspm_pm_state_change(struct pci_dev *pdev);
12404 - extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev);
12405 - extern void pci_disable_link_state(struct pci_dev *pdev, int state);
12406 - extern void pci_disable_link_state_locked(struct pci_dev *pdev, int state);
12407 --extern void pcie_clear_aspm(void);
12408 -+extern void pcie_clear_aspm(struct pci_bus *bus);
12409 - extern void pcie_no_aspm(void);
12410 - #else
12411 - static inline void pcie_aspm_init_link_state(struct pci_dev *pdev)
12412 -@@ -47,7 +47,7 @@ static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
12413 - static inline void pci_disable_link_state(struct pci_dev *pdev, int state)
12414 - {
12415 - }
12416 --static inline void pcie_clear_aspm(void)
12417 -+static inline void pcie_clear_aspm(struct pci_bus *bus)
12418 - {
12419 - }
12420 - static inline void pcie_no_aspm(void)