--- /dev/null
+From 2ef5692efad330b67a234e2c49edad38538751e7 Mon Sep 17 00:00:00 2001
+From: Mengdong Lin <mengdong.lin@intel.com>
+Date: Thu, 28 Mar 2013 05:20:22 -0400
+Subject: ALSA: hda - bug fix on return value when getting HDMI ELD info
+
+From: Mengdong Lin <mengdong.lin@intel.com>
+
+commit 2ef5692efad330b67a234e2c49edad38538751e7 upstream.
+
+In function snd_hdmi_get_eld(), the variable 'ret' should be initialized to 0.
+Otherwise it will be returned uninitialized as non-zero after ELD info is got
+successfully. Thus hdmi_present_sense() will always assume ELD info is invalid
+by mistake, and /proc file system cannot show the proper ELD info.
+
+Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
+Acked-by: David Henningsson <david.henningsson@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/hda_eld.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/sound/pci/hda/hda_eld.c
++++ b/sound/pci/hda/hda_eld.c
+@@ -322,7 +322,7 @@ int snd_hdmi_get_eld(struct hdmi_eld *el
+ struct hda_codec *codec, hda_nid_t nid)
+ {
+ int i;
+- int ret;
++ int ret = 0;
+ int size;
+ unsigned char *buf;
+
--- /dev/null
+From 1d87caa69c04008e09f5ff47b5e6acb6116febc7 Mon Sep 17 00:00:00 2001
+From: Rainer Koenig <Rainer.Koenig@ts.fujitsu.com>
+Date: Thu, 4 Apr 2013 08:40:38 +0200
+Subject: ALSA: hda - Enabling Realtek ALC 671 codec
+
+From: Rainer Koenig <Rainer.Koenig@ts.fujitsu.com>
+
+commit 1d87caa69c04008e09f5ff47b5e6acb6116febc7 upstream.
+
+* Added the device ID to the modalias list and assinged ALC662 patches
+for it
+* Added 4 port support for the device ID 0671 in alc662_parse_auto_config
+
+Signed-off-by: Rainer Koenig <Rainer.Koenig@ts.fujitsu.com>
+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, 3 insertions(+), 1 deletion(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6720,7 +6720,8 @@ static int alc662_parse_auto_config(stru
+ const hda_nid_t *ssids;
+
+ if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
+- codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670)
++ codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670 ||
++ codec->vendor_id == 0x10ec0671)
+ ssids = alc663_ssids;
+ else
+ ssids = alc662_ssids;
+@@ -7173,6 +7174,7 @@ static const struct hda_codec_preset snd
+ { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
+ { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
+ { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
++ { .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 },
+ { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
+ { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
+ { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
--- /dev/null
+From aeb3a97222832e5457c4b72d72235098ce4bfe8d Mon Sep 17 00:00:00 2001
+From: David Henningsson <david.henningsson@canonical.com>
+Date: Thu, 4 Apr 2013 11:47:13 +0200
+Subject: ALSA: hda - fix typo in proc output
+
+From: David Henningsson <david.henningsson@canonical.com>
+
+commit aeb3a97222832e5457c4b72d72235098ce4bfe8d upstream.
+
+Rename "Digitial In" to "Digital In". This function is only used for
+proc output, so should not cause any problems to change.
+
+Signed-off-by: David Henningsson <david.henningsson@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/hda_codec.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/sound/pci/hda/hda_codec.c
++++ b/sound/pci/hda/hda_codec.c
+@@ -173,7 +173,7 @@ const char *snd_hda_get_jack_type(u32 cf
+ "Line Out", "Speaker", "HP Out", "CD",
+ "SPDIF Out", "Digital Out", "Modem Line", "Modem Hand",
+ "Line In", "Aux", "Mic", "Telephony",
+- "SPDIF In", "Digitial In", "Reserved", "Other"
++ "SPDIF In", "Digital In", "Reserved", "Other"
+ };
+
+ return jack_types[(cfg & AC_DEFCFG_DEVICE)
--- /dev/null
+From a8ec3a662921220fc058ed6f7f3674697876d218 Mon Sep 17 00:00:00 2001
+From: Ilija Hadzic <ihadzic@research.bell-labs.com>
+Date: Tue, 2 Apr 2013 09:56:10 -0400
+Subject: drm: correctly restore mappings if drm_open fails
+
+From: Ilija Hadzic <ihadzic@research.bell-labs.com>
+
+commit a8ec3a662921220fc058ed6f7f3674697876d218 upstream.
+
+If first drm_open fails, the error-handling path will
+incorrectly restore inode's mapping to NULL. This can
+cause the crash later on. Fix by separately storing
+away mapping pointers that drm_open can touch and
+restore each from its own respective variable if the
+call fails.
+
+Fixes: https://bugzilla.novell.com/show_bug.cgi?id=807850
+(thanks to Michal Hocko for investigating investigating and
+finding the root cause of the bug)
+
+Reference:
+http://lists.freedesktop.org/archives/dri-devel/2013-March/036564.html
+
+v2: Use one variable to store file and inode mapping
+ since they are the same at the function entry.
+ Fix spelling mistakes in commit message.
+
+v3: Add reference to the original bug report.
+
+Reported-by: Marco Munderloh <munderl@tnt.uni-hannover.de>
+Tested-by: Marco Munderloh <munderl@tnt.uni-hannover.de>
+Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
+Cc: Michal Hocko <mhocko@suse.cz>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/drm_fops.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/gpu/drm/drm_fops.c
++++ b/drivers/gpu/drm/drm_fops.c
+@@ -123,6 +123,7 @@ int drm_open(struct inode *inode, struct
+ int retcode = 0;
+ int need_setup = 0;
+ struct address_space *old_mapping;
++ struct address_space *old_imapping;
+
+ minor = idr_find(&drm_minors_idr, minor_id);
+ if (!minor)
+@@ -137,6 +138,7 @@ int drm_open(struct inode *inode, struct
+ if (!dev->open_count++)
+ need_setup = 1;
+ mutex_lock(&dev->struct_mutex);
++ old_imapping = inode->i_mapping;
+ old_mapping = dev->dev_mapping;
+ if (old_mapping == NULL)
+ dev->dev_mapping = &inode->i_data;
+@@ -159,8 +161,8 @@ int drm_open(struct inode *inode, struct
+
+ err_undo:
+ mutex_lock(&dev->struct_mutex);
+- filp->f_mapping = old_mapping;
+- inode->i_mapping = old_mapping;
++ filp->f_mapping = old_imapping;
++ inode->i_mapping = old_imapping;
+ iput(container_of(dev->dev_mapping, struct inode, i_data));
+ dev->dev_mapping = old_mapping;
+ mutex_unlock(&dev->struct_mutex);
--- /dev/null
+From 637f44d24f8868ee5a597a99e7874fdd150d4cba Mon Sep 17 00:00:00 2001
+From: Adam Jackson <ajax@redhat.com>
+Date: Mon, 25 Mar 2013 15:40:05 -0400
+Subject: drm/i915: Be sure to turn hsync/vsync back on at crt enable (v2)
+
+From: Adam Jackson <ajax@redhat.com>
+
+commit 637f44d24f8868ee5a597a99e7874fdd150d4cba upstream.
+
+commit f40ebd6bcbbd0d30591f42dc16be52b5086a366b
+Author: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
+Date: Tue Mar 5 14:24:48 2013 +0100
+
+ drm/i915: Turn off hsync and vsync on ADPA when disabling crt
+
+properly disabled the hsync/vsync logic at disable time, but neglected
+to re-enable them at enable time.
+
+v2: In the enable hook, restore the connector's expected DPMS level
+instead of forcing ON. Do this by stashing a back pointer to the
+connector in the crt (suggested by danvet) since otherwise it's awkward
+to look up.
+
+Signed-off-by: Adam Jackson <ajax@redhat.com>
+[danvet: Added more verbose commit citation and cc: stable tag. Also,
+make it compile. Then self-lart and try to assign the right pointer.]
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/i915/intel_crt.c | 40 ++++++++++++++++-----------------------
+ 1 file changed, 17 insertions(+), 23 deletions(-)
+
+--- a/drivers/gpu/drm/i915/intel_crt.c
++++ b/drivers/gpu/drm/i915/intel_crt.c
+@@ -45,6 +45,9 @@
+
+ struct intel_crt {
+ struct intel_encoder base;
++ /* DPMS state is stored in the connector, which we need in the
++ * encoder's enable/disable callbacks */
++ struct intel_connector *connector;
+ bool force_hotplug_required;
+ u32 adpa_reg;
+ };
+@@ -81,29 +84,6 @@ static bool intel_crt_get_hw_state(struc
+ return true;
+ }
+
+-static void intel_disable_crt(struct intel_encoder *encoder)
+-{
+- struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
+- struct intel_crt *crt = intel_encoder_to_crt(encoder);
+- u32 temp;
+-
+- temp = I915_READ(crt->adpa_reg);
+- temp |= ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE;
+- temp &= ~ADPA_DAC_ENABLE;
+- I915_WRITE(crt->adpa_reg, temp);
+-}
+-
+-static void intel_enable_crt(struct intel_encoder *encoder)
+-{
+- struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
+- struct intel_crt *crt = intel_encoder_to_crt(encoder);
+- u32 temp;
+-
+- temp = I915_READ(crt->adpa_reg);
+- temp |= ADPA_DAC_ENABLE;
+- I915_WRITE(crt->adpa_reg, temp);
+-}
+-
+ /* Note: The caller is required to filter out dpms modes not supported by the
+ * platform. */
+ static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode)
+@@ -135,6 +115,19 @@ static void intel_crt_set_dpms(struct in
+ I915_WRITE(crt->adpa_reg, temp);
+ }
+
++static void intel_disable_crt(struct intel_encoder *encoder)
++{
++ intel_crt_set_dpms(encoder, DRM_MODE_DPMS_OFF);
++}
++
++static void intel_enable_crt(struct intel_encoder *encoder)
++{
++ struct intel_crt *crt = intel_encoder_to_crt(encoder);
++
++ intel_crt_set_dpms(encoder, crt->connector->base.dpms);
++}
++
++
+ static void intel_crt_dpms(struct drm_connector *connector, int mode)
+ {
+ struct drm_device *dev = connector->dev;
+@@ -746,6 +739,7 @@ void intel_crt_init(struct drm_device *d
+ }
+
+ connector = &intel_connector->base;
++ crt->connector = intel_connector;
+ drm_connector_init(dev, &intel_connector->base,
+ &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA);
+
--- /dev/null
+From b43decd2c513ae44a5462a1a4c2622f0fa77c9e0 Mon Sep 17 00:00:00 2001
+From: Maarten Lankhorst <maarten.lankhorst@canonical.com>
+Date: Sun, 24 Mar 2013 15:36:38 +0100
+Subject: drm/nouveau: fix handling empty channel list in ioctl's
+
+From: Maarten Lankhorst <maarten.lankhorst@canonical.com>
+
+commit b43decd2c513ae44a5462a1a4c2622f0fa77c9e0 upstream.
+
+If there are no channels, chan would never end up being NULL,
+and so the null pointer check would fail.
+
+Solve this by initializing chan to NULL, and iterating over temp instead.
+
+Fixes oops when running intel-gpu-tools/tests/kms_flip, which attempts to
+do some intel ioctl's on a nouveau device.
+
+Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
+Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/nouveau/nouveau_abi16.c | 18 ++++++++++--------
+ 1 file changed, 10 insertions(+), 8 deletions(-)
+
+--- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
++++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
+@@ -386,7 +386,7 @@ nouveau_abi16_ioctl_notifierobj_alloc(AB
+ struct nouveau_drm *drm = nouveau_drm(dev);
+ struct nouveau_device *device = nv_device(drm->device);
+ struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev);
+- struct nouveau_abi16_chan *chan, *temp;
++ struct nouveau_abi16_chan *chan = NULL, *temp;
+ struct nouveau_abi16_ntfy *ntfy;
+ struct nouveau_object *object;
+ struct nv_dma_class args = {};
+@@ -399,10 +399,11 @@ nouveau_abi16_ioctl_notifierobj_alloc(AB
+ if (unlikely(nv_device(abi16->device)->card_type >= NV_C0))
+ return nouveau_abi16_put(abi16, -EINVAL);
+
+- list_for_each_entry_safe(chan, temp, &abi16->channels, head) {
+- if (chan->chan->handle == (NVDRM_CHAN | info->channel))
++ list_for_each_entry(temp, &abi16->channels, head) {
++ if (temp->chan->handle == (NVDRM_CHAN | info->channel)) {
++ chan = temp;
+ break;
+- chan = NULL;
++ }
+ }
+
+ if (!chan)
+@@ -454,17 +455,18 @@ nouveau_abi16_ioctl_gpuobj_free(ABI16_IO
+ {
+ struct drm_nouveau_gpuobj_free *fini = data;
+ struct nouveau_abi16 *abi16 = nouveau_abi16_get(file_priv, dev);
+- struct nouveau_abi16_chan *chan, *temp;
++ struct nouveau_abi16_chan *chan = NULL, *temp;
+ struct nouveau_abi16_ntfy *ntfy;
+ int ret;
+
+ if (unlikely(!abi16))
+ return -ENOMEM;
+
+- list_for_each_entry_safe(chan, temp, &abi16->channels, head) {
+- if (chan->chan->handle == (NVDRM_CHAN | fini->channel))
++ list_for_each_entry(temp, &abi16->channels, head) {
++ if (temp->chan->handle == (NVDRM_CHAN | fini->channel)) {
++ chan = temp;
+ break;
+- chan = NULL;
++ }
+ }
+
+ if (!chan)
--- /dev/null
+From 9afd9b7090225d78ef56423a2ff65354dc38f1b1 Mon Sep 17 00:00:00 2001
+From: Gabriel Fernandez <gabriel.fernandez@stericsson.com>
+Date: Mon, 18 Mar 2013 11:45:05 +0100
+Subject: gpio: stmpe: pass DT node to irqdomain
+
+From: Gabriel Fernandez <gabriel.fernandez@stericsson.com>
+
+commit 9afd9b7090225d78ef56423a2ff65354dc38f1b1 upstream.
+
+The irq domain was implemented but the device tree
+node was not transmitted to irq_domain_add_simple().
+
+Signed-off-by: Gabriel Fernandez <gabriel.fernandez@stericsson.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpio/gpio-stmpe.c | 15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+--- a/drivers/gpio/gpio-stmpe.c
++++ b/drivers/gpio/gpio-stmpe.c
+@@ -307,11 +307,15 @@ static const struct irq_domain_ops stmpe
+ .xlate = irq_domain_xlate_twocell,
+ };
+
+-static int stmpe_gpio_irq_init(struct stmpe_gpio *stmpe_gpio)
++static int stmpe_gpio_irq_init(struct stmpe_gpio *stmpe_gpio,
++ struct device_node *np)
+ {
+- int base = stmpe_gpio->irq_base;
++ int base = 0;
+
+- stmpe_gpio->domain = irq_domain_add_simple(NULL,
++ if (!np)
++ base = stmpe_gpio->irq_base;
++
++ stmpe_gpio->domain = irq_domain_add_simple(np,
+ stmpe_gpio->chip.ngpio, base,
+ &stmpe_gpio_irq_simple_ops, stmpe_gpio);
+ if (!stmpe_gpio->domain) {
+@@ -346,6 +350,9 @@ static int stmpe_gpio_probe(struct platf
+ stmpe_gpio->chip = template_chip;
+ stmpe_gpio->chip.ngpio = stmpe->num_gpios;
+ stmpe_gpio->chip.dev = &pdev->dev;
++#ifdef CONFIG_OF
++ stmpe_gpio->chip.of_node = np;
++#endif
+ stmpe_gpio->chip.base = pdata ? pdata->gpio_base : -1;
+
+ if (pdata)
+@@ -366,7 +373,7 @@ static int stmpe_gpio_probe(struct platf
+ goto out_free;
+
+ if (irq >= 0) {
+- ret = stmpe_gpio_irq_init(stmpe_gpio);
++ ret = stmpe_gpio_irq_init(stmpe_gpio, np);
+ if (ret)
+ goto out_disable;
+
--- /dev/null
+From f1a9a149abc86903e81dd1b2e720f3f89874384b Mon Sep 17 00:00:00 2001
+From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
+Date: Tue, 2 Apr 2013 11:11:52 +0200
+Subject: HID: magicmouse: fix race between input_register() and probe()
+
+From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
+
+commit f1a9a149abc86903e81dd1b2e720f3f89874384b upstream.
+
+Since kernel 3.7, it appears that the input registration occured before
+the end of magicmouse_setup_input(). This is shown by receiving a lot of
+"EV_SYN SYN_REPORT 1" instead of normal "EV_SYN SYN_REPORT 0".
+This value means that the output buffer is full, and the user space
+is loosing events.
+
+Using .input_configured guarantees that the race is not occuring, and that
+the call of "input_set_events_per_packet(input, 60)" is taken into account
+by input_register().
+
+Fixes:
+https://bugzilla.redhat.com/show_bug.cgi?id=908604
+
+Reported-and-Tested-By: Clarke Wixon <cwixon@usa.net>
+Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/hid/hid-magicmouse.c | 29 ++++++++++++++++++++---------
+ 1 file changed, 20 insertions(+), 9 deletions(-)
+
+--- a/drivers/hid/hid-magicmouse.c
++++ b/drivers/hid/hid-magicmouse.c
+@@ -462,6 +462,21 @@ static int magicmouse_input_mapping(stru
+ return 0;
+ }
+
++static void magicmouse_input_configured(struct hid_device *hdev,
++ struct hid_input *hi)
++
++{
++ struct magicmouse_sc *msc = hid_get_drvdata(hdev);
++
++ int ret = magicmouse_setup_input(msc->input, hdev);
++ if (ret) {
++ hid_err(hdev, "magicmouse setup input failed (%d)\n", ret);
++ /* clean msc->input to notify probe() of the failure */
++ msc->input = NULL;
++ }
++}
++
++
+ static int magicmouse_probe(struct hid_device *hdev,
+ const struct hid_device_id *id)
+ {
+@@ -493,15 +508,10 @@ static int magicmouse_probe(struct hid_d
+ goto err_free;
+ }
+
+- /* We do this after hid-input is done parsing reports so that
+- * hid-input uses the most natural button and axis IDs.
+- */
+- if (msc->input) {
+- ret = magicmouse_setup_input(msc->input, hdev);
+- if (ret) {
+- hid_err(hdev, "magicmouse setup input failed (%d)\n", ret);
+- goto err_stop_hw;
+- }
++ if (!msc->input) {
++ hid_err(hdev, "magicmouse input not registered\n");
++ ret = -ENOMEM;
++ goto err_stop_hw;
+ }
+
+ if (id->product == USB_DEVICE_ID_APPLE_MAGICMOUSE)
+@@ -568,6 +578,7 @@ static struct hid_driver magicmouse_driv
+ .remove = magicmouse_remove,
+ .raw_event = magicmouse_raw_event,
+ .input_mapping = magicmouse_input_mapping,
++ .input_configured = magicmouse_input_configured,
+ };
+
+ static int __init magicmouse_init(void)
--- /dev/null
+From 0c81157b46c533139d6be721d41617020c59a2c3 Mon Sep 17 00:00:00 2001
+From: David Daney <david.daney@cavium.com>
+Date: Tue, 26 Feb 2013 14:35:23 -0800
+Subject: MIPS: Fix logic errors in bitops.c
+
+From: David Daney <david.daney@cavium.com>
+
+commit 0c81157b46c533139d6be721d41617020c59a2c3 upstream.
+
+commit 92d11594f6 (MIPS: Remove irqflags.h dependency from bitops.h)
+factored some of the bitops code out into a separate file
+(arch/mips/lib/bitops.c). Unfortunately the logic converting a bit
+mask into a boolean result was lost in some of the functions. We had:
+
+ int res;
+ unsigned long shifted_result_bit;
+ .
+ .
+ .
+ res = shifted_result_bit;
+ return res;
+
+Which truncates off the high 32 bits (thus yielding an incorrect
+value) on 64-bit systems.
+
+The manifestation of this is that a non-SMP 64-bit kernel will not
+boot as the bitmap operations in bootmem.c are all screwed up.
+
+Signed-off-by: David Daney <david.daney@cavium.com>
+Cc: linux-mips@linux-mips.org
+Cc: Jim Quinlan <jim2101024@gmail.com>
+Patchwork: https://patchwork.linux-mips.org/patch/4965/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/mips/lib/bitops.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+--- a/arch/mips/lib/bitops.c
++++ b/arch/mips/lib/bitops.c
+@@ -90,12 +90,12 @@ int __mips_test_and_set_bit(unsigned lon
+ unsigned bit = nr & SZLONG_MASK;
+ unsigned long mask;
+ unsigned long flags;
+- unsigned long res;
++ int res;
+
+ a += nr >> SZLONG_LOG;
+ mask = 1UL << bit;
+ raw_local_irq_save(flags);
+- res = (mask & *a);
++ res = (mask & *a) != 0;
+ *a |= mask;
+ raw_local_irq_restore(flags);
+ return res;
+@@ -116,12 +116,12 @@ int __mips_test_and_set_bit_lock(unsigne
+ unsigned bit = nr & SZLONG_MASK;
+ unsigned long mask;
+ unsigned long flags;
+- unsigned long res;
++ int res;
+
+ a += nr >> SZLONG_LOG;
+ mask = 1UL << bit;
+ raw_local_irq_save(flags);
+- res = (mask & *a);
++ res = (mask & *a) != 0;
+ *a |= mask;
+ raw_local_irq_restore(flags);
+ return res;
+@@ -141,12 +141,12 @@ int __mips_test_and_clear_bit(unsigned l
+ unsigned bit = nr & SZLONG_MASK;
+ unsigned long mask;
+ unsigned long flags;
+- unsigned long res;
++ int res;
+
+ a += nr >> SZLONG_LOG;
+ mask = 1UL << bit;
+ raw_local_irq_save(flags);
+- res = (mask & *a);
++ res = (mask & *a) != 0;
+ *a &= ~mask;
+ raw_local_irq_restore(flags);
+ return res;
+@@ -166,12 +166,12 @@ int __mips_test_and_change_bit(unsigned
+ unsigned bit = nr & SZLONG_MASK;
+ unsigned long mask;
+ unsigned long flags;
+- unsigned long res;
++ int res;
+
+ a += nr >> SZLONG_LOG;
+ mask = 1UL << bit;
+ raw_local_irq_save(flags);
+- res = (mask & *a);
++ res = (mask & *a) != 0;
+ *a ^= mask;
+ raw_local_irq_restore(flags);
+ return res;
--- /dev/null
+From b6a9b7f6b1f21735a7456d534dc0e68e61359d2c Mon Sep 17 00:00:00 2001
+From: Jan Stancek <jstancek@redhat.com>
+Date: Thu, 4 Apr 2013 11:35:10 -0700
+Subject: mm: prevent mmap_cache race in find_vma()
+
+From: Jan Stancek <jstancek@redhat.com>
+
+commit b6a9b7f6b1f21735a7456d534dc0e68e61359d2c upstream.
+
+find_vma() can be called by multiple threads with read lock
+held on mm->mmap_sem and any of them can update mm->mmap_cache.
+Prevent compiler from re-fetching mm->mmap_cache, because other
+readers could update it in the meantime:
+
+ thread 1 thread 2
+ |
+ find_vma() | find_vma()
+ struct vm_area_struct *vma = NULL; |
+ vma = mm->mmap_cache; |
+ if (!(vma && vma->vm_end > addr |
+ && vma->vm_start <= addr)) { |
+ | mm->mmap_cache = vma;
+ return vma; |
+ ^^ compiler may optimize this |
+ local variable out and re-read |
+ mm->mmap_cache |
+
+This issue can be reproduced with gcc-4.8.0-1 on s390x by running
+mallocstress testcase from LTP, which triggers:
+
+ kernel BUG at mm/rmap.c:1088!
+ Call Trace:
+ ([<000003d100c57000>] 0x3d100c57000)
+ [<000000000023a1c0>] do_wp_page+0x2fc/0xa88
+ [<000000000023baae>] handle_pte_fault+0x41a/0xac8
+ [<000000000023d832>] handle_mm_fault+0x17a/0x268
+ [<000000000060507a>] do_protection_exception+0x1e2/0x394
+ [<0000000000603a04>] pgm_check_handler+0x138/0x13c
+ [<000003fffcf1f07a>] 0x3fffcf1f07a
+ Last Breaking-Event-Address:
+ [<000000000024755e>] page_add_new_anon_rmap+0xc2/0x168
+
+Thanks to Jakub Jelinek for his insight on gcc and helping to
+track this down.
+
+Signed-off-by: Jan Stancek <jstancek@redhat.com>
+Acked-by: David Rientjes <rientjes@google.com>
+Signed-off-by: Hugh Dickins <hughd@google.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/mmap.c | 2 +-
+ mm/nommu.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/mm/mmap.c
++++ b/mm/mmap.c
+@@ -1922,7 +1922,7 @@ struct vm_area_struct *find_vma(struct m
+
+ /* Check the cache first. */
+ /* (Cache hit rate is typically around 35%.) */
+- vma = mm->mmap_cache;
++ vma = ACCESS_ONCE(mm->mmap_cache);
+ if (!(vma && vma->vm_end > addr && vma->vm_start <= addr)) {
+ struct rb_node *rb_node;
+
+--- a/mm/nommu.c
++++ b/mm/nommu.c
+@@ -819,7 +819,7 @@ struct vm_area_struct *find_vma(struct m
+ struct vm_area_struct *vma;
+
+ /* check the cache first */
+- vma = mm->mmap_cache;
++ vma = ACCESS_ONCE(mm->mmap_cache);
+ if (vma && vma->vm_start <= addr && vma->vm_end > addr)
+ return vma;
+
--- /dev/null
+From 8abac3ba51b5525354e9b2ec0eed1c9e95c905d9 Mon Sep 17 00:00:00 2001
+From: Lars-Peter Clausen <lars@metafoo.de>
+Date: Wed, 13 Mar 2013 16:38:33 +0100
+Subject: regmap: cache Fix regcache-rbtree sync
+
+From: Lars-Peter Clausen <lars@metafoo.de>
+
+commit 8abac3ba51b5525354e9b2ec0eed1c9e95c905d9 upstream.
+
+The last register block, which falls into the specified range, is not handled
+correctly. The formula which calculates the number of register which should be
+synced is inverse (and off by one). E.g. if all registers in that block should
+be synced only one is synced, and if only one should be synced all (but one) are
+synced. To calculate the number of registers that need to be synced we need to
+subtract the number of the first register in the block from the max register
+number and add one. This patch updates the code accordingly.
+
+The issue was introduced in commit ac8d91c ("regmap: Supply ranges to the sync
+operations").
+
+Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
+Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/base/regmap/regcache-rbtree.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/base/regmap/regcache-rbtree.c
++++ b/drivers/base/regmap/regcache-rbtree.c
+@@ -398,7 +398,7 @@ static int regcache_rbtree_sync(struct r
+ base = 0;
+
+ if (max < rbnode->base_reg + rbnode->blklen)
+- end = rbnode->base_reg + rbnode->blklen - max;
++ end = max - rbnode->base_reg + 1;
+ else
+ end = rbnode->blklen;
+
--- /dev/null
+From c6432ea9cc043994d5b7dcb3ad86a087777cb40c Mon Sep 17 00:00:00 2001
+From: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
+Date: Mon, 11 Mar 2013 17:27:02 +0000
+Subject: regmap: Initialize `map->debugfs' before regcache
+
+From: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
+
+commit c6432ea9cc043994d5b7dcb3ad86a087777cb40c upstream.
+
+In the rbtree code we are exposing statistics relating to the
+number of nodes/registers of the rbtree cache for each of the
+devices. Ensure that `map->debugfs' has been initialized before
+we attempt to initialize the debugfs entry for the rbtree cache.
+
+Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
+Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/base/regmap/regmap.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/base/regmap/regmap.c
++++ b/drivers/base/regmap/regmap.c
+@@ -662,12 +662,12 @@ struct regmap *regmap_init(struct device
+ }
+ }
+
++ regmap_debugfs_init(map, config->name);
++
+ ret = regcache_init(map, config);
+ if (ret != 0)
+ goto err_range;
+
+- regmap_debugfs_init(map, config->name);
+-
+ /* Add a devres resource for dev_get_regmap() */
+ m = devres_alloc(dev_get_regmap_release, sizeof(*m), GFP_KERNEL);
+ if (!m) {
--- /dev/null
+From 35e5cbc0af240778e61113286c019837e06aeec6 Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Fri, 29 Mar 2013 15:39:16 +0100
+Subject: reiserfs: Fix warning and inode leak when deleting inode with xattrs
+
+From: Jan Kara <jack@suse.cz>
+
+commit 35e5cbc0af240778e61113286c019837e06aeec6 upstream.
+
+After commit 21d8a15a (lookup_one_len: don't accept . and ..) reiserfs
+started failing to delete xattrs from inode. This was due to a buggy
+test for '.' and '..' in fill_with_dentries() which resulted in passing
+'.' and '..' entries to lookup_one_len() in some cases. That returned
+error and so we failed to iterate over all xattrs of and inode.
+
+Fix the test in fill_with_dentries() along the lines of the one in
+lookup_one_len().
+
+Reported-by: Pawel Zawora <pzawora@gmail.com>
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/reiserfs/xattr.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/fs/reiserfs/xattr.c
++++ b/fs/reiserfs/xattr.c
+@@ -187,8 +187,8 @@ fill_with_dentries(void *buf, const char
+ if (dbuf->count == ARRAY_SIZE(dbuf->dentries))
+ return -ENOSPC;
+
+- if (name[0] == '.' && (name[1] == '\0' ||
+- (name[1] == '.' && name[2] == '\0')))
++ if (name[0] == '.' && (namelen < 2 ||
++ (namelen == 2 && name[1] == '.')))
+ return 0;
+
+ dentry = lookup_one_len(name, dbuf->xadir, namelen);
--- /dev/null
+From e24b0bfa2f0446ffaad2661040be23668133aef8 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <jhovold@gmail.com>
+Date: Fri, 5 Apr 2013 18:16:34 +0200
+Subject: Revert "drivers/rtc/rtc-at91rm9200.c: use a variable for storing IMR"
+
+From: Johan Hovold <jhovold@gmail.com>
+
+commit e24b0bfa2f0446ffaad2661040be23668133aef8 upstream.
+
+This reverts commit 0ef1594c017521ea89278e80fe3f80dafb17abde.
+
+This patch introduced a few races which cannot be easily fixed with a
+small follow-up patch. Furthermore, the SoC with the broken hardware
+register, which this patch intended to add support for, can only be used
+with device trees, which this driver currently does not support.
+
+[ Here is the discussion that led to this "revert" patch:
+ https://lkml.org/lkml/2013/4/3/176 ]
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/rtc/rtc-at91rm9200.c | 50 ++++++++++++++++---------------------------
+ drivers/rtc/rtc-at91rm9200.h | 1
+ 2 files changed, 20 insertions(+), 31 deletions(-)
+
+--- a/drivers/rtc/rtc-at91rm9200.c
++++ b/drivers/rtc/rtc-at91rm9200.c
+@@ -44,7 +44,6 @@ static DECLARE_COMPLETION(at91_rtc_updat
+ static unsigned int at91_alarm_year = AT91_RTC_EPOCH;
+ static void __iomem *at91_rtc_regs;
+ static int irq;
+-static u32 at91_rtc_imr;
+
+ /*
+ * Decode time/date into rtc_time structure
+@@ -109,11 +108,9 @@ static int at91_rtc_settime(struct devic
+ cr = at91_rtc_read(AT91_RTC_CR);
+ at91_rtc_write(AT91_RTC_CR, cr | AT91_RTC_UPDCAL | AT91_RTC_UPDTIM);
+
+- at91_rtc_imr |= AT91_RTC_ACKUPD;
+ at91_rtc_write(AT91_RTC_IER, AT91_RTC_ACKUPD);
+ wait_for_completion(&at91_rtc_updated); /* wait for ACKUPD interrupt */
+ at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD);
+- at91_rtc_imr &= ~AT91_RTC_ACKUPD;
+
+ at91_rtc_write(AT91_RTC_TIMR,
+ bin2bcd(tm->tm_sec) << 0
+@@ -145,7 +142,7 @@ static int at91_rtc_readalarm(struct dev
+ tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year);
+ tm->tm_year = at91_alarm_year - 1900;
+
+- alrm->enabled = (at91_rtc_imr & AT91_RTC_ALARM)
++ alrm->enabled = (at91_rtc_read(AT91_RTC_IMR) & AT91_RTC_ALARM)
+ ? 1 : 0;
+
+ pr_debug("%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__,
+@@ -171,7 +168,6 @@ static int at91_rtc_setalarm(struct devi
+ tm.tm_sec = alrm->time.tm_sec;
+
+ at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM);
+- at91_rtc_imr &= ~AT91_RTC_ALARM;
+ at91_rtc_write(AT91_RTC_TIMALR,
+ bin2bcd(tm.tm_sec) << 0
+ | bin2bcd(tm.tm_min) << 8
+@@ -184,7 +180,6 @@ static int at91_rtc_setalarm(struct devi
+
+ if (alrm->enabled) {
+ at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM);
+- at91_rtc_imr |= AT91_RTC_ALARM;
+ at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM);
+ }
+
+@@ -201,12 +196,9 @@ static int at91_rtc_alarm_irq_enable(str
+
+ if (enabled) {
+ at91_rtc_write(AT91_RTC_SCCR, AT91_RTC_ALARM);
+- at91_rtc_imr |= AT91_RTC_ALARM;
+ at91_rtc_write(AT91_RTC_IER, AT91_RTC_ALARM);
+- } else {
++ } else
+ at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ALARM);
+- at91_rtc_imr &= ~AT91_RTC_ALARM;
+- }
+
+ return 0;
+ }
+@@ -215,10 +207,12 @@ static int at91_rtc_alarm_irq_enable(str
+ */
+ static int at91_rtc_proc(struct device *dev, struct seq_file *seq)
+ {
++ unsigned long imr = at91_rtc_read(AT91_RTC_IMR);
++
+ seq_printf(seq, "update_IRQ\t: %s\n",
+- (at91_rtc_imr & AT91_RTC_ACKUPD) ? "yes" : "no");
++ (imr & AT91_RTC_ACKUPD) ? "yes" : "no");
+ seq_printf(seq, "periodic_IRQ\t: %s\n",
+- (at91_rtc_imr & AT91_RTC_SECEV) ? "yes" : "no");
++ (imr & AT91_RTC_SECEV) ? "yes" : "no");
+
+ return 0;
+ }
+@@ -233,7 +227,7 @@ static irqreturn_t at91_rtc_interrupt(in
+ unsigned int rtsr;
+ unsigned long events = 0;
+
+- rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_imr;
++ rtsr = at91_rtc_read(AT91_RTC_SR) & at91_rtc_read(AT91_RTC_IMR);
+ if (rtsr) { /* this interrupt is shared! Is it ours? */
+ if (rtsr & AT91_RTC_ALARM)
+ events |= (RTC_AF | RTC_IRQF);
+@@ -297,7 +291,6 @@ static int __init at91_rtc_probe(struct
+ at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM |
+ AT91_RTC_SECEV | AT91_RTC_TIMEV |
+ AT91_RTC_CALEV);
+- at91_rtc_imr = 0;
+
+ ret = request_irq(irq, at91_rtc_interrupt,
+ IRQF_SHARED,
+@@ -337,7 +330,6 @@ static int __exit at91_rtc_remove(struct
+ at91_rtc_write(AT91_RTC_IDR, AT91_RTC_ACKUPD | AT91_RTC_ALARM |
+ AT91_RTC_SECEV | AT91_RTC_TIMEV |
+ AT91_RTC_CALEV);
+- at91_rtc_imr = 0;
+ free_irq(irq, pdev);
+
+ rtc_device_unregister(rtc);
+@@ -350,35 +342,31 @@ static int __exit at91_rtc_remove(struct
+
+ /* AT91RM9200 RTC Power management control */
+
+-static u32 at91_rtc_bkpimr;
+-
++static u32 at91_rtc_imr;
+
+ static int at91_rtc_suspend(struct device *dev)
+ {
+ /* this IRQ is shared with DBGU and other hardware which isn't
+ * necessarily doing PM like we are...
+ */
+- at91_rtc_bkpimr = at91_rtc_imr & (AT91_RTC_ALARM|AT91_RTC_SECEV);
+- if (at91_rtc_bkpimr) {
+- if (device_may_wakeup(dev)) {
++ at91_rtc_imr = at91_rtc_read(AT91_RTC_IMR)
++ & (AT91_RTC_ALARM|AT91_RTC_SECEV);
++ if (at91_rtc_imr) {
++ if (device_may_wakeup(dev))
+ enable_irq_wake(irq);
+- } else {
+- at91_rtc_write(AT91_RTC_IDR, at91_rtc_bkpimr);
+- at91_rtc_imr &= ~at91_rtc_bkpimr;
+- }
+-}
++ else
++ at91_rtc_write(AT91_RTC_IDR, at91_rtc_imr);
++ }
+ return 0;
+ }
+
+ static int at91_rtc_resume(struct device *dev)
+ {
+- if (at91_rtc_bkpimr) {
+- if (device_may_wakeup(dev)) {
++ if (at91_rtc_imr) {
++ if (device_may_wakeup(dev))
+ disable_irq_wake(irq);
+- } else {
+- at91_rtc_imr |= at91_rtc_bkpimr;
+- at91_rtc_write(AT91_RTC_IER, at91_rtc_bkpimr);
+- }
++ else
++ at91_rtc_write(AT91_RTC_IER, at91_rtc_imr);
+ }
+ return 0;
+ }
+--- a/drivers/rtc/rtc-at91rm9200.h
++++ b/drivers/rtc/rtc-at91rm9200.h
+@@ -64,6 +64,7 @@
+ #define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */
+ #define AT91_RTC_IER 0x20 /* Interrupt Enable Register */
+ #define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */
++#define AT91_RTC_IMR 0x28 /* Interrupt Mask Register */
+
+ #define AT91_RTC_VER 0x2c /* Valid Entry Register */
+ #define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */
asoc-imx-ssi-fix-occasional-ac97-reset-failure.patch
asoc-dma-sh7760-fix-compile-error.patch
asoc-spear_pcm-update-to-new-pcm_new-api.patch
+regmap-initialize-map-debugfs-before-regcache.patch
+regmap-cache-fix-regcache-rbtree-sync.patch
+mips-fix-logic-errors-in-bitops.c.patch
+hid-magicmouse-fix-race-between-input_register-and-probe.patch
+spi-s3c64xx-modified-error-interrupt-handling-and-init.patch
+spi-mpc512x-psc-optionally-keep-psc-ss-asserted-across-xfer-segmensts.patch
+gpio-stmpe-pass-dt-node-to-irqdomain.patch
+ubifs-make-space-fixup-work-in-the-remount-case.patch
+reiserfs-fix-warning-and-inode-leak-when-deleting-inode-with-xattrs.patch
+alsa-hda-bug-fix-on-return-value-when-getting-hdmi-eld-info.patch
+alsa-hda-enabling-realtek-alc-671-codec.patch
+alsa-hda-fix-typo-in-proc-output.patch
+drm-nouveau-fix-handling-empty-channel-list-in-ioctl-s.patch
+drm-i915-be-sure-to-turn-hsync-vsync-back-on-at-crt-enable-v2.patch
+drm-correctly-restore-mappings-if-drm_open-fails.patch
+revert-drivers-rtc-rtc-at91rm9200.c-use-a-variable-for-storing-imr.patch
+mm-prevent-mmap_cache-race-in-find_vma.patch
--- /dev/null
+From 1ad849aee5f53353ed88d9cd3d68a51b03a7d44f Mon Sep 17 00:00:00 2001
+From: Anatolij Gustschin <agust@denx.de>
+Date: Wed, 13 Mar 2013 14:57:43 +0100
+Subject: spi/mpc512x-psc: optionally keep PSC SS asserted across xfer segmensts
+
+From: Anatolij Gustschin <agust@denx.de>
+
+commit 1ad849aee5f53353ed88d9cd3d68a51b03a7d44f upstream.
+
+Some SPI slave devices require asserted chip select signal across
+multiple transfer segments of an SPI message. Currently the driver
+always de-asserts the internal SS signal for every single transfer
+segment of the message and ignores the 'cs_change' flag of the
+transfer description. Disable the internal chip select (SS) only
+if this is needed and indicated by the 'cs_change' flag.
+
+Without this change, each partial transfer of a surrounding
+multi-part SPI transaction might erroneously change the SS
+signal, which might prevent slaves from answering the request
+that was sent in a previous transfer segment because the
+transaction could be considered aborted (SS was de-asserted
+before reading the response).
+
+Reported-by: Gerhard Sittig <gerhard.sittig@ifm.com>
+Signed-off-by: Anatolij Gustschin <agust@denx.de>
+Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/spi/spi-mpc512x-psc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/spi/spi-mpc512x-psc.c
++++ b/drivers/spi/spi-mpc512x-psc.c
+@@ -164,7 +164,7 @@ static int mpc512x_psc_spi_transfer_rxtx
+
+ for (i = count; i > 0; i--) {
+ data = tx_buf ? *tx_buf++ : 0;
+- if (len == EOFBYTE)
++ if (len == EOFBYTE && t->cs_change)
+ setbits32(&fifo->txcmd, MPC512x_PSC_FIFO_EOF);
+ out_8(&fifo->txdata_8, data);
+ len--;
--- /dev/null
+From 375981f2e14868be16cafbffd34a4f16a6ee01c6 Mon Sep 17 00:00:00 2001
+From: Girish K S <girishks2000@gmail.com>
+Date: Wed, 13 Mar 2013 12:13:30 +0530
+Subject: spi/s3c64xx: modified error interrupt handling and init
+
+From: Girish K S <girishks2000@gmail.com>
+
+commit 375981f2e14868be16cafbffd34a4f16a6ee01c6 upstream.
+
+The status of the interrupt is available in the status register,
+so reading the clear pending register and writing back the same
+value will not actually clear the pending interrupts. This patch
+modifies the interrupt handler to read the status register and
+clear the corresponding pending bit in the clear pending register.
+
+Modified the hwInit function to clear all the pending interrupts.
+
+Signed-off-by: Girish K S <ks.giri@samsung.com>
+Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/spi/spi-s3c64xx.c | 41 +++++++++++++++++++++++++----------------
+ 1 file changed, 25 insertions(+), 16 deletions(-)
+
+--- a/drivers/spi/spi-s3c64xx.c
++++ b/drivers/spi/spi-s3c64xx.c
+@@ -997,25 +997,30 @@ static irqreturn_t s3c64xx_spi_irq(int i
+ {
+ struct s3c64xx_spi_driver_data *sdd = data;
+ struct spi_master *spi = sdd->master;
+- unsigned int val;
+-
+- val = readl(sdd->regs + S3C64XX_SPI_PENDING_CLR);
+-
+- val &= S3C64XX_SPI_PND_RX_OVERRUN_CLR |
+- S3C64XX_SPI_PND_RX_UNDERRUN_CLR |
+- S3C64XX_SPI_PND_TX_OVERRUN_CLR |
+- S3C64XX_SPI_PND_TX_UNDERRUN_CLR;
++ unsigned int val, clr = 0;
+
+- writel(val, sdd->regs + S3C64XX_SPI_PENDING_CLR);
++ val = readl(sdd->regs + S3C64XX_SPI_STATUS);
+
+- if (val & S3C64XX_SPI_PND_RX_OVERRUN_CLR)
++ if (val & S3C64XX_SPI_ST_RX_OVERRUN_ERR) {
++ clr = S3C64XX_SPI_PND_RX_OVERRUN_CLR;
+ dev_err(&spi->dev, "RX overrun\n");
+- if (val & S3C64XX_SPI_PND_RX_UNDERRUN_CLR)
++ }
++ if (val & S3C64XX_SPI_ST_RX_UNDERRUN_ERR) {
++ clr |= S3C64XX_SPI_PND_RX_UNDERRUN_CLR;
+ dev_err(&spi->dev, "RX underrun\n");
+- if (val & S3C64XX_SPI_PND_TX_OVERRUN_CLR)
++ }
++ if (val & S3C64XX_SPI_ST_TX_OVERRUN_ERR) {
++ clr |= S3C64XX_SPI_PND_TX_OVERRUN_CLR;
+ dev_err(&spi->dev, "TX overrun\n");
+- if (val & S3C64XX_SPI_PND_TX_UNDERRUN_CLR)
++ }
++ if (val & S3C64XX_SPI_ST_TX_UNDERRUN_ERR) {
++ clr |= S3C64XX_SPI_PND_TX_UNDERRUN_CLR;
+ dev_err(&spi->dev, "TX underrun\n");
++ }
++
++ /* Clear the pending irq by setting and then clearing it */
++ writel(clr, sdd->regs + S3C64XX_SPI_PENDING_CLR);
++ writel(0, sdd->regs + S3C64XX_SPI_PENDING_CLR);
+
+ return IRQ_HANDLED;
+ }
+@@ -1039,9 +1044,13 @@ static void s3c64xx_spi_hwinit(struct s3
+ writel(0, regs + S3C64XX_SPI_MODE_CFG);
+ writel(0, regs + S3C64XX_SPI_PACKET_CNT);
+
+- /* Clear any irq pending bits */
+- writel(readl(regs + S3C64XX_SPI_PENDING_CLR),
+- regs + S3C64XX_SPI_PENDING_CLR);
++ /* Clear any irq pending bits, should set and clear the bits */
++ val = S3C64XX_SPI_PND_RX_OVERRUN_CLR |
++ S3C64XX_SPI_PND_RX_UNDERRUN_CLR |
++ S3C64XX_SPI_PND_TX_OVERRUN_CLR |
++ S3C64XX_SPI_PND_TX_UNDERRUN_CLR;
++ writel(val, regs + S3C64XX_SPI_PENDING_CLR);
++ writel(0, regs + S3C64XX_SPI_PENDING_CLR);
+
+ writel(0, regs + S3C64XX_SPI_SWAP_CFG);
+
--- /dev/null
+From 67e753ca41782913d805ff4a8a2b0f60b26b7915 Mon Sep 17 00:00:00 2001
+From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
+Date: Thu, 14 Mar 2013 10:49:23 +0200
+Subject: UBIFS: make space fixup work in the remount case
+
+From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
+
+commit 67e753ca41782913d805ff4a8a2b0f60b26b7915 upstream.
+
+The UBIFS space fixup is a useful feature which allows to fixup the "broken"
+flash space at the time of the first mount. The "broken" space is usually the
+result of using a "dumb" industrial flasher which is not able to skip empty
+NAND pages and just writes all 0xFFs to the empty space, which has grave
+side-effects for UBIFS when UBIFS trise to write useful data to those empty
+pages.
+
+The fix-up feature works roughly like this:
+1. mkfs.ubifs sets the fixup flag in UBIFS superblock when creating the image
+ (see -F option)
+2. when the file-system is mounted for the first time, UBIFS notices the fixup
+ flag and re-writes the entire media atomically, which may take really a lot
+ of time.
+3. UBIFS clears the fixup flag in the superblock.
+
+This works fine when the file system is mounted R/W for the very first time.
+But it did not really work in the case when we first mount the file-system R/O,
+and then re-mount R/W. The reason was that we started the fixup procedure too
+late, which we cannot really do because we have to fixup the space before it
+starts being used.
+
+Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
+Reported-by: Mark Jackson <mpfj-list@mimc.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ubifs/super.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+--- a/fs/ubifs/super.c
++++ b/fs/ubifs/super.c
+@@ -1568,6 +1568,12 @@ static int ubifs_remount_rw(struct ubifs
+ c->remounting_rw = 1;
+ c->ro_mount = 0;
+
++ if (c->space_fixup) {
++ err = ubifs_fixup_free_space(c);
++ if (err)
++ return err;
++ }
++
+ err = check_free_space(c);
+ if (err)
+ goto out;
+@@ -1684,12 +1690,6 @@ static int ubifs_remount_rw(struct ubifs
+ err = dbg_check_space_info(c);
+ }
+
+- if (c->space_fixup) {
+- err = ubifs_fixup_free_space(c);
+- if (err)
+- goto out;
+- }
+-
+ mutex_unlock(&c->umount_mutex);
+ return err;
+