Gentoo Archives: gentoo-commits

From: "Tom Wijsman (tomwij)" <tomwij@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r2497 - in genpatches-2.6/trunk: . 3.10.7
Date: Thu, 29 Aug 2013 12:09:23
Message-Id: 20130829120912.B24412004C@flycatcher.gentoo.org
1 Author: tomwij
2 Date: 2013-08-29 12:09:12 +0000 (Thu, 29 Aug 2013)
3 New Revision: 2497
4
5 Added:
6 genpatches-2.6/trunk/3.10.7/
7 genpatches-2.6/trunk/3.10.7/0000_README
8 genpatches-2.6/trunk/3.10.7/1000_linux-3.10.1.patch
9 genpatches-2.6/trunk/3.10.7/1001_linux-3.10.2.patch
10 genpatches-2.6/trunk/3.10.7/1002_linux-3.10.3.patch
11 genpatches-2.6/trunk/3.10.7/1003_linux-3.10.4.patch
12 genpatches-2.6/trunk/3.10.7/1004_linux-3.10.5.patch
13 genpatches-2.6/trunk/3.10.7/1005_linux-3.10.6.patch
14 genpatches-2.6/trunk/3.10.7/1006_linux-3.10.7.patch
15 genpatches-2.6/trunk/3.10.7/1500_XATTR_USER_PREFIX.patch
16 genpatches-2.6/trunk/3.10.7/1700_enable-thinkpad-micled.patch
17 genpatches-2.6/trunk/3.10.7/1801_block-cgroups-kconfig-build-bits-for-BFQ-v6r2-3.10.patch
18 genpatches-2.6/trunk/3.10.7/1802_block-introduce-the-BFQ-v6r2-I-O-sched-for-3.10.patch1
19 genpatches-2.6/trunk/3.10.7/1803_block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v6r2-for-3.10.0.patch1
20 genpatches-2.6/trunk/3.10.7/2400_kcopy-patch-for-infiniband-driver.patch
21 genpatches-2.6/trunk/3.10.7/2700_ThinkPad-30-brightness-control-fix.patch
22 genpatches-2.6/trunk/3.10.7/2900_dev-root-proc-mount-fix.patch
23 genpatches-2.6/trunk/3.10.7/4200_fbcondecor-0.9.6.patch
24 genpatches-2.6/trunk/3.10.7/4500_nouveau-video-output-control-Kconfig.patch
25 genpatches-2.6/trunk/3.10.7/4567_distro-Gentoo-Kconfig.patch
26 Log:
27 Import 3.10-13 (3.10.7 release) as 3.10.7 branch, to bring security fixes to stable.
28
29 Added: genpatches-2.6/trunk/3.10.7/0000_README
30 ===================================================================
31 --- genpatches-2.6/trunk/3.10.7/0000_README (rev 0)
32 +++ genpatches-2.6/trunk/3.10.7/0000_README 2013-08-29 12:09:12 UTC (rev 2497)
33 @@ -0,0 +1,116 @@
34 +README
35 +--------------------------------------------------------------------------
36 +This patchset is to be the 2.6 series of gentoo-sources.
37 +It is designed for cross-compatibility, fixes and stability, with performance
38 +and additional features/driver support being a second.
39 +
40 +Unless otherwise stated and marked as such, this kernel should be suitable for
41 +all environments.
42 +
43 +
44 +Patchset Numbering Scheme
45 +--------------------------------------------------------------------------
46 +
47 +FIXES
48 +1000-1400 linux-stable
49 +1400-1500 linux-stable queue
50 +1500-1700 security
51 +1700-1800 architecture-related
52 +1800-1900 mm/scheduling/misc
53 +1900-2000 filesystems
54 +2000-2100 networking core
55 +2100-2200 storage core
56 +2200-2300 power management (ACPI, APM)
57 +2300-2400 bus (USB, IEEE1394, PCI, PCMCIA, ...)
58 +2400-2500 network drivers
59 +2500-2600 storage drivers
60 +2600-2700 input
61 +2700-2900 media (graphics, sound, tv)
62 +2900-3000 other
63 +3000-4000 reserved
64 +
65 +FEATURES
66 +4000-4100 network
67 +4100-4200 storage
68 +4200-4300 graphics
69 +4300-4400 filesystem
70 +4400-4500 security enhancement
71 +4500-4600 other
72 +
73 +Individual Patch Descriptions:
74 +--------------------------------------------------------------------------
75 +Patch: 1000_linux-3.10.1.patch
76 +From: http://www.kernel.org
77 +Desc: Linux 3.10.1
78 +
79 +Patch: 1001_linux-3.10.2.patch
80 +From: http://www.kernel.org
81 +Desc: Linux 3.10.2
82 +
83 +Patch: 1002_linux-3.10.3.patch
84 +From: http://www.kernel.org
85 +Desc: Linux 3.10.3
86 +
87 +Patch: 1003_linux-3.10.4.patch
88 +From: http://www.kernel.org
89 +Desc: Linux 3.10.4
90 +
91 +Patch: 1004_linux-3.10.5.patch
92 +From: http://www.kernel.org
93 +Desc: Linux 3.10.5
94 +
95 +Patch: 1005_linux-3.10.6.patch
96 +From: http://www.kernel.org
97 +Desc: Linux 3.10.6
98 +
99 +Patch: 1006_linux-3.10.7.patch
100 +From: http://www.kernel.org
101 +Desc: Linux 3.10.7
102 +
103 +Patch: 1500_XATTR_USER_PREFIX.patch
104 +From: https://bugs.gentoo.org/show_bug.cgi?id=470644
105 +Desc: Support for namespace user.pax.* on tmpfs.
106 +
107 +Patch: 1700_enable-thinkpad-micled.patch
108 +From: https://bugs.gentoo.org/show_bug.cgi?id=449248
109 +Desc: Enable mic mute led in thinkpads
110 +
111 +Patch: 1800_memcg-OOM-revert-ZFS-deadlock.patch
112 +From: https://bugs.gentoo.org/show_bug.cgi?id=462066
113 +Desc: Revert memcg patches that prevent OOM with too many dirty pages.
114 +
115 +Patch: 1801_block-cgroups-kconfig-build-bits-for-BFQ-v6r2-3.10.patch
116 +From: http://algo.ing.unimo.it/people/paolo/disk_sched/
117 +Desc: BFQ v6r2 patch 1 for 3.10: Build, cgroups and kconfig bits
118 +
119 +Patch: 1802_block-introduce-the-BFQ-v6r2-I-O-sched-for-3.10.patch1
120 +From: http://algo.ing.unimo.it/people/paolo/disk_sched/
121 +Desc: BFQ v6r2 patch 2 for 3.10: BFQ Scheduler
122 +
123 +Patch: 1803_block-bfq-add-Early-Queue-Merge-EQM-to-BFQ-v6r2-for-3.10.0.patch1
124 +From: http://algo.ing.unimo.it/people/paolo/disk_sched/
125 +Desc: BFQ v6r2 patch 3 for 3.10: Early Queue Merge (EQM)
126 +
127 +Patch: 2400_kcopy-patch-for-infiniband-driver.patch
128 +From: Alexey Shvetsov <alexxy@g.o>
129 +Desc: Zero copy for infiniband psm userspace driver
130 +
131 +Patch: 2700_ThinkPad-30-brightness-control-fix.patch
132 +From: Seth Forshee <seth.forshee@×××××××××.com>
133 +Desc: ACPI: Disable Windows 8 compatibility for some Lenovo ThinkPads
134 +
135 +Patch: 2900_dev-root-proc-mount-fix.patch
136 +From: https://bugs.gentoo.org/show_bug.cgi?id=438380
137 +Desc: Ensure that /dev/root doesn't appear in /proc/mounts when bootint without an initramfs.
138 +
139 +Patch: 4200_fbcondecor-0.9.6.patch
140 +From: http://dev.gentoo.org/~spock
141 +Desc: Bootsplash successor by Michal Januszewski ported by Jeremy (bug #452574)
142 +
143 +Patch: 4500_nouveau-video-output-control-Kconfig.patch
144 +From: Tom Wijsman <TomWij@g.o
145 +Desc: Make DRM_NOUVEU select VIDEO_OUTPUT_CONTROL, fixes bug #475748.
146 +
147 +Patch: 4567_distro-Gentoo-Kconfig.patch
148 +From: Tom Wijsman <TomWij@g.o
149 +Desc: Add Gentoo Linux support config settings and defaults.
150
151 Added: genpatches-2.6/trunk/3.10.7/1000_linux-3.10.1.patch
152 ===================================================================
153 --- genpatches-2.6/trunk/3.10.7/1000_linux-3.10.1.patch (rev 0)
154 +++ genpatches-2.6/trunk/3.10.7/1000_linux-3.10.1.patch 2013-08-29 12:09:12 UTC (rev 2497)
155 @@ -0,0 +1,511 @@
156 +diff --git a/MAINTAINERS b/MAINTAINERS
157 +index ad7e322..48c7480 100644
158 +--- a/MAINTAINERS
159 ++++ b/MAINTAINERS
160 +@@ -7667,6 +7667,7 @@ STABLE BRANCH
161 + M: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
162 + L: stable@×××××××××××.org
163 + S: Supported
164 ++F: Documentation/stable_kernel_rules.txt
165 +
166 + STAGING SUBSYSTEM
167 + M: Greg Kroah-Hartman <gregkh@×××××××××××××××.org>
168 +diff --git a/Makefile b/Makefile
169 +index e5e3ba0..b75cc30 100644
170 +--- a/Makefile
171 ++++ b/Makefile
172 +@@ -1,6 +1,6 @@
173 + VERSION = 3
174 + PATCHLEVEL = 10
175 +-SUBLEVEL = 0
176 ++SUBLEVEL = 1
177 + EXTRAVERSION =
178 + NAME = Unicycling Gorilla
179 +
180 +diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
181 +index 260a919..5402c94 100644
182 +--- a/arch/x86/kvm/vmx.c
183 ++++ b/arch/x86/kvm/vmx.c
184 +@@ -3399,15 +3399,22 @@ static void vmx_get_segment(struct kvm_vcpu *vcpu,
185 + var->limit = vmx_read_guest_seg_limit(vmx, seg);
186 + var->selector = vmx_read_guest_seg_selector(vmx, seg);
187 + ar = vmx_read_guest_seg_ar(vmx, seg);
188 ++ var->unusable = (ar >> 16) & 1;
189 + var->type = ar & 15;
190 + var->s = (ar >> 4) & 1;
191 + var->dpl = (ar >> 5) & 3;
192 +- var->present = (ar >> 7) & 1;
193 ++ /*
194 ++ * Some userspaces do not preserve unusable property. Since usable
195 ++ * segment has to be present according to VMX spec we can use present
196 ++ * property to amend userspace bug by making unusable segment always
197 ++ * nonpresent. vmx_segment_access_rights() already marks nonpresent
198 ++ * segment as unusable.
199 ++ */
200 ++ var->present = !var->unusable;
201 + var->avl = (ar >> 12) & 1;
202 + var->l = (ar >> 13) & 1;
203 + var->db = (ar >> 14) & 1;
204 + var->g = (ar >> 15) & 1;
205 +- var->unusable = (ar >> 16) & 1;
206 + }
207 +
208 + static u64 vmx_get_segment_base(struct kvm_vcpu *vcpu, int seg)
209 +diff --git a/block/genhd.c b/block/genhd.c
210 +index 20625ee..cdeb527 100644
211 +--- a/block/genhd.c
212 ++++ b/block/genhd.c
213 +@@ -512,7 +512,7 @@ static void register_disk(struct gendisk *disk)
214 +
215 + ddev->parent = disk->driverfs_dev;
216 +
217 +- dev_set_name(ddev, disk->disk_name);
218 ++ dev_set_name(ddev, "%s", disk->disk_name);
219 +
220 + /* delay uevents, until we scanned partition table */
221 + dev_set_uevent_suppress(ddev, 1);
222 +diff --git a/crypto/algapi.c b/crypto/algapi.c
223 +index 6149a6e..7a1ae87 100644
224 +--- a/crypto/algapi.c
225 ++++ b/crypto/algapi.c
226 +@@ -495,7 +495,8 @@ static struct crypto_template *__crypto_lookup_template(const char *name)
227 +
228 + struct crypto_template *crypto_lookup_template(const char *name)
229 + {
230 +- return try_then_request_module(__crypto_lookup_template(name), name);
231 ++ return try_then_request_module(__crypto_lookup_template(name), "%s",
232 ++ name);
233 + }
234 + EXPORT_SYMBOL_GPL(crypto_lookup_template);
235 +
236 +diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
237 +index 037288e..46b35f7 100644
238 +--- a/drivers/block/nbd.c
239 ++++ b/drivers/block/nbd.c
240 +@@ -714,7 +714,8 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
241 + else
242 + blk_queue_flush(nbd->disk->queue, 0);
243 +
244 +- thread = kthread_create(nbd_thread, nbd, nbd->disk->disk_name);
245 ++ thread = kthread_create(nbd_thread, nbd, "%s",
246 ++ nbd->disk->disk_name);
247 + if (IS_ERR(thread)) {
248 + mutex_lock(&nbd->tx_lock);
249 + return PTR_ERR(thread);
250 +diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
251 +index d620b44..8a3aff7 100644
252 +--- a/drivers/cdrom/cdrom.c
253 ++++ b/drivers/cdrom/cdrom.c
254 +@@ -2882,7 +2882,7 @@ static noinline int mmc_ioctl_cdrom_read_data(struct cdrom_device_info *cdi,
255 + if (lba < 0)
256 + return -EINVAL;
257 +
258 +- cgc->buffer = kmalloc(blocksize, GFP_KERNEL);
259 ++ cgc->buffer = kzalloc(blocksize, GFP_KERNEL);
260 + if (cgc->buffer == NULL)
261 + return -ENOMEM;
262 +
263 +diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
264 +index fb65dec..591b6fb 100644
265 +--- a/drivers/cpufreq/cpufreq_stats.c
266 ++++ b/drivers/cpufreq/cpufreq_stats.c
267 +@@ -349,6 +349,7 @@ static int __cpuinit cpufreq_stat_cpu_callback(struct notifier_block *nfb,
268 +
269 + switch (action) {
270 + case CPU_ONLINE:
271 ++ case CPU_ONLINE_FROZEN:
272 + cpufreq_update_policy(cpu);
273 + break;
274 + case CPU_DOWN_PREPARE:
275 +diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c
276 +index fefc39f..98de1dd 100644
277 +--- a/drivers/power/charger-manager.c
278 ++++ b/drivers/power/charger-manager.c
279 +@@ -450,7 +450,7 @@ static void uevent_notify(struct charger_manager *cm, const char *event)
280 + strncpy(env_str, event, UEVENT_BUF_SIZE);
281 + kobject_uevent(&cm->dev->kobj, KOBJ_CHANGE);
282 +
283 +- dev_info(cm->dev, event);
284 ++ dev_info(cm->dev, "%s", event);
285 + }
286 +
287 + /**
288 +diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c
289 +index 0fab6b5..9d86947 100644
290 +--- a/drivers/scsi/osd/osd_uld.c
291 ++++ b/drivers/scsi/osd/osd_uld.c
292 +@@ -485,7 +485,7 @@ static int osd_probe(struct device *dev)
293 + oud->class_dev.class = &osd_uld_class;
294 + oud->class_dev.parent = dev;
295 + oud->class_dev.release = __remove;
296 +- error = dev_set_name(&oud->class_dev, disk->disk_name);
297 ++ error = dev_set_name(&oud->class_dev, "%s", disk->disk_name);
298 + if (error) {
299 + OSD_ERR("dev_set_name failed => %d\n", error);
300 + goto err_put_cdev;
301 +diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
302 +index c1c5552..6f6a1b4 100644
303 +--- a/drivers/scsi/sd.c
304 ++++ b/drivers/scsi/sd.c
305 +@@ -142,7 +142,7 @@ sd_store_cache_type(struct device *dev, struct device_attribute *attr,
306 + char *buffer_data;
307 + struct scsi_mode_data data;
308 + struct scsi_sense_hdr sshdr;
309 +- const char *temp = "temporary ";
310 ++ static const char temp[] = "temporary ";
311 + int len;
312 +
313 + if (sdp->type != TYPE_DISK)
314 +diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
315 +index 26e3a97..c52948b 100644
316 +--- a/drivers/tty/serial/8250/8250_pci.c
317 ++++ b/drivers/tty/serial/8250/8250_pci.c
318 +@@ -4797,10 +4797,6 @@ static struct pci_device_id serial_pci_tbl[] = {
319 + PCI_VENDOR_ID_IBM, 0x0299,
320 + 0, 0, pbn_b0_bt_2_115200 },
321 +
322 +- { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9835,
323 +- 0x1000, 0x0012,
324 +- 0, 0, pbn_b0_bt_2_115200 },
325 +-
326 + { PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9901,
327 + 0xA000, 0x1000,
328 + 0, 0, pbn_b0_1_115200 },
329 +diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
330 +index 6464029..4476682 100644
331 +--- a/drivers/tty/tty_io.c
332 ++++ b/drivers/tty/tty_io.c
333 +@@ -1618,6 +1618,8 @@ static void release_tty(struct tty_struct *tty, int idx)
334 + tty_free_termios(tty);
335 + tty_driver_remove_tty(tty->driver, tty);
336 + tty->port->itty = NULL;
337 ++ if (tty->link)
338 ++ tty->link->port->itty = NULL;
339 + cancel_work_sync(&tty->port->buf.work);
340 +
341 + if (tty->link)
342 +diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
343 +index 9b6b2b6..be661d8 100644
344 +--- a/fs/ceph/xattr.c
345 ++++ b/fs/ceph/xattr.c
346 +@@ -675,17 +675,18 @@ ssize_t ceph_getxattr(struct dentry *dentry, const char *name, void *value,
347 + if (!ceph_is_valid_xattr(name))
348 + return -ENODATA;
349 +
350 +- spin_lock(&ci->i_ceph_lock);
351 +- dout("getxattr %p ver=%lld index_ver=%lld\n", inode,
352 +- ci->i_xattrs.version, ci->i_xattrs.index_version);
353 +
354 + /* let's see if a virtual xattr was requested */
355 + vxattr = ceph_match_vxattr(inode, name);
356 + if (vxattr && !(vxattr->exists_cb && !vxattr->exists_cb(ci))) {
357 + err = vxattr->getxattr_cb(ci, value, size);
358 +- goto out;
359 ++ return err;
360 + }
361 +
362 ++ spin_lock(&ci->i_ceph_lock);
363 ++ dout("getxattr %p ver=%lld index_ver=%lld\n", inode,
364 ++ ci->i_xattrs.version, ci->i_xattrs.index_version);
365 ++
366 + if (__ceph_caps_issued_mask(ci, CEPH_CAP_XATTR_SHARED, 1) &&
367 + (ci->i_xattrs.index_version >= ci->i_xattrs.version)) {
368 + goto get_xattr;
369 +diff --git a/fs/hpfs/map.c b/fs/hpfs/map.c
370 +index 4acb19d..803d3da 100644
371 +--- a/fs/hpfs/map.c
372 ++++ b/fs/hpfs/map.c
373 +@@ -17,7 +17,8 @@ __le32 *hpfs_map_bitmap(struct super_block *s, unsigned bmp_block,
374 + struct quad_buffer_head *qbh, char *id)
375 + {
376 + secno sec;
377 +- if (hpfs_sb(s)->sb_chk) if (bmp_block * 16384 > hpfs_sb(s)->sb_fs_size) {
378 ++ unsigned n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14;
379 ++ if (hpfs_sb(s)->sb_chk) if (bmp_block >= n_bands) {
380 + hpfs_error(s, "hpfs_map_bitmap called with bad parameter: %08x at %s", bmp_block, id);
381 + return NULL;
382 + }
383 +diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
384 +index a0617e7..962e90c 100644
385 +--- a/fs/hpfs/super.c
386 ++++ b/fs/hpfs/super.c
387 +@@ -558,7 +558,13 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
388 + sbi->sb_cp_table = NULL;
389 + sbi->sb_c_bitmap = -1;
390 + sbi->sb_max_fwd_alloc = 0xffffff;
391 +-
392 ++
393 ++ if (sbi->sb_fs_size >= 0x80000000) {
394 ++ hpfs_error(s, "invalid size in superblock: %08x",
395 ++ (unsigned)sbi->sb_fs_size);
396 ++ goto bail4;
397 ++ }
398 ++
399 + /* Load bitmap directory */
400 + if (!(sbi->sb_bmp_dir = hpfs_load_bitmap_directory(s, le32_to_cpu(superblock->bitmaps))))
401 + goto bail4;
402 +diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
403 +index 1fab140..2c37442 100644
404 +--- a/fs/nfs/nfs4state.c
405 ++++ b/fs/nfs/nfs4state.c
406 +@@ -228,19 +228,8 @@ static int nfs41_setup_state_renewal(struct nfs_client *clp)
407 + return status;
408 + }
409 +
410 +-/*
411 +- * Back channel returns NFS4ERR_DELAY for new requests when
412 +- * NFS4_SESSION_DRAINING is set so there is no work to be done when draining
413 +- * is ended.
414 +- */
415 +-static void nfs4_end_drain_session(struct nfs_client *clp)
416 ++static void nfs4_end_drain_slot_table(struct nfs4_slot_table *tbl)
417 + {
418 +- struct nfs4_session *ses = clp->cl_session;
419 +- struct nfs4_slot_table *tbl;
420 +-
421 +- if (ses == NULL)
422 +- return;
423 +- tbl = &ses->fc_slot_table;
424 + if (test_and_clear_bit(NFS4_SLOT_TBL_DRAINING, &tbl->slot_tbl_state)) {
425 + spin_lock(&tbl->slot_tbl_lock);
426 + nfs41_wake_slot_table(tbl);
427 +@@ -248,6 +237,16 @@ static void nfs4_end_drain_session(struct nfs_client *clp)
428 + }
429 + }
430 +
431 ++static void nfs4_end_drain_session(struct nfs_client *clp)
432 ++{
433 ++ struct nfs4_session *ses = clp->cl_session;
434 ++
435 ++ if (ses != NULL) {
436 ++ nfs4_end_drain_slot_table(&ses->bc_slot_table);
437 ++ nfs4_end_drain_slot_table(&ses->fc_slot_table);
438 ++ }
439 ++}
440 ++
441 + /*
442 + * Signal state manager thread if session fore channel is drained
443 + */
444 +diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
445 +index 6cd86e0..582321a 100644
446 +--- a/fs/nfsd/nfs4xdr.c
447 ++++ b/fs/nfsd/nfs4xdr.c
448 +@@ -162,8 +162,8 @@ static __be32 *read_buf(struct nfsd4_compoundargs *argp, u32 nbytes)
449 + */
450 + memcpy(p, argp->p, avail);
451 + /* step to next page */
452 +- argp->p = page_address(argp->pagelist[0]);
453 + argp->pagelist++;
454 ++ argp->p = page_address(argp->pagelist[0]);
455 + if (argp->pagelen < PAGE_SIZE) {
456 + argp->end = argp->p + (argp->pagelen>>2);
457 + argp->pagelen = 0;
458 +diff --git a/include/linux/ceph/decode.h b/include/linux/ceph/decode.h
459 +index 379f715..0442c3d 100644
460 +--- a/include/linux/ceph/decode.h
461 ++++ b/include/linux/ceph/decode.h
462 +@@ -160,11 +160,6 @@ static inline void ceph_decode_timespec(struct timespec *ts,
463 + static inline void ceph_encode_timespec(struct ceph_timespec *tv,
464 + const struct timespec *ts)
465 + {
466 +- BUG_ON(ts->tv_sec < 0);
467 +- BUG_ON(ts->tv_sec > (__kernel_time_t)U32_MAX);
468 +- BUG_ON(ts->tv_nsec < 0);
469 +- BUG_ON(ts->tv_nsec > (long)U32_MAX);
470 +-
471 + tv->tv_sec = cpu_to_le32((u32)ts->tv_sec);
472 + tv->tv_nsec = cpu_to_le32((u32)ts->tv_nsec);
473 + }
474 +diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
475 +index 6b4890f..feaf0c7 100644
476 +--- a/include/linux/hugetlb.h
477 ++++ b/include/linux/hugetlb.h
478 +@@ -358,6 +358,17 @@ static inline int hstate_index(struct hstate *h)
479 + return h - hstates;
480 + }
481 +
482 ++pgoff_t __basepage_index(struct page *page);
483 ++
484 ++/* Return page->index in PAGE_SIZE units */
485 ++static inline pgoff_t basepage_index(struct page *page)
486 ++{
487 ++ if (!PageCompound(page))
488 ++ return page->index;
489 ++
490 ++ return __basepage_index(page);
491 ++}
492 ++
493 + #else /* CONFIG_HUGETLB_PAGE */
494 + struct hstate {};
495 + #define alloc_huge_page_node(h, nid) NULL
496 +@@ -378,6 +389,11 @@ static inline unsigned int pages_per_huge_page(struct hstate *h)
497 + }
498 + #define hstate_index_to_shift(index) 0
499 + #define hstate_index(h) 0
500 ++
501 ++static inline pgoff_t basepage_index(struct page *page)
502 ++{
503 ++ return page->index;
504 ++}
505 + #endif /* CONFIG_HUGETLB_PAGE */
506 +
507 + #endif /* _LINUX_HUGETLB_H */
508 +diff --git a/kernel/futex.c b/kernel/futex.c
509 +index b26dcfc..49dacfb 100644
510 +--- a/kernel/futex.c
511 ++++ b/kernel/futex.c
512 +@@ -61,6 +61,7 @@
513 + #include <linux/nsproxy.h>
514 + #include <linux/ptrace.h>
515 + #include <linux/sched/rt.h>
516 ++#include <linux/hugetlb.h>
517 +
518 + #include <asm/futex.h>
519 +
520 +@@ -365,7 +366,7 @@ again:
521 + } else {
522 + key->both.offset |= FUT_OFF_INODE; /* inode-based key */
523 + key->shared.inode = page_head->mapping->host;
524 +- key->shared.pgoff = page_head->index;
525 ++ key->shared.pgoff = basepage_index(page);
526 + }
527 +
528 + get_futex_key_refs(key);
529 +diff --git a/kernel/module.c b/kernel/module.c
530 +index cab4bce..fa53db8 100644
531 +--- a/kernel/module.c
532 ++++ b/kernel/module.c
533 +@@ -2927,7 +2927,6 @@ static struct module *layout_and_allocate(struct load_info *info, int flags)
534 + {
535 + /* Module within temporary copy. */
536 + struct module *mod;
537 +- Elf_Shdr *pcpusec;
538 + int err;
539 +
540 + mod = setup_load_info(info, flags);
541 +@@ -2942,17 +2941,10 @@ static struct module *layout_and_allocate(struct load_info *info, int flags)
542 + err = module_frob_arch_sections(info->hdr, info->sechdrs,
543 + info->secstrings, mod);
544 + if (err < 0)
545 +- goto out;
546 ++ return ERR_PTR(err);
547 +
548 +- pcpusec = &info->sechdrs[info->index.pcpu];
549 +- if (pcpusec->sh_size) {
550 +- /* We have a special allocation for this section. */
551 +- err = percpu_modalloc(mod,
552 +- pcpusec->sh_size, pcpusec->sh_addralign);
553 +- if (err)
554 +- goto out;
555 +- pcpusec->sh_flags &= ~(unsigned long)SHF_ALLOC;
556 +- }
557 ++ /* We will do a special allocation for per-cpu sections later. */
558 ++ info->sechdrs[info->index.pcpu].sh_flags &= ~(unsigned long)SHF_ALLOC;
559 +
560 + /* Determine total sizes, and put offsets in sh_entsize. For now
561 + this is done generically; there doesn't appear to be any
562 +@@ -2963,17 +2955,22 @@ static struct module *layout_and_allocate(struct load_info *info, int flags)
563 + /* Allocate and move to the final place */
564 + err = move_module(mod, info);
565 + if (err)
566 +- goto free_percpu;
567 ++ return ERR_PTR(err);
568 +
569 + /* Module has been copied to its final place now: return it. */
570 + mod = (void *)info->sechdrs[info->index.mod].sh_addr;
571 + kmemleak_load_module(mod, info);
572 + return mod;
573 ++}
574 +
575 +-free_percpu:
576 +- percpu_modfree(mod);
577 +-out:
578 +- return ERR_PTR(err);
579 ++static int alloc_module_percpu(struct module *mod, struct load_info *info)
580 ++{
581 ++ Elf_Shdr *pcpusec = &info->sechdrs[info->index.pcpu];
582 ++ if (!pcpusec->sh_size)
583 ++ return 0;
584 ++
585 ++ /* We have a special allocation for this section. */
586 ++ return percpu_modalloc(mod, pcpusec->sh_size, pcpusec->sh_addralign);
587 + }
588 +
589 + /* mod is no longer valid after this! */
590 +@@ -3237,6 +3234,11 @@ static int load_module(struct load_info *info, const char __user *uargs,
591 + }
592 + #endif
593 +
594 ++ /* To avoid stressing percpu allocator, do this once we're unique. */
595 ++ err = alloc_module_percpu(mod, info);
596 ++ if (err)
597 ++ goto unlink_mod;
598 ++
599 + /* Now module is in final location, initialize linked lists, etc. */
600 + err = module_unload_init(mod);
601 + if (err)
602 +diff --git a/mm/hugetlb.c b/mm/hugetlb.c
603 +index e2bfbf7..5cf99bf 100644
604 +--- a/mm/hugetlb.c
605 ++++ b/mm/hugetlb.c
606 +@@ -690,6 +690,23 @@ int PageHuge(struct page *page)
607 + }
608 + EXPORT_SYMBOL_GPL(PageHuge);
609 +
610 ++pgoff_t __basepage_index(struct page *page)
611 ++{
612 ++ struct page *page_head = compound_head(page);
613 ++ pgoff_t index = page_index(page_head);
614 ++ unsigned long compound_idx;
615 ++
616 ++ if (!PageHuge(page_head))
617 ++ return page_index(page);
618 ++
619 ++ if (compound_order(page_head) >= MAX_ORDER)
620 ++ compound_idx = page_to_pfn(page) - page_to_pfn(page_head);
621 ++ else
622 ++ compound_idx = page - page_head;
623 ++
624 ++ return (index << compound_order(page_head)) + compound_idx;
625 ++}
626 ++
627 + static struct page *alloc_fresh_huge_page_node(struct hstate *h, int nid)
628 + {
629 + struct page *page;
630 +diff --git a/mm/memcontrol.c b/mm/memcontrol.c
631 +index 1947218..fd79df5 100644
632 +--- a/mm/memcontrol.c
633 ++++ b/mm/memcontrol.c
634 +@@ -6303,8 +6303,6 @@ mem_cgroup_css_online(struct cgroup *cont)
635 + * call __mem_cgroup_free, so return directly
636 + */
637 + mem_cgroup_put(memcg);
638 +- if (parent->use_hierarchy)
639 +- mem_cgroup_put(parent);
640 + }
641 + return error;
642 + }
643 +diff --git a/net/ceph/auth_none.c b/net/ceph/auth_none.c
644 +index 925ca58..8c93fa8 100644
645 +--- a/net/ceph/auth_none.c
646 ++++ b/net/ceph/auth_none.c
647 +@@ -39,6 +39,11 @@ static int should_authenticate(struct ceph_auth_client *ac)
648 + return xi->starting;
649 + }
650 +
651 ++static int build_request(struct ceph_auth_client *ac, void *buf, void *end)
652 ++{
653 ++ return 0;
654 ++}
655 ++
656 + /*
657 + * the generic auth code decode the global_id, and we carry no actual
658 + * authenticate state, so nothing happens here.
659 +@@ -106,6 +111,7 @@ static const struct ceph_auth_client_ops ceph_auth_none_ops = {
660 + .destroy = destroy,
661 + .is_authenticated = is_authenticated,
662 + .should_authenticate = should_authenticate,
663 ++ .build_request = build_request,
664 + .handle_reply = handle_reply,
665 + .create_authorizer = ceph_auth_none_create_authorizer,
666 + .destroy_authorizer = ceph_auth_none_destroy_authorizer,
667
668 Added: genpatches-2.6/trunk/3.10.7/1001_linux-3.10.2.patch
669 ===================================================================
670 --- genpatches-2.6/trunk/3.10.7/1001_linux-3.10.2.patch (rev 0)
671 +++ genpatches-2.6/trunk/3.10.7/1001_linux-3.10.2.patch 2013-08-29 12:09:12 UTC (rev 2497)
672 @@ -0,0 +1,2395 @@
673 +diff --git a/Documentation/parisc/registers b/Documentation/parisc/registers
674 +index dd3cadd..10c7d17 100644
675 +--- a/Documentation/parisc/registers
676 ++++ b/Documentation/parisc/registers
677 +@@ -78,6 +78,14 @@ Shadow Registers used by interruption handler code
678 + TOC enable bit 1
679 +
680 + =========================================================================
681 ++
682 ++The PA-RISC architecture defines 7 registers as "shadow registers".
683 ++Those are used in RETURN FROM INTERRUPTION AND RESTORE instruction to reduce
684 ++the state save and restore time by eliminating the need for general register
685 ++(GR) saves and restores in interruption handlers.
686 ++Shadow registers are the GRs 1, 8, 9, 16, 17, 24, and 25.
687 ++
688 ++=========================================================================
689 + Register usage notes, originally from John Marvin, with some additional
690 + notes from Randolph Chung.
691 +
692 +diff --git a/Makefile b/Makefile
693 +index b75cc30..4336730 100644
694 +--- a/Makefile
695 ++++ b/Makefile
696 +@@ -1,6 +1,6 @@
697 + VERSION = 3
698 + PATCHLEVEL = 10
699 +-SUBLEVEL = 1
700 ++SUBLEVEL = 2
701 + EXTRAVERSION =
702 + NAME = Unicycling Gorilla
703 +
704 +diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
705 +index 73fd7d0..587ceef 100644
706 +--- a/arch/arm/boot/dts/imx23.dtsi
707 ++++ b/arch/arm/boot/dts/imx23.dtsi
708 +@@ -23,8 +23,12 @@
709 + };
710 +
711 + cpus {
712 +- cpu@0 {
713 +- compatible = "arm,arm926ejs";
714 ++ #address-cells = <0>;
715 ++ #size-cells = <0>;
716 ++
717 ++ cpu {
718 ++ compatible = "arm,arm926ej-s";
719 ++ device_type = "cpu";
720 + };
721 + };
722 +
723 +diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
724 +index 600f7cb..4c10a19 100644
725 +--- a/arch/arm/boot/dts/imx28.dtsi
726 ++++ b/arch/arm/boot/dts/imx28.dtsi
727 +@@ -32,8 +32,12 @@
728 + };
729 +
730 + cpus {
731 +- cpu@0 {
732 +- compatible = "arm,arm926ejs";
733 ++ #address-cells = <0>;
734 ++ #size-cells = <0>;
735 ++
736 ++ cpu {
737 ++ compatible = "arm,arm926ej-s";
738 ++ device_type = "cpu";
739 + };
740 + };
741 +
742 +diff --git a/arch/arm/boot/dts/imx6dl.dtsi b/arch/arm/boot/dts/imx6dl.dtsi
743 +index 5bcdf3a..62dc781 100644
744 +--- a/arch/arm/boot/dts/imx6dl.dtsi
745 ++++ b/arch/arm/boot/dts/imx6dl.dtsi
746 +@@ -18,12 +18,14 @@
747 +
748 + cpu@0 {
749 + compatible = "arm,cortex-a9";
750 ++ device_type = "cpu";
751 + reg = <0>;
752 + next-level-cache = <&L2>;
753 + };
754 +
755 + cpu@1 {
756 + compatible = "arm,cortex-a9";
757 ++ device_type = "cpu";
758 + reg = <1>;
759 + next-level-cache = <&L2>;
760 + };
761 +diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi
762 +index 21e6758..dc54a72 100644
763 +--- a/arch/arm/boot/dts/imx6q.dtsi
764 ++++ b/arch/arm/boot/dts/imx6q.dtsi
765 +@@ -18,6 +18,7 @@
766 +
767 + cpu@0 {
768 + compatible = "arm,cortex-a9";
769 ++ device_type = "cpu";
770 + reg = <0>;
771 + next-level-cache = <&L2>;
772 + operating-points = <
773 +@@ -39,18 +40,21 @@
774 +
775 + cpu@1 {
776 + compatible = "arm,cortex-a9";
777 ++ device_type = "cpu";
778 + reg = <1>;
779 + next-level-cache = <&L2>;
780 + };
781 +
782 + cpu@2 {
783 + compatible = "arm,cortex-a9";
784 ++ device_type = "cpu";
785 + reg = <2>;
786 + next-level-cache = <&L2>;
787 + };
788 +
789 + cpu@3 {
790 + compatible = "arm,cortex-a9";
791 ++ device_type = "cpu";
792 + reg = <3>;
793 + next-level-cache = <&L2>;
794 + };
795 +diff --git a/arch/arm/include/asm/mmu_context.h b/arch/arm/include/asm/mmu_context.h
796 +index a7b85e0..dc90203 100644
797 +--- a/arch/arm/include/asm/mmu_context.h
798 ++++ b/arch/arm/include/asm/mmu_context.h
799 +@@ -27,7 +27,15 @@ void __check_vmalloc_seq(struct mm_struct *mm);
800 + void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk);
801 + #define init_new_context(tsk,mm) ({ atomic64_set(&mm->context.id, 0); 0; })
802 +
803 +-DECLARE_PER_CPU(atomic64_t, active_asids);
804 ++#ifdef CONFIG_ARM_ERRATA_798181
805 ++void a15_erratum_get_cpumask(int this_cpu, struct mm_struct *mm,
806 ++ cpumask_t *mask);
807 ++#else /* !CONFIG_ARM_ERRATA_798181 */
808 ++static inline void a15_erratum_get_cpumask(int this_cpu, struct mm_struct *mm,
809 ++ cpumask_t *mask)
810 ++{
811 ++}
812 ++#endif /* CONFIG_ARM_ERRATA_798181 */
813 +
814 + #else /* !CONFIG_CPU_HAS_ASID */
815 +
816 +diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
817 +index 8c3094d..d9f5cd4 100644
818 +--- a/arch/arm/kernel/perf_event.c
819 ++++ b/arch/arm/kernel/perf_event.c
820 +@@ -569,6 +569,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
821 + return;
822 + }
823 +
824 ++ perf_callchain_store(entry, regs->ARM_pc);
825 + tail = (struct frame_tail __user *)regs->ARM_fp - 1;
826 +
827 + while ((entry->nr < PERF_MAX_STACK_DEPTH) &&
828 +diff --git a/arch/arm/kernel/smp_tlb.c b/arch/arm/kernel/smp_tlb.c
829 +index 9a52a07..a98b62d 100644
830 +--- a/arch/arm/kernel/smp_tlb.c
831 ++++ b/arch/arm/kernel/smp_tlb.c
832 +@@ -103,7 +103,7 @@ static void broadcast_tlb_a15_erratum(void)
833 +
834 + static void broadcast_tlb_mm_a15_erratum(struct mm_struct *mm)
835 + {
836 +- int cpu, this_cpu;
837 ++ int this_cpu;
838 + cpumask_t mask = { CPU_BITS_NONE };
839 +
840 + if (!erratum_a15_798181())
841 +@@ -111,21 +111,7 @@ static void broadcast_tlb_mm_a15_erratum(struct mm_struct *mm)
842 +
843 + dummy_flush_tlb_a15_erratum();
844 + this_cpu = get_cpu();
845 +- for_each_online_cpu(cpu) {
846 +- if (cpu == this_cpu)
847 +- continue;
848 +- /*
849 +- * We only need to send an IPI if the other CPUs are running
850 +- * the same ASID as the one being invalidated. There is no
851 +- * need for locking around the active_asids check since the
852 +- * switch_mm() function has at least one dmb() (as required by
853 +- * this workaround) in case a context switch happens on
854 +- * another CPU after the condition below.
855 +- */
856 +- if (atomic64_read(&mm->context.id) ==
857 +- atomic64_read(&per_cpu(active_asids, cpu)))
858 +- cpumask_set_cpu(cpu, &mask);
859 +- }
860 ++ a15_erratum_get_cpumask(this_cpu, mm, &mask);
861 + smp_call_function_many(&mask, ipi_flush_tlb_a15_erratum, NULL, 1);
862 + put_cpu();
863 + }
864 +diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
865 +index 90525d9..f6fd1d4 100644
866 +--- a/arch/arm/kernel/smp_twd.c
867 ++++ b/arch/arm/kernel/smp_twd.c
868 +@@ -120,7 +120,7 @@ static int twd_rate_change(struct notifier_block *nb,
869 + * changing cpu.
870 + */
871 + if (flags == POST_RATE_CHANGE)
872 +- smp_call_function(twd_update_frequency,
873 ++ on_each_cpu(twd_update_frequency,
874 + (void *)&cnd->new_rate, 1);
875 +
876 + return NOTIFY_OK;
877 +diff --git a/arch/arm/mach-shmobile/setup-emev2.c b/arch/arm/mach-shmobile/setup-emev2.c
878 +index 899a86c..1ccddd2 100644
879 +--- a/arch/arm/mach-shmobile/setup-emev2.c
880 ++++ b/arch/arm/mach-shmobile/setup-emev2.c
881 +@@ -287,14 +287,14 @@ static struct gpio_em_config gio3_config = {
882 + static struct resource gio3_resources[] = {
883 + [0] = {
884 + .name = "GIO_096",
885 +- .start = 0xe0050100,
886 +- .end = 0xe005012b,
887 ++ .start = 0xe0050180,
888 ++ .end = 0xe00501ab,
889 + .flags = IORESOURCE_MEM,
890 + },
891 + [1] = {
892 + .name = "GIO_096",
893 +- .start = 0xe0050140,
894 +- .end = 0xe005015f,
895 ++ .start = 0xe00501c0,
896 ++ .end = 0xe00501df,
897 + .flags = IORESOURCE_MEM,
898 + },
899 + [2] = {
900 +diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c
901 +index c5a75a7..7f45c2e 100644
902 +--- a/arch/arm/mach-shmobile/setup-r8a73a4.c
903 ++++ b/arch/arm/mach-shmobile/setup-r8a73a4.c
904 +@@ -62,7 +62,7 @@ enum { SCIFA0, SCIFA1, SCIFB0, SCIFB1, SCIFB2, SCIFB3 };
905 + static const struct plat_sci_port scif[] = {
906 + SCIFA_DATA(SCIFA0, 0xe6c40000, gic_spi(144)), /* SCIFA0 */
907 + SCIFA_DATA(SCIFA1, 0xe6c50000, gic_spi(145)), /* SCIFA1 */
908 +- SCIFB_DATA(SCIFB0, 0xe6c50000, gic_spi(145)), /* SCIFB0 */
909 ++ SCIFB_DATA(SCIFB0, 0xe6c20000, gic_spi(148)), /* SCIFB0 */
910 + SCIFB_DATA(SCIFB1, 0xe6c30000, gic_spi(149)), /* SCIFB1 */
911 + SCIFB_DATA(SCIFB2, 0xe6ce0000, gic_spi(150)), /* SCIFB2 */
912 + SCIFB_DATA(SCIFB3, 0xe6cf0000, gic_spi(151)), /* SCIFB3 */
913 +diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
914 +index 2ac3737..eeab06e 100644
915 +--- a/arch/arm/mm/context.c
916 ++++ b/arch/arm/mm/context.c
917 +@@ -39,19 +39,43 @@
918 + * non 64-bit operations.
919 + */
920 + #define ASID_FIRST_VERSION (1ULL << ASID_BITS)
921 +-#define NUM_USER_ASIDS (ASID_FIRST_VERSION - 1)
922 +-
923 +-#define ASID_TO_IDX(asid) ((asid & ~ASID_MASK) - 1)
924 +-#define IDX_TO_ASID(idx) ((idx + 1) & ~ASID_MASK)
925 ++#define NUM_USER_ASIDS ASID_FIRST_VERSION
926 +
927 + static DEFINE_RAW_SPINLOCK(cpu_asid_lock);
928 + static atomic64_t asid_generation = ATOMIC64_INIT(ASID_FIRST_VERSION);
929 + static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS);
930 +
931 +-DEFINE_PER_CPU(atomic64_t, active_asids);
932 ++static DEFINE_PER_CPU(atomic64_t, active_asids);
933 + static DEFINE_PER_CPU(u64, reserved_asids);
934 + static cpumask_t tlb_flush_pending;
935 +
936 ++#ifdef CONFIG_ARM_ERRATA_798181
937 ++void a15_erratum_get_cpumask(int this_cpu, struct mm_struct *mm,
938 ++ cpumask_t *mask)
939 ++{
940 ++ int cpu;
941 ++ unsigned long flags;
942 ++ u64 context_id, asid;
943 ++
944 ++ raw_spin_lock_irqsave(&cpu_asid_lock, flags);
945 ++ context_id = mm->context.id.counter;
946 ++ for_each_online_cpu(cpu) {
947 ++ if (cpu == this_cpu)
948 ++ continue;
949 ++ /*
950 ++ * We only need to send an IPI if the other CPUs are
951 ++ * running the same ASID as the one being invalidated.
952 ++ */
953 ++ asid = per_cpu(active_asids, cpu).counter;
954 ++ if (asid == 0)
955 ++ asid = per_cpu(reserved_asids, cpu);
956 ++ if (context_id == asid)
957 ++ cpumask_set_cpu(cpu, mask);
958 ++ }
959 ++ raw_spin_unlock_irqrestore(&cpu_asid_lock, flags);
960 ++}
961 ++#endif
962 ++
963 + #ifdef CONFIG_ARM_LPAE
964 + static void cpu_set_reserved_ttbr0(void)
965 + {
966 +@@ -128,7 +152,16 @@ static void flush_context(unsigned int cpu)
967 + asid = 0;
968 + } else {
969 + asid = atomic64_xchg(&per_cpu(active_asids, i), 0);
970 +- __set_bit(ASID_TO_IDX(asid), asid_map);
971 ++ /*
972 ++ * If this CPU has already been through a
973 ++ * rollover, but hasn't run another task in
974 ++ * the meantime, we must preserve its reserved
975 ++ * ASID, as this is the only trace we have of
976 ++ * the process it is still running.
977 ++ */
978 ++ if (asid == 0)
979 ++ asid = per_cpu(reserved_asids, i);
980 ++ __set_bit(asid & ~ASID_MASK, asid_map);
981 + }
982 + per_cpu(reserved_asids, i) = asid;
983 + }
984 +@@ -167,17 +200,19 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)
985 + /*
986 + * Allocate a free ASID. If we can't find one, take a
987 + * note of the currently active ASIDs and mark the TLBs
988 +- * as requiring flushes.
989 ++ * as requiring flushes. We always count from ASID #1,
990 ++ * as we reserve ASID #0 to switch via TTBR0 and indicate
991 ++ * rollover events.
992 + */
993 +- asid = find_first_zero_bit(asid_map, NUM_USER_ASIDS);
994 ++ asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, 1);
995 + if (asid == NUM_USER_ASIDS) {
996 + generation = atomic64_add_return(ASID_FIRST_VERSION,
997 + &asid_generation);
998 + flush_context(cpu);
999 +- asid = find_first_zero_bit(asid_map, NUM_USER_ASIDS);
1000 ++ asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, 1);
1001 + }
1002 + __set_bit(asid, asid_map);
1003 +- asid = generation | IDX_TO_ASID(asid);
1004 ++ asid |= generation;
1005 + cpumask_clear(mm_cpumask(mm));
1006 + }
1007 +
1008 +diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
1009 +index 9a5cdc0..0ecc43f 100644
1010 +--- a/arch/arm/mm/init.c
1011 ++++ b/arch/arm/mm/init.c
1012 +@@ -600,7 +600,7 @@ void __init mem_init(void)
1013 +
1014 + #ifdef CONFIG_SA1111
1015 + /* now that our DMA memory is actually so designated, we can free it */
1016 +- free_reserved_area(__va(PHYS_PFN_OFFSET), swapper_pg_dir, 0, NULL);
1017 ++ free_reserved_area(__va(PHYS_OFFSET), swapper_pg_dir, 0, NULL);
1018 + #endif
1019 +
1020 + free_highpages();
1021 +diff --git a/arch/c6x/mm/init.c b/arch/c6x/mm/init.c
1022 +index a9fcd89..b74ccb5 100644
1023 +--- a/arch/c6x/mm/init.c
1024 ++++ b/arch/c6x/mm/init.c
1025 +@@ -18,6 +18,7 @@
1026 + #include <linux/initrd.h>
1027 +
1028 + #include <asm/sections.h>
1029 ++#include <asm/uaccess.h>
1030 +
1031 + /*
1032 + * ZERO_PAGE is a special page that is used for zero-initialized
1033 +diff --git a/arch/parisc/include/asm/special_insns.h b/arch/parisc/include/asm/special_insns.h
1034 +index d306b75..e150930 100644
1035 +--- a/arch/parisc/include/asm/special_insns.h
1036 ++++ b/arch/parisc/include/asm/special_insns.h
1037 +@@ -32,9 +32,12 @@ static inline void set_eiem(unsigned long val)
1038 + cr; \
1039 + })
1040 +
1041 +-#define mtsp(gr, cr) \
1042 +- __asm__ __volatile__("mtsp %0,%1" \
1043 ++#define mtsp(val, cr) \
1044 ++ { if (__builtin_constant_p(val) && ((val) == 0)) \
1045 ++ __asm__ __volatile__("mtsp %%r0,%0" : : "i" (cr) : "memory"); \
1046 ++ else \
1047 ++ __asm__ __volatile__("mtsp %0,%1" \
1048 + : /* no outputs */ \
1049 +- : "r" (gr), "i" (cr) : "memory")
1050 ++ : "r" (val), "i" (cr) : "memory"); }
1051 +
1052 + #endif /* __PARISC_SPECIAL_INSNS_H */
1053 +diff --git a/arch/parisc/include/asm/tlbflush.h b/arch/parisc/include/asm/tlbflush.h
1054 +index 5273da9..9d086a5 100644
1055 +--- a/arch/parisc/include/asm/tlbflush.h
1056 ++++ b/arch/parisc/include/asm/tlbflush.h
1057 +@@ -63,13 +63,14 @@ static inline void flush_tlb_mm(struct mm_struct *mm)
1058 + static inline void flush_tlb_page(struct vm_area_struct *vma,
1059 + unsigned long addr)
1060 + {
1061 +- unsigned long flags;
1062 ++ unsigned long flags, sid;
1063 +
1064 + /* For one page, it's not worth testing the split_tlb variable */
1065 +
1066 + mb();
1067 +- mtsp(vma->vm_mm->context,1);
1068 ++ sid = vma->vm_mm->context;
1069 + purge_tlb_start(flags);
1070 ++ mtsp(sid, 1);
1071 + pdtlb(addr);
1072 + pitlb(addr);
1073 + purge_tlb_end(flags);
1074 +diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
1075 +index 65fb4cb..2e65aa5 100644
1076 +--- a/arch/parisc/kernel/cache.c
1077 ++++ b/arch/parisc/kernel/cache.c
1078 +@@ -440,8 +440,8 @@ void __flush_tlb_range(unsigned long sid, unsigned long start,
1079 + else {
1080 + unsigned long flags;
1081 +
1082 +- mtsp(sid, 1);
1083 + purge_tlb_start(flags);
1084 ++ mtsp(sid, 1);
1085 + if (split_tlb) {
1086 + while (npages--) {
1087 + pdtlb(start);
1088 +diff --git a/arch/parisc/lib/memcpy.c b/arch/parisc/lib/memcpy.c
1089 +index a49cc81..ac4370b 100644
1090 +--- a/arch/parisc/lib/memcpy.c
1091 ++++ b/arch/parisc/lib/memcpy.c
1092 +@@ -2,6 +2,7 @@
1093 + * Optimized memory copy routines.
1094 + *
1095 + * Copyright (C) 2004 Randolph Chung <tausq@××××××.org>
1096 ++ * Copyright (C) 2013 Helge Deller <deller@×××.de>
1097 + *
1098 + * This program is free software; you can redistribute it and/or modify
1099 + * it under the terms of the GNU General Public License as published by
1100 +@@ -153,17 +154,21 @@ static inline void prefetch_dst(const void *addr)
1101 + #define prefetch_dst(addr) do { } while(0)
1102 + #endif
1103 +
1104 ++#define PA_MEMCPY_OK 0
1105 ++#define PA_MEMCPY_LOAD_ERROR 1
1106 ++#define PA_MEMCPY_STORE_ERROR 2
1107 ++
1108 + /* Copy from a not-aligned src to an aligned dst, using shifts. Handles 4 words
1109 + * per loop. This code is derived from glibc.
1110 + */
1111 +-static inline unsigned long copy_dstaligned(unsigned long dst, unsigned long src, unsigned long len, unsigned long o_dst, unsigned long o_src, unsigned long o_len)
1112 ++static inline unsigned long copy_dstaligned(unsigned long dst,
1113 ++ unsigned long src, unsigned long len)
1114 + {
1115 + /* gcc complains that a2 and a3 may be uninitialized, but actually
1116 + * they cannot be. Initialize a2/a3 to shut gcc up.
1117 + */
1118 + register unsigned int a0, a1, a2 = 0, a3 = 0;
1119 + int sh_1, sh_2;
1120 +- struct exception_data *d;
1121 +
1122 + /* prefetch_src((const void *)src); */
1123 +
1124 +@@ -197,7 +202,7 @@ static inline unsigned long copy_dstaligned(unsigned long dst, unsigned long src
1125 + goto do2;
1126 + case 0:
1127 + if (len == 0)
1128 +- return 0;
1129 ++ return PA_MEMCPY_OK;
1130 + /* a3 = ((unsigned int *) src)[0];
1131 + a0 = ((unsigned int *) src)[1]; */
1132 + ldw(s_space, 0, src, a3, cda_ldw_exc);
1133 +@@ -256,42 +261,35 @@ do0:
1134 + preserve_branch(handle_load_error);
1135 + preserve_branch(handle_store_error);
1136 +
1137 +- return 0;
1138 ++ return PA_MEMCPY_OK;
1139 +
1140 + handle_load_error:
1141 + __asm__ __volatile__ ("cda_ldw_exc:\n");
1142 +- d = &__get_cpu_var(exception_data);
1143 +- DPRINTF("cda_ldw_exc: o_len=%lu fault_addr=%lu o_src=%lu ret=%lu\n",
1144 +- o_len, d->fault_addr, o_src, o_len - d->fault_addr + o_src);
1145 +- return o_len * 4 - d->fault_addr + o_src;
1146 ++ return PA_MEMCPY_LOAD_ERROR;
1147 +
1148 + handle_store_error:
1149 + __asm__ __volatile__ ("cda_stw_exc:\n");
1150 +- d = &__get_cpu_var(exception_data);
1151 +- DPRINTF("cda_stw_exc: o_len=%lu fault_addr=%lu o_dst=%lu ret=%lu\n",
1152 +- o_len, d->fault_addr, o_dst, o_len - d->fault_addr + o_dst);
1153 +- return o_len * 4 - d->fault_addr + o_dst;
1154 ++ return PA_MEMCPY_STORE_ERROR;
1155 + }
1156 +
1157 +
1158 +-/* Returns 0 for success, otherwise, returns number of bytes not transferred. */
1159 +-static unsigned long pa_memcpy(void *dstp, const void *srcp, unsigned long len)
1160 ++/* Returns PA_MEMCPY_OK, PA_MEMCPY_LOAD_ERROR or PA_MEMCPY_STORE_ERROR.
1161 ++ * In case of an access fault the faulty address can be read from the per_cpu
1162 ++ * exception data struct. */
1163 ++static unsigned long pa_memcpy_internal(void *dstp, const void *srcp,
1164 ++ unsigned long len)
1165 + {
1166 + register unsigned long src, dst, t1, t2, t3;
1167 + register unsigned char *pcs, *pcd;
1168 + register unsigned int *pws, *pwd;
1169 + register double *pds, *pdd;
1170 +- unsigned long ret = 0;
1171 +- unsigned long o_dst, o_src, o_len;
1172 +- struct exception_data *d;
1173 ++ unsigned long ret;
1174 +
1175 + src = (unsigned long)srcp;
1176 + dst = (unsigned long)dstp;
1177 + pcs = (unsigned char *)srcp;
1178 + pcd = (unsigned char *)dstp;
1179 +
1180 +- o_dst = dst; o_src = src; o_len = len;
1181 +-
1182 + /* prefetch_src((const void *)srcp); */
1183 +
1184 + if (len < THRESHOLD)
1185 +@@ -401,7 +399,7 @@ byte_copy:
1186 + len--;
1187 + }
1188 +
1189 +- return 0;
1190 ++ return PA_MEMCPY_OK;
1191 +
1192 + unaligned_copy:
1193 + /* possibly we are aligned on a word, but not on a double... */
1194 +@@ -438,8 +436,7 @@ unaligned_copy:
1195 + src = (unsigned long)pcs;
1196 + }
1197 +
1198 +- ret = copy_dstaligned(dst, src, len / sizeof(unsigned int),
1199 +- o_dst, o_src, o_len);
1200 ++ ret = copy_dstaligned(dst, src, len / sizeof(unsigned int));
1201 + if (ret)
1202 + return ret;
1203 +
1204 +@@ -454,17 +451,41 @@ unaligned_copy:
1205 +
1206 + handle_load_error:
1207 + __asm__ __volatile__ ("pmc_load_exc:\n");
1208 +- d = &__get_cpu_var(exception_data);
1209 +- DPRINTF("pmc_load_exc: o_len=%lu fault_addr=%lu o_src=%lu ret=%lu\n",
1210 +- o_len, d->fault_addr, o_src, o_len - d->fault_addr + o_src);
1211 +- return o_len - d->fault_addr + o_src;
1212 ++ return PA_MEMCPY_LOAD_ERROR;
1213 +
1214 + handle_store_error:
1215 + __asm__ __volatile__ ("pmc_store_exc:\n");
1216 ++ return PA_MEMCPY_STORE_ERROR;
1217 ++}
1218 ++
1219 ++
1220 ++/* Returns 0 for success, otherwise, returns number of bytes not transferred. */
1221 ++static unsigned long pa_memcpy(void *dstp, const void *srcp, unsigned long len)
1222 ++{
1223 ++ unsigned long ret, fault_addr, reference;
1224 ++ struct exception_data *d;
1225 ++
1226 ++ ret = pa_memcpy_internal(dstp, srcp, len);
1227 ++ if (likely(ret == PA_MEMCPY_OK))
1228 ++ return 0;
1229 ++
1230 ++ /* if a load or store fault occured we can get the faulty addr */
1231 + d = &__get_cpu_var(exception_data);
1232 +- DPRINTF("pmc_store_exc: o_len=%lu fault_addr=%lu o_dst=%lu ret=%lu\n",
1233 +- o_len, d->fault_addr, o_dst, o_len - d->fault_addr + o_dst);
1234 +- return o_len - d->fault_addr + o_dst;
1235 ++ fault_addr = d->fault_addr;
1236 ++
1237 ++ /* error in load or store? */
1238 ++ if (ret == PA_MEMCPY_LOAD_ERROR)
1239 ++ reference = (unsigned long) srcp;
1240 ++ else
1241 ++ reference = (unsigned long) dstp;
1242 ++
1243 ++ DPRINTF("pa_memcpy: fault type = %lu, len=%lu fault_addr=%lu ref=%lu\n",
1244 ++ ret, len, fault_addr, reference);
1245 ++
1246 ++ if (fault_addr >= reference)
1247 ++ return len - (fault_addr - reference);
1248 ++ else
1249 ++ return len;
1250 + }
1251 +
1252 + #ifdef __KERNEL__
1253 +diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
1254 +index c205035..d606463 100644
1255 +--- a/arch/x86/boot/compressed/eboot.c
1256 ++++ b/arch/x86/boot/compressed/eboot.c
1257 +@@ -992,18 +992,20 @@ static efi_status_t exit_boot(struct boot_params *boot_params,
1258 + efi_memory_desc_t *mem_map;
1259 + efi_status_t status;
1260 + __u32 desc_version;
1261 ++ bool called_exit = false;
1262 + u8 nr_entries;
1263 + int i;
1264 +
1265 + size = sizeof(*mem_map) * 32;
1266 +
1267 + again:
1268 +- size += sizeof(*mem_map);
1269 ++ size += sizeof(*mem_map) * 2;
1270 + _size = size;
1271 + status = low_alloc(size, 1, (unsigned long *)&mem_map);
1272 + if (status != EFI_SUCCESS)
1273 + return status;
1274 +
1275 ++get_map:
1276 + status = efi_call_phys5(sys_table->boottime->get_memory_map, &size,
1277 + mem_map, &key, &desc_size, &desc_version);
1278 + if (status == EFI_BUFFER_TOO_SMALL) {
1279 +@@ -1029,8 +1031,20 @@ again:
1280 + /* Might as well exit boot services now */
1281 + status = efi_call_phys2(sys_table->boottime->exit_boot_services,
1282 + handle, key);
1283 +- if (status != EFI_SUCCESS)
1284 +- goto free_mem_map;
1285 ++ if (status != EFI_SUCCESS) {
1286 ++ /*
1287 ++ * ExitBootServices() will fail if any of the event
1288 ++ * handlers change the memory map. In which case, we
1289 ++ * must be prepared to retry, but only once so that
1290 ++ * we're guaranteed to exit on repeated failures instead
1291 ++ * of spinning forever.
1292 ++ */
1293 ++ if (called_exit)
1294 ++ goto free_mem_map;
1295 ++
1296 ++ called_exit = true;
1297 ++ goto get_map;
1298 ++ }
1299 +
1300 + /* Historic? */
1301 + boot_params->alt_mem_k = 32 * 1024;
1302 +diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
1303 +index 3d88bfd..13e8935 100644
1304 +--- a/arch/x86/xen/time.c
1305 ++++ b/arch/x86/xen/time.c
1306 +@@ -36,9 +36,8 @@ static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate);
1307 + /* snapshots of runstate info */
1308 + static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot);
1309 +
1310 +-/* unused ns of stolen and blocked time */
1311 ++/* unused ns of stolen time */
1312 + static DEFINE_PER_CPU(u64, xen_residual_stolen);
1313 +-static DEFINE_PER_CPU(u64, xen_residual_blocked);
1314 +
1315 + /* return an consistent snapshot of 64-bit time/counter value */
1316 + static u64 get64(const u64 *p)
1317 +@@ -115,7 +114,7 @@ static void do_stolen_accounting(void)
1318 + {
1319 + struct vcpu_runstate_info state;
1320 + struct vcpu_runstate_info *snap;
1321 +- s64 blocked, runnable, offline, stolen;
1322 ++ s64 runnable, offline, stolen;
1323 + cputime_t ticks;
1324 +
1325 + get_runstate_snapshot(&state);
1326 +@@ -125,7 +124,6 @@ static void do_stolen_accounting(void)
1327 + snap = &__get_cpu_var(xen_runstate_snapshot);
1328 +
1329 + /* work out how much time the VCPU has not been runn*ing* */
1330 +- blocked = state.time[RUNSTATE_blocked] - snap->time[RUNSTATE_blocked];
1331 + runnable = state.time[RUNSTATE_runnable] - snap->time[RUNSTATE_runnable];
1332 + offline = state.time[RUNSTATE_offline] - snap->time[RUNSTATE_offline];
1333 +
1334 +@@ -141,17 +139,6 @@ static void do_stolen_accounting(void)
1335 + ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen);
1336 + __this_cpu_write(xen_residual_stolen, stolen);
1337 + account_steal_ticks(ticks);
1338 +-
1339 +- /* Add the appropriate number of ticks of blocked time,
1340 +- including any left-overs from last time. */
1341 +- blocked += __this_cpu_read(xen_residual_blocked);
1342 +-
1343 +- if (blocked < 0)
1344 +- blocked = 0;
1345 +-
1346 +- ticks = iter_div_u64_rem(blocked, NS_PER_TICK, &blocked);
1347 +- __this_cpu_write(xen_residual_blocked, blocked);
1348 +- account_idle_ticks(ticks);
1349 + }
1350 +
1351 + /* Get the TSC speed from Xen */
1352 +diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
1353 +index 536562c..97c949a 100644
1354 +--- a/drivers/acpi/Makefile
1355 ++++ b/drivers/acpi/Makefile
1356 +@@ -43,6 +43,7 @@ acpi-y += acpi_platform.o
1357 + acpi-y += power.o
1358 + acpi-y += event.o
1359 + acpi-y += sysfs.o
1360 ++acpi-$(CONFIG_X86) += acpi_cmos_rtc.o
1361 + acpi-$(CONFIG_DEBUG_FS) += debugfs.o
1362 + acpi-$(CONFIG_ACPI_NUMA) += numa.o
1363 + acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
1364 +diff --git a/drivers/acpi/acpi_cmos_rtc.c b/drivers/acpi/acpi_cmos_rtc.c
1365 +new file mode 100644
1366 +index 0000000..84190ed
1367 +--- /dev/null
1368 ++++ b/drivers/acpi/acpi_cmos_rtc.c
1369 +@@ -0,0 +1,92 @@
1370 ++/*
1371 ++ * ACPI support for CMOS RTC Address Space access
1372 ++ *
1373 ++ * Copyright (C) 2013, Intel Corporation
1374 ++ * Authors: Lan Tianyu <tianyu.lan@×××××.com>
1375 ++ *
1376 ++ * This program is free software; you can redistribute it and/or modify
1377 ++ * it under the terms of the GNU General Public License version 2 as
1378 ++ * published by the Free Software Foundation.
1379 ++ */
1380 ++
1381 ++#include <linux/acpi.h>
1382 ++#include <linux/device.h>
1383 ++#include <linux/err.h>
1384 ++#include <linux/kernel.h>
1385 ++#include <linux/module.h>
1386 ++#include <asm-generic/rtc.h>
1387 ++
1388 ++#include "internal.h"
1389 ++
1390 ++#define PREFIX "ACPI: "
1391 ++
1392 ++ACPI_MODULE_NAME("cmos rtc");
1393 ++
1394 ++static const struct acpi_device_id acpi_cmos_rtc_ids[] = {
1395 ++ { "PNP0B00" },
1396 ++ { "PNP0B01" },
1397 ++ { "PNP0B02" },
1398 ++ {}
1399 ++};
1400 ++
1401 ++static acpi_status
1402 ++acpi_cmos_rtc_space_handler(u32 function, acpi_physical_address address,
1403 ++ u32 bits, u64 *value64,
1404 ++ void *handler_context, void *region_context)
1405 ++{
1406 ++ int i;
1407 ++ u8 *value = (u8 *)&value64;
1408 ++
1409 ++ if (address > 0xff || !value64)
1410 ++ return AE_BAD_PARAMETER;
1411 ++
1412 ++ if (function != ACPI_WRITE && function != ACPI_READ)
1413 ++ return AE_BAD_PARAMETER;
1414 ++
1415 ++ spin_lock_irq(&rtc_lock);
1416 ++
1417 ++ for (i = 0; i < DIV_ROUND_UP(bits, 8); ++i, ++address, ++value)
1418 ++ if (function == ACPI_READ)
1419 ++ *value = CMOS_READ(address);
1420 ++ else
1421 ++ CMOS_WRITE(*value, address);
1422 ++
1423 ++ spin_unlock_irq(&rtc_lock);
1424 ++
1425 ++ return AE_OK;
1426 ++}
1427 ++
1428 ++static int acpi_install_cmos_rtc_space_handler(struct acpi_device *adev,
1429 ++ const struct acpi_device_id *id)
1430 ++{
1431 ++ acpi_status status;
1432 ++
1433 ++ status = acpi_install_address_space_handler(adev->handle,
1434 ++ ACPI_ADR_SPACE_CMOS,
1435 ++ &acpi_cmos_rtc_space_handler,
1436 ++ NULL, NULL);
1437 ++ if (ACPI_FAILURE(status)) {
1438 ++ pr_err(PREFIX "Error installing CMOS-RTC region handler\n");
1439 ++ return -ENODEV;
1440 ++ }
1441 ++
1442 ++ return 0;
1443 ++}
1444 ++
1445 ++static void acpi_remove_cmos_rtc_space_handler(struct acpi_device *adev)
1446 ++{
1447 ++ if (ACPI_FAILURE(acpi_remove_address_space_handler(adev->handle,
1448 ++ ACPI_ADR_SPACE_CMOS, &acpi_cmos_rtc_space_handler)))
1449 ++ pr_err(PREFIX "Error removing CMOS-RTC region handler\n");
1450 ++}
1451 ++
1452 ++static struct acpi_scan_handler cmos_rtc_handler = {
1453 ++ .ids = acpi_cmos_rtc_ids,
1454 ++ .attach = acpi_install_cmos_rtc_space_handler,
1455 ++ .detach = acpi_remove_cmos_rtc_space_handler,
1456 ++};
1457 ++
1458 ++void __init acpi_cmos_rtc_init(void)
1459 ++{
1460 ++ acpi_scan_add_handler(&cmos_rtc_handler);
1461 ++}
1462 +diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
1463 +index 35eebda..09b06e2 100644
1464 +--- a/drivers/acpi/acpica/hwxfsleep.c
1465 ++++ b/drivers/acpi/acpica/hwxfsleep.c
1466 +@@ -240,12 +240,14 @@ static acpi_status acpi_hw_sleep_dispatch(u8 sleep_state, u32 function_id)
1467 + &acpi_sleep_dispatch[function_id];
1468 +
1469 + #if (!ACPI_REDUCED_HARDWARE)
1470 +-
1471 + /*
1472 + * If the Hardware Reduced flag is set (from the FADT), we must
1473 +- * use the extended sleep registers
1474 ++ * use the extended sleep registers (FADT). Note: As per the ACPI
1475 ++ * specification, these extended registers are to be used for HW-reduced
1476 ++ * platforms only. They are not general-purpose replacements for the
1477 ++ * legacy PM register sleep support.
1478 + */
1479 +- if (acpi_gbl_reduced_hardware || acpi_gbl_FADT.sleep_control.address) {
1480 ++ if (acpi_gbl_reduced_hardware) {
1481 + status = sleep_functions->extended_function(sleep_state);
1482 + } else {
1483 + /* Legacy sleep */
1484 +diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
1485 +index 31c217a..553527c 100644
1486 +--- a/drivers/acpi/device_pm.c
1487 ++++ b/drivers/acpi/device_pm.c
1488 +@@ -324,14 +324,27 @@ int acpi_bus_update_power(acpi_handle handle, int *state_p)
1489 + if (result)
1490 + return result;
1491 +
1492 +- if (state == ACPI_STATE_UNKNOWN)
1493 ++ if (state == ACPI_STATE_UNKNOWN) {
1494 + state = ACPI_STATE_D0;
1495 +-
1496 +- result = acpi_device_set_power(device, state);
1497 +- if (!result && state_p)
1498 ++ result = acpi_device_set_power(device, state);
1499 ++ if (result)
1500 ++ return result;
1501 ++ } else {
1502 ++ if (device->power.flags.power_resources) {
1503 ++ /*
1504 ++ * We don't need to really switch the state, bu we need
1505 ++ * to update the power resources' reference counters.
1506 ++ */
1507 ++ result = acpi_power_transition(device, state);
1508 ++ if (result)
1509 ++ return result;
1510 ++ }
1511 ++ device->power.state = state;
1512 ++ }
1513 ++ if (state_p)
1514 + *state_p = state;
1515 +
1516 +- return result;
1517 ++ return 0;
1518 + }
1519 + EXPORT_SYMBOL_GPL(acpi_bus_update_power);
1520 +
1521 +diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
1522 +index edc0081..80403c1 100644
1523 +--- a/drivers/acpi/ec.c
1524 ++++ b/drivers/acpi/ec.c
1525 +@@ -983,6 +983,10 @@ static struct dmi_system_id __initdata ec_dmi_table[] = {
1526 + ec_enlarge_storm_threshold, "CLEVO hardware", {
1527 + DMI_MATCH(DMI_SYS_VENDOR, "CLEVO Co."),
1528 + DMI_MATCH(DMI_PRODUCT_NAME, "M720T/M730T"),}, NULL},
1529 ++ {
1530 ++ ec_skip_dsdt_scan, "HP Folio 13", {
1531 ++ DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
1532 ++ DMI_MATCH(DMI_PRODUCT_NAME, "HP Folio 13"),}, NULL},
1533 + {},
1534 + };
1535 +
1536 +diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
1537 +index c610a76..63a0854 100644
1538 +--- a/drivers/acpi/internal.h
1539 ++++ b/drivers/acpi/internal.h
1540 +@@ -50,6 +50,11 @@ void acpi_memory_hotplug_init(void);
1541 + #else
1542 + static inline void acpi_memory_hotplug_init(void) {}
1543 + #endif
1544 ++#ifdef CONFIG_X86
1545 ++void acpi_cmos_rtc_init(void);
1546 ++#else
1547 ++static inline void acpi_cmos_rtc_init(void) {}
1548 ++#endif
1549 +
1550 + void acpi_sysfs_add_hotplug_profile(struct acpi_hotplug_profile *hotplug,
1551 + const char *name);
1552 +diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
1553 +index 27da630..14807e5 100644
1554 +--- a/drivers/acpi/scan.c
1555 ++++ b/drivers/acpi/scan.c
1556 +@@ -2040,6 +2040,7 @@ int __init acpi_scan_init(void)
1557 + acpi_pci_link_init();
1558 + acpi_platform_init();
1559 + acpi_lpss_init();
1560 ++ acpi_cmos_rtc_init();
1561 + acpi_container_init();
1562 + acpi_memory_hotplug_init();
1563 + acpi_dock_init();
1564 +diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
1565 +index 2b50dfd..b112625 100644
1566 +--- a/drivers/ata/ahci.c
1567 ++++ b/drivers/ata/ahci.c
1568 +@@ -291,6 +291,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
1569 + { PCI_VDEVICE(INTEL, 0x8d64), board_ahci }, /* Wellsburg RAID */
1570 + { PCI_VDEVICE(INTEL, 0x8d66), board_ahci }, /* Wellsburg RAID */
1571 + { PCI_VDEVICE(INTEL, 0x8d6e), board_ahci }, /* Wellsburg RAID */
1572 ++ { PCI_VDEVICE(INTEL, 0x23a3), board_ahci }, /* Coleto Creek AHCI */
1573 +
1574 + /* JMicron 360/1/3/5/6, match class to avoid IDE function */
1575 + { PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
1576 +@@ -310,6 +311,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
1577 +
1578 + /* AMD */
1579 + { PCI_VDEVICE(AMD, 0x7800), board_ahci }, /* AMD Hudson-2 */
1580 ++ { PCI_VDEVICE(AMD, 0x7900), board_ahci }, /* AMD CZ */
1581 + /* AMD is using RAID class only for ahci controllers */
1582 + { PCI_VENDOR_ID_AMD, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
1583 + PCI_CLASS_STORAGE_RAID << 8, 0xffffff, board_ahci },
1584 +diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
1585 +index a70ff15..7b9bdd8 100644
1586 +--- a/drivers/ata/libahci.c
1587 ++++ b/drivers/ata/libahci.c
1588 +@@ -1560,8 +1560,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
1589 + u32 fbs = readl(port_mmio + PORT_FBS);
1590 + int pmp = fbs >> PORT_FBS_DWE_OFFSET;
1591 +
1592 +- if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links) &&
1593 +- ata_link_online(&ap->pmp_link[pmp])) {
1594 ++ if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links)) {
1595 + link = &ap->pmp_link[pmp];
1596 + fbs_need_dec = true;
1597 + }
1598 +diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
1599 +index 46b35f7..cf1576d 100644
1600 +--- a/drivers/block/nbd.c
1601 ++++ b/drivers/block/nbd.c
1602 +@@ -623,8 +623,10 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
1603 + if (!nbd->sock)
1604 + return -EINVAL;
1605 +
1606 ++ nbd->disconnect = 1;
1607 ++
1608 + nbd_send_req(nbd, &sreq);
1609 +- return 0;
1610 ++ return 0;
1611 + }
1612 +
1613 + case NBD_CLEAR_SOCK: {
1614 +@@ -654,6 +656,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
1615 + nbd->sock = SOCKET_I(inode);
1616 + if (max_part > 0)
1617 + bdev->bd_invalidated = 1;
1618 ++ nbd->disconnect = 0; /* we're connected now */
1619 + return 0;
1620 + } else {
1621 + fput(file);
1622 +@@ -743,6 +746,8 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
1623 + set_capacity(nbd->disk, 0);
1624 + if (max_part > 0)
1625 + ioctl_by_bdev(bdev, BLKRRPART, 0);
1626 ++ if (nbd->disconnect) /* user requested, ignore socket errors */
1627 ++ return 0;
1628 + return nbd->harderror;
1629 + }
1630 +
1631 +diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
1632 +index a17553f..7ec82f0 100644
1633 +--- a/drivers/dma/pl330.c
1634 ++++ b/drivers/dma/pl330.c
1635 +@@ -2485,10 +2485,10 @@ static void pl330_free_chan_resources(struct dma_chan *chan)
1636 + struct dma_pl330_chan *pch = to_pchan(chan);
1637 + unsigned long flags;
1638 +
1639 +- spin_lock_irqsave(&pch->lock, flags);
1640 +-
1641 + tasklet_kill(&pch->task);
1642 +
1643 ++ spin_lock_irqsave(&pch->lock, flags);
1644 ++
1645 + pl330_release_channel(pch->pl330_chid);
1646 + pch->pl330_chid = NULL;
1647 +
1648 +diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
1649 +index feae88b..c7710b5 100644
1650 +--- a/drivers/hid/hid-apple.c
1651 ++++ b/drivers/hid/hid-apple.c
1652 +@@ -524,6 +524,12 @@ static const struct hid_device_id apple_devices[] = {
1653 + .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
1654 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS),
1655 + .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
1656 ++ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI),
1657 ++ .driver_data = APPLE_HAS_FN },
1658 ++ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO),
1659 ++ .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
1660 ++ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS),
1661 ++ .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
1662 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
1663 + .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
1664 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
1665 +diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
1666 +index 264f550..402f486 100644
1667 +--- a/drivers/hid/hid-core.c
1668 ++++ b/drivers/hid/hid-core.c
1669 +@@ -1547,6 +1547,9 @@ static const struct hid_device_id hid_have_special_driver[] = {
1670 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) },
1671 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) },
1672 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) },
1673 ++ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI) },
1674 ++ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO) },
1675 ++ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS) },
1676 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) },
1677 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) },
1678 + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
1679 +@@ -2179,6 +2182,9 @@ static const struct hid_device_id hid_mouse_ignore_list[] = {
1680 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) },
1681 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) },
1682 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) },
1683 ++ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI) },
1684 ++ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO) },
1685 ++ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS) },
1686 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
1687 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
1688 + { }
1689 +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
1690 +index 38535c9..2168885 100644
1691 +--- a/drivers/hid/hid-ids.h
1692 ++++ b/drivers/hid/hid-ids.h
1693 +@@ -135,6 +135,9 @@
1694 + #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b
1695 + #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI 0x0255
1696 + #define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO 0x0256
1697 ++#define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0291
1698 ++#define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0292
1699 ++#define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0293
1700 + #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a
1701 + #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b
1702 + #define USB_DEVICE_ID_APPLE_IRCONTROL 0x8240
1703 +diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
1704 +index d6fbb577..791f45d 100644
1705 +--- a/drivers/hv/ring_buffer.c
1706 ++++ b/drivers/hv/ring_buffer.c
1707 +@@ -32,7 +32,7 @@
1708 + void hv_begin_read(struct hv_ring_buffer_info *rbi)
1709 + {
1710 + rbi->ring_buffer->interrupt_mask = 1;
1711 +- smp_mb();
1712 ++ mb();
1713 + }
1714 +
1715 + u32 hv_end_read(struct hv_ring_buffer_info *rbi)
1716 +@@ -41,7 +41,7 @@ u32 hv_end_read(struct hv_ring_buffer_info *rbi)
1717 + u32 write;
1718 +
1719 + rbi->ring_buffer->interrupt_mask = 0;
1720 +- smp_mb();
1721 ++ mb();
1722 +
1723 + /*
1724 + * Now check to see if the ring buffer is still empty.
1725 +@@ -71,7 +71,7 @@ u32 hv_end_read(struct hv_ring_buffer_info *rbi)
1726 +
1727 + static bool hv_need_to_signal(u32 old_write, struct hv_ring_buffer_info *rbi)
1728 + {
1729 +- smp_mb();
1730 ++ mb();
1731 + if (rbi->ring_buffer->interrupt_mask)
1732 + return false;
1733 +
1734 +@@ -442,7 +442,7 @@ int hv_ringbuffer_write(struct hv_ring_buffer_info *outring_info,
1735 + sizeof(u64));
1736 +
1737 + /* Issue a full memory barrier before updating the write index */
1738 +- smp_mb();
1739 ++ mb();
1740 +
1741 + /* Now, update the write location */
1742 + hv_set_next_write_location(outring_info, next_write_location);
1743 +@@ -549,7 +549,7 @@ int hv_ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer,
1744 + /* Make sure all reads are done before we update the read index since */
1745 + /* the writer may start writing to the read area once the read index */
1746 + /*is updated */
1747 +- smp_mb();
1748 ++ mb();
1749 +
1750 + /* Update the read index */
1751 + hv_set_next_read_location(inring_info, next_read_location);
1752 +diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
1753 +index bf421e0..4004e54 100644
1754 +--- a/drivers/hv/vmbus_drv.c
1755 ++++ b/drivers/hv/vmbus_drv.c
1756 +@@ -434,7 +434,7 @@ static void vmbus_on_msg_dpc(unsigned long data)
1757 + * will not deliver any more messages since there is
1758 + * no empty slot
1759 + */
1760 +- smp_mb();
1761 ++ mb();
1762 +
1763 + if (msg->header.message_flags.msg_pending) {
1764 + /*
1765 +diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
1766 +index 2baff1b..4ef4d5e 100644
1767 +--- a/drivers/input/mouse/bcm5974.c
1768 ++++ b/drivers/input/mouse/bcm5974.c
1769 +@@ -88,6 +88,10 @@
1770 + #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI 0x0259
1771 + #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO 0x025a
1772 + #define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS 0x025b
1773 ++/* MacbookAir6,2 (unibody, June 2013) */
1774 ++#define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0291
1775 ++#define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0292
1776 ++#define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0293
1777 +
1778 + #define BCM5974_DEVICE(prod) { \
1779 + .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \
1780 +@@ -145,6 +149,10 @@ static const struct usb_device_id bcm5974_table[] = {
1781 + BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI),
1782 + BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO),
1783 + BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS),
1784 ++ /* MacbookAir6,2 */
1785 ++ BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI),
1786 ++ BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ISO),
1787 ++ BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_JIS),
1788 + /* Terminating entry */
1789 + {}
1790 + };
1791 +@@ -172,15 +180,18 @@ struct bt_data {
1792 + /* trackpad header types */
1793 + enum tp_type {
1794 + TYPE1, /* plain trackpad */
1795 +- TYPE2 /* button integrated in trackpad */
1796 ++ TYPE2, /* button integrated in trackpad */
1797 ++ TYPE3 /* additional header fields since June 2013 */
1798 + };
1799 +
1800 + /* trackpad finger data offsets, le16-aligned */
1801 + #define FINGER_TYPE1 (13 * sizeof(__le16))
1802 + #define FINGER_TYPE2 (15 * sizeof(__le16))
1803 ++#define FINGER_TYPE3 (19 * sizeof(__le16))
1804 +
1805 + /* trackpad button data offsets */
1806 + #define BUTTON_TYPE2 15
1807 ++#define BUTTON_TYPE3 23
1808 +
1809 + /* list of device capability bits */
1810 + #define HAS_INTEGRATED_BUTTON 1
1811 +@@ -400,6 +411,19 @@ static const struct bcm5974_config bcm5974_config_table[] = {
1812 + { SN_COORD, -150, 6730 },
1813 + { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION }
1814 + },
1815 ++ {
1816 ++ USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI,
1817 ++ USB_DEVICE_ID_APPLE_WELLSPRING8_ISO,
1818 ++ USB_DEVICE_ID_APPLE_WELLSPRING8_JIS,
1819 ++ HAS_INTEGRATED_BUTTON,
1820 ++ 0, sizeof(struct bt_data),
1821 ++ 0x83, TYPE3, FINGER_TYPE3, FINGER_TYPE3 + SIZEOF_ALL_FINGERS,
1822 ++ { SN_PRESSURE, 0, 300 },
1823 ++ { SN_WIDTH, 0, 2048 },
1824 ++ { SN_COORD, -4620, 5140 },
1825 ++ { SN_COORD, -150, 6600 },
1826 ++ { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION }
1827 ++ },
1828 + {}
1829 + };
1830 +
1831 +@@ -557,6 +581,9 @@ static int report_tp_state(struct bcm5974 *dev, int size)
1832 + input_report_key(input, BTN_LEFT, ibt);
1833 + }
1834 +
1835 ++ if (c->tp_type == TYPE3)
1836 ++ input_report_key(input, BTN_LEFT, dev->tp_data[BUTTON_TYPE3]);
1837 ++
1838 + input_sync(input);
1839 +
1840 + return 0;
1841 +@@ -572,9 +599,14 @@ static int report_tp_state(struct bcm5974 *dev, int size)
1842 +
1843 + static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on)
1844 + {
1845 +- char *data = kmalloc(8, GFP_KERNEL);
1846 + int retval = 0, size;
1847 ++ char *data;
1848 ++
1849 ++ /* Type 3 does not require a mode switch */
1850 ++ if (dev->cfg.tp_type == TYPE3)
1851 ++ return 0;
1852 +
1853 ++ data = kmalloc(8, GFP_KERNEL);
1854 + if (!data) {
1855 + dev_err(&dev->intf->dev, "out of memory\n");
1856 + retval = -ENOMEM;
1857 +diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
1858 +index c5e3029..48acfc6 100644
1859 +--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
1860 ++++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
1861 +@@ -576,10 +576,16 @@ static void iwl_pcie_txq_unmap(struct iwl_trans *trans, int txq_id)
1862 +
1863 + spin_lock_bh(&txq->lock);
1864 + while (q->write_ptr != q->read_ptr) {
1865 ++ IWL_DEBUG_TX_REPLY(trans, "Q %d Free %d\n",
1866 ++ txq_id, q->read_ptr);
1867 + iwl_pcie_txq_free_tfd(trans, txq);
1868 + q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd);
1869 + }
1870 ++ txq->active = false;
1871 + spin_unlock_bh(&txq->lock);
1872 ++
1873 ++ /* just in case - this queue may have been stopped */
1874 ++ iwl_wake_queue(trans, txq);
1875 + }
1876 +
1877 + /*
1878 +@@ -927,6 +933,12 @@ void iwl_trans_pcie_reclaim(struct iwl_trans *trans, int txq_id, int ssn,
1879 +
1880 + spin_lock_bh(&txq->lock);
1881 +
1882 ++ if (!txq->active) {
1883 ++ IWL_DEBUG_TX_QUEUES(trans, "Q %d inactive - ignoring idx %d\n",
1884 ++ txq_id, ssn);
1885 ++ goto out;
1886 ++ }
1887 ++
1888 + if (txq->q.read_ptr == tfd_num)
1889 + goto out;
1890 +
1891 +@@ -1103,6 +1115,7 @@ void iwl_trans_pcie_txq_enable(struct iwl_trans *trans, int txq_id, int fifo,
1892 + (fifo << SCD_QUEUE_STTS_REG_POS_TXF) |
1893 + (1 << SCD_QUEUE_STTS_REG_POS_WSL) |
1894 + SCD_QUEUE_STTS_REG_MSK);
1895 ++ trans_pcie->txq[txq_id].active = true;
1896 + IWL_DEBUG_TX_QUEUES(trans, "Activate queue %d on FIFO %d WrPtr: %d\n",
1897 + txq_id, fifo, ssn & 0xff);
1898 + }
1899 +diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c
1900 +index 953f1a0..2119313 100644
1901 +--- a/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c
1902 ++++ b/drivers/net/wireless/rtlwifi/rtl8192cu/rf.c
1903 +@@ -104,7 +104,7 @@ void rtl92cu_phy_rf6052_set_cck_txpower(struct ieee80211_hw *hw,
1904 + tx_agc[RF90_PATH_A] = 0x10101010;
1905 + tx_agc[RF90_PATH_B] = 0x10101010;
1906 + } else if (rtlpriv->dm.dynamic_txhighpower_lvl ==
1907 +- TXHIGHPWRLEVEL_LEVEL1) {
1908 ++ TXHIGHPWRLEVEL_LEVEL2) {
1909 + tx_agc[RF90_PATH_A] = 0x00000000;
1910 + tx_agc[RF90_PATH_B] = 0x00000000;
1911 + } else{
1912 +diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
1913 +index 826f085..2bd5985 100644
1914 +--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
1915 ++++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
1916 +@@ -359,6 +359,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
1917 + {RTL_USB_DEVICE(0x2001, 0x330a, rtl92cu_hal_cfg)}, /*D-Link-Alpha*/
1918 + {RTL_USB_DEVICE(0x2019, 0xab2b, rtl92cu_hal_cfg)}, /*Planex -Abocom*/
1919 + {RTL_USB_DEVICE(0x20f4, 0x624d, rtl92cu_hal_cfg)}, /*TRENDNet*/
1920 ++ {RTL_USB_DEVICE(0x2357, 0x0100, rtl92cu_hal_cfg)}, /*TP-Link WN8200ND*/
1921 + {RTL_USB_DEVICE(0x7392, 0x7822, rtl92cu_hal_cfg)}, /*Edimax -Edimax*/
1922 + {}
1923 + };
1924 +diff --git a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
1925 +index e4c4cdc..d9ee2ef 100644
1926 +--- a/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
1927 ++++ b/drivers/net/wireless/rtlwifi/rtl8723ae/sw.c
1928 +@@ -251,7 +251,7 @@ static struct rtl_hal_cfg rtl8723ae_hal_cfg = {
1929 + .bar_id = 2,
1930 + .write_readback = true,
1931 + .name = "rtl8723ae_pci",
1932 +- .fw_name = "rtlwifi/rtl8723aefw.bin",
1933 ++ .fw_name = "rtlwifi/rtl8723fw.bin",
1934 + .ops = &rtl8723ae_hal_ops,
1935 + .mod_params = &rtl8723ae_mod_params,
1936 + .maps[SYS_ISO_CTRL] = REG_SYS_ISO_CTRL,
1937 +@@ -353,8 +353,8 @@ MODULE_AUTHOR("Realtek WlanFAE <wlanfae@×××××××.com>");
1938 + MODULE_AUTHOR("Larry Finger <Larry.Finger@××××××××.net>");
1939 + MODULE_LICENSE("GPL");
1940 + MODULE_DESCRIPTION("Realtek 8723E 802.11n PCI wireless");
1941 +-MODULE_FIRMWARE("rtlwifi/rtl8723aefw.bin");
1942 +-MODULE_FIRMWARE("rtlwifi/rtl8723aefw_B.bin");
1943 ++MODULE_FIRMWARE("rtlwifi/rtl8723fw.bin");
1944 ++MODULE_FIRMWARE("rtlwifi/rtl8723fw_B.bin");
1945 +
1946 + module_param_named(swenc, rtl8723ae_mod_params.sw_crypto, bool, 0444);
1947 + module_param_named(debug, rtl8723ae_mod_params.debug, int, 0444);
1948 +diff --git a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
1949 +index 1f05913..19f6f70 100644
1950 +--- a/drivers/parisc/lba_pci.c
1951 ++++ b/drivers/parisc/lba_pci.c
1952 +@@ -613,6 +613,54 @@ truncate_pat_collision(struct resource *root, struct resource *new)
1953 + return 0; /* truncation successful */
1954 + }
1955 +
1956 ++/*
1957 ++ * extend_lmmio_len: extend lmmio range to maximum length
1958 ++ *
1959 ++ * This is needed at least on C8000 systems to get the ATI FireGL card
1960 ++ * working. On other systems we will currently not extend the lmmio space.
1961 ++ */
1962 ++static unsigned long
1963 ++extend_lmmio_len(unsigned long start, unsigned long end, unsigned long lba_len)
1964 ++{
1965 ++ struct resource *tmp;
1966 ++
1967 ++ pr_debug("LMMIO mismatch: PAT length = 0x%lx, MASK register = 0x%lx\n",
1968 ++ end - start, lba_len);
1969 ++
1970 ++ lba_len = min(lba_len+1, 256UL*1024*1024); /* limit to 256 MB */
1971 ++
1972 ++ pr_debug("LBA: lmmio_space [0x%lx-0x%lx] - original\n", start, end);
1973 ++
1974 ++ if (boot_cpu_data.cpu_type < mako) {
1975 ++ pr_info("LBA: Not a C8000 system - not extending LMMIO range.\n");
1976 ++ return end;
1977 ++ }
1978 ++
1979 ++ end += lba_len;
1980 ++ if (end < start) /* fix overflow */
1981 ++ end = -1ULL;
1982 ++
1983 ++ pr_debug("LBA: lmmio_space [0x%lx-0x%lx] - current\n", start, end);
1984 ++
1985 ++ /* first overlap */
1986 ++ for (tmp = iomem_resource.child; tmp; tmp = tmp->sibling) {
1987 ++ pr_debug("LBA: testing %pR\n", tmp);
1988 ++ if (tmp->start == start)
1989 ++ continue; /* ignore ourself */
1990 ++ if (tmp->end < start)
1991 ++ continue;
1992 ++ if (tmp->start > end)
1993 ++ continue;
1994 ++ if (end >= tmp->start)
1995 ++ end = tmp->start - 1;
1996 ++ }
1997 ++
1998 ++ pr_info("LBA: lmmio_space [0x%lx-0x%lx] - new\n", start, end);
1999 ++
2000 ++ /* return new end */
2001 ++ return end;
2002 ++}
2003 ++
2004 + #else
2005 + #define truncate_pat_collision(r,n) (0)
2006 + #endif
2007 +@@ -994,6 +1042,14 @@ lba_pat_resources(struct parisc_device *pa_dev, struct lba_device *lba_dev)
2008 + case PAT_LMMIO:
2009 + /* used to fix up pre-initialized MEM BARs */
2010 + if (!lba_dev->hba.lmmio_space.flags) {
2011 ++ unsigned long lba_len;
2012 ++
2013 ++ lba_len = ~READ_REG32(lba_dev->hba.base_addr
2014 ++ + LBA_LMMIO_MASK);
2015 ++ if ((p->end - p->start) != lba_len)
2016 ++ p->end = extend_lmmio_len(p->start,
2017 ++ p->end, lba_len);
2018 ++
2019 + sprintf(lba_dev->hba.lmmio_name,
2020 + "PCI%02x LMMIO",
2021 + (int)lba_dev->hba.bus_num.start);
2022 +diff --git a/drivers/pci/iov.c b/drivers/pci/iov.c
2023 +index c93071d..a971a6f 100644
2024 +--- a/drivers/pci/iov.c
2025 ++++ b/drivers/pci/iov.c
2026 +@@ -92,6 +92,8 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
2027 + pci_read_config_word(dev, iov->pos + PCI_SRIOV_VF_DID, &virtfn->device);
2028 + pci_setup_device(virtfn);
2029 + virtfn->dev.parent = dev->dev.parent;
2030 ++ virtfn->physfn = pci_dev_get(dev);
2031 ++ virtfn->is_virtfn = 1;
2032 +
2033 + for (i = 0; i < PCI_SRIOV_NUM_BARS; i++) {
2034 + res = dev->resource + PCI_IOV_RESOURCES + i;
2035 +@@ -113,9 +115,6 @@ static int virtfn_add(struct pci_dev *dev, int id, int reset)
2036 + pci_device_add(virtfn, virtfn->bus);
2037 + mutex_unlock(&iov->dev->sriov->lock);
2038 +
2039 +- virtfn->physfn = pci_dev_get(dev);
2040 +- virtfn->is_virtfn = 1;
2041 +-
2042 + rc = pci_bus_add_device(virtfn);
2043 + sprintf(buf, "virtfn%u", id);
2044 + rc = sysfs_create_link(&dev->dev.kobj, &virtfn->dev.kobj, buf);
2045 +diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
2046 +index 70f10fa..ea37072 100644
2047 +--- a/drivers/pci/probe.c
2048 ++++ b/drivers/pci/probe.c
2049 +@@ -1703,12 +1703,16 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
2050 + bridge->dev.release = pci_release_bus_bridge_dev;
2051 + dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus);
2052 + error = pcibios_root_bridge_prepare(bridge);
2053 +- if (error)
2054 +- goto bridge_dev_reg_err;
2055 ++ if (error) {
2056 ++ kfree(bridge);
2057 ++ goto err_out;
2058 ++ }
2059 +
2060 + error = device_register(&bridge->dev);
2061 +- if (error)
2062 +- goto bridge_dev_reg_err;
2063 ++ if (error) {
2064 ++ put_device(&bridge->dev);
2065 ++ goto err_out;
2066 ++ }
2067 + b->bridge = get_device(&bridge->dev);
2068 + device_enable_async_suspend(b->bridge);
2069 + pci_set_bus_of_node(b);
2070 +@@ -1764,8 +1768,6 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
2071 + class_dev_reg_err:
2072 + put_device(&bridge->dev);
2073 + device_unregister(&bridge->dev);
2074 +-bridge_dev_reg_err:
2075 +- kfree(bridge);
2076 + err_out:
2077 + kfree(b);
2078 + return NULL;
2079 +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
2080 +index 7d68aee..df4655c 100644
2081 +--- a/drivers/pci/quirks.c
2082 ++++ b/drivers/pci/quirks.c
2083 +@@ -1022,6 +1022,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk
2084 + DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode);
2085 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE, quirk_amd_ide_mode);
2086 + DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_HUDSON2_SATA_IDE, quirk_amd_ide_mode);
2087 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x7900, quirk_amd_ide_mode);
2088 ++DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, 0x7900, quirk_amd_ide_mode);
2089 +
2090 + /*
2091 + * Serverworks CSB5 IDE does not fully support native mode
2092 +diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
2093 +index 966abc6..f7197a7 100644
2094 +--- a/drivers/pci/xen-pcifront.c
2095 ++++ b/drivers/pci/xen-pcifront.c
2096 +@@ -678,10 +678,9 @@ static int pcifront_connect_and_init_dma(struct pcifront_device *pdev)
2097 + if (!pcifront_dev) {
2098 + dev_info(&pdev->xdev->dev, "Installing PCI frontend\n");
2099 + pcifront_dev = pdev;
2100 +- } else {
2101 +- dev_err(&pdev->xdev->dev, "PCI frontend already installed!\n");
2102 ++ } else
2103 + err = -EEXIST;
2104 +- }
2105 ++
2106 + spin_unlock(&pcifront_dev_lock);
2107 +
2108 + if (!err && !swiotlb_nr_tbl()) {
2109 +@@ -848,7 +847,7 @@ static int pcifront_try_connect(struct pcifront_device *pdev)
2110 + goto out;
2111 +
2112 + err = pcifront_connect_and_init_dma(pdev);
2113 +- if (err) {
2114 ++ if (err && err != -EEXIST) {
2115 + xenbus_dev_fatal(pdev->xdev, err,
2116 + "Error setting up PCI Frontend");
2117 + goto out;
2118 +diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c
2119 +index 01463c7..1b2c631 100644
2120 +--- a/drivers/pcmcia/at91_cf.c
2121 ++++ b/drivers/pcmcia/at91_cf.c
2122 +@@ -100,9 +100,9 @@ static int at91_cf_get_status(struct pcmcia_socket *s, u_int *sp)
2123 + int vcc = gpio_is_valid(cf->board->vcc_pin);
2124 +
2125 + *sp = SS_DETECT | SS_3VCARD;
2126 +- if (!rdy || gpio_get_value(rdy))
2127 ++ if (!rdy || gpio_get_value(cf->board->irq_pin))
2128 + *sp |= SS_READY;
2129 +- if (!vcc || gpio_get_value(vcc))
2130 ++ if (!vcc || gpio_get_value(cf->board->vcc_pin))
2131 + *sp |= SS_POWERON;
2132 + } else
2133 + *sp = 0;
2134 +diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c
2135 +index 5032c24..9100a34 100644
2136 +--- a/drivers/rtc/rtc-rv3029c2.c
2137 ++++ b/drivers/rtc/rtc-rv3029c2.c
2138 +@@ -310,7 +310,7 @@ static int rv3029c2_rtc_i2c_set_alarm(struct i2c_client *client,
2139 + dev_dbg(&client->dev, "alarm IRQ armed\n");
2140 + } else {
2141 + /* disable AIE irq */
2142 +- ret = rv3029c2_rtc_i2c_alarm_set_irq(client, 1);
2143 ++ ret = rv3029c2_rtc_i2c_alarm_set_irq(client, 0);
2144 + if (ret)
2145 + return ret;
2146 +
2147 +diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
2148 +index 21a7e17..572d481 100644
2149 +--- a/drivers/tty/serial/pch_uart.c
2150 ++++ b/drivers/tty/serial/pch_uart.c
2151 +@@ -217,6 +217,7 @@ enum {
2152 + #define FRI2_64_UARTCLK 64000000 /* 64.0000 MHz */
2153 + #define FRI2_48_UARTCLK 48000000 /* 48.0000 MHz */
2154 + #define NTC1_UARTCLK 64000000 /* 64.0000 MHz */
2155 ++#define MINNOW_UARTCLK 50000000 /* 50.0000 MHz */
2156 +
2157 + struct pch_uart_buffer {
2158 + unsigned char *buf;
2159 +@@ -398,6 +399,10 @@ static int pch_uart_get_uartclk(void)
2160 + strstr(cmp, "nanoETXexpress-TT")))
2161 + return NTC1_UARTCLK;
2162 +
2163 ++ cmp = dmi_get_system_info(DMI_BOARD_NAME);
2164 ++ if (cmp && strstr(cmp, "MinnowBoard"))
2165 ++ return MINNOW_UARTCLK;
2166 ++
2167 + return DEFAULT_UARTCLK;
2168 + }
2169 +
2170 +diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
2171 +index 97666e8..c35a9ec 100644
2172 +--- a/drivers/usb/gadget/f_mass_storage.c
2173 ++++ b/drivers/usb/gadget/f_mass_storage.c
2174 +@@ -413,6 +413,7 @@ static int fsg_set_halt(struct fsg_dev *fsg, struct usb_ep *ep)
2175 + /* Caller must hold fsg->lock */
2176 + static void wakeup_thread(struct fsg_common *common)
2177 + {
2178 ++ smp_wmb(); /* ensure the write of bh->state is complete */
2179 + /* Tell the main thread that something has happened */
2180 + common->thread_wakeup_needed = 1;
2181 + if (common->thread_task)
2182 +@@ -632,6 +633,7 @@ static int sleep_thread(struct fsg_common *common)
2183 + }
2184 + __set_current_state(TASK_RUNNING);
2185 + common->thread_wakeup_needed = 0;
2186 ++ smp_rmb(); /* ensure the latest bh->state is visible */
2187 + return rc;
2188 + }
2189 +
2190 +diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
2191 +index 16d7150..dda408f 100644
2192 +--- a/drivers/usb/host/ehci-omap.c
2193 ++++ b/drivers/usb/host/ehci-omap.c
2194 +@@ -187,6 +187,12 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
2195 + }
2196 +
2197 + omap->phy[i] = phy;
2198 ++
2199 ++ if (pdata->port_mode[i] == OMAP_EHCI_PORT_MODE_PHY) {
2200 ++ usb_phy_init(omap->phy[i]);
2201 ++ /* bring PHY out of suspend */
2202 ++ usb_phy_set_suspend(omap->phy[i], 0);
2203 ++ }
2204 + }
2205 +
2206 + pm_runtime_enable(dev);
2207 +@@ -211,13 +217,14 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
2208 + }
2209 +
2210 + /*
2211 +- * Bring PHYs out of reset.
2212 ++ * Bring PHYs out of reset for non PHY modes.
2213 + * Even though HSIC mode is a PHY-less mode, the reset
2214 + * line exists between the chips and can be modelled
2215 + * as a PHY device for reset control.
2216 + */
2217 + for (i = 0; i < omap->nports; i++) {
2218 +- if (!omap->phy[i])
2219 ++ if (!omap->phy[i] ||
2220 ++ pdata->port_mode[i] == OMAP_EHCI_PORT_MODE_PHY)
2221 + continue;
2222 +
2223 + usb_phy_init(omap->phy[i]);
2224 +diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
2225 +index fbf75e5..f2e57a1 100644
2226 +--- a/drivers/usb/host/xhci-mem.c
2227 ++++ b/drivers/usb/host/xhci-mem.c
2228 +@@ -369,6 +369,10 @@ static struct xhci_container_ctx *xhci_alloc_container_ctx(struct xhci_hcd *xhci
2229 + ctx->size += CTX_SIZE(xhci->hcc_params);
2230 +
2231 + ctx->bytes = dma_pool_alloc(xhci->device_pool, flags, &ctx->dma);
2232 ++ if (!ctx->bytes) {
2233 ++ kfree(ctx);
2234 ++ return NULL;
2235 ++ }
2236 + memset(ctx->bytes, 0, ctx->size);
2237 + return ctx;
2238 + }
2239 +diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
2240 +index df90fe5..93ad67e 100644
2241 +--- a/drivers/usb/host/xhci-plat.c
2242 ++++ b/drivers/usb/host/xhci-plat.c
2243 +@@ -179,6 +179,7 @@ static int xhci_plat_remove(struct platform_device *dev)
2244 +
2245 + usb_remove_hcd(hcd);
2246 + iounmap(hcd->regs);
2247 ++ release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
2248 + usb_put_hcd(hcd);
2249 + kfree(xhci);
2250 +
2251 +diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
2252 +index bd4323d..5dd857d 100644
2253 +--- a/drivers/usb/serial/option.c
2254 ++++ b/drivers/usb/serial/option.c
2255 +@@ -159,8 +159,6 @@ static void option_instat_callback(struct urb *urb);
2256 + #define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED 0x9000
2257 + #define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED 0x9001
2258 + #define NOVATELWIRELESS_PRODUCT_E362 0x9010
2259 +-#define NOVATELWIRELESS_PRODUCT_G1 0xA001
2260 +-#define NOVATELWIRELESS_PRODUCT_G1_M 0xA002
2261 + #define NOVATELWIRELESS_PRODUCT_G2 0xA010
2262 + #define NOVATELWIRELESS_PRODUCT_MC551 0xB001
2263 +
2264 +@@ -730,8 +728,6 @@ static const struct usb_device_id option_ids[] = {
2265 + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC547) },
2266 + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_HIGHSPEED) },
2267 + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED) },
2268 +- { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1) },
2269 +- { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G1_M) },
2270 + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G2) },
2271 + /* Novatel Ovation MC551 a.k.a. Verizon USB551L */
2272 + { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC551, 0xff, 0xff, 0xff) },
2273 +diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
2274 +index bd794b4..c65437c 100644
2275 +--- a/drivers/usb/serial/qcserial.c
2276 ++++ b/drivers/usb/serial/qcserial.c
2277 +@@ -35,7 +35,13 @@ static const struct usb_device_id id_table[] = {
2278 + {DEVICE_G1K(0x04da, 0x250c)}, /* Panasonic Gobi QDL device */
2279 + {DEVICE_G1K(0x413c, 0x8172)}, /* Dell Gobi Modem device */
2280 + {DEVICE_G1K(0x413c, 0x8171)}, /* Dell Gobi QDL device */
2281 +- {DEVICE_G1K(0x1410, 0xa001)}, /* Novatel Gobi Modem device */
2282 ++ {DEVICE_G1K(0x1410, 0xa001)}, /* Novatel/Verizon USB-1000 */
2283 ++ {DEVICE_G1K(0x1410, 0xa002)}, /* Novatel Gobi Modem device */
2284 ++ {DEVICE_G1K(0x1410, 0xa003)}, /* Novatel Gobi Modem device */
2285 ++ {DEVICE_G1K(0x1410, 0xa004)}, /* Novatel Gobi Modem device */
2286 ++ {DEVICE_G1K(0x1410, 0xa005)}, /* Novatel Gobi Modem device */
2287 ++ {DEVICE_G1K(0x1410, 0xa006)}, /* Novatel Gobi Modem device */
2288 ++ {DEVICE_G1K(0x1410, 0xa007)}, /* Novatel Gobi Modem device */
2289 + {DEVICE_G1K(0x1410, 0xa008)}, /* Novatel Gobi QDL device */
2290 + {DEVICE_G1K(0x0b05, 0x1776)}, /* Asus Gobi Modem device */
2291 + {DEVICE_G1K(0x0b05, 0x1774)}, /* Asus Gobi QDL device */
2292 +diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
2293 +index 02fae7f..7fb054b 100644
2294 +--- a/fs/btrfs/ctree.c
2295 ++++ b/fs/btrfs/ctree.c
2296 +@@ -1089,7 +1089,8 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
2297 + btrfs_set_node_ptr_generation(parent, parent_slot,
2298 + trans->transid);
2299 + btrfs_mark_buffer_dirty(parent);
2300 +- tree_mod_log_free_eb(root->fs_info, buf);
2301 ++ if (last_ref)
2302 ++ tree_mod_log_free_eb(root->fs_info, buf);
2303 + btrfs_free_tree_block(trans, root, buf, parent_start,
2304 + last_ref);
2305 + }
2306 +@@ -1161,8 +1162,8 @@ __tree_mod_log_oldest_root(struct btrfs_fs_info *fs_info,
2307 + * time_seq).
2308 + */
2309 + static void
2310 +-__tree_mod_log_rewind(struct extent_buffer *eb, u64 time_seq,
2311 +- struct tree_mod_elem *first_tm)
2312 ++__tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct extent_buffer *eb,
2313 ++ u64 time_seq, struct tree_mod_elem *first_tm)
2314 + {
2315 + u32 n;
2316 + struct rb_node *next;
2317 +@@ -1172,6 +1173,7 @@ __tree_mod_log_rewind(struct extent_buffer *eb, u64 time_seq,
2318 + unsigned long p_size = sizeof(struct btrfs_key_ptr);
2319 +
2320 + n = btrfs_header_nritems(eb);
2321 ++ tree_mod_log_read_lock(fs_info);
2322 + while (tm && tm->seq >= time_seq) {
2323 + /*
2324 + * all the operations are recorded with the operator used for
2325 +@@ -1226,6 +1228,7 @@ __tree_mod_log_rewind(struct extent_buffer *eb, u64 time_seq,
2326 + if (tm->index != first_tm->index)
2327 + break;
2328 + }
2329 ++ tree_mod_log_read_unlock(fs_info);
2330 + btrfs_set_header_nritems(eb, n);
2331 + }
2332 +
2333 +@@ -1274,7 +1277,7 @@ tree_mod_log_rewind(struct btrfs_fs_info *fs_info, struct extent_buffer *eb,
2334 +
2335 + extent_buffer_get(eb_rewin);
2336 + btrfs_tree_read_lock(eb_rewin);
2337 +- __tree_mod_log_rewind(eb_rewin, time_seq, tm);
2338 ++ __tree_mod_log_rewind(fs_info, eb_rewin, time_seq, tm);
2339 + WARN_ON(btrfs_header_nritems(eb_rewin) >
2340 + BTRFS_NODEPTRS_PER_BLOCK(fs_info->tree_root));
2341 +
2342 +@@ -1350,7 +1353,7 @@ get_old_root(struct btrfs_root *root, u64 time_seq)
2343 + btrfs_set_header_generation(eb, old_generation);
2344 + }
2345 + if (tm)
2346 +- __tree_mod_log_rewind(eb, time_seq, tm);
2347 ++ __tree_mod_log_rewind(root->fs_info, eb, time_seq, tm);
2348 + else
2349 + WARN_ON(btrfs_header_level(eb) != 0);
2350 + WARN_ON(btrfs_header_nritems(eb) > BTRFS_NODEPTRS_PER_BLOCK(root));
2351 +diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
2352 +index ff40f1c..ba9690b 100644
2353 +--- a/fs/btrfs/send.c
2354 ++++ b/fs/btrfs/send.c
2355 +@@ -4579,6 +4579,41 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_)
2356 + send_root = BTRFS_I(file_inode(mnt_file))->root;
2357 + fs_info = send_root->fs_info;
2358 +
2359 ++ /*
2360 ++ * This is done when we lookup the root, it should already be complete
2361 ++ * by the time we get here.
2362 ++ */
2363 ++ WARN_ON(send_root->orphan_cleanup_state != ORPHAN_CLEANUP_DONE);
2364 ++
2365 ++ /*
2366 ++ * If we just created this root we need to make sure that the orphan
2367 ++ * cleanup has been done and committed since we search the commit root,
2368 ++ * so check its commit root transid with our otransid and if they match
2369 ++ * commit the transaction to make sure everything is updated.
2370 ++ */
2371 ++ down_read(&send_root->fs_info->extent_commit_sem);
2372 ++ if (btrfs_header_generation(send_root->commit_root) ==
2373 ++ btrfs_root_otransid(&send_root->root_item)) {
2374 ++ struct btrfs_trans_handle *trans;
2375 ++
2376 ++ up_read(&send_root->fs_info->extent_commit_sem);
2377 ++
2378 ++ trans = btrfs_attach_transaction_barrier(send_root);
2379 ++ if (IS_ERR(trans)) {
2380 ++ if (PTR_ERR(trans) != -ENOENT) {
2381 ++ ret = PTR_ERR(trans);
2382 ++ goto out;
2383 ++ }
2384 ++ /* ENOENT means theres no transaction */
2385 ++ } else {
2386 ++ ret = btrfs_commit_transaction(trans, send_root);
2387 ++ if (ret)
2388 ++ goto out;
2389 ++ }
2390 ++ } else {
2391 ++ up_read(&send_root->fs_info->extent_commit_sem);
2392 ++ }
2393 ++
2394 + arg = memdup_user(arg_, sizeof(*arg));
2395 + if (IS_ERR(arg)) {
2396 + ret = PTR_ERR(arg);
2397 +diff --git a/fs/cifs/cifs_unicode.h b/fs/cifs/cifs_unicode.h
2398 +index 4fb0974..fe8d627 100644
2399 +--- a/fs/cifs/cifs_unicode.h
2400 ++++ b/fs/cifs/cifs_unicode.h
2401 +@@ -327,14 +327,14 @@ UniToupper(register wchar_t uc)
2402 + /*
2403 + * UniStrupr: Upper case a unicode string
2404 + */
2405 +-static inline wchar_t *
2406 +-UniStrupr(register wchar_t *upin)
2407 ++static inline __le16 *
2408 ++UniStrupr(register __le16 *upin)
2409 + {
2410 +- register wchar_t *up;
2411 ++ register __le16 *up;
2412 +
2413 + up = upin;
2414 + while (*up) { /* For all characters */
2415 +- *up = UniToupper(*up);
2416 ++ *up = cpu_to_le16(UniToupper(le16_to_cpu(*up)));
2417 + up++;
2418 + }
2419 + return upin; /* Return input pointer */
2420 +diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
2421 +index 71436d1..f59d0d5 100644
2422 +--- a/fs/cifs/cifsencrypt.c
2423 ++++ b/fs/cifs/cifsencrypt.c
2424 +@@ -414,7 +414,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
2425 + int rc = 0;
2426 + int len;
2427 + char nt_hash[CIFS_NTHASH_SIZE];
2428 +- wchar_t *user;
2429 ++ __le16 *user;
2430 + wchar_t *domain;
2431 + wchar_t *server;
2432 +
2433 +@@ -439,7 +439,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
2434 + return rc;
2435 + }
2436 +
2437 +- /* convert ses->user_name to unicode and uppercase */
2438 ++ /* convert ses->user_name to unicode */
2439 + len = ses->user_name ? strlen(ses->user_name) : 0;
2440 + user = kmalloc(2 + (len * 2), GFP_KERNEL);
2441 + if (user == NULL) {
2442 +@@ -448,7 +448,7 @@ static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
2443 + }
2444 +
2445 + if (len) {
2446 +- len = cifs_strtoUTF16((__le16 *)user, ses->user_name, len, nls_cp);
2447 ++ len = cifs_strtoUTF16(user, ses->user_name, len, nls_cp);
2448 + UniStrupr(user);
2449 + } else {
2450 + memset(user, '\0', 2);
2451 +diff --git a/fs/cifs/file.c b/fs/cifs/file.c
2452 +index 48b29d2..c2934f8 100644
2453 +--- a/fs/cifs/file.c
2454 ++++ b/fs/cifs/file.c
2455 +@@ -553,11 +553,10 @@ cifs_relock_file(struct cifsFileInfo *cfile)
2456 + struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
2457 + int rc = 0;
2458 +
2459 +- /* we are going to update can_cache_brlcks here - need a write access */
2460 +- down_write(&cinode->lock_sem);
2461 ++ down_read(&cinode->lock_sem);
2462 + if (cinode->can_cache_brlcks) {
2463 +- /* can cache locks - no need to push them */
2464 +- up_write(&cinode->lock_sem);
2465 ++ /* can cache locks - no need to relock */
2466 ++ up_read(&cinode->lock_sem);
2467 + return rc;
2468 + }
2469 +
2470 +@@ -568,7 +567,7 @@ cifs_relock_file(struct cifsFileInfo *cfile)
2471 + else
2472 + rc = tcon->ses->server->ops->push_mand_locks(cfile);
2473 +
2474 +- up_write(&cinode->lock_sem);
2475 ++ up_read(&cinode->lock_sem);
2476 + return rc;
2477 + }
2478 +
2479 +diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
2480 +index 20efd81..449b6cf 100644
2481 +--- a/fs/cifs/inode.c
2482 ++++ b/fs/cifs/inode.c
2483 +@@ -558,6 +558,11 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
2484 + fattr->cf_mode &= ~(S_IWUGO);
2485 +
2486 + fattr->cf_nlink = le32_to_cpu(info->NumberOfLinks);
2487 ++ if (fattr->cf_nlink < 1) {
2488 ++ cifs_dbg(1, "replacing bogus file nlink value %u\n",
2489 ++ fattr->cf_nlink);
2490 ++ fattr->cf_nlink = 1;
2491 ++ }
2492 + }
2493 +
2494 + fattr->cf_uid = cifs_sb->mnt_uid;
2495 +diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
2496 +index 692de13..cea8ecf 100644
2497 +--- a/fs/ext3/namei.c
2498 ++++ b/fs/ext3/namei.c
2499 +@@ -576,11 +576,8 @@ static int htree_dirblock_to_tree(struct file *dir_file,
2500 + if (!ext3_check_dir_entry("htree_dirblock_to_tree", dir, de, bh,
2501 + (block<<EXT3_BLOCK_SIZE_BITS(dir->i_sb))
2502 + +((char *)de - bh->b_data))) {
2503 +- /* On error, skip the f_pos to the next block. */
2504 +- dir_file->f_pos = (dir_file->f_pos |
2505 +- (dir->i_sb->s_blocksize - 1)) + 1;
2506 +- brelse (bh);
2507 +- return count;
2508 ++ /* silently ignore the rest of the block */
2509 ++ break;
2510 + }
2511 + ext3fs_dirhash(de->name, de->name_len, hinfo);
2512 + if ((hinfo->hash < start_hash) ||
2513 +diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
2514 +index d0f13ea..3742e4c 100644
2515 +--- a/fs/ext4/balloc.c
2516 ++++ b/fs/ext4/balloc.c
2517 +@@ -38,8 +38,8 @@ ext4_group_t ext4_get_group_number(struct super_block *sb,
2518 + ext4_group_t group;
2519 +
2520 + if (test_opt2(sb, STD_GROUP_SIZE))
2521 +- group = (le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block) +
2522 +- block) >>
2523 ++ group = (block -
2524 ++ le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) >>
2525 + (EXT4_BLOCK_SIZE_BITS(sb) + EXT4_CLUSTER_BITS(sb) + 3);
2526 + else
2527 + ext4_get_group_no_and_offset(sb, block, &group, NULL);
2528 +diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
2529 +index bc0f191..e49da58 100644
2530 +--- a/fs/ext4/extents.c
2531 ++++ b/fs/ext4/extents.c
2532 +@@ -4659,7 +4659,7 @@ static int ext4_xattr_fiemap(struct inode *inode,
2533 + error = ext4_get_inode_loc(inode, &iloc);
2534 + if (error)
2535 + return error;
2536 +- physical = iloc.bh->b_blocknr << blockbits;
2537 ++ physical = (__u64)iloc.bh->b_blocknr << blockbits;
2538 + offset = EXT4_GOOD_OLD_INODE_SIZE +
2539 + EXT4_I(inode)->i_extra_isize;
2540 + physical += offset;
2541 +@@ -4667,7 +4667,7 @@ static int ext4_xattr_fiemap(struct inode *inode,
2542 + flags |= FIEMAP_EXTENT_DATA_INLINE;
2543 + brelse(iloc.bh);
2544 + } else { /* external block */
2545 +- physical = EXT4_I(inode)->i_file_acl << blockbits;
2546 ++ physical = (__u64)EXT4_I(inode)->i_file_acl << blockbits;
2547 + length = inode->i_sb->s_blocksize;
2548 + }