--- /dev/null
+From 598e306184d26fa1d546334f2eb370b4d94a4ad3 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Fri, 23 May 2014 09:21:06 +0200
+Subject: ALSA: hda/analog - Fix silent output on ASUS A8JN
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 598e306184d26fa1d546334f2eb370b4d94a4ad3 upstream.
+
+ASUS A8JN with AD1986A codec seems following the normal EAPD in the
+normal order (0 = off, 1 = on) unlike other machines with AD1986A.
+Apply the workaround used for Toshiba laptop that showed the same
+problem.
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=75041
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_analog.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_analog.c
++++ b/sound/pci/hda/patch_analog.c
+@@ -333,6 +333,7 @@ static const struct hda_fixup ad1986a_fi
+
+ static const struct snd_pci_quirk ad1986a_fixup_tbl[] = {
+ SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_FIXUP_LAPTOP_IMIC),
++ SND_PCI_QUIRK(0x1043, 0x1447, "ASUS A8JN", AD1986A_FIXUP_EAPD),
+ SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8100, "ASUS P5", AD1986A_FIXUP_3STACK),
+ SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8200, "ASUS M2", AD1986A_FIXUP_3STACK),
+ SND_PCI_QUIRK(0x10de, 0xcb84, "ASUS A8N-VM", AD1986A_FIXUP_3STACK),
--- /dev/null
+From e30cf2d2bed3aed74a651c64de323ba26e4ff7d0 Mon Sep 17 00:00:00 2001
+From: Ronan Marquet <ronan.marquet@orange.fr>
+Date: Sun, 1 Jun 2014 18:38:53 +0200
+Subject: ALSA: hda/realtek - Correction of fixup codes for PB V7900 laptop
+
+From: Ronan Marquet <ronan.marquet@orange.fr>
+
+commit e30cf2d2bed3aed74a651c64de323ba26e4ff7d0 upstream.
+
+Correcion of wrong fixup entries add in commit ca8f0424 to replace
+static model quirk for PB V7900 laptop (will model).
+
+[note: the removal of ALC260_FIXUP_HP_PIN_0F chain is also needed as a
+ part of the fix; otherwise the pin is set up wrongly as a headphone,
+ and user-space (PulseAudio) may be wrongly trying to detect the jack
+ state -- tiwai]
+
+Fixes: ca8f04247eaa ('ALSA: hda/realtek - Add the fixup codes for ALC260 model=will')
+Signed-off-by: Ronan Marquet <ronan.marquet@orange.fr>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_realtek.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -1646,12 +1646,10 @@ static const struct hda_fixup alc260_fix
+ [ALC260_FIXUP_COEF] = {
+ .type = HDA_FIXUP_VERBS,
+ .v.verbs = (const struct hda_verb[]) {
+- { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
+- { 0x20, AC_VERB_SET_PROC_COEF, 0x3040 },
++ { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
++ { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
+ { }
+ },
+- .chained = true,
+- .chain_id = ALC260_FIXUP_HP_PIN_0F,
+ },
+ [ALC260_FIXUP_GPIO1] = {
+ .type = HDA_FIXUP_VERBS,
--- /dev/null
+From 192a98e280e560510a62aca8cfa83b4ae7c095bb Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Mon, 2 Jun 2014 15:16:07 +0200
+Subject: ALSA: hda/realtek - Fix COEF widget NID for ALC260 replacer fixup
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 192a98e280e560510a62aca8cfa83b4ae7c095bb upstream.
+
+The conversion to a fixup table for Replacer model with ALC260 in
+commit 20f7d928 took the wrong widget NID for COEF setups. Namely,
+NID 0x1a should have been used instead of NID 0x20, which is the
+common node for all Realtek codecs but ALC260.
+
+Fixes: 20f7d928fa6e ('ALSA: hda/realtek - Replace ALC260 model=replacer with the auto-parser')
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_realtek.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -1664,8 +1664,8 @@ static const struct hda_fixup alc260_fix
+ [ALC260_FIXUP_REPLACER] = {
+ .type = HDA_FIXUP_VERBS,
+ .v.verbs = (const struct hda_verb[]) {
+- { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
+- { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
++ { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
++ { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
+ { }
+ },
+ .chained = true,
--- /dev/null
+From 40b9397a1a61a37917b93e7d57e6f2faf3a086b4 Mon Sep 17 00:00:00 2001
+From: Samuel Ortiz <sameo@linux.intel.com>
+Date: Wed, 14 May 2014 17:53:35 +0200
+Subject: Bluetooth: Fix L2CAP LE debugfs entries permissions
+
+From: Samuel Ortiz <sameo@linux.intel.com>
+
+commit 40b9397a1a61a37917b93e7d57e6f2faf3a086b4 upstream.
+
+0466 was probably meant to be 0644, there's no reason why everyone
+except root could write there.
+
+Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
+Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/bluetooth/l2cap_core.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/net/bluetooth/l2cap_core.c
++++ b/net/bluetooth/l2cap_core.c
+@@ -7471,9 +7471,9 @@ int __init l2cap_init(void)
+ l2cap_debugfs = debugfs_create_file("l2cap", 0444, bt_debugfs,
+ NULL, &l2cap_debugfs_fops);
+
+- debugfs_create_u16("l2cap_le_max_credits", 0466, bt_debugfs,
++ debugfs_create_u16("l2cap_le_max_credits", 0644, bt_debugfs,
+ &le_max_credits);
+- debugfs_create_u16("l2cap_le_default_mps", 0466, bt_debugfs,
++ debugfs_create_u16("l2cap_le_default_mps", 0644, bt_debugfs,
+ &le_default_mps);
+
+ bt_6lowpan_init();
--- /dev/null
+From 3991b31ea072b070081ca3bfa860a077eda67de5 Mon Sep 17 00:00:00 2001
+From: NeilBrown <neilb@suse.de>
+Date: Wed, 28 May 2014 13:39:23 +1000
+Subject: md: always set MD_RECOVERY_INTR when aborting a reshape or other "resync".
+
+From: NeilBrown <neilb@suse.de>
+
+commit 3991b31ea072b070081ca3bfa860a077eda67de5 upstream.
+
+If mddev->ro is set, md_to_sync will (correctly) abort.
+However in that case MD_RECOVERY_INTR isn't set.
+
+If a RESHAPE had been requested, then ->finish_reshape() will be
+called and it will think the reshape was successful even though
+nothing happened.
+
+Normally a resync will not be requested if ->ro is set, but if an
+array is stopped while a reshape is on-going, then when the array is
+started, the reshape will be restarted. If the array is also set
+read-only at this point, the reshape will instantly appear to success,
+resulting in data corruption.
+
+Consequently, this patch is suitable for any -stable kernel.
+
+Signed-off-by: NeilBrown <neilb@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/md/md.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/md/md.c
++++ b/drivers/md/md.c
+@@ -7395,8 +7395,10 @@ void md_do_sync(struct md_thread *thread
+ /* just incase thread restarts... */
+ if (test_bit(MD_RECOVERY_DONE, &mddev->recovery))
+ return;
+- if (mddev->ro) /* never try to sync a read-only array */
++ if (mddev->ro) {/* never try to sync a read-only array */
++ set_bit(MD_RECOVERY_INTR, &mddev->recovery);
+ return;
++ }
+
+ if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) {
+ if (test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) {
--- /dev/null
+From 2ac295a544dcae9299cba13ce250419117ae7fd1 Mon Sep 17 00:00:00 2001
+From: NeilBrown <neilb@suse.de>
+Date: Thu, 29 May 2014 11:40:03 +1000
+Subject: md: always set MD_RECOVERY_INTR when interrupting a reshape thread.
+
+From: NeilBrown <neilb@suse.de>
+
+commit 2ac295a544dcae9299cba13ce250419117ae7fd1 upstream.
+
+Commit 8313b8e57f55b15e5b7f7fc5d1630bbf686a9a97
+ md: fix problem when adding device to read-only array with bitmap.
+
+added a called to md_reap_sync_thread() which cause a reshape thread
+to be interrupted (in particular, it could cause md_thread() to never even
+call md_do_sync()).
+However it didn't set MD_RECOVERY_INTR so ->finish_reshape() would not
+know that the reshape didn't complete.
+
+This only happens when mddev->ro is set and normally reshape threads
+don't run in that situation. But raid5 and raid10 can start a reshape
+thread during "run" is the array is in the middle of a reshape.
+They do this even if ->ro is set.
+
+So it is best to set MD_RECOVERY_INTR before abortingg the
+sync thread, just in case.
+
+Though it rare for this to trigger a problem it can cause data corruption
+because the reshape isn't finished properly.
+So it is suitable for any stable which the offending commit was applied to.
+(3.2 or later)
+
+Fixes: 8313b8e57f55b15e5b7f7fc5d1630bbf686a9a97
+Signed-off-by: NeilBrown <neilb@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/md/md.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/md/md.c
++++ b/drivers/md/md.c
+@@ -7840,6 +7840,7 @@ void md_check_recovery(struct mddev *mdd
+ /* There is no thread, but we need to call
+ * ->spare_active and clear saved_raid_disk
+ */
++ set_bit(MD_RECOVERY_INTR, &mddev->recovery);
+ md_reap_sync_thread(mddev);
+ clear_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
+ goto unlock;
drm-radeon-use-the-cp-dma-on-cik.patch
libata-blacklist-queued-trim-for-crucial-m500.patch
sched-fix-sched_policy-0-comparison.patch
+md-always-set-md_recovery_intr-when-aborting-a-reshape-or-other-resync.patch
+md-always-set-md_recovery_intr-when-interrupting-a-reshape-thread.patch
+xhci-delete-endpoints-from-bandwidth-list-before-freeing-whole-device.patch
+staging-speakup-move-pasting-into-a-work-item.patch
+staging-comedi-ni_daq_700-add-mux-settling-delay.patch
+staging-speakup-update-__speakup_paste_selection-tty-ab-usage-to-match-vt.patch
+staging-r8192e_pci-fix-htons-error.patch
+bluetooth-fix-l2cap-le-debugfs-entries-permissions.patch
+alsa-hda-analog-fix-silent-output-on-asus-a8jn.patch
+alsa-hda-realtek-correction-of-fixup-codes-for-pb-v7900-laptop.patch
+alsa-hda-realtek-fix-coef-widget-nid-for-alc260-replacer-fixup.patch
+usb-ftdi_sio-add-novatech-orionlxm-product-id.patch
+usb-cdc-wdm-export-cdc-wdm-uapi-header.patch
+usb-cdc-wdm-properly-include-types.h.patch
+usb-serial-option-add-support-for-novatel-e371-pcie-card.patch
+usb-io_ti-fix-firmware-download-on-big-endian-machines-part-2.patch
+usb-pci-quirks-prevent-sony-vaio-t-series-from-switching-usb-ports.patch
+usb-avoid-runtime-suspend-loops-for-hcds-that-can-t-handle-suspend-resume.patch
--- /dev/null
+From ffed54dced86723f352323f15789d9ad6bee25e1 Mon Sep 17 00:00:00 2001
+From: Ian Abbott <abbotti@mev.co.uk>
+Date: Mon, 19 May 2014 11:29:04 +0100
+Subject: staging: comedi: ni_daq_700: add mux settling delay
+
+From: Ian Abbott <abbotti@mev.co.uk>
+
+commit ffed54dced86723f352323f15789d9ad6bee25e1 upstream.
+
+I got a patch from the original author, Fred Brooks, to add a small
+settling delay after setting the AI channel multiplexor. The lack of
+delay resulted in unstable or scrambled data on faster processors.
+
+Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
+Reported-by: Fred Brooks <nsaspook@nsaspook.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/comedi/drivers/ni_daq_700.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/staging/comedi/drivers/ni_daq_700.c
++++ b/drivers/staging/comedi/drivers/ni_daq_700.c
+@@ -122,6 +122,8 @@ static int daq700_ai_rinsn(struct comedi
+ /* write channel to multiplexer */
+ /* set mask scan bit high to disable scanning */
+ outb(chan | 0x80, dev->iobase + CMD_R1);
++ /* mux needs 2us to really settle [Fred Brooks]. */
++ udelay(2);
+
+ /* convert n samples */
+ for (n = 0; n < insn->n; n++) {
--- /dev/null
+From 9326c5ca0982f548cc08c0cffb14dcbd020f3d43 Mon Sep 17 00:00:00 2001
+From: Sean MacLennan <seanm@seanm.ca>
+Date: Wed, 28 May 2014 11:19:00 -0400
+Subject: staging: r8192e_pci: fix htons error
+
+From: Sean MacLennan <seanm@seanm.ca>
+
+commit 9326c5ca0982f548cc08c0cffb14dcbd020f3d43 upstream.
+
+A sparse error fixup removed a htons() which is required for the driver
+to function. This patch puts the htons() back and fixes the sparse
+warning correctly by changing the left side cast.
+
+Signed-off-by: Sean MacLennan <seanm@seanm.ca>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/rtl8192e/rtllib_tx.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/staging/rtl8192e/rtllib_tx.c
++++ b/drivers/staging/rtl8192e/rtllib_tx.c
+@@ -171,7 +171,7 @@ inline int rtllib_put_snap(u8 *data, u16
+ snap->oui[1] = oui[1];
+ snap->oui[2] = oui[2];
+
+- *(u16 *)(data + SNAP_SIZE) = h_proto;
++ *(__be16 *)(data + SNAP_SIZE) = htons(h_proto);
+
+ return SNAP_SIZE + sizeof(u16);
+ }
--- /dev/null
+From d7500135802ca55b3f4e01a16544e8b34082f8c3 Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <ben@decadent.org.uk>
+Date: Mon, 19 May 2014 00:56:22 +0100
+Subject: Staging: speakup: Move pasting into a work item
+
+From: Ben Hutchings <ben@decadent.org.uk>
+
+commit d7500135802ca55b3f4e01a16544e8b34082f8c3 upstream.
+
+Input is handled in softirq context, but when pasting we may
+need to sleep. speakup_paste_selection() currently tries to
+bodge this by busy-waiting if in_atomic(), but that doesn't
+help because the ldisc may also sleep.
+
+For bonus breakage, speakup_paste_selection() changes the
+state of current, even though it's not running in process
+context.
+
+Move it into a work item and make sure to cancel it on exit.
+
+References: https://bugs.debian.org/735202
+References: https://bugs.debian.org/744015
+Reported-by: Paul Gevers <elbrus@debian.org>
+Reported-and-tested-by: Jarek Czekalski <jarekczek@poczta.onet.pl>
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/speakup/main.c | 1
+ drivers/staging/speakup/selection.c | 40 +++++++++++++++++++++++++++++-------
+ drivers/staging/speakup/speakup.h | 1
+ 3 files changed, 35 insertions(+), 7 deletions(-)
+
+--- a/drivers/staging/speakup/main.c
++++ b/drivers/staging/speakup/main.c
+@@ -2218,6 +2218,7 @@ static void __exit speakup_exit(void)
+ unregister_keyboard_notifier(&keyboard_notifier_block);
+ unregister_vt_notifier(&vt_notifier_block);
+ speakup_unregister_devsynth();
++ speakup_cancel_paste();
+ del_timer(&cursor_timer);
+ kthread_stop(speakup_task);
+ speakup_task = NULL;
+--- a/drivers/staging/speakup/selection.c
++++ b/drivers/staging/speakup/selection.c
+@@ -4,6 +4,8 @@
+ #include <linux/sched.h>
+ #include <linux/device.h> /* for dev_warn */
+ #include <linux/selection.h>
++#include <linux/workqueue.h>
++#include <asm/cmpxchg.h>
+
+ #include "speakup.h"
+
+@@ -121,20 +123,24 @@ int speakup_set_selection(struct tty_str
+ return 0;
+ }
+
+-/* TODO: move to some helper thread, probably. That'd fix having to check for
+- * in_atomic(). */
+-int speakup_paste_selection(struct tty_struct *tty)
+-{
++struct speakup_paste_work {
++ struct work_struct work;
++ struct tty_struct *tty;
++};
++
++static void __speakup_paste_selection(struct work_struct *work)
++{
++ struct speakup_paste_work *spw =
++ container_of(work, struct speakup_paste_work, work);
++ struct tty_struct *tty = xchg(&spw->tty, NULL);
+ struct vc_data *vc = (struct vc_data *) tty->driver_data;
+ int pasted = 0, count;
+ DECLARE_WAITQUEUE(wait, current);
++
+ add_wait_queue(&vc->paste_wait, &wait);
+ while (sel_buffer && sel_buffer_lth > pasted) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ if (test_bit(TTY_THROTTLED, &tty->flags)) {
+- if (in_atomic())
+- /* if we are in an interrupt handler, abort */
+- break;
+ schedule();
+ continue;
+ }
+@@ -146,6 +152,26 @@ int speakup_paste_selection(struct tty_s
+ }
+ remove_wait_queue(&vc->paste_wait, &wait);
+ current->state = TASK_RUNNING;
++ tty_kref_put(tty);
++}
++
++static struct speakup_paste_work speakup_paste_work = {
++ .work = __WORK_INITIALIZER(speakup_paste_work.work,
++ __speakup_paste_selection)
++};
++
++int speakup_paste_selection(struct tty_struct *tty)
++{
++ if (cmpxchg(&speakup_paste_work.tty, NULL, tty) != NULL)
++ return -EBUSY;
++
++ tty_kref_get(tty);
++ schedule_work_on(WORK_CPU_UNBOUND, &speakup_paste_work.work);
+ return 0;
+ }
+
++void speakup_cancel_paste(void)
++{
++ cancel_work_sync(&speakup_paste_work.work);
++ tty_kref_put(speakup_paste_work.tty);
++}
+--- a/drivers/staging/speakup/speakup.h
++++ b/drivers/staging/speakup/speakup.h
+@@ -77,6 +77,7 @@ extern void synth_buffer_clear(void);
+ extern void speakup_clear_selection(void);
+ extern int speakup_set_selection(struct tty_struct *tty);
+ extern int speakup_paste_selection(struct tty_struct *tty);
++extern void speakup_cancel_paste(void);
+ extern void speakup_register_devsynth(void);
+ extern void speakup_unregister_devsynth(void);
+ extern void synth_write(const char *buf, size_t count);
--- /dev/null
+From 28a821c306889b9f2c3fff49abedc9b2c743eb73 Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <ben@decadent.org.uk>
+Date: Mon, 19 May 2014 01:03:06 +0100
+Subject: Staging: speakup: Update __speakup_paste_selection() tty (ab)usage to match vt
+
+From: Ben Hutchings <ben@decadent.org.uk>
+
+commit 28a821c306889b9f2c3fff49abedc9b2c743eb73 upstream.
+
+This function is largely a duplicate of paste_selection() in
+drivers/tty/vt/selection.c, but with its own selection state. The
+speakup selection mechanism should really be merged with vt.
+
+For now, apply the changes from 'TTY: vt, fix paste_selection ldisc
+handling', 'tty: Make ldisc input flow control concurrency-friendly',
+and 'tty: Fix unsafe vt paste_selection()'.
+
+References: https://bugs.debian.org/735202
+References: https://bugs.debian.org/744015
+Reported-by: Paul Gevers <elbrus@debian.org>
+Reported-and-tested-by: Jarek Czekalski <jarekczek@poczta.onet.pl>
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/speakup/selection.c | 14 +++++++++++---
+ drivers/tty/tty_buffer.c | 2 ++
+ 2 files changed, 13 insertions(+), 3 deletions(-)
+
+--- a/drivers/staging/speakup/selection.c
++++ b/drivers/staging/speakup/selection.c
+@@ -5,6 +5,8 @@
+ #include <linux/device.h> /* for dev_warn */
+ #include <linux/selection.h>
+ #include <linux/workqueue.h>
++#include <linux/tty.h>
++#include <linux/tty_flip.h>
+ #include <asm/cmpxchg.h>
+
+ #include "speakup.h"
+@@ -135,8 +137,12 @@ static void __speakup_paste_selection(st
+ struct tty_struct *tty = xchg(&spw->tty, NULL);
+ struct vc_data *vc = (struct vc_data *) tty->driver_data;
+ int pasted = 0, count;
++ struct tty_ldisc *ld;
+ DECLARE_WAITQUEUE(wait, current);
+
++ ld = tty_ldisc_ref_wait(tty);
++ tty_buffer_lock_exclusive(&vc->port);
++
+ add_wait_queue(&vc->paste_wait, &wait);
+ while (sel_buffer && sel_buffer_lth > pasted) {
+ set_current_state(TASK_INTERRUPTIBLE);
+@@ -145,13 +151,15 @@ static void __speakup_paste_selection(st
+ continue;
+ }
+ count = sel_buffer_lth - pasted;
+- count = min_t(int, count, tty->receive_room);
+- tty->ldisc->ops->receive_buf(tty, sel_buffer + pasted,
+- NULL, count);
++ count = tty_ldisc_receive_buf(ld, sel_buffer + pasted, NULL,
++ count);
+ pasted += count;
+ }
+ remove_wait_queue(&vc->paste_wait, &wait);
+ current->state = TASK_RUNNING;
++
++ tty_buffer_unlock_exclusive(&vc->port);
++ tty_ldisc_deref(ld);
+ tty_kref_put(tty);
+ }
+
+--- a/drivers/tty/tty_buffer.c
++++ b/drivers/tty/tty_buffer.c
+@@ -60,6 +60,7 @@ void tty_buffer_lock_exclusive(struct tt
+ atomic_inc(&buf->priority);
+ mutex_lock(&buf->lock);
+ }
++EXPORT_SYMBOL_GPL(tty_buffer_lock_exclusive);
+
+ void tty_buffer_unlock_exclusive(struct tty_port *port)
+ {
+@@ -73,6 +74,7 @@ void tty_buffer_unlock_exclusive(struct
+ if (restart)
+ queue_work(system_unbound_wq, &buf->work);
+ }
++EXPORT_SYMBOL_GPL(tty_buffer_unlock_exclusive);
+
+ /**
+ * tty_buffer_space_avail - return unused buffer space
--- /dev/null
+From 8ef42ddd9a53b73e6fc3934278710c27f80f324f Mon Sep 17 00:00:00 2001
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Fri, 23 May 2014 10:45:54 -0400
+Subject: USB: Avoid runtime suspend loops for HCDs that can't handle suspend/resume
+
+From: Alan Stern <stern@rowland.harvard.edu>
+
+commit 8ef42ddd9a53b73e6fc3934278710c27f80f324f upstream.
+
+Not all host controller drivers have bus-suspend and bus-resume
+methods. When one doesn't, it will cause problems if runtime PM is
+enabled in the kernel. The PM core will attempt to suspend the
+controller's root hub, the suspend will fail because there is no
+bus-suspend routine, and a -EBUSY error code will be returned to the
+PM core. This will cause the suspend attempt to be repeated shortly
+thereafter, in a never-ending loop.
+
+Part of the problem is that the original error code -ENOENT gets
+changed to -EBUSY in usb_runtime_suspend(), on the grounds that the PM
+core will interpret -ENOENT as meaning that the root hub has gotten
+into a runtime-PM error state. While this change is appropriate for
+real USB devices, it's not such a good idea for a root hub. In fact,
+considering the root hub to be in a runtime-PM error state would not
+be far from the truth. Therefore this patch updates
+usb_runtime_suspend() so that it adjusts error codes only for
+non-root-hub devices.
+
+Furthermore, the patch attempts to prevent the problem from occurring
+in the first place by not enabling runtime PM by default for root hubs
+whose host controller driver doesn't have bus_suspend and bus_resume
+methods.
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Reported-by: Will Deacon <will.deacon@arm.com>
+Tested-by: Will Deacon <will.deacon@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/core/driver.c | 9 ++++++---
+ drivers/usb/core/hub.c | 15 +++++++++++++--
+ 2 files changed, 19 insertions(+), 5 deletions(-)
+
+--- a/drivers/usb/core/driver.c
++++ b/drivers/usb/core/driver.c
+@@ -1801,10 +1801,13 @@ int usb_runtime_suspend(struct device *d
+ if (status == -EAGAIN || status == -EBUSY)
+ usb_mark_last_busy(udev);
+
+- /* The PM core reacts badly unless the return code is 0,
+- * -EAGAIN, or -EBUSY, so always return -EBUSY on an error.
++ /*
++ * The PM core reacts badly unless the return code is 0,
++ * -EAGAIN, or -EBUSY, so always return -EBUSY on an error
++ * (except for root hubs, because they don't suspend through
++ * an upstream port like other USB devices).
+ */
+- if (status != 0)
++ if (status != 0 && udev->parent)
+ return -EBUSY;
+ return status;
+ }
+--- a/drivers/usb/core/hub.c
++++ b/drivers/usb/core/hub.c
+@@ -1679,8 +1679,19 @@ static int hub_probe(struct usb_interfac
+ */
+ pm_runtime_set_autosuspend_delay(&hdev->dev, 0);
+
+- /* Hubs have proper suspend/resume support. */
+- usb_enable_autosuspend(hdev);
++ /*
++ * Hubs have proper suspend/resume support, except for root hubs
++ * where the controller driver doesn't have bus_suspend and
++ * bus_resume methods.
++ */
++ if (hdev->parent) { /* normal device */
++ usb_enable_autosuspend(hdev);
++ } else { /* root hub */
++ const struct hc_driver *drv = bus_to_hcd(hdev->bus)->driver;
++
++ if (drv->bus_suspend && drv->bus_resume)
++ usb_enable_autosuspend(hdev);
++ }
+
+ if (hdev->level == MAX_TOPO_LEVEL) {
+ dev_err(&intf->dev,
--- /dev/null
+From 7d1896360f4d055d68565ef8ed56a677580f1a39 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>
+Date: Sat, 10 May 2014 16:31:40 +0200
+Subject: usb: cdc-wdm: export cdc-wdm uapi header
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>
+
+commit 7d1896360f4d055d68565ef8ed56a677580f1a39 upstream.
+
+The include/uapi/linux/usb/cdc-wdm.h header defines cdc-wdm
+userspace APIs and should be exported by make headers_install.
+
+Fixes: 3edce1cf813a ("USB: cdc-wdm: implement IOCTL_WDM_MAX_COMMAND")
+Signed-off-by: Bjørn Mork <bjorn@mork.no>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/uapi/linux/usb/Kbuild | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/include/uapi/linux/usb/Kbuild
++++ b/include/uapi/linux/usb/Kbuild
+@@ -1,6 +1,7 @@
+ # UAPI Header export list
+ header-y += audio.h
+ header-y += cdc.h
++header-y += cdc-wdm.h
+ header-y += ch11.h
+ header-y += ch9.h
+ header-y += functionfs.h
--- /dev/null
+From 7ac3764fcafc06e72e1a79a9d998b9fdd900b2a6 Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Tue, 27 May 2014 16:32:10 -0700
+Subject: USB: cdc-wdm: properly include types.h
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+commit 7ac3764fcafc06e72e1a79a9d998b9fdd900b2a6 upstream.
+
+The file include/uapi/linux/usb/cdc-wdm.h uses a __u16 so it needs to
+include types.h as well to make the build system happy.
+
+Fixes: 3edce1cf813a ("USB: cdc-wdm: implement IOCTL_WDM_MAX_COMMAND")
+Cc: Bjørn Mork <bjorn@mork.no>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/uapi/linux/usb/cdc-wdm.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/include/uapi/linux/usb/cdc-wdm.h
++++ b/include/uapi/linux/usb/cdc-wdm.h
+@@ -9,6 +9,8 @@
+ #ifndef _UAPI__LINUX_USB_CDC_WDM_H
+ #define _UAPI__LINUX_USB_CDC_WDM_H
+
++#include <linux/types.h>
++
+ /*
+ * This IOCTL is used to retrieve the wMaxCommand for the device,
+ * defining the message limit for both reading and writing.
--- /dev/null
+From d0839d757e6294921c31b1c4ca4f1dcc5df63bcd Mon Sep 17 00:00:00 2001
+From: George McCollister <george.mccollister@gmail.com>
+Date: Sat, 26 Apr 2014 12:04:47 +0200
+Subject: USB: ftdi_sio: add NovaTech OrionLXm product ID
+
+From: George McCollister <george.mccollister@gmail.com>
+
+commit d0839d757e6294921c31b1c4ca4f1dcc5df63bcd upstream.
+
+The NovaTech OrionLXm uses an onboard FTDI serial converter for JTAG and
+console access.
+
+Here is the lsusb output:
+Bus 004 Device 123: ID 0403:7c90 Future Technology Devices
+International, Ltd
+
+Signed-off-by: George McCollister <george.mccollister@gmail.com>
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/ftdi_sio.c | 2 ++
+ drivers/usb/serial/ftdi_sio_ids.h | 5 +++++
+ 2 files changed, 7 insertions(+)
+
+--- a/drivers/usb/serial/ftdi_sio.c
++++ b/drivers/usb/serial/ftdi_sio.c
+@@ -580,6 +580,8 @@ static const struct usb_device_id id_tab
+ { USB_DEVICE(FTDI_VID, FTDI_TAVIR_STK500_PID) },
+ { USB_DEVICE(FTDI_VID, FTDI_TIAO_UMPA_PID),
+ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
++ { USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID),
++ .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
+ /*
+ * ELV devices:
+ */
+--- a/drivers/usb/serial/ftdi_sio_ids.h
++++ b/drivers/usb/serial/ftdi_sio_ids.h
+@@ -538,6 +538,11 @@
+ */
+ #define FTDI_TIAO_UMPA_PID 0x8a98 /* TIAO/DIYGADGET USB Multi-Protocol Adapter */
+
++/*
++ * NovaTech product ids (FTDI_VID)
++ */
++#define FTDI_NT_ORIONLXM_PID 0x7c90 /* OrionLXm Substation Automation Platform */
++
+
+ /********************************/
+ /** third-party VID/PID combos **/
--- /dev/null
+From c03890ff5e24a4bf59059f2d179f427559b7330a Mon Sep 17 00:00:00 2001
+From: Johan Hovold <jhovold@gmail.com>
+Date: Sat, 26 Apr 2014 11:53:44 +0200
+Subject: USB: io_ti: fix firmware download on big-endian machines (part 2)
+
+From: Johan Hovold <jhovold@gmail.com>
+
+commit c03890ff5e24a4bf59059f2d179f427559b7330a upstream.
+
+A recent patch that purported to fix firmware download on big-endian
+machines failed to add the corresponding sparse annotation to the
+i2c-header. This was reported by the kbuild test robot.
+
+Adding the appropriate annotation revealed another endianess bug related
+to the i2c-header Size-field in a code path that is exercised when the
+firmware is actually being downloaded (and not just verified and left
+untouched unless older than the firmware at hand).
+
+This patch adds the required sparse annotation to the i2c-header and
+makes sure that the Size-field is sent in little-endian byte order
+during firmware download also on big-endian machines.
+
+Note that this patch is only compile-tested, but that there is no
+functional change for little-endian systems.
+
+Reported-by: kbuild test robot <fengguang.wu@intel.com>
+Cc: Ludovic Drolez <ldrolez@debian.org>
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/io_ti.c | 2 +-
+ drivers/usb/serial/io_usbvend.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/serial/io_ti.c
++++ b/drivers/usb/serial/io_ti.c
+@@ -821,7 +821,7 @@ static int build_i2c_fw_hdr(__u8 *header
+ firmware_rec = (struct ti_i2c_firmware_rec*)i2c_header->Data;
+
+ i2c_header->Type = I2C_DESC_TYPE_FIRMWARE_BLANK;
+- i2c_header->Size = (__u16)buffer_size;
++ i2c_header->Size = cpu_to_le16(buffer_size);
+ i2c_header->CheckSum = cs;
+ firmware_rec->Ver_Major = OperationalMajorVersion;
+ firmware_rec->Ver_Minor = OperationalMinorVersion;
+--- a/drivers/usb/serial/io_usbvend.h
++++ b/drivers/usb/serial/io_usbvend.h
+@@ -594,7 +594,7 @@ struct edge_boot_descriptor {
+
+ struct ti_i2c_desc {
+ __u8 Type; // Type of descriptor
+- __u16 Size; // Size of data only not including header
++ __le16 Size; // Size of data only not including header
+ __u8 CheckSum; // Checksum (8 bit sum of data only)
+ __u8 Data[0]; // Data starts here
+ } __attribute__((packed));
--- /dev/null
+From b38f09ccc3fd453180e96273bf3f34083c30809a Mon Sep 17 00:00:00 2001
+From: Mathias Nyman <mathias.nyman@linux.intel.com>
+Date: Wed, 28 May 2014 23:18:35 +0300
+Subject: usb: pci-quirks: Prevent Sony VAIO t-series from switching usb ports
+
+From: Mathias Nyman <mathias.nyman@linux.intel.com>
+
+commit b38f09ccc3fd453180e96273bf3f34083c30809a upstream.
+
+Sony VAIO t-series machines are not capable of switching usb2 ports over
+from Intel EHCI to xHCI controller. If tried the USB2 port will be left
+unconnected and unusable.
+
+This patch should be backported to stable kernels as old as 3.12,
+that contain the commit 26b76798e0507429506b93cd49f8c4cfdab06896
+"Intel xhci: refactor EHCI/xHCI port switching"
+
+Reported-by: Jorge <xxopxe@gmail.com>
+Tested-by: Jorge <xxopxe@gmail.com>
+Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/pci-quirks.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/drivers/usb/host/pci-quirks.c
++++ b/drivers/usb/host/pci-quirks.c
+@@ -847,6 +847,13 @@ void usb_enable_intel_xhci_ports(struct
+ bool ehci_found = false;
+ struct pci_dev *companion = NULL;
+
++ /* Sony VAIO t-series with subsystem device ID 90a8 is not capable of
++ * switching ports from EHCI to xHCI
++ */
++ if (xhci_pdev->subsystem_vendor == PCI_VENDOR_ID_SONY &&
++ xhci_pdev->subsystem_device == 0x90a8)
++ return;
++
+ /* make sure an intel EHCI controller exists */
+ for_each_pci_dev(companion) {
+ if (companion->class == PCI_CLASS_SERIAL_USB_EHCI &&
--- /dev/null
+From 8a61ba3a47ac39f660702aa66a172185dd605a86 Mon Sep 17 00:00:00 2001
+From: Alexej Starschenko <starschenko@gmail.com>
+Date: Wed, 7 May 2014 10:43:29 +0200
+Subject: USB: serial: option: add support for Novatel E371 PCIe card
+
+From: Alexej Starschenko <starschenko@gmail.com>
+
+commit 8a61ba3a47ac39f660702aa66a172185dd605a86 upstream.
+
+Adds product ID for the Novatel E371 PCI Express Mini Card.
+
+$ lsusb
+Bus 001 Device 024: ID 1410:9011 Novatel Wireless
+
+$ usb-devices
+T: Bus=01 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#= 24 Spd=480 MxCh= 0
+D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
+P: Vendor=1410 ProdID=9011 Rev=00.03
+S: Manufacturer=Novatel Wireless, Inc.
+S: Product=Novatel Wireless HSPA
+S: SerialNumber=012773002115811
+C: #Ifs= 6 Cfg#= 1 Atr=e0 MxPwr=500mA
+I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
+I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
+I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
+I: If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
+I: If#= 6 Alt= 0 #EPs= 1 Cls=02(commc) Sub=06 Prot=00 Driver=cdc_ether
+I: If#= 7 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
+
+Tested with kernel 3.2.0.
+
+Signed-off-by: Alexej Starschenko <starschenko@gmail.com>
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/option.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/usb/serial/option.c
++++ b/drivers/usb/serial/option.c
+@@ -161,6 +161,7 @@ static void option_instat_callback(struc
+ #define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED 0x9000
+ #define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED 0x9001
+ #define NOVATELWIRELESS_PRODUCT_E362 0x9010
++#define NOVATELWIRELESS_PRODUCT_E371 0x9011
+ #define NOVATELWIRELESS_PRODUCT_G2 0xA010
+ #define NOVATELWIRELESS_PRODUCT_MC551 0xB001
+
+@@ -1012,6 +1013,7 @@ static const struct usb_device_id option
+ /* Novatel Ovation MC551 a.k.a. Verizon USB551L */
+ { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC551, 0xff, 0xff, 0xff) },
+ { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E362, 0xff, 0xff, 0xff) },
++ { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E371, 0xff, 0xff, 0xff) },
+
+ { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) },
+ { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) },
--- /dev/null
+From 5dc2808c4729bf080487e61b80ee04e0fdb12a37 Mon Sep 17 00:00:00 2001
+From: Mathias Nyman <mathias.nyman@linux.intel.com>
+Date: Wed, 28 May 2014 23:51:13 +0300
+Subject: xhci: delete endpoints from bandwidth list before freeing whole device
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Mathias Nyman <mathias.nyman@linux.intel.com>
+
+commit 5dc2808c4729bf080487e61b80ee04e0fdb12a37 upstream.
+
+Lists of endpoints are stored for bandwidth calculation for roothub ports.
+Make sure we remove all endpoints from the list before the whole device,
+containing its endpoints list_head stuctures, is freed.
+
+This used to be done in the wrong order in xhci_mem_cleanup(),
+and triggered an oops in resume from S4 (hibernate).
+
+Tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
+Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci-mem.c | 20 ++++++++++----------
+ 1 file changed, 10 insertions(+), 10 deletions(-)
+
+--- a/drivers/usb/host/xhci-mem.c
++++ b/drivers/usb/host/xhci-mem.c
+@@ -1722,6 +1722,16 @@ void xhci_mem_cleanup(struct xhci_hcd *x
+ kfree(cur_cd);
+ }
+
++ num_ports = HCS_MAX_PORTS(xhci->hcs_params1);
++ for (i = 0; i < num_ports; i++) {
++ struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table;
++ for (j = 0; j < XHCI_MAX_INTERVAL; j++) {
++ struct list_head *ep = &bwt->interval_bw[j].endpoints;
++ while (!list_empty(ep))
++ list_del_init(ep->next);
++ }
++ }
++
+ for (i = 1; i < MAX_HC_SLOTS; ++i)
+ xhci_free_virt_device(xhci, i);
+
+@@ -1757,16 +1767,6 @@ void xhci_mem_cleanup(struct xhci_hcd *x
+ if (!xhci->rh_bw)
+ goto no_bw;
+
+- num_ports = HCS_MAX_PORTS(xhci->hcs_params1);
+- for (i = 0; i < num_ports; i++) {
+- struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table;
+- for (j = 0; j < XHCI_MAX_INTERVAL; j++) {
+- struct list_head *ep = &bwt->interval_bw[j].endpoints;
+- while (!list_empty(ep))
+- list_del_init(ep->next);
+- }
+- }
+-
+ for (i = 0; i < num_ports; i++) {
+ struct xhci_tt_bw_info *tt, *n;
+ list_for_each_entry_safe(tt, n, &xhci->rh_bw[i].tts, tt_list) {