--- /dev/null
+From 25be5821521640eb00b7eb219ffe59664510d073 Mon Sep 17 00:00:00 2001
+From: Kyle McMartin <kyle@redhat.com>
+Date: Tue, 22 Mar 2011 16:19:50 -0400
+Subject: ACPI battery: fribble sysfs files from a resume notifier
+
+From: Kyle McMartin <kyle@redhat.com>
+
+commit 25be5821521640eb00b7eb219ffe59664510d073 upstream.
+
+Commit da8aeb92 re-poked the battery on resume, but Linus reports that
+it broke his eee and partially reverted it in b23fffd7. Unfortunately
+this also results in my x201s giving crack values until the sysfs files
+are poked again. In the revert message, it was suggested that we poke it
+from a PM notifier, so let's do that.
+
+With this in place, I haven't noticed the units going nutty on my
+gnome-power-manager across a dozen suspends or so...
+
+Signed-off-by: Kyle McMartin <kyle@redhat.com>
+Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
+Signed-off-by: Len Brown <len.brown@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/acpi/battery.c | 22 ++++++++++++++++++++++
+ 1 file changed, 22 insertions(+)
+
+--- a/drivers/acpi/battery.c
++++ b/drivers/acpi/battery.c
+@@ -33,6 +33,7 @@
+ #include <linux/async.h>
+ #include <linux/dmi.h>
+ #include <linux/slab.h>
++#include <linux/suspend.h>
+
+ #ifdef CONFIG_ACPI_PROCFS_POWER
+ #include <linux/proc_fs.h>
+@@ -102,6 +103,7 @@ struct acpi_battery {
+ struct mutex lock;
+ struct power_supply bat;
+ struct acpi_device *device;
++ struct notifier_block pm_nb;
+ unsigned long update_time;
+ int rate_now;
+ int capacity_now;
+@@ -940,6 +942,21 @@ static void acpi_battery_notify(struct a
+ power_supply_changed(&battery->bat);
+ }
+
++static int battery_notify(struct notifier_block *nb,
++ unsigned long mode, void *_unused)
++{
++ struct acpi_battery *battery = container_of(nb, struct acpi_battery,
++ pm_nb);
++ switch (mode) {
++ case PM_POST_SUSPEND:
++ sysfs_remove_battery(battery);
++ sysfs_add_battery(battery);
++ break;
++ }
++
++ return 0;
++}
++
+ static int acpi_battery_add(struct acpi_device *device)
+ {
+ int result = 0;
+@@ -972,6 +989,10 @@ static int acpi_battery_add(struct acpi_
+ #endif
+ kfree(battery);
+ }
++
++ battery->pm_nb.notifier_call = battery_notify;
++ register_pm_notifier(&battery->pm_nb);
++
+ return result;
+ }
+
+@@ -982,6 +1003,7 @@ static int acpi_battery_remove(struct ac
+ if (!device || !acpi_driver_data(device))
+ return -EINVAL;
+ battery = acpi_driver_data(device);
++ unregister_pm_notifier(&battery->pm_nb);
+ #ifdef CONFIG_ACPI_PROCFS_POWER
+ acpi_battery_remove_fs(device);
+ #endif
--- /dev/null
+From 7b3a24c57d2eeda8dba9c205342b12689c4679f9 Mon Sep 17 00:00:00 2001
+From: Maxime Bizon <mbizon@freebox.fr>
+Date: Wed, 16 Mar 2011 14:58:32 +0100
+Subject: ahci: don't enable port irq before handler is registered
+
+From: Maxime Bizon <mbizon@freebox.fr>
+
+commit 7b3a24c57d2eeda8dba9c205342b12689c4679f9 upstream.
+
+The ahci_pmp_attach() & ahci_pmp_detach() unmask port irqs, but they
+are also called during port initialization, before ahci host irq
+handler is registered. On ce4100 platform, this sometimes triggers
+"irq 4: nobody cared" message when loading driver.
+
+Fixed this by not touching the register if the port is in frozen
+state, and mark all uninitialized port as frozen.
+
+Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
+Acked-by: Tejun Heo <tj@kernel.org>
+Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/ata/libahci.c | 17 +++++++++++++++--
+ drivers/ata/libata-core.c | 4 ++--
+ 2 files changed, 17 insertions(+), 4 deletions(-)
+
+--- a/drivers/ata/libahci.c
++++ b/drivers/ata/libahci.c
+@@ -1897,7 +1897,17 @@ static void ahci_pmp_attach(struct ata_p
+ ahci_enable_fbs(ap);
+
+ pp->intr_mask |= PORT_IRQ_BAD_PMP;
+- writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
++
++ /*
++ * We must not change the port interrupt mask register if the
++ * port is marked frozen, the value in pp->intr_mask will be
++ * restored later when the port is thawed.
++ *
++ * Note that during initialization, the port is marked as
++ * frozen since the irq handler is not yet registered.
++ */
++ if (!(ap->pflags & ATA_PFLAG_FROZEN))
++ writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
+ }
+
+ static void ahci_pmp_detach(struct ata_port *ap)
+@@ -1913,7 +1923,10 @@ static void ahci_pmp_detach(struct ata_p
+ writel(cmd, port_mmio + PORT_CMD);
+
+ pp->intr_mask &= ~PORT_IRQ_BAD_PMP;
+- writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
++
++ /* see comment above in ahci_pmp_attach() */
++ if (!(ap->pflags & ATA_PFLAG_FROZEN))
++ writel(pp->intr_mask, port_mmio + PORT_IRQ_MASK);
+ }
+
+ int ahci_port_resume(struct ata_port *ap)
+--- a/drivers/ata/libata-core.c
++++ b/drivers/ata/libata-core.c
+@@ -5479,8 +5479,8 @@ struct ata_port *ata_port_alloc(struct a
+ ap = kzalloc(sizeof(*ap), GFP_KERNEL);
+ if (!ap)
+ return NULL;
+-
+- ap->pflags |= ATA_PFLAG_INITIALIZING;
++
++ ap->pflags |= ATA_PFLAG_INITIALIZING | ATA_PFLAG_FROZEN;
+ ap->lock = &host->lock;
+ ap->print_id = -1;
+ ap->host = host;
--- /dev/null
+From 6981d184376e74391c23c116a068f8d1305f0e57 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Fri, 15 Apr 2011 10:11:12 +0200
+Subject: ALSA: hda - Add a fix-up for Acer dmic with ALC271x codec
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 6981d184376e74391c23c116a068f8d1305f0e57 upstream.
+
+Acer laptops with ALC271x needs a magic initialization for digital-mic
+to make it working with mono streams (and PulseAudio).
+Added a fix-up applied to Acer with ALC271x generically.
+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ sound/pci/hda/patch_realtek.c | 25 ++++++++++++++++++++++++-
+ 1 file changed, 24 insertions(+), 1 deletion(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -14945,6 +14945,23 @@ static void alc269_fixup_hweq(struct hda
+ alc_write_coef_idx(codec, 0x1e, coef | 0x80);
+ }
+
++static void alc271_fixup_dmic(struct hda_codec *codec,
++ const struct alc_fixup *fix, int action)
++{
++ static struct hda_verb verbs[] = {
++ {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
++ {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
++ {}
++ };
++ unsigned int cfg;
++
++ if (strcmp(codec->chip_name, "ALC271X"))
++ return;
++ cfg = snd_hda_codec_get_pincfg(codec, 0x12);
++ if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
++ snd_hda_sequence_write(codec, verbs);
++}
++
+ enum {
+ ALC269_FIXUP_SONY_VAIO,
+ ALC275_FIXUP_SONY_VAIO_GPIO2,
+@@ -14953,6 +14970,7 @@ enum {
+ ALC269_FIXUP_ASUS_G73JW,
+ ALC269_FIXUP_LENOVO_EAPD,
+ ALC275_FIXUP_SONY_HWEQ,
++ ALC271_FIXUP_DMIC,
+ };
+
+ static const struct alc_fixup alc269_fixups[] = {
+@@ -15006,7 +15024,11 @@ static const struct alc_fixup alc269_fix
+ .v.func = alc269_fixup_hweq,
+ .chained = true,
+ .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
+- }
++ },
++ [ALC271_FIXUP_DMIC] = {
++ .type = ALC_FIXUP_FUNC,
++ .v.func = alc271_fixup_dmic,
++ },
+ };
+
+ static struct snd_pci_quirk alc269_fixup_tbl[] = {
+@@ -15015,6 +15037,7 @@ static struct snd_pci_quirk alc269_fixup
+ SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
+ SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
+ SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
++ SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
+ SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
+ SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
+ SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
--- /dev/null
+From 1fdf9b49e9e7788d09bad4b08a6a821ac39798f3 Mon Sep 17 00:00:00 2001
+From: Lars-Peter Clausen <lars@metafoo.de>
+Date: Tue, 12 Apr 2011 19:33:28 +0200
+Subject: ASoC: codecs: JZ4740: Fix OOPS
+
+From: Lars-Peter Clausen <lars@metafoo.de>
+
+commit 1fdf9b49e9e7788d09bad4b08a6a821ac39798f3 upstream.
+
+Commit ce6120cc(ASoC: Decouple DAPM from CODECs) changed the signature of
+snd_soc_dapm_widgets_new to take an pointer to a snd_soc_dapm_context instead of
+a snd_soc_codec. The call to snd_soc_dapm_widgets_new in jz4740_codec_dev_probe
+was not updated to reflect this change, which results in a compiletime warning
+and a runtime OOPS.
+
+Since the core code calls snd_soc_dapm_widgets_new after the codec has been
+registered it can be dropped here.
+
+Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
+Acked-by: Liam Girdwood <lrg@ti.com>
+Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ sound/soc/codecs/jz4740.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/sound/soc/codecs/jz4740.c
++++ b/sound/soc/codecs/jz4740.c
+@@ -308,8 +308,6 @@ static int jz4740_codec_dev_probe(struct
+ snd_soc_dapm_add_routes(dapm, jz4740_codec_dapm_routes,
+ ARRAY_SIZE(jz4740_codec_dapm_routes));
+
+- snd_soc_dapm_new_widgets(codec);
+-
+ jz4740_codec_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
+
+ return 0;
--- /dev/null
+From 39cca168bdfaef9d0c496ec27f292445d6184946 Mon Sep 17 00:00:00 2001
+From: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Date: Fri, 8 Apr 2011 16:32:16 +0900
+Subject: ASoC: Fix output PGA enabling in wm_hubs CODECs
+
+From: Mark Brown <broonie@opensource.wolfsonmicro.com>
+
+commit 39cca168bdfaef9d0c496ec27f292445d6184946 upstream.
+
+The output PGA was not being powered up in headphone and speaker paths,
+removing the ability to offer volume control and mute with the output
+PGA.
+
+Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ sound/soc/codecs/wm_hubs.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/sound/soc/codecs/wm_hubs.c
++++ b/sound/soc/codecs/wm_hubs.c
+@@ -739,12 +739,12 @@ static const struct snd_soc_dapm_route a
+
+ { "SPKL", "Input Switch", "MIXINL" },
+ { "SPKL", "IN1LP Switch", "IN1LP" },
+- { "SPKL", "Output Switch", "Left Output Mixer" },
++ { "SPKL", "Output Switch", "Left Output PGA" },
+ { "SPKL", NULL, "TOCLK" },
+
+ { "SPKR", "Input Switch", "MIXINR" },
+ { "SPKR", "IN1RP Switch", "IN1RP" },
+- { "SPKR", "Output Switch", "Right Output Mixer" },
++ { "SPKR", "Output Switch", "Right Output PGA" },
+ { "SPKR", NULL, "TOCLK" },
+
+ { "SPKL Boost", "Direct Voice Switch", "Direct Voice" },
+@@ -766,8 +766,8 @@ static const struct snd_soc_dapm_route a
+ { "SPKOUTRP", NULL, "SPKR Driver" },
+ { "SPKOUTRN", NULL, "SPKR Driver" },
+
+- { "Left Headphone Mux", "Mixer", "Left Output Mixer" },
+- { "Right Headphone Mux", "Mixer", "Right Output Mixer" },
++ { "Left Headphone Mux", "Mixer", "Left Output PGA" },
++ { "Right Headphone Mux", "Mixer", "Right Output PGA" },
+
+ { "Headphone PGA", NULL, "Left Headphone Mux" },
+ { "Headphone PGA", NULL, "Right Headphone Mux" },
--- /dev/null
+From 2165136585b5c7d6f118f1d90fbde550bb7de212 Mon Sep 17 00:00:00 2001
+From: Ike Panhc <ike.pan@canonical.com>
+Date: Wed, 23 Feb 2011 21:39:59 +0800
+Subject: ideapad: read brightness setting on brightness key notify
+
+From: Ike Panhc <ike.pan@canonical.com>
+
+commit 2165136585b5c7d6f118f1d90fbde550bb7de212 upstream.
+
+BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=25922
+
+On ideapad Y530, the brightness key notify will be blocked if the last notify
+is not responsed by getting the brightness value. Read value when we get the
+notify shall fix the problem and will not have any difference on other ideapads.
+
+Signed-off-by: Ike Panhc <ike.pan@canonical.com>
+Signed-off-by: Matthew Garrett <mjg@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/platform/x86/ideapad-laptop.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/platform/x86/ideapad-laptop.c
++++ b/drivers/platform/x86/ideapad-laptop.c
+@@ -459,6 +459,8 @@ static void ideapad_acpi_notify(struct a
+ if (test_bit(vpc_bit, &vpc1)) {
+ if (vpc_bit == 9)
+ ideapad_sync_rfk_state(adevice);
++ else if (vpc_bit == 4)
++ read_ec_data(handle, 0x12, &vpc2);
+ else
+ ideapad_input_report(priv, vpc_bit);
+ }
--- /dev/null
+From 3ba41621156681afcdbcd624e3191cbc65eb94f4 Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <ben@decadent.org.uk>
+Date: Sat, 23 Apr 2011 18:42:56 +0100
+Subject: kconfig: Avoid buffer underrun in choice input
+
+From: Ben Hutchings <ben@decadent.org.uk>
+
+commit 3ba41621156681afcdbcd624e3191cbc65eb94f4 upstream.
+
+Commit 40aee729b350 ('kconfig: fix default value for choice input')
+fixed some cases where kconfig would select the wrong option from a
+choice with a single valid option and thus enter an infinite loop.
+
+However, this broke the test for user input of the form 'N?', because
+when kconfig selects the single valid option the input is zero-length
+and the test will read the byte before the input buffer. If this
+happens to contain '?' (as it will in a mips build on Debian unstable
+today) then kconfig again enters an infinite loop.
+
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ scripts/kconfig/conf.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/scripts/kconfig/conf.c
++++ b/scripts/kconfig/conf.c
+@@ -332,7 +332,7 @@ static int conf_choice(struct menu *menu
+ }
+ if (!child)
+ continue;
+- if (line[strlen(line) - 1] == '?') {
++ if (line[0] && line[strlen(line) - 1] == '?') {
+ print_help(child);
+ continue;
+ }
--- /dev/null
+From ae01b2493c3bf03c504c32ac4ebb01d528508db3 Mon Sep 17 00:00:00 2001
+From: Tejun Heo <tj@kernel.org>
+Date: Wed, 16 Mar 2011 11:14:55 +0100
+Subject: libata: Implement ATA_FLAG_NO_DIPM and apply it to mcp65
+
+From: Tejun Heo <tj@kernel.org>
+
+commit ae01b2493c3bf03c504c32ac4ebb01d528508db3 upstream.
+
+NVIDIA mcp65 familiy of controllers cause command timeouts when DIPM
+is used. Implement ATA_FLAG_NO_DIPM and apply it.
+
+This problem was reported by Stefan Bader in the following thread.
+
+ http://thread.gmane.org/gmane.linux.ide/48841
+
+stable: applicable to 2.6.37 and 38.
+
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Reported-by: Stefan Bader <stefan.bader@canonical.com>
+Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/ata/ahci.c | 2 +-
+ drivers/ata/libata-eh.c | 6 ++++--
+ include/linux/libata.h | 1 +
+ 3 files changed, 6 insertions(+), 3 deletions(-)
+
+--- a/drivers/ata/ahci.c
++++ b/drivers/ata/ahci.c
+@@ -150,7 +150,7 @@ static const struct ata_port_info ahci_p
+ {
+ AHCI_HFLAGS (AHCI_HFLAG_NO_FPDMA_AA | AHCI_HFLAG_NO_PMP |
+ AHCI_HFLAG_YES_NCQ),
+- .flags = AHCI_FLAG_COMMON,
++ .flags = AHCI_FLAG_COMMON | ATA_FLAG_NO_DIPM,
+ .pio_mask = ATA_PIO4,
+ .udma_mask = ATA_UDMA6,
+ .port_ops = &ahci_ops,
+--- a/drivers/ata/libata-eh.c
++++ b/drivers/ata/libata-eh.c
+@@ -3276,6 +3276,7 @@ static int ata_eh_set_lpm(struct ata_lin
+ struct ata_eh_context *ehc = &link->eh_context;
+ struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL;
+ enum ata_lpm_policy old_policy = link->lpm_policy;
++ bool no_dipm = ap->flags & ATA_FLAG_NO_DIPM;
+ unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM;
+ unsigned int err_mask;
+ int rc;
+@@ -3292,7 +3293,7 @@ static int ata_eh_set_lpm(struct ata_lin
+ */
+ ata_for_each_dev(dev, link, ENABLED) {
+ bool hipm = ata_id_has_hipm(dev->id);
+- bool dipm = ata_id_has_dipm(dev->id);
++ bool dipm = ata_id_has_dipm(dev->id) && !no_dipm;
+
+ /* find the first enabled and LPM enabled devices */
+ if (!link_dev)
+@@ -3349,7 +3350,8 @@ static int ata_eh_set_lpm(struct ata_lin
+
+ /* host config updated, enable DIPM if transitioning to MIN_POWER */
+ ata_for_each_dev(dev, link, ENABLED) {
+- if (policy == ATA_LPM_MIN_POWER && ata_id_has_dipm(dev->id)) {
++ if (policy == ATA_LPM_MIN_POWER && !no_dipm &&
++ ata_id_has_dipm(dev->id)) {
+ err_mask = ata_dev_set_feature(dev,
+ SETFEATURES_SATA_ENABLE, SATA_DIPM);
+ if (err_mask && err_mask != AC_ERR_DEV) {
+--- a/include/linux/libata.h
++++ b/include/linux/libata.h
+@@ -203,6 +203,7 @@ enum {
+ * management */
+ ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity
+ * led */
++ ATA_FLAG_NO_DIPM = (1 << 23), /* host not happy with DIPM */
+
+ /* bits 24:31 of ap->flags are reserved for LLD specific flags */
+
--- /dev/null
+From 5680e94148a86e8c31fdc5cb0ea0d5c6810c05b0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
+Date: Mon, 11 Apr 2011 10:59:09 +0200
+Subject: serial/imx: read cts state only after acking cts change irq
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
+
+commit 5680e94148a86e8c31fdc5cb0ea0d5c6810c05b0 upstream.
+
+If cts changes between reading the level at the cts input (USR1_RTSS)
+and acking the irq (USR1_RTSD) the last edge doesn't generate an irq and
+uart_handle_cts_change is called with a outdated value for cts.
+
+The race was introduced by commit
+
+ ceca629 ([ARM] 2971/1: i.MX uart handle rts irq)
+
+Reported-by: Arwed Springer <Arwed.Springer@de.trumpf.com>
+Tested-by: Arwed Springer <Arwed.Springer@de.trumpf.com>
+Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/tty/serial/imx.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/tty/serial/imx.c
++++ b/drivers/tty/serial/imx.c
+@@ -382,12 +382,13 @@ static void imx_start_tx(struct uart_por
+ static irqreturn_t imx_rtsint(int irq, void *dev_id)
+ {
+ struct imx_port *sport = dev_id;
+- unsigned int val = readl(sport->port.membase + USR1) & USR1_RTSS;
++ unsigned int val;
+ unsigned long flags;
+
+ spin_lock_irqsave(&sport->port.lock, flags);
+
+ writel(USR1_RTSD, sport->port.membase + USR1);
++ val = readl(sport->port.membase + USR1) & USR1_RTSS;
+ uart_handle_cts_change(&sport->port, !!val);
+ wake_up_interruptible(&sport->port.state->port.delta_msr_wait);
+
drm-radeon-kms-fix-bad-shift-in-atom-iio-table-parser.patch
drm-i915-sanitize-the-output-registers-after-resume.patch
drm-i915-tv-remember-the-detected-tv-type.patch
+tty-n_gsm-fix-bug-in-crc-calculation-for-gsm1-mode.patch
+serial-imx-read-cts-state-only-after-acking-cts-change-irq.patch
+asoc-fix-output-pga-enabling-in-wm_hubs-codecs.patch
+asoc-codecs-jz4740-fix-oops.patch
+alsa-hda-add-a-fix-up-for-acer-dmic-with-alc271x-codec.patch
+ahci-don-t-enable-port-irq-before-handler-is-registered.patch
+libata-implement-ata_flag_no_dipm-and-apply-it-to-mcp65.patch
+kconfig-avoid-buffer-underrun-in-choice-input.patch
+ubifs-fix-master-node-recovery.patch
+ideapad-read-brightness-setting-on-brightness-key-notify.patch
+acpi-battery-fribble-sysfs-files-from-a-resume-notifier.patch
--- /dev/null
+From 9db4e4381a8e881ff65a5d3400bfa471f84217e7 Mon Sep 17 00:00:00 2001
+From: Mikhail Kshevetskiy <mikhail.kshevetskiy@gmail.com>
+Date: Sun, 27 Mar 2011 04:05:00 +0400
+Subject: tty/n_gsm: fix bug in CRC calculation for gsm1 mode
+
+From: Mikhail Kshevetskiy <mikhail.kshevetskiy@gmail.com>
+
+commit 9db4e4381a8e881ff65a5d3400bfa471f84217e7 upstream.
+
+Problem description:
+ gsm_queue() calculate a CRC for arrived frames. As a last step of
+ CRC calculation it call
+
+ gsm->fcs = gsm_fcs_add(gsm->fcs, gsm->received_fcs);
+
+ This work perfectly for the case of GSM0 mode as gsm->received_fcs
+ contain the last piece of data required to generate final CRC.
+
+ gsm->received_fcs is not used for GSM1 mode. Thus we put an
+ additional byte to CRC calculation. As result we get a wrong CRC
+ and reject incoming frame.
+
+Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@gmail.com>
+Acked-by: Alan Cox <alan@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/tty/n_gsm.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+--- a/drivers/tty/n_gsm.c
++++ b/drivers/tty/n_gsm.c
+@@ -1659,8 +1659,12 @@ static void gsm_queue(struct gsm_mux *gs
+
+ if ((gsm->control & ~PF) == UI)
+ gsm->fcs = gsm_fcs_add_block(gsm->fcs, gsm->buf, gsm->len);
+- /* generate final CRC with received FCS */
+- gsm->fcs = gsm_fcs_add(gsm->fcs, gsm->received_fcs);
++ if (gsm->encoding == 0){
++ /* WARNING: gsm->received_fcs is used for gsm->encoding = 0 only.
++ In this case it contain the last piece of data
++ required to generate final CRC */
++ gsm->fcs = gsm_fcs_add(gsm->fcs, gsm->received_fcs);
++ }
+ if (gsm->fcs != GOOD_FCS) {
+ gsm->bad_fcs++;
+ if (debug & 4)
--- /dev/null
+From 6e0d9fd38b750d678bf9fd07db23582f52fafa55 Mon Sep 17 00:00:00 2001
+From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
+Date: Thu, 21 Apr 2011 14:49:55 +0300
+Subject: UBIFS: fix master node recovery
+
+From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
+
+commit 6e0d9fd38b750d678bf9fd07db23582f52fafa55 upstream.
+
+This patch fixes the following symptoms:
+1. Unmount UBIFS cleanly.
+2. Start mounting UBIFS R/W and have a power cut immediately
+3. Start mounting UBIFS R/O, this succeeds
+4. Try to re-mount UBIFS R/W - this fails immediately or later on,
+ because UBIFS will write the master node to the flash area
+ which has been written before.
+
+The analysis of the problem:
+
+1. UBIFS is unmounted cleanly, both copies of the master node are clean.
+2. UBIFS is being mounter R/W, starts changing master node copy 1, and
+ a power cut happens. The copy N1 becomes corrupted.
+3. UBIFS is being mounted R/O. It notices the copy N1 is corrupted and
+ reads copy N2. Copy N2 is clean.
+4. Because of R/O mode, UBIFS cannot recover copy 1.
+5. The mount code (ubifs_mount()) sees that the master node is clean,
+ so it decides that no recovery is needed.
+6. We are re-mounting R/W. UBIFS believes no recovery is needed and
+ starts updating the master node, but copy N1 is still corrupted
+ and was not recovered!
+
+Fix this problem by marking the master node as dirty every time we
+recover it and we are in R/O mode. This forces further recovery and
+the UBIFS cleans-up the corruptions and recovers the copy N1 when
+re-mounting R/W later.
+
+Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ fs/ubifs/recovery.c | 26 ++++++++++++++++++++++++++
+ 1 file changed, 26 insertions(+)
+
+--- a/fs/ubifs/recovery.c
++++ b/fs/ubifs/recovery.c
+@@ -300,6 +300,32 @@ int ubifs_recover_master_node(struct ubi
+ goto out_free;
+ }
+ memcpy(c->rcvrd_mst_node, c->mst_node, UBIFS_MST_NODE_SZ);
++
++ /*
++ * We had to recover the master node, which means there was an
++ * unclean reboot. However, it is possible that the master node
++ * is clean at this point, i.e., %UBIFS_MST_DIRTY is not set.
++ * E.g., consider the following chain of events:
++ *
++ * 1. UBIFS was cleanly unmounted, so the master node is clean
++ * 2. UBIFS is being mounted R/W and starts changing the master
++ * node in the first (%UBIFS_MST_LNUM). A power cut happens,
++ * so this LEB ends up with some amount of garbage at the
++ * end.
++ * 3. UBIFS is being mounted R/O. We reach this place and
++ * recover the master node from the second LEB
++ * (%UBIFS_MST_LNUM + 1). But we cannot update the media
++ * because we are being mounted R/O. We have to defer the
++ * operation.
++ * 4. However, this master node (@c->mst_node) is marked as
++ * clean (since the step 1). And if we just return, the
++ * mount code will be confused and won't recover the master
++ * node when it is re-mounter R/W later.
++ *
++ * Thus, to force the recovery by marking the master node as
++ * dirty.
++ */
++ c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY);
+ } else {
+ /* Write the recovered master node */
+ c->max_sqnum = le64_to_cpu(mst->ch.sqnum) - 1;