linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review
@ 2013-01-24  3:26 Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 01/74] usb: gadget: dummy: fix enumeration with g_multi Herton Ronaldo Krzesinski
                   ` (73 more replies)
  0 siblings, 74 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Herton Ronaldo Krzesinski

I am announcing the review cycle for the 3.5.7.4 release of stable patches.
This new release contains 74 patches. Proposed patches are posted as a
response to this message. The same patches are also available at the
following repository:

git://kernel.ubuntu.com/ubuntu/linux.git linux-3.5.y-review

If there are any problems, or if anything is missing, please answer to
this or to any of the followup patches. Note that any answer should be
made at maximum in 3 days, after that the final release of 3.5.7.4 will be
made.

For more information about the 3.5.y.z extended stable tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Included below are the diffstat and shortlog for this release.

-Herton

-- 
 arch/arm/mach-pxa/include/mach/mfp-pxa27x.h     |    3 +
 arch/arm/mach-pxa/pxa27x.c                      |    4 +-
 arch/s390/include/asm/timex.h                   |   28 ++++
 arch/s390/kernel/time.c                         |    2 +-
 arch/s390/kvm/interrupt.c                       |    2 +-
 arch/sh/include/asm/elf.h                       |    4 +-
 arch/x86/kernel/setup.c                         |   78 +++++++++++
 drivers/gpu/drm/i915/i915_gem.c                 |    7 +-
 drivers/gpu/drm/nouveau/nv04_dfp.c              |    2 +-
 drivers/gpu/drm/nouveau/nv10_fence.c            |    3 +
 drivers/gpu/drm/radeon/r600_cs.c                |    6 +-
 drivers/gpu/drm/radeon/radeon_cs.c              |    5 +-
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c |    8 ++
 drivers/gpu/drm/udl/udl_connector.c             |   17 ++-
 drivers/iommu/intel-iommu.c                     |   31 +++++
 drivers/net/ethernet/intel/igb/igb_main.c       |   22 ++-
 drivers/net/wireless/b43/b43.h                  |    5 +
 drivers/net/wireless/b43/main.c                 |   54 ++++++--
 drivers/net/wireless/b43/main.h                 |    5 +-
 drivers/net/wireless/mwifiex/sta_ioctl.c        |   21 ++-
 drivers/net/wireless/rt2x00/rt2800usb.c         |    1 +
 drivers/platform/x86/samsung-laptop.c           |   10 ++
 drivers/platform/x86/sony-laptop.c              |   15 +-
 drivers/regulator/max8997.c                     |   36 +++--
 drivers/regulator/max8998.c                     |  167 +++++++----------------
 drivers/scsi/sd.c                               |   13 +-
 drivers/staging/comedi/comedi_fops.c            |    3 +
 drivers/staging/comedi/drivers/comedi_test.c    |    2 +-
 drivers/staging/comedi/drivers/ni_pcimio.c      |   16 +--
 drivers/staging/rtl8712/usb_intf.c              |    2 +
 drivers/staging/speakup/synth.c                 |    4 +-
 drivers/target/target_core_transport.c          |    9 +-
 drivers/target/tcm_fc/tfc_sess.c                |   12 +-
 drivers/usb/chipidea/host.c                     |    3 +
 drivers/usb/class/cdc-acm.c                     |    6 +
 drivers/usb/core/hub.c                          |  120 ++++++++++++----
 drivers/usb/core/quirks.c                       |    3 +
 drivers/usb/gadget/dummy_hcd.c                  |    9 +-
 drivers/usb/host/xhci-hub.c                     |   38 +++++-
 drivers/usb/host/xhci-mem.c                     |    2 +
 drivers/usb/host/xhci-ring.c                    |    9 ++
 drivers/usb/host/xhci.c                         |   10 ++
 drivers/usb/musb/musb_core.c                    |    5 +-
 drivers/usb/serial/ftdi_sio.c                   |    2 +
 drivers/usb/serial/ftdi_sio_ids.h               |    6 +
 drivers/usb/serial/io_ti.c                      |    3 +
 drivers/usb/serial/option.c                     |   18 ++-
 include/linux/audit.h                           |    4 +-
 kernel/auditsc.c                                |   14 +-
 mm/bootmem.c                                    |   24 +++-
 mm/compaction.c                                 |    6 +-
 mm/page_alloc.c                                 |    2 +-
 net/mac80211/ibss.c                             |    9 +-
 net/mac80211/ieee80211_i.h                      |   11 +-
 net/mac80211/mlme.c                             |   73 +++++++---
 net/mac80211/scan.c                             |   47 +++----
 net/mac80211/sta_info.c                         |    2 +-
 net/sunrpc/sched.c                              |    3 +-
 net/sunrpc/xprt.c                               |   12 +-
 sound/arm/pxa2xx-ac97-lib.c                     |   26 +++-
 sound/pci/hda/patch_conexant.c                  |   16 ---
 sound/soc/codecs/wm2000.c                       |    4 +-
 sound/soc/codecs/wm2200.c                       |    8 +-
 sound/soc/codecs/wm5100.c                       |    6 -
 sound/soc/soc-pcm.c                             |    1 +
 sound/usb/quirks.c                              |    8 +-
 66 files changed, 747 insertions(+), 360 deletions(-)

Andreas Fleig (1):
      USB: Add device quirk for Microsoft VX700 webcam

Axel Lin (6):
      ASoC: wm2200: Fix setting dai format in wm2200_set_fmt
      regulator: max8997: Use uV in voltage_map_desc
      regulator: max8998: Convert to regulator_list_voltage_linear()
      regulator: max8998: Convert to set_voltage_sel and regulator_map_voltage_linear
      regulator: max8998: Use uV in voltage_map_desc
      regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel

Bing Zhao (1):
      mwifiex: check wait_event_interruptible return value

Bjørn Mork (2):
      USB: option: blacklist network interface on ZTE MF880
      USB: option: add Telekom Speedstick LTE II

Chris Wilson (1):
      drm/i915; Only increment the user-pin-count after successfully pinning the bo

David Henningsson (2):
      Revert "ALSA: hda - Shut up pins at power-saving mode with Conexnat codecs"
      ALSA: usb - fix race in creation of M-Audio Fast track pro driver

Denis N Ladin (1):
      USB: cdc-acm: Add support for "PSC Scanning, Magellan 800i"

Dzianis Kahanovich (1):
      USB: option: add Nexpring NP10T terminal id

Fabio Estevam (1):
      usb: chipidea: Allow disabling streaming not only in udc mode

Hannes Reinecke (1):
      target: use correct sense code for LUN communication failure

Hans de Goede (3):
      udldrmfb: Fix EDID not working with monitors with EDID extension blocks
      udldrmfb: udl_get_edid: usb_control_msg buffer must not be on the stack
      udldrmfb: udl_get_edid: drop unneeded i--

Heiko Carstens (1):
      s390/time: fix sched_clock() overflow

Ian Abbott (2):
      staging: comedi: prevent auto-unconfig of manually configured devices
      staging: comedi: comedi_test: fix race when cancelling command

Ilija Hadzic (2):
      drm/radeon: fix NULL pointer dereference in UMS mode
      drm/radeon: fix a bogus kfree

Jason Liu (1):
      mm: compaction: fix echo 1 > compact_memory return error issue

Jean-Christian de Rivaz (1):
      Add CDC-ACM support for the CX93010-2x UCMxx USB Modem

Jerome Glisse (1):
      radeon/kms: force rn50 chip to always report connected on analog output

Jesse Barnes (1):
      x86/Sandy Bridge: reserve pages when integrated graphics is present

Joel D. Diaz (1):
      [SCSI] sd: Reshuffle init_sd to avoid crash

Johannes Berg (2):
      mac80211: use del_timer_sync for final sta cleanup timer deletion
      mac80211: fix dtim_period in hidden SSID AP association

Kees Cook (1):
      audit: create explicit AUDIT_SECCOMP event type

Larry Finger (2):
      staging: r8712u: Add new device ID
      b43: Fix firmware loading when driver is built into the kernel

Laura Abbott (1):
      mm: use aligned zone start for pfn_to_bitidx calculation

Maia Kozheva (1):
      rt2800usb: Add support for 2001:3c1e (D-Link DWA-125 rev B1) USB Wi-Fi adapter

Marcin Slusarz (2):
      drm/nouveau: fix blank LVDS screen regression on pre-nv50 cards
      drm/nv17-50: restore fence buffer on resume

Mark Brown (3):
      ASoC: wm2200: Remove DSP B and left justified AIF modes
      ASoC: wm5100: Remove DSP B and left justified formats
      ASoC: wm2000: Fix sense of speech clarity enable

Mark Rustad (2):
      tcm_fc: Do not indicate retry capability to initiators
      tcm_fc: Do not report target role when target is not defined

Mattia Dongili (1):
      sony-laptop: fix SNC buffer calls when SN06 returns Integers

Max Filippov (1):
      mm: bootmem: fix free_all_bootmem_core() with odd bitmap alignment

Mike Dunn (2):
      ALSA: pxa27x: fix ac97 cold reset
      ALSA: pxa27x: fix ac97 warm reset

Nickolai Zeldovich (1):
      staging: speakup: avoid out-of-range access in synth_init()

Oliver Neukum (1):
      USB: hub: handle claim of enabled remote wakeup after reset

Patrick Lai (1):
      ASoC: pcm: allow backend hardware to be freed in pause state

Quentin.Li (1):
      USB: option: Add new MEDIATEK PID support

Roland Dreier (2):
      target: Fix use-after-free in LUN RESET handling
      target: Release se_cmd when LUN lookup fails for TMR

Samuel Thibault (1):
      staging: speakup: avoid out-of-range access in synth_add()

Sarah Sharp (8):
      xhci: Handle HS bulk/ctrl endpoints that don't NAK.
      USB: Handle auto-transition from hot to warm reset.
      USB: Ignore xHCI Reset Device status.
      USB: Allow USB 3.0 ports to be disabled.
      USB: Increase reset timeout.
      USB: Ignore port state until reset completes.
      USB: Handle warm reset failure on empty port.
      xhci: Avoid "dead ports", add roothub port polling.

Sebastian Andrzej Siewior (1):
      usb: gadget: dummy: fix enumeration with g_multi

Sergei Shtylyov (1):
      usb: musb: core: print new line in the driver banner again

Seth Forshee (1):
      samsung-laptop: Add quirk for broken acpi_video backlight on N250P

Stanislaw Gruszka (1):
      mac80211: fix ibss scanning

Stefan Assmann (1):
      igb: release already assigned MSI-X interrupts if setup fails

Thomas Schwinge (1):
      sh: Fix FDPIC binary loader

Tom Mingarelli (1):
      intel-iommu: Prevent devices with RMRRs from being placed into SI Domain

Tomasz Mloduchowski (1):
      usb: ftdi_sio: Crucible Technologies COMET Caller ID - pid added

Trond Myklebust (1):
      SUNRPC: Ensure we release the socket write lock if the rpc_task exits early

Wolfgang Frisch (1):
      USB: io_ti: Fix NULL dereference in chase_port()

Éric Piel (1):
      staging: comedi: fix minimum AO period for NI 625x and NI 628x

^ permalink raw reply	[flat|nested] 77+ messages in thread

* [PATCH 01/74] usb: gadget: dummy: fix enumeration with g_multi
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 02/74] usb: musb: core: print new line in the driver banner again Herton Ronaldo Krzesinski
                   ` (72 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sebastian Andrzej Siewior, Felipe Balbi, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

commit 1d16638e3b9cc195bac18a8fcbca748f33c1bc24 upstream.

If we do have endpoints named like "ep-a" then bEndpointAddress is
counted internally by the gadget framework.

If we do have endpoints named like "ep-1" then bEndpointAddress is
assigned from the digit after "ep-".

If we do have both, then it is likely that after we used up the
"generic" endpoints we will use the digits and thus assign one
bEndpointAddress to multiple endpoints.

This theory can be proofed by using the completely enabled g_multi.
Without this patch, the mass storage won't enumerate and times out
because it shares endpoints with RNDIS.

This patch also adds fills up the endpoints list so we have in total
endpoints 1 to 15 in + out available while some of them are restricted
to certain types like BULK or ISO. Without this change the nokia gadget
won't load because the system does not provide enough (BULK) endpoints
but it did before ep-a - ep-f were removed.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/gadget/dummy_hcd.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index afdbb1c..4ad1f1c 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -126,10 +126,7 @@ static const char ep0name[] = "ep0";
 static const char *const ep_name[] = {
 	ep0name,				/* everyone has ep0 */
 
-	/* act like a net2280: high speed, six configurable endpoints */
-	"ep-a", "ep-b", "ep-c", "ep-d", "ep-e", "ep-f",
-
-	/* or like pxa250: fifteen fixed function endpoints */
+	/* act like a pxa250: fifteen fixed function endpoints */
 	"ep1in-bulk", "ep2out-bulk", "ep3in-iso", "ep4out-iso", "ep5in-int",
 	"ep6in-bulk", "ep7out-bulk", "ep8in-iso", "ep9out-iso", "ep10in-int",
 	"ep11in-bulk", "ep12out-bulk", "ep13in-iso", "ep14out-iso",
@@ -137,6 +134,10 @@ static const char *const ep_name[] = {
 
 	/* or like sa1100: two fixed function endpoints */
 	"ep1out-bulk", "ep2in-bulk",
+
+	/* and now some generic EPs so we have enough in multi config */
+	"ep3out", "ep4in", "ep5out", "ep6out", "ep7in", "ep8out", "ep9in",
+	"ep10out", "ep11out", "ep12in", "ep13out", "ep14in", "ep15out",
 };
 #define DUMMY_ENDPOINTS	ARRAY_SIZE(ep_name)
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 02/74] usb: musb: core: print new line in the driver banner again
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 01/74] usb: gadget: dummy: fix enumeration with g_multi Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 03/74] ASoC: pcm: allow backend hardware to be freed in pause state Herton Ronaldo Krzesinski
                   ` (71 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Sergei Shtylyov, Felipe Balbi, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sergei Shtylyov <sshtylyov@ru.mvista.com>

commit 2ac788f705e5118dd45204e7a5bc8d5bb6873835 upstream.

Commit 5c8a86e10a7c164f44537fabdc169fd8b4e7a440 (usb: musb: drop unneeded
musb_debug trickery) erroneously removed '\n' from the driver's banner.
Concatenate all the banner substrings while adding it back...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/musb/musb_core.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index db3dff8..fde4898 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2402,10 +2402,7 @@ static int __init musb_init(void)
 	if (usb_disabled())
 		return 0;
 
-	pr_info("%s: version " MUSB_VERSION ", "
-		"?dma?"
-		", "
-		"otg (peripheral+host)",
+	pr_info("%s: version " MUSB_VERSION ", ?dma?, otg (peripheral+host)\n",
 		musb_driver_name);
 	return platform_driver_register(&musb_driver);
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 03/74] ASoC: pcm: allow backend hardware to be freed in pause state
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 01/74] usb: gadget: dummy: fix enumeration with g_multi Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 02/74] usb: musb: core: print new line in the driver banner again Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 04/74] ASoC: wm2200: Fix setting dai format in wm2200_set_fmt Herton Ronaldo Krzesinski
                   ` (70 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Patrick Lai, Mark Brown, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Patrick Lai <plai@codeaurora.org>

commit 08b27848da620f206a8b6d80f26184485dd7aa40 upstream.

When front-end PCM session is in paused state, back-end
PCM session will be put in paused state as well if given
front-end PCM session is the only client of given back-end.
Then, application closes front-end PCM session, DPCM
framework will not allow back-end enters HW_FREE state
so back-end will never get shutdown completely.

Signed-off-by: Patrick Lai <plai@codeaurora.org>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 sound/soc/soc-pcm.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 48fd15b..6f2bad0 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1240,6 +1240,7 @@ static int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream)
 		if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) &&
 		    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) &&
 		    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) &&
+		    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) &&
 		    (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP))
 			continue;
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 04/74] ASoC: wm2200: Fix setting dai format in wm2200_set_fmt
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (2 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 03/74] ASoC: pcm: allow backend hardware to be freed in pause state Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 05/74] mac80211: fix ibss scanning Herton Ronaldo Krzesinski
                   ` (69 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Axel Lin, Mark Brown, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Axel Lin <axel.lin@ingics.com>

commit 2a5f431592343b78896013b055582f94c12a5049 upstream.

According to the defines in wm2200.h:
/*
 * R1284 (0x504) - Audio IF 1_5
 */

We should not left shift 1 bit for fmt_val when setting dai format.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 sound/soc/codecs/wm2200.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c
index c8bff6d..201fc58 100644
--- a/sound/soc/codecs/wm2200.c
+++ b/sound/soc/codecs/wm2200.c
@@ -1440,7 +1440,7 @@ static int wm2200_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 			    WM2200_AIF1TX_LRCLK_MSTR | WM2200_AIF1TX_LRCLK_INV,
 			    lrclk);
 	snd_soc_update_bits(codec, WM2200_AUDIO_IF_1_5,
-			    WM2200_AIF1_FMT_MASK << 1, fmt_val << 1);
+			    WM2200_AIF1_FMT_MASK, fmt_val);
 
 	return 0;
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 05/74] mac80211: fix ibss scanning
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (3 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 04/74] ASoC: wm2200: Fix setting dai format in wm2200_set_fmt Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 06/74] mac80211: use del_timer_sync for final sta cleanup timer deletion Herton Ronaldo Krzesinski
                   ` (68 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Stanislaw Gruszka, Johannes Berg, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Stanislaw Gruszka <sgruszka@redhat.com>

commit 34bcf71502413f8903ade93746f2d0f04b937a78 upstream.

Do not scan on no-IBSS and disabled channels in IBSS mode. Doing this
can trigger Microcode errors on iwlwifi and iwlegacy drivers.

Also rename ieee80211_request_internal_scan() function since it is only
used in IBSS mode and simplify calling it from ieee80211_sta_find_ibss().

This patch should address:
https://bugzilla.redhat.com/show_bug.cgi?id=883414
https://bugzilla.kernel.org/show_bug.cgi?id=49411

Reported-by: Jesse Kahtava <jesse_kahtava@f-m.fm>
Reported-by: Mikko Rapeli  <mikko.rapeli@iki.fi>
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 net/mac80211/ibss.c        |    9 ++++-----
 net/mac80211/ieee80211_i.h |    6 +++---
 net/mac80211/scan.c        |   34 ++++++++++++++++++++++++----------
 3 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
index 980b4f4..374d5b4 100644
--- a/net/mac80211/ibss.c
+++ b/net/mac80211/ibss.c
@@ -665,8 +665,8 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata)
 	printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other "
 	       "IBSS networks with same SSID (merge)\n", sdata->name);
 
-	ieee80211_request_internal_scan(sdata,
-			ifibss->ssid, ifibss->ssid_len, NULL);
+	ieee80211_request_ibss_scan(sdata, ifibss->ssid, ifibss->ssid_len,
+				    NULL);
 }
 
 static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata)
@@ -773,9 +773,8 @@ static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata)
 		printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to "
 		       "join\n", sdata->name);
 
-		ieee80211_request_internal_scan(sdata,
-				ifibss->ssid, ifibss->ssid_len,
-				ifibss->fixed_channel ? ifibss->channel : NULL);
+		ieee80211_request_ibss_scan(sdata, ifibss->ssid,
+					    ifibss->ssid_len, chan);
 	} else {
 		int interval = IEEE80211_SCAN_INTERVAL;
 
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 98dab42..d0b1c56 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1257,9 +1257,9 @@ void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
 
 /* scan/BSS handling */
 void ieee80211_scan_work(struct work_struct *work);
-int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata,
-				    const u8 *ssid, u8 ssid_len,
-				    struct ieee80211_channel *chan);
+int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
+				const u8 *ssid, u8 ssid_len,
+				struct ieee80211_channel *chan);
 int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
 			   struct cfg80211_scan_request *req);
 void ieee80211_scan_cancel(struct ieee80211_local *local);
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 169da07..fd973e5 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -817,9 +817,9 @@ int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
 	return res;
 }
 
-int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata,
-				    const u8 *ssid, u8 ssid_len,
-				    struct ieee80211_channel *chan)
+int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
+				const u8 *ssid, u8 ssid_len,
+				struct ieee80211_channel *chan)
 {
 	struct ieee80211_local *local = sdata->local;
 	int ret = -EBUSY;
@@ -833,22 +833,36 @@ int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata,
 
 	/* fill internal scan request */
 	if (!chan) {
-		int i, nchan = 0;
+		int i, max_n;
+		int n_ch = 0;
 
 		for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
 			if (!local->hw.wiphy->bands[band])
 				continue;
-			for (i = 0;
-			     i < local->hw.wiphy->bands[band]->n_channels;
-			     i++) {
-				local->int_scan_req->channels[nchan] =
+
+			max_n = local->hw.wiphy->bands[band]->n_channels;
+			for (i = 0; i < max_n; i++) {
+				struct ieee80211_channel *tmp_ch =
 				    &local->hw.wiphy->bands[band]->channels[i];
-				nchan++;
+
+				if (tmp_ch->flags & (IEEE80211_CHAN_NO_IBSS |
+						     IEEE80211_CHAN_DISABLED))
+					continue;
+
+				local->int_scan_req->channels[n_ch] = tmp_ch;
+				n_ch++;
 			}
 		}
 
-		local->int_scan_req->n_channels = nchan;
+		if (WARN_ON_ONCE(n_ch == 0))
+			goto unlock;
+
+		local->int_scan_req->n_channels = n_ch;
 	} else {
+		if (WARN_ON_ONCE(chan->flags & (IEEE80211_CHAN_NO_IBSS |
+						IEEE80211_CHAN_DISABLED)))
+			goto unlock;
+
 		local->int_scan_req->channels[0] = chan;
 		local->int_scan_req->n_channels = 1;
 	}
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 06/74] mac80211: use del_timer_sync for final sta cleanup timer deletion
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (4 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 05/74] mac80211: fix ibss scanning Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 07/74] mac80211: fix dtim_period in hidden SSID AP association Herton Ronaldo Krzesinski
                   ` (67 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Johannes Berg, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johannes Berg <johannes.berg@intel.com>

commit a56f992cdabc63f56b4b142885deebebf936ff76 upstream.

This is a very old bug, but there's nothing that prevents the
timer from running while the module is being removed when we
only do del_timer() instead of del_timer_sync().

The timer should normally not be running at this point, but
it's not clearly impossible (or we could just remove this.)

Tested-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 net/mac80211/sta_info.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 6c74f1e..fec8eab 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -844,7 +844,7 @@ void sta_info_init(struct ieee80211_local *local)
 
 void sta_info_stop(struct ieee80211_local *local)
 {
-	del_timer(&local->sta_cleanup);
+	del_timer_sync(&local->sta_cleanup);
 	sta_info_flush(local, NULL);
 }
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 07/74] mac80211: fix dtim_period in hidden SSID AP association
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (5 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 06/74] mac80211: use del_timer_sync for final sta cleanup timer deletion Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 08/74] xhci: Handle HS bulk/ctrl endpoints that don't NAK Herton Ronaldo Krzesinski
                   ` (66 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Emmanuel Grumbach, Johannes Berg, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Johannes Berg <johannes.berg@intel.com>

commit 826262c3d23743cb032a9e1a65a0f9be75091a5e upstream.

When AP's SSID is hidden the BSS can appear several times in
cfg80211's BSS list: once with a zero-length SSID that comes
from the beacon, and once for each SSID from probe reponses.

Since the mac80211 stores its data in ieee80211_bss which
is embedded into cfg80211_bss, mac80211's data will be
duplicated too.

This becomes a problem when a driver needs the dtim_period
since this data exists only in the beacon's instance in
cfg80211 bss table which isn't the instance that is used
when associating.

Remove the DTIM period from the BSS table and track it
explicitly to avoid this problem.

Tested-by: Efi Tubul <efi.tubul@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[ herton: adjust context, no RCU locking (use same backport as the one
  for 3.7), keep printk usage instead of non-existent sdata_info in 3.5 ]
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 net/mac80211/ieee80211_i.h |    5 +--
 net/mac80211/mlme.c        |   73 +++++++++++++++++++++++++++++++-------------
 net/mac80211/scan.c        |   13 --------
 3 files changed, 53 insertions(+), 38 deletions(-)

diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index d0b1c56..16655d6 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -81,8 +81,6 @@ struct ieee80211_bss {
 	size_t ssid_len;
 	u8 ssid[IEEE80211_MAX_SSID_LEN];
 
-	u8 dtim_period;
-
 	bool wmm_used;
 	bool uapsd_supported;
 
@@ -129,7 +127,6 @@ enum ieee80211_bss_corrupt_data_flags {
 
 /**
  * enum ieee80211_valid_data_flags - BSS valid data flags
- * @IEEE80211_BSS_VALID_DTIM: DTIM data was gathered from non-corrupt IE
  * @IEEE80211_BSS_VALID_WMM: WMM/UAPSD data was gathered from non-corrupt IE
  * @IEEE80211_BSS_VALID_RATES: Supported rates were gathered from non-corrupt IE
  * @IEEE80211_BSS_VALID_ERP: ERP flag was gathered from non-corrupt IE
@@ -140,7 +137,6 @@ enum ieee80211_bss_corrupt_data_flags {
  * beacon/probe response.
  */
 enum ieee80211_bss_valid_data_flags {
-	IEEE80211_BSS_VALID_DTIM		= BIT(0),
 	IEEE80211_BSS_VALID_WMM			= BIT(1),
 	IEEE80211_BSS_VALID_RATES		= BIT(2),
 	IEEE80211_BSS_VALID_ERP			= BIT(3)
@@ -444,6 +440,7 @@ struct ieee80211_if_managed {
 	unsigned long timers_running; /* used for quiesce/restart */
 	bool powersave; /* powersave requested for this iface */
 	bool broken_ap; /* AP is broken -- turn off powersave */
+	u8 dtim_period;
 	enum ieee80211_smps_mode req_smps, /* requested smps mode */
 				 ap_smps, /* smps mode AP thinks we're in */
 				 driver_smps_mode; /* smps mode request */
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 6d79367..4549e7e 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -994,12 +994,8 @@ void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency)
 		if (beaconint_us > latency) {
 			local->ps_sdata = NULL;
 		} else {
-			struct ieee80211_bss *bss;
 			int maxslp = 1;
-			u8 dtimper;
-
-			bss = (void *)found->u.mgd.associated->priv;
-			dtimper = bss->dtim_period;
+			u8 dtimper = found->u.mgd.dtim_period;
 
 			/* If the TIM IE is invalid, pretend the value is 1 */
 			if (!dtimper)
@@ -1305,10 +1301,17 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
 
 	ieee80211_led_assoc(local, 1);
 
-	if (local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD)
-		bss_conf->dtim_period = bss->dtim_period;
-	else
+	if (local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) {
+		/*
+		 * If the AP is buggy we may get here with no DTIM period
+		 * known, so assume it's 1 which is the only safe assumption
+		 * in that case, although if the TIM IE is broken powersave
+		 * probably just won't work at all.
+		 */
+		bss_conf->dtim_period = sdata->u.mgd.dtim_period ?: 1;
+	} else {
 		bss_conf->dtim_period = 0;
+	}
 
 	bss_conf->assoc = 1;
 
@@ -1441,6 +1444,8 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
 	del_timer_sync(&sdata->u.mgd.bcn_mon_timer);
 	del_timer_sync(&sdata->u.mgd.timer);
 	del_timer_sync(&sdata->u.mgd.chswitch_timer);
+
+	sdata->vif.bss_conf.dtim_period = 0;
 }
 
 void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata,
@@ -2205,11 +2210,18 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
 	struct ieee80211_channel *channel;
 	bool need_ps = false;
 
-	if (sdata->u.mgd.associated &&
-	    ether_addr_equal(mgmt->bssid, sdata->u.mgd.associated->bssid)) {
-		bss = (void *)sdata->u.mgd.associated->priv;
+	if ((sdata->u.mgd.associated &&
+	     ether_addr_equal(mgmt->bssid, sdata->u.mgd.associated->bssid)) ||
+	    (sdata->u.mgd.assoc_data &&
+	     ether_addr_equal(mgmt->bssid,
+			      sdata->u.mgd.assoc_data->bss->bssid))) {
 		/* not previously set so we may need to recalc */
-		need_ps = !bss->dtim_period;
+		need_ps = sdata->u.mgd.associated && !sdata->u.mgd.dtim_period;
+
+		if (elems->tim && !elems->parse_error) {
+			struct ieee80211_tim_ie *tim_ie = elems->tim;
+			sdata->u.mgd.dtim_period = tim_ie->dtim_period;
+		}
 	}
 
 	if (elems->ds_params && elems->ds_params_len == 1)
@@ -3413,20 +3425,39 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
 	/* kick off associate process */
 
 	ifmgd->assoc_data = assoc_data;
+	ifmgd->dtim_period = 0;
 
 	err = ieee80211_prep_connection(sdata, req->bss, true);
 	if (err)
 		goto err_clear;
 
-	if (!bss->dtim_period &&
-	    sdata->local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) {
-		/*
-		 * Wait up to one beacon interval ...
-		 * should this be more if we miss one?
-		 */
-		printk(KERN_DEBUG "%s: waiting for beacon from %pM\n",
-		       sdata->name, ifmgd->bssid);
-		assoc_data->timeout = TU_TO_EXP_TIME(req->bss->beacon_interval);
+	if (sdata->local->hw.flags & IEEE80211_HW_NEED_DTIM_PERIOD) {
+		const u8 *beacon_ies = req->bss->beacon_ies;
+		size_t beacon_ies_len = req->bss->len_beacon_ies;
+
+		if (!beacon_ies_len) {
+			/*
+			 * Wait up to one beacon interval ...
+			 * should this be more if we miss one?
+			 */
+			printk(KERN_DEBUG "%s: waiting for beacon from %pM\n",
+			       sdata->name, ifmgd->bssid);
+			assoc_data->timeout =
+				TU_TO_EXP_TIME(req->bss->beacon_interval);
+		} else {
+			const u8 *tim_ie = cfg80211_find_ie(WLAN_EID_TIM,
+							    beacon_ies,
+							    beacon_ies_len);
+			if (tim_ie && tim_ie[1] >=
+					sizeof(struct ieee80211_tim_ie)) {
+				const struct ieee80211_tim_ie *tim;
+				tim = (void *)(tim_ie + 2);
+				ifmgd->dtim_period = tim->dtim_period;
+			}
+			assoc_data->have_beacon = true;
+			assoc_data->sent_assoc = false;
+			assoc_data->timeout = jiffies;
+		}
 	} else {
 		assoc_data->have_beacon = true;
 		assoc_data->sent_assoc = false;
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index fd973e5..58ac7d0 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -112,19 +112,6 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
 			bss->valid_data |= IEEE80211_BSS_VALID_ERP;
 	}
 
-	if (elems->tim && (!elems->parse_error ||
-			   !(bss->valid_data & IEEE80211_BSS_VALID_DTIM))) {
-		struct ieee80211_tim_ie *tim_ie =
-			(struct ieee80211_tim_ie *)elems->tim;
-		bss->dtim_period = tim_ie->dtim_period;
-		if (!elems->parse_error)
-				bss->valid_data |= IEEE80211_BSS_VALID_DTIM;
-	}
-
-	/* If the beacon had no TIM IE, or it was invalid, use 1 */
-	if (beacon && !bss->dtim_period)
-		bss->dtim_period = 1;
-
 	/* replace old supported rates if we get new values */
 	if (!elems->parse_error ||
 	    !(bss->valid_data & IEEE80211_BSS_VALID_RATES)) {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 08/74] xhci: Handle HS bulk/ctrl endpoints that don't NAK.
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (6 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 07/74] mac80211: fix dtim_period in hidden SSID AP association Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 09/74] USB: Handle auto-transition from hot to warm reset Herton Ronaldo Krzesinski
                   ` (65 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Sarah Sharp, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sarah Sharp <sarah.a.sharp@linux.intel.com>

commit 55c1945edaac94c5338a3647bc2e85ff75d9cf36 upstream.

A high speed control or bulk endpoint may have bInterval set to zero,
which means it does not NAK.  If bInterval is non-zero, it means the
endpoint NAKs at a rate of 2^(bInterval - 1).

The xHCI code to compute the NAK interval does not handle the special
case of zero properly.  The current code unconditionally subtracts one
from bInterval and uses it as an exponent.  This causes a very large
bInterval to be used, and warning messages like these will be printed:

usb 1-1: ep 0x1 - rounding interval to 32768 microframes, ep desc says 0 microframes

This may cause the xHCI host hardware to reject the Configure Endpoint
command, which means the HS device will be unusable under xHCI ports.

This patch should be backported to kernels as old as 2.6.31, that contain
commit dfa49c4ad120a784ef1ff0717168aa79f55a483a "USB: xhci - fix math in
xhci_get_endpoint_interval()".

Reported-by: Vincent Pelletier <plr.vincent@gmail.com>
Suggested-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/host/xhci-mem.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index fb51c70..35616ff 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -1250,6 +1250,8 @@ static unsigned int xhci_microframes_to_exponent(struct usb_device *udev,
 static unsigned int xhci_parse_microframe_interval(struct usb_device *udev,
 		struct usb_host_endpoint *ep)
 {
+	if (ep->desc.bInterval == 0)
+		return 0;
 	return xhci_microframes_to_exponent(udev, ep,
 			ep->desc.bInterval, 0, 15);
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 09/74] USB: Handle auto-transition from hot to warm reset.
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (7 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 08/74] xhci: Handle HS bulk/ctrl endpoints that don't NAK Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 10/74] USB: Ignore xHCI Reset Device status Herton Ronaldo Krzesinski
                   ` (64 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Sarah Sharp, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sarah Sharp <sarah.a.sharp@linux.intel.com>

commit 1c7439c61fa6516419c32a9824976334ea969d47 upstream.

USB 3.0 hubs and roothubs will automatically transition a failed hot
reset to a warm (BH) reset.  In that case, the warm reset change bit
will be set, and the link state change bit may also be set.  Change
hub_port_finish_reset to unconditionally clear those change bits for USB
3.0 hubs.  If these bits are not cleared, we may lose port change events
from the roothub.

This commit should be backported to kernels as old as 3.2, that contain
the commit 75d7cf72ab9fa01dc70877aa5c68e8ef477229dc "usbcore: refine
warm reset logic".

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/core/hub.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index f04ca3c..931eea2 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2471,16 +2471,16 @@ static void hub_port_finish_reset(struct usb_hub *hub, int port1,
 		clear_port_feature(hub->hdev,
 				port1, USB_PORT_FEAT_C_RESET);
 		/* FIXME need disconnect() for NOTATTACHED device */
-		if (warm) {
+		if (hub_is_superspeed(hub->hdev)) {
 			clear_port_feature(hub->hdev, port1,
 					USB_PORT_FEAT_C_BH_PORT_RESET);
 			clear_port_feature(hub->hdev, port1,
 					USB_PORT_FEAT_C_PORT_LINK_STATE);
-		} else {
+		}
+		if (!warm)
 			usb_set_device_state(udev, *status
 					? USB_STATE_NOTATTACHED
 					: USB_STATE_DEFAULT);
-		}
 		break;
 	}
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 10/74] USB: Ignore xHCI Reset Device status.
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (8 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 09/74] USB: Handle auto-transition from hot to warm reset Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 11/74] USB: Allow USB 3.0 ports to be disabled Herton Ronaldo Krzesinski
                   ` (63 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Sarah Sharp, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sarah Sharp <sarah.a.sharp@linux.intel.com>

commit 8b8132bc3d1cc3d4c0687e4d638a482fa920d98a upstream.

When the USB core finishes reseting a USB device, the xHCI driver sends
a Reset Device command to the host.  The xHC then updates its internal
representation of the USB device to the 'Default' device state.  If the
device was already in the Default state, the xHC will complete the
command with an error status.

If a device needs to be reset several times during enumeration, the
second reset will always fail because of the xHCI Reset Device command.
This can cause issues during enumeration.

For example, usb_reset_and_verify_device calls into hub_port_init in a
loop.  Say that on the first call into hub_port_init, the device is
successfully reset, but doesn't respond to several set address control
transfers.  Then the port will be disabled, but the udev will remain in
tact.  usb_reset_and_verify_device will call into hub_port_init again.

On the second call into hub_port_init, the device will be reset, and the
xHCI driver will issue a Reset Device command.  This command will fail
(because the device is already in the Default state), and
usb_reset_and_verify_device will fail.  The port will be disabled, and
the device won't be able to enumerate.

Fix this by ignoring the return value of the HCD reset_device callback.

This commit should be backported to kernels as old as 3.2, that contain
the commit 75d7cf72ab9fa01dc70877aa5c68e8ef477229dc "usbcore: refine
warm reset logic".

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/core/hub.c |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 931eea2..03af701 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2456,14 +2456,11 @@ static void hub_port_finish_reset(struct usb_hub *hub, int port1,
 			msleep(10 + 40);
 			update_devnum(udev, 0);
 			hcd = bus_to_hcd(udev->bus);
-			if (hcd->driver->reset_device) {
-				*status = hcd->driver->reset_device(hcd, udev);
-				if (*status < 0) {
-					dev_err(&udev->dev, "Cannot reset "
-							"HCD device state\n");
-					break;
-				}
-			}
+			/* The xHC may think the device is already reset,
+			 * so ignore the status.
+			 */
+			if (hcd->driver->reset_device)
+				hcd->driver->reset_device(hcd, udev);
 		}
 		/* FALL THROUGH */
 	case -ENOTCONN:
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 11/74] USB: Allow USB 3.0 ports to be disabled.
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (9 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 10/74] USB: Ignore xHCI Reset Device status Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 12/74] USB: Increase reset timeout Herton Ronaldo Krzesinski
                   ` (62 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Sarah Sharp, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sarah Sharp <sarah.a.sharp@linux.intel.com>

commit 41e7e056cdc662f704fa9262e5c6e213b4ab45dd upstream.

If hot and warm reset fails, or a port remains in the Compliance Mode,
the USB core needs to be able to disable a USB 3.0 port.  Unlike USB 2.0
ports, once the port is placed into the Disabled link state, it will not
report any new device connects.  To get device connect notifications, we
need to put the link into the Disabled state, and then the RxDetect
state.

The xHCI driver needs to atomically clear all change bits on USB 3.0
port disable, so that we get Port Status Change Events for future port
changes.  We could technically do this in the USB core instead of in the
xHCI roothub code, since the port state machine can't advance out of the
disabled state until we set the link state to RxDetect.  However,
external USB 3.0 hubs don't need this code.  They are level-triggered,
not edge-triggered like xHCI, so they will continue to send interrupt
events when any change bit is set.  Therefore it doesn't make sense to
put this code in the USB core.

This patch is part of a series to fix several reports of infinite loops
on device enumeration failure.  This includes John, when he boots with
a USB 3.0 device (Roseweil eusb3 enclosure) attached to his NEC 0.96
host controller.  The fix requires warm reset support, so it does not
make sense to backport this patch to stable kernels without warm reset
support.

This patch should be backported to kernels as old as 3.2, contain the
commit ID 75d7cf72ab9fa01dc70877aa5c68e8ef477229dc "usbcore: refine warm
reset logic"

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: John Covici <covici@ccs.covici.com>
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/core/hub.c      |   63 +++++++++++++++++++++++++++++++++++++++++--
 drivers/usb/host/xhci-hub.c |   31 +++++++++++++++++++--
 2 files changed, 90 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 03af701..ba01327 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -866,6 +866,60 @@ static int hub_hub_status(struct usb_hub *hub,
 	return ret;
 }
 
+static int hub_set_port_link_state(struct usb_hub *hub, int port1,
+			unsigned int link_status)
+{
+	return set_port_feature(hub->hdev,
+			port1 | (link_status << 3),
+			USB_PORT_FEAT_LINK_STATE);
+}
+
+/*
+ * If USB 3.0 ports are placed into the Disabled state, they will no longer
+ * detect any device connects or disconnects.  This is generally not what the
+ * USB core wants, since it expects a disabled port to produce a port status
+ * change event when a new device connects.
+ *
+ * Instead, set the link state to Disabled, wait for the link to settle into
+ * that state, clear any change bits, and then put the port into the RxDetect
+ * state.
+ */
+static int hub_usb3_port_disable(struct usb_hub *hub, int port1)
+{
+	int ret;
+	int total_time;
+	u16 portchange, portstatus;
+
+	if (!hub_is_superspeed(hub->hdev))
+		return -EINVAL;
+
+	ret = hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_SS_DISABLED);
+	if (ret) {
+		dev_err(hub->intfdev, "cannot disable port %d (err = %d)\n",
+				port1, ret);
+		return ret;
+	}
+
+	/* Wait for the link to enter the disabled state. */
+	for (total_time = 0; ; total_time += HUB_DEBOUNCE_STEP) {
+		ret = hub_port_status(hub, port1, &portstatus, &portchange);
+		if (ret < 0)
+			return ret;
+
+		if ((portstatus & USB_PORT_STAT_LINK_STATE) ==
+				USB_SS_PORT_LS_SS_DISABLED)
+			break;
+		if (total_time >= HUB_DEBOUNCE_TIMEOUT)
+			break;
+		msleep(HUB_DEBOUNCE_STEP);
+	}
+	if (total_time >= HUB_DEBOUNCE_TIMEOUT)
+		dev_warn(hub->intfdev, "Could not disable port %d after %d ms\n",
+				port1, total_time);
+
+	return hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_RX_DETECT);
+}
+
 static int hub_port_disable(struct usb_hub *hub, int port1, int set_state)
 {
 	struct usb_device *hdev = hub->hdev;
@@ -874,8 +928,13 @@ static int hub_port_disable(struct usb_hub *hub, int port1, int set_state)
 	if (hdev->children[port1-1] && set_state)
 		usb_set_device_state(hdev->children[port1-1],
 				USB_STATE_NOTATTACHED);
-	if (!hub->error && !hub_is_superspeed(hub->hdev))
-		ret = clear_port_feature(hdev, port1, USB_PORT_FEAT_ENABLE);
+	if (!hub->error) {
+		if (hub_is_superspeed(hub->hdev))
+			ret = hub_usb3_port_disable(hub, port1);
+		else
+			ret = clear_port_feature(hdev, port1,
+					USB_PORT_FEAT_ENABLE);
+	}
 	if (ret)
 		dev_err(hub->intfdev, "cannot disable port %d (err = %d)\n",
 				port1, ret);
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 32ca289..4b07826 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -756,12 +756,39 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 			break;
 		case USB_PORT_FEAT_LINK_STATE:
 			temp = xhci_readl(xhci, port_array[wIndex]);
+
+			/* Disable port */
+			if (link_state == USB_SS_PORT_LS_SS_DISABLED) {
+				xhci_dbg(xhci, "Disable port %d\n", wIndex);
+				temp = xhci_port_state_to_neutral(temp);
+				/*
+				 * Clear all change bits, so that we get a new
+				 * connection event.
+				 */
+				temp |= PORT_CSC | PORT_PEC | PORT_WRC |
+					PORT_OCC | PORT_RC | PORT_PLC |
+					PORT_CEC;
+				xhci_writel(xhci, temp | PORT_PE,
+					port_array[wIndex]);
+				temp = xhci_readl(xhci, port_array[wIndex]);
+				break;
+			}
+
+			/* Put link in RxDetect (enable port) */
+			if (link_state == USB_SS_PORT_LS_RX_DETECT) {
+				xhci_dbg(xhci, "Enable port %d\n", wIndex);
+				xhci_set_link_state(xhci, port_array, wIndex,
+						link_state);
+				temp = xhci_readl(xhci, port_array[wIndex]);
+				break;
+			}
+
 			/* Software should not attempt to set
-			 * port link state above '5' (Rx.Detect) and the port
+			 * port link state above '3' (U3) and the port
 			 * must be enabled.
 			 */
 			if ((temp & PORT_PE) == 0 ||
-				(link_state > USB_SS_PORT_LS_RX_DETECT)) {
+				(link_state > USB_SS_PORT_LS_U3)) {
 				xhci_warn(xhci, "Cannot set link state.\n");
 				goto error;
 			}
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 12/74] USB: Increase reset timeout.
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (10 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 11/74] USB: Allow USB 3.0 ports to be disabled Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 13/74] USB: Ignore port state until reset completes Herton Ronaldo Krzesinski
                   ` (61 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Sarah Sharp, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sarah Sharp <sarah.a.sharp@linux.intel.com>

commit 77c7f072c87fa951e9a74805febf26466f31170c upstream.

John's NEC 0.96 xHCI host controller needs a longer timeout for a warm
reset to complete.  The logs show it takes 650ms to complete the warm
reset, so extend the hub reset timeout to 800ms to be on the safe side.

This commit should be backported to kernels as old as 3.2, that contain
the commit 75d7cf72ab9fa01dc70877aa5c68e8ef477229dc "usbcore: refine
warm reset logic".

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: John Covici <covici@ccs.covici.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/core/hub.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index ba01327..0b408c6 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2390,7 +2390,7 @@ static unsigned hub_is_wusb(struct usb_hub *hub)
 #define HUB_SHORT_RESET_TIME	10
 #define HUB_BH_RESET_TIME	50
 #define HUB_LONG_RESET_TIME	200
-#define HUB_RESET_TIMEOUT	500
+#define HUB_RESET_TIMEOUT	800
 
 static int hub_port_reset(struct usb_hub *hub, int port1,
 			struct usb_device *udev, unsigned int delay, bool warm);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 13/74] USB: Ignore port state until reset completes.
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (11 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 12/74] USB: Increase reset timeout Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 14/74] USB: Handle warm reset failure on empty port Herton Ronaldo Krzesinski
                   ` (60 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Sarah Sharp, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sarah Sharp <sarah.a.sharp@linux.intel.com>

commit 4f43447e62b37ee19c82a13f72f35b1ca60a74d3 upstream.

The port reset code bails out early if the current connect status is
cleared (device disconnected).  If we're issuing a hot reset, it may
also look at the link state before the reset is finished.

Section 10.14.2.6 of the USB 3.0 spec says that when a port enters the
Error state or Resetting state, the port connection bit retains the
value from the previous state.  Therefore we can't trust it until the
reset finishes.  Also, the xHCI spec section 4.19.1.2.5 says software
shall ignore the link state while the port is resetting, as it can be in
an unknown state.

The port state during reset is also unknown for USB 2.0 hubs.  The hub
sends a reset signal by driving the bus into an SE0 state.  This
overwhelms the "connect" signal from the device, so the port can't tell
whether anything is connected or not.

Fix the port reset code to ignore the port link state and current
connect bit until the reset finishes, and USB_PORT_STAT_RESET is
cleared.

Remove the check for USB_PORT_STAT_C_BH_RESET in the warm reset case,
because it's redundant.  When the warm reset finishes, the port reset
bit will be cleared at the same time USB_PORT_STAT_C_BH_RESET is set.
Remove the now-redundant check for a cleared USB_PORT_STAT_RESET bit
in the code to deal with the finished reset.

This patch should be backported to all stable kernels.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/core/hub.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 0b408c6..89fc61b 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2425,6 +2425,10 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
 		if (ret < 0)
 			return ret;
 
+		/* The port state is unknown until the reset completes. */
+		if ((portstatus & USB_PORT_STAT_RESET))
+			goto delay;
+
 		/*
 		 * Some buggy devices require a warm reset to be issued even
 		 * when the port appears not to be connected.
@@ -2470,11 +2474,7 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
 			if ((portchange & USB_PORT_STAT_C_CONNECTION))
 				return -ENOTCONN;
 
-			/* if we`ve finished resetting, then break out of
-			 * the loop
-			 */
-			if (!(portstatus & USB_PORT_STAT_RESET) &&
-			    (portstatus & USB_PORT_STAT_ENABLE)) {
+			if ((portstatus & USB_PORT_STAT_ENABLE)) {
 				if (hub_is_wusb(hub))
 					udev->speed = USB_SPEED_WIRELESS;
 				else if (hub_is_superspeed(hub->hdev))
@@ -2488,10 +2488,10 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
 				return 0;
 			}
 		} else {
-			if (portchange & USB_PORT_STAT_C_BH_RESET)
-				return 0;
+			return 0;
 		}
 
+delay:
 		/* switch to the long delay after two short delay failures */
 		if (delay_time >= 2 * HUB_SHORT_RESET_TIME)
 			delay = HUB_LONG_RESET_TIME;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 14/74] USB: Handle warm reset failure on empty port.
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (12 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 13/74] USB: Ignore port state until reset completes Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 15/74] xhci: Avoid "dead ports", add roothub port polling Herton Ronaldo Krzesinski
                   ` (59 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Sarah Sharp, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sarah Sharp <sarah.a.sharp@linux.intel.com>

commit 65bdac5effd15d6af619b3b7218627ef4d84ed6a upstream.

An empty port can transition to either Inactive or Compliance Mode if a
newly connected USB 3.0 device fails to link train.  In that case, we
issue a warm reset.  Some devices, such as John's Roseweil eusb3
enclosure, slip back into Compliance Mode after the warm reset.

The current warm reset code does not check for device connect status on
warm reset completion, and it incorrectly reports the warm reset
succeeded.  This causes the USB core to attempt to send a Set Address
control transfer to a port in Compliance Mode, which will always fail.

Make hub_port_wait_reset check the current connect status and link state
after the warm reset completes.  Return a failure status if the device
is disconnected or the link state is Compliance Mode or SS.Inactive.

Make hub_events disable the port if warm reset fails.  This will disable
the port, and then bring it back into the RxDetect state.  Make the USB
core ignore the connect change until the device reconnects.

Note that this patch does NOT handle connected devices slipping into the
Inactive state very well.  This is a concern, because devices can go
into the Inactive state on U1/U2 exit failure.  However, the fix for
that case is too large for stable, so it will be submitted in a separate
patch.

This patch should be backported to kernels as old as 3.2, contain the
commit ID 75d7cf72ab9fa01dc70877aa5c68e8ef477229dc "usbcore: refine warm
reset logic"

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: John Covici <covici@ccs.covici.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/core/hub.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 89fc61b..2532bdc 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2488,6 +2488,11 @@ static int hub_port_wait_reset(struct usb_hub *hub, int port1,
 				return 0;
 			}
 		} else {
+			if (!(portstatus & USB_PORT_STAT_CONNECTION) ||
+					hub_port_warm_reset_required(hub,
+						portstatus))
+				return -ENOTCONN;
+
 			return 0;
 		}
 
@@ -4492,9 +4497,14 @@ static void hub_events(void)
 			 * SS.Inactive state.
 			 */
 			if (hub_port_warm_reset_required(hub, portstatus)) {
+				int status;
+
 				dev_dbg(hub_dev, "warm reset port %d\n", i);
-				hub_port_reset(hub, i, NULL,
+				status = hub_port_reset(hub, i, NULL,
 						HUB_BH_RESET_TIME, true);
+				if (status < 0)
+					hub_port_disable(hub, i, 1);
+				connect_change = 0;
 			}
 
 			if (connect_change)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 15/74] xhci: Avoid "dead ports", add roothub port polling.
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (13 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 14/74] USB: Handle warm reset failure on empty port Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 16/74] ASoC: wm2200: Remove DSP B and left justified AIF modes Herton Ronaldo Krzesinski
                   ` (58 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Sarah Sharp, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Sarah Sharp <sarah.a.sharp@linux.intel.com>

commit c52804a472649b2e5005342308739434cbd51119 upstream.

The USB core hub thread (khubd) is designed with external USB hubs in
mind.  It expects that if a port status change bit is set, the hub will
continue to send a notification through the hub status data transfer.
Basically, it expects hub notifications to be level-triggered.

The xHCI host controller is designed to be edge-triggered on the logical
'OR' of all the port status change bits.  When all port status change
bits are clear, and a new change bit is set, the xHC will generate a
Port Status Change Event.  If another change bit is set in the same port
status register before the first bit is cleared, it will not send
another event.

This means that the hub code may lose port status changes because of
race conditions between clearing change bits.  The user sees this as a
"dead port" that doesn't react to device connects.

The fix is to turn on port polling whenever a new change bit is set.
Once the USB core issues a hub status request that shows that no change
bits are set in any USB ports, turn off port polling.

We can't allow the USB core to poll the roothub for port events during
host suspend because if the PCI host is in D3cold, the port registers
will be all f's.  Instead, stop the port polling timer, and
unconditionally restart it when the host resumes.  If there are no port
change bits set after the resume, the first call to hub_status_data will
disable polling.

This patch should be backported to stable kernels with the first xHCI
support, 2.6.31 and newer, that include the commit
0f2a79300a1471cf92ab43af165ea13555c8b0a5 "USB: xhci: Root hub support."
There will be merge conflicts because the check for HC_STATE_SUSPENDED
was moved into xhci_suspend in 3.8.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/host/xhci-hub.c  |    7 +++++++
 drivers/usb/host/xhci-ring.c |    9 +++++++++
 drivers/usb/host/xhci.c      |   10 ++++++++++
 3 files changed, 26 insertions(+)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 4b07826..7534bb4 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -959,6 +959,7 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf)
 	int max_ports;
 	__le32 __iomem **port_array;
 	struct xhci_bus_state *bus_state;
+	bool reset_change = false;
 
 	max_ports = xhci_get_ports(hcd, &port_array);
 	bus_state = &xhci->bus_state[hcd_index(hcd)];
@@ -990,6 +991,12 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf)
 			buf[(i + 1) / 8] |= 1 << (i + 1) % 8;
 			status = 1;
 		}
+		if ((temp & PORT_RC))
+			reset_change = true;
+	}
+	if (!status && !reset_change) {
+		xhci_dbg(xhci, "%s: stopping port polling.\n", __func__);
+		clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
 	}
 	spin_unlock_irqrestore(&xhci->lock, flags);
 	return status ? retval : 0;
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 7ac8c9fa..c3c174d 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1725,6 +1725,15 @@ cleanup:
 	if (bogus_port_status)
 		return;
 
+	/*
+	 * xHCI port-status-change events occur when the "or" of all the
+	 * status-change bits in the portsc register changes from 0 to 1.
+	 * New status changes won't cause an event if any other change
+	 * bits are still set.  When an event occurs, switch over to
+	 * polling to avoid losing status changes.
+	 */
+	xhci_dbg(xhci, "%s: starting port polling.\n", __func__);
+	set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
 	spin_unlock(&xhci->lock);
 	/* Pass this up to the core */
 	usb_hcd_poll_rh_status(hcd);
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 77da9a0..7002b67 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -880,6 +880,11 @@ int xhci_suspend(struct xhci_hcd *xhci)
 	struct usb_hcd		*hcd = xhci_to_hcd(xhci);
 	u32			command;
 
+	/* Don't poll the roothubs on bus suspend. */
+	xhci_dbg(xhci, "%s: stopping port polling.\n", __func__);
+	clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
+	del_timer_sync(&hcd->rh_timer);
+
 	spin_lock_irq(&xhci->lock);
 	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
 	clear_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags);
@@ -1064,6 +1069,11 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
 	if (xhci->quirks & XHCI_COMP_MODE_QUIRK)
 		compliance_mode_recovery_timer_init(xhci);
 
+	/* Re-enable port polling. */
+	xhci_dbg(xhci, "%s: starting port polling.\n", __func__);
+	set_bit(HCD_FLAG_POLL_RH, &hcd->flags);
+	usb_hcd_poll_rh_status(hcd);
+
 	return retval;
 }
 #endif	/* CONFIG_PM */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 16/74] ASoC: wm2200: Remove DSP B and left justified AIF modes
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (14 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 15/74] xhci: Avoid "dead ports", add roothub port polling Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 17/74] ASoC: wm5100: Remove DSP B and left justified formats Herton Ronaldo Krzesinski
                   ` (57 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Mark Brown, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mark Brown <broonie@opensource.wolfsonmicro.com>

commit 0cc411b934c4317b363d1af993549f391852b980 upstream.

These are not supported.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 sound/soc/codecs/wm2200.c |    6 ------
 1 file changed, 6 deletions(-)

diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c
index 201fc58..86b84a1 100644
--- a/sound/soc/codecs/wm2200.c
+++ b/sound/soc/codecs/wm2200.c
@@ -1380,15 +1380,9 @@ static int wm2200_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 	case SND_SOC_DAIFMT_DSP_A:
 		fmt_val = 0;
 		break;
-	case SND_SOC_DAIFMT_DSP_B:
-		fmt_val = 1;
-		break;
 	case SND_SOC_DAIFMT_I2S:
 		fmt_val = 2;
 		break;
-	case SND_SOC_DAIFMT_LEFT_J:
-		fmt_val = 3;
-		break;
 	default:
 		dev_err(codec->dev, "Unsupported DAI format %d\n",
 			fmt & SND_SOC_DAIFMT_FORMAT_MASK);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 17/74] ASoC: wm5100: Remove DSP B and left justified formats
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (15 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 16/74] ASoC: wm2200: Remove DSP B and left justified AIF modes Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 18/74] mwifiex: check wait_event_interruptible return value Herton Ronaldo Krzesinski
                   ` (56 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Mark Brown, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mark Brown <broonie@opensource.wolfsonmicro.com>

commit 5f960294e2031d12f10c8488c3446fecbf59628d upstream.

These are not supported

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 sound/soc/codecs/wm5100.c |    6 ------
 1 file changed, 6 deletions(-)

diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c
index cb6d537..d986704 100644
--- a/sound/soc/codecs/wm5100.c
+++ b/sound/soc/codecs/wm5100.c
@@ -1279,15 +1279,9 @@ static int wm5100_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
 	case SND_SOC_DAIFMT_DSP_A:
 		mask = 0;
 		break;
-	case SND_SOC_DAIFMT_DSP_B:
-		mask = 1;
-		break;
 	case SND_SOC_DAIFMT_I2S:
 		mask = 2;
 		break;
-	case SND_SOC_DAIFMT_LEFT_J:
-		mask = 3;
-		break;
 	default:
 		dev_err(codec->dev, "Unsupported DAI format %d\n",
 			fmt & SND_SOC_DAIFMT_FORMAT_MASK);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 18/74] mwifiex: check wait_event_interruptible return value
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (16 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 17/74] ASoC: wm5100: Remove DSP B and left justified formats Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 19/74] ASoC: wm2000: Fix sense of speech clarity enable Herton Ronaldo Krzesinski
                   ` (55 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bing Zhao, Amitkumar Karwar, John W. Linville, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Bing Zhao <bzhao@marvell.com>

commit 9c969d8ccb1e17bd20742f4ac9f00c1a64487234 upstream.

wait_event_interruptible function returns -ERESTARTSYS if it's
interrupted by a signal. Driver should check the return value
and handle this case properly.

In mwifiex_wait_queue_complete() routine, as we are now checking
wait_event_interruptible return value, the condition check is not
required. Also, we have removed mwifiex_cancel_pending_ioctl()
call to avoid a chance of sending second command to FW by other path
as soon as we clear current command node. FW can not handle two
commands simultaneously.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/net/wireless/mwifiex/sta_ioctl.c |   21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index 106c449..a5db9f1 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -53,7 +53,6 @@ int mwifiex_copy_mcast_addr(struct mwifiex_multicast_list *mlist,
  */
 int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter)
 {
-	bool cancel_flag = false;
 	int status;
 	struct cmd_ctrl_node *cmd_queued;
 
@@ -70,14 +69,11 @@ int mwifiex_wait_queue_complete(struct mwifiex_adapter *adapter)
 	queue_work(adapter->workqueue, &adapter->main_work);
 
 	/* Wait for completion */
-	wait_event_interruptible(adapter->cmd_wait_q.wait,
-				 *(cmd_queued->condition));
-	if (!*(cmd_queued->condition))
-		cancel_flag = true;
-
-	if (cancel_flag) {
-		mwifiex_cancel_pending_ioctl(adapter);
-		dev_dbg(adapter->dev, "cmd cancel\n");
+	status = wait_event_interruptible(adapter->cmd_wait_q.wait,
+					  *(cmd_queued->condition));
+	if (status) {
+		dev_err(adapter->dev, "cmd_wait_q terminated: %d\n", status);
+		return status;
 	}
 
 	status = adapter->cmd_wait_q.status;
@@ -430,8 +426,11 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
 		return false;
 	}
 
-	wait_event_interruptible(adapter->hs_activate_wait_q,
-				 adapter->hs_activate_wait_q_woken);
+	if (wait_event_interruptible(adapter->hs_activate_wait_q,
+				     adapter->hs_activate_wait_q_woken)) {
+		dev_err(adapter->dev, "hs_activate_wait_q terminated\n");
+		return false;
+	}
 
 	return true;
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 19/74] ASoC: wm2000: Fix sense of speech clarity enable
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (17 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 18/74] mwifiex: check wait_event_interruptible return value Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 20/74] drm/i915; Only increment the user-pin-count after successfully pinning the bo Herton Ronaldo Krzesinski
                   ` (54 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team; +Cc: Mark Brown, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mark Brown <broonie@opensource.wolfsonmicro.com>

commit 267f8fa2e1eef0612b2007e1f1846bcbc35cc1fa upstream.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 sound/soc/codecs/wm2000.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c
index 45f2faf..baa9752 100644
--- a/sound/soc/codecs/wm2000.c
+++ b/sound/soc/codecs/wm2000.c
@@ -188,9 +188,9 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue)
 
 	ret = wm2000_read(i2c, WM2000_REG_SPEECH_CLARITY);
 	if (wm2000->speech_clarity)
-		ret &= ~WM2000_SPEECH_CLARITY;
-	else
 		ret |= WM2000_SPEECH_CLARITY;
+	else
+		ret &= ~WM2000_SPEECH_CLARITY;
 	wm2000_write(i2c, WM2000_REG_SPEECH_CLARITY, ret);
 
 	wm2000_write(i2c, WM2000_REG_SYS_START0, 0x33);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 20/74] drm/i915; Only increment the user-pin-count after successfully pinning the bo
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (18 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 19/74] ASoC: wm2000: Fix sense of speech clarity enable Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 21/74] samsung-laptop: Add quirk for broken acpi_video backlight on N250P Herton Ronaldo Krzesinski
                   ` (53 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Chris Wilson, Daniel Vetter, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Chris Wilson <chris@chris-wilson.co.uk>

commit 93be8788e648817d62fda33e2998eb6ca6ebf3a3 upstream.

As along the error path we do not correct the user pin-count for the
failure, we may end up with userspace believing that it has a pinned
object at offset 0 (when interrupted by a signal for example).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/gpu/drm/i915/i915_gem.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 4dc8a9b..7605f40 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3125,14 +3125,15 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data,
 		goto out;
 	}
 
-	obj->user_pin_count++;
-	obj->pin_filp = file;
-	if (obj->user_pin_count == 1) {
+	if (obj->user_pin_count == 0) {
 		ret = i915_gem_object_pin(obj, args->alignment, true);
 		if (ret)
 			goto out;
 	}
 
+	obj->user_pin_count++;
+	obj->pin_filp = file;
+
 	/* XXX - flush the CPU caches for pinned objects
 	 * as the X server doesn't manage domains yet
 	 */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 21/74] samsung-laptop: Add quirk for broken acpi_video backlight on N250P
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (19 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 20/74] drm/i915; Only increment the user-pin-count after successfully pinning the bo Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 22/74] sony-laptop: fix SNC buffer calls when SN06 returns Integers Herton Ronaldo Krzesinski
                   ` (52 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Seth Forshee, Matthew Garrett, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Seth Forshee <seth.forshee@canonical.com>

commit e04c200f1f2de8eaa2f5af6d97e7e213a1abb424 upstream.

BugLink: http://bugs.launchpad.net/bugs/1086921
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/platform/x86/samsung-laptop.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index e2a34b4..1afbe5e 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -1506,6 +1506,16 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
 		},
 	 .driver_data = &samsung_broken_acpi_video,
 	},
+	{
+	 .callback = samsung_dmi_matched,
+	 .ident = "N250P",
+	 .matches = {
+		DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+		DMI_MATCH(DMI_PRODUCT_NAME, "N250P"),
+		DMI_MATCH(DMI_BOARD_NAME, "N250P"),
+		},
+	 .driver_data = &samsung_broken_acpi_video,
+	},
 	{ },
 };
 MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 22/74] sony-laptop: fix SNC buffer calls when SN06 returns Integers
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (20 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 21/74] samsung-laptop: Add quirk for broken acpi_video backlight on N250P Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 23/74] staging: r8712u: Add new device ID Herton Ronaldo Krzesinski
                   ` (51 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Fabrizio Narni, mus.svz, Mattia Dongili, Matthew Garrett,
	Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mattia Dongili <malattia@linux.it>

commit dcbeec264d73b7228ffdfe767eab69b2353099b1 upstream.

SN06 in some cases returns an Integer instead of a buffer. While the
code handling the return value was trying to cope with the difference,
the memcpy call was not making any difference between the two types of
acpi_object union. This regression was introduced in 3.5.
While there also rework the return value logic to improve readability.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=48671
Cc: Fabrizio Narni <shibotto@gmail.com>
Cc: <mus.svz@gmail.com>
Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/platform/x86/sony-laptop.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index d456ff0..d4a6172 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -784,28 +784,29 @@ static int sony_nc_int_call(acpi_handle handle, char *name, int *value,
 static int sony_nc_buffer_call(acpi_handle handle, char *name, u64 *value,
 		void *buffer, size_t buflen)
 {
+	int ret = 0;
 	size_t len = len;
 	union acpi_object *object = __call_snc_method(handle, name, value);
 
 	if (!object)
 		return -EINVAL;
 
-	if (object->type == ACPI_TYPE_BUFFER)
+	if (object->type == ACPI_TYPE_BUFFER) {
 		len = MIN(buflen, object->buffer.length);
+		memcpy(buffer, object->buffer.pointer, len);
 
-	else if (object->type == ACPI_TYPE_INTEGER)
+	} else if (object->type == ACPI_TYPE_INTEGER) {
 		len = MIN(buflen, sizeof(object->integer.value));
+		memcpy(buffer, &object->integer.value, len);
 
-	else {
+	} else {
 		pr_warn("Invalid acpi_object: expected 0x%x got 0x%x\n",
 				ACPI_TYPE_BUFFER, object->type);
-		kfree(object);
-		return -EINVAL;
+		ret = -EINVAL;
 	}
 
-	memcpy(buffer, object->buffer.pointer, len);
 	kfree(object);
-	return 0;
+	return ret;
 }
 
 struct sony_nc_handles {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 23/74] staging: r8712u: Add new device ID
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (21 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 22/74] sony-laptop: fix SNC buffer calls when SN06 returns Integers Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 24/74] b43: Fix firmware loading when driver is built into the kernel Herton Ronaldo Krzesinski
                   ` (50 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Larry Finger, Thomas Hartmann, Greg Kroah-Hartman,
	Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Larry Finger <Larry.Finger@lwfinger.net>

commit da849a92d3bafaf24d770e971c2c9e5c3f60b5d1 upstream.

The ISY IWL 1000 USB WLAN stick with USB ID 050d:11f1 is a clone of
the Belkin F7D1101 V1 device.

Reported-by: Thomas Hartmann <hartmann@ict.tuwien.ac.at>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Thomas Hartmann <hartmann@ict.tuwien.ac.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/staging/rtl8712/usb_intf.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/rtl8712/usb_intf.c b/drivers/staging/rtl8712/usb_intf.c
index 69f616c..1bc8097 100644
--- a/drivers/staging/rtl8712/usb_intf.c
+++ b/drivers/staging/rtl8712/usb_intf.c
@@ -66,6 +66,8 @@ static struct usb_device_id rtl871x_usb_id_tbl[] = {
 	{USB_DEVICE(0x0B05, 0x1791)}, /* 11n mode disable */
 	/* Belkin */
 	{USB_DEVICE(0x050D, 0x945A)},
+	/* ISY IWL - Belkin clone */
+	{USB_DEVICE(0x050D, 0x11F1)},
 	/* Corega */
 	{USB_DEVICE(0x07AA, 0x0047)},
 	/* D-Link */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 24/74] b43: Fix firmware loading when driver is built into the kernel
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (22 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 23/74] staging: r8712u: Add new device ID Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 25/74] staging: speakup: avoid out-of-range access in synth_init() Herton Ronaldo Krzesinski
                   ` (49 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Larry Finger, John W. Linville, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Larry Finger <Larry.Finger@lwfinger.net>

commit 5e20a4b53094651d80f856ff55a916b999dbb57a upstream.

Recent versions of udev cause synchronous firmware loading from the
probe routine to fail because the request to user space would time
out. The original fix for b43 (commit 6b6fa58) moved the firmware
load from the probe routine to a work queue, but it still used synchronous
firmware loading. This method is OK when b43 is built as a module;
however, it fails when the driver is compiled into the kernel.

This version changes the code to load the initial firmware file
using request_firmware_nowait(). A completion event is used to
hold the work queue until that file is available. This driver
reads several firmware files - the remainder can be read synchronously.
On some test systems, the async read fails; however, a following synch
read works, thus the async failure falls through to the sync try.

Reported-and-Tested by: Felix Janda <felix.janda@posteo.de>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/net/wireless/b43/b43.h  |    5 ++++
 drivers/net/wireless/b43/main.c |   54 +++++++++++++++++++++++++++++----------
 drivers/net/wireless/b43/main.h |    5 ++--
 3 files changed, 48 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 7c899fc..ac593ab 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -7,6 +7,7 @@
 #include <linux/hw_random.h>
 #include <linux/bcma/bcma.h>
 #include <linux/ssb/ssb.h>
+#include <linux/completion.h>
 #include <net/mac80211.h>
 
 #include "debugfs.h"
@@ -718,6 +719,10 @@ enum b43_firmware_file_type {
 struct b43_request_fw_context {
 	/* The device we are requesting the fw for. */
 	struct b43_wldev *dev;
+	/* a completion event structure needed if this call is asynchronous */
+	struct completion fw_load_complete;
+	/* a pointer to the firmware object */
+	const struct firmware *blob;
 	/* The type of firmware to request. */
 	enum b43_firmware_file_type req_type;
 	/* Error messages for each firmware type. */
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index a4e020a..823943b 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2088,11 +2088,18 @@ static void b43_print_fw_helptext(struct b43_wl *wl, bool error)
 		b43warn(wl, text);
 }
 
+static void b43_fw_cb(const struct firmware *firmware, void *context)
+{
+	struct b43_request_fw_context *ctx = context;
+
+	ctx->blob = firmware;
+	complete(&ctx->fw_load_complete);
+}
+
 int b43_do_request_fw(struct b43_request_fw_context *ctx,
 		      const char *name,
-		      struct b43_firmware_file *fw)
+		      struct b43_firmware_file *fw, bool async)
 {
-	const struct firmware *blob;
 	struct b43_fw_header *hdr;
 	u32 size;
 	int err;
@@ -2131,11 +2138,31 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx,
 		B43_WARN_ON(1);
 		return -ENOSYS;
 	}
-	err = request_firmware(&blob, ctx->fwname, ctx->dev->dev->dev);
+	if (async) {
+		/* do this part asynchronously */
+		init_completion(&ctx->fw_load_complete);
+		err = request_firmware_nowait(THIS_MODULE, 1, ctx->fwname,
+					      ctx->dev->dev->dev, GFP_KERNEL,
+					      ctx, b43_fw_cb);
+		if (err < 0) {
+			pr_err("Unable to load firmware\n");
+			return err;
+		}
+		/* stall here until fw ready */
+		wait_for_completion(&ctx->fw_load_complete);
+		if (ctx->blob)
+			goto fw_ready;
+	/* On some ARM systems, the async request will fail, but the next sync
+	 * request works. For this reason, we dall through here
+	 */
+	}
+	err = request_firmware(&ctx->blob, ctx->fwname,
+			       ctx->dev->dev->dev);
 	if (err == -ENOENT) {
 		snprintf(ctx->errors[ctx->req_type],
 			 sizeof(ctx->errors[ctx->req_type]),
-			 "Firmware file \"%s\" not found\n", ctx->fwname);
+			 "Firmware file \"%s\" not found\n",
+			 ctx->fwname);
 		return err;
 	} else if (err) {
 		snprintf(ctx->errors[ctx->req_type],
@@ -2144,14 +2171,15 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx,
 			 ctx->fwname, err);
 		return err;
 	}
-	if (blob->size < sizeof(struct b43_fw_header))
+fw_ready:
+	if (ctx->blob->size < sizeof(struct b43_fw_header))
 		goto err_format;
-	hdr = (struct b43_fw_header *)(blob->data);
+	hdr = (struct b43_fw_header *)(ctx->blob->data);
 	switch (hdr->type) {
 	case B43_FW_TYPE_UCODE:
 	case B43_FW_TYPE_PCM:
 		size = be32_to_cpu(hdr->size);
-		if (size != blob->size - sizeof(struct b43_fw_header))
+		if (size != ctx->blob->size - sizeof(struct b43_fw_header))
 			goto err_format;
 		/* fallthrough */
 	case B43_FW_TYPE_IV:
@@ -2162,7 +2190,7 @@ int b43_do_request_fw(struct b43_request_fw_context *ctx,
 		goto err_format;
 	}
 
-	fw->data = blob;
+	fw->data = ctx->blob;
 	fw->filename = name;
 	fw->type = ctx->req_type;
 
@@ -2172,7 +2200,7 @@ err_format:
 	snprintf(ctx->errors[ctx->req_type],
 		 sizeof(ctx->errors[ctx->req_type]),
 		 "Firmware file \"%s\" format error.\n", ctx->fwname);
-	release_firmware(blob);
+	release_firmware(ctx->blob);
 
 	return -EPROTO;
 }
@@ -2223,7 +2251,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)
 			goto err_no_ucode;
 		}
 	}
-	err = b43_do_request_fw(ctx, filename, &fw->ucode);
+	err = b43_do_request_fw(ctx, filename, &fw->ucode, true);
 	if (err)
 		goto err_load;
 
@@ -2235,7 +2263,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)
 	else
 		goto err_no_pcm;
 	fw->pcm_request_failed = false;
-	err = b43_do_request_fw(ctx, filename, &fw->pcm);
+	err = b43_do_request_fw(ctx, filename, &fw->pcm, false);
 	if (err == -ENOENT) {
 		/* We did not find a PCM file? Not fatal, but
 		 * core rev <= 10 must do without hwcrypto then. */
@@ -2296,7 +2324,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)
 	default:
 		goto err_no_initvals;
 	}
-	err = b43_do_request_fw(ctx, filename, &fw->initvals);
+	err = b43_do_request_fw(ctx, filename, &fw->initvals, false);
 	if (err)
 		goto err_load;
 
@@ -2355,7 +2383,7 @@ static int b43_try_request_fw(struct b43_request_fw_context *ctx)
 	default:
 		goto err_no_initvals;
 	}
-	err = b43_do_request_fw(ctx, filename, &fw->initvals_band);
+	err = b43_do_request_fw(ctx, filename, &fw->initvals_band, false);
 	if (err)
 		goto err_load;
 
diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h
index 8c684cd..abac25e 100644
--- a/drivers/net/wireless/b43/main.h
+++ b/drivers/net/wireless/b43/main.h
@@ -137,9 +137,8 @@ void b43_mac_phy_clock_set(struct b43_wldev *dev, bool on);
 
 
 struct b43_request_fw_context;
-int b43_do_request_fw(struct b43_request_fw_context *ctx,
-		      const char *name,
-		      struct b43_firmware_file *fw);
+int b43_do_request_fw(struct b43_request_fw_context *ctx, const char *name,
+		      struct b43_firmware_file *fw, bool async);
 void b43_do_release_fw(struct b43_firmware_file *fw);
 
 #endif /* B43_MAIN_H_ */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 25/74] staging: speakup: avoid out-of-range access in synth_init()
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (23 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 24/74] b43: Fix firmware loading when driver is built into the kernel Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 26/74] staging: speakup: avoid out-of-range access in synth_add() Herton Ronaldo Krzesinski
                   ` (48 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Nickolai Zeldovich, Samuel Thibault, Greg Kroah-Hartman,
	Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Nickolai Zeldovich <nickolai@csail.mit.edu>

commit ae428655b826f2755a8101b27beda42a275ef8ad upstream.

Check that array index is in-bounds before accessing the synths[] array.

Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/staging/speakup/synth.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index 331eae7..217fd4a 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -342,7 +342,7 @@ int synth_init(char *synth_name)
 
 	mutex_lock(&spk_mutex);
 	/* First, check if we already have it loaded. */
-	for (i = 0; synths[i] != NULL && i < MAXSYNTHS; i++)
+	for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++)
 		if (strcmp(synths[i]->name, synth_name) == 0)
 			synth = synths[i];
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 26/74] staging: speakup: avoid out-of-range access in synth_add()
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (24 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 25/74] staging: speakup: avoid out-of-range access in synth_init() Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 27/74] staging: comedi: fix minimum AO period for NI 625x and NI 628x Herton Ronaldo Krzesinski
                   ` (47 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Samuel Thibault, Nickolai Zeldovich, Greg Kroah-Hartman,
	Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Samuel Thibault <samuel.thibault@ens-lyon.org>

commit 6102c48bd421074a33e102f2ebda3724e8d275f9 upstream.

Check that array index is in-bounds before accessing the synths[] array.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Nickolai Zeldovich <nickolai@csail.mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/staging/speakup/synth.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index 217fd4a..5710fc5 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -423,7 +423,7 @@ int synth_add(struct spk_synth *in_synth)
 	int i;
 	int status = 0;
 	mutex_lock(&spk_mutex);
-	for (i = 0; synths[i] != NULL && i < MAXSYNTHS; i++)
+	for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++)
 		/* synth_remove() is responsible for rotating the array down */
 		if (in_synth == synths[i]) {
 			mutex_unlock(&spk_mutex);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 27/74] staging: comedi: fix minimum AO period for NI 625x and NI 628x
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (25 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 26/74] staging: speakup: avoid out-of-range access in synth_add() Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 28/74] staging: comedi: prevent auto-unconfig of manually configured devices Herton Ronaldo Krzesinski
                   ` (46 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Éric Piel, Greg Kroah-Hartman, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?=C3=89ric=20Piel?= <piel@delmic.com>

commit 34b55d8c48f4f76044d8f4d6ec3dc786cf210312 upstream.

The minimum period was set to 357 ns, while the divider for these boards is 50
ns. This prevented to output at maximum speed as ni_ao_cmdtest() would return
357 but would not accept it.

Not sure why it was set to 357 ns (this was done before the git history,
which starts 5 years ago). My guess is that it comes from reading the
specification stating a 2.8 MHz rate (~ 357 ns). The latest
specification states a 2.86 MHz rate (~ 350 ns), which makes a lot
more sense.

Tested on a pci-6251.

Signed-off-by: Éric Piel <piel@delmic.com>
Acked-By: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/staging/comedi/drivers/ni_pcimio.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c
index 3974c0d..fa09fd7 100644
--- a/drivers/staging/comedi/drivers/ni_pcimio.c
+++ b/drivers/staging/comedi/drivers/ni_pcimio.c
@@ -963,7 +963,7 @@ static const struct ni_board_struct ni_boards[] = {
 	 .ao_range_table = &range_ni_M_625x_ao,
 	 .reg_type = ni_reg_625x,
 	 .ao_unipolar = 0,
-	 .ao_speed = 357,
+	 .ao_speed = 350,
 	 .num_p0_dio_channels = 8,
 	 .caldac = {caldac_none},
 	 .has_8255 = 0,
@@ -982,7 +982,7 @@ static const struct ni_board_struct ni_boards[] = {
 	 .ao_range_table = &range_ni_M_625x_ao,
 	 .reg_type = ni_reg_625x,
 	 .ao_unipolar = 0,
-	 .ao_speed = 357,
+	 .ao_speed = 350,
 	 .num_p0_dio_channels = 8,
 	 .caldac = {caldac_none},
 	 .has_8255 = 0,
@@ -1001,7 +1001,7 @@ static const struct ni_board_struct ni_boards[] = {
 	 .ao_range_table = &range_ni_M_625x_ao,
 	 .reg_type = ni_reg_625x,
 	 .ao_unipolar = 0,
-	 .ao_speed = 357,
+	 .ao_speed = 350,
 	 .num_p0_dio_channels = 8,
 	 .caldac = {caldac_none},
 	 .has_8255 = 0,
@@ -1037,7 +1037,7 @@ static const struct ni_board_struct ni_boards[] = {
 	 .ao_range_table = &range_ni_M_625x_ao,
 	 .reg_type = ni_reg_625x,
 	 .ao_unipolar = 0,
-	 .ao_speed = 357,
+	 .ao_speed = 350,
 	 .num_p0_dio_channels = 32,
 	 .caldac = {caldac_none},
 	 .has_8255 = 0,
@@ -1056,7 +1056,7 @@ static const struct ni_board_struct ni_boards[] = {
 	 .ao_range_table = &range_ni_M_625x_ao,
 	 .reg_type = ni_reg_625x,
 	 .ao_unipolar = 0,
-	 .ao_speed = 357,
+	 .ao_speed = 350,
 	 .num_p0_dio_channels = 32,
 	 .caldac = {caldac_none},
 	 .has_8255 = 0,
@@ -1092,7 +1092,7 @@ static const struct ni_board_struct ni_boards[] = {
 	 .ao_range_table = &range_ni_M_628x_ao,
 	 .reg_type = ni_reg_628x,
 	 .ao_unipolar = 1,
-	 .ao_speed = 357,
+	 .ao_speed = 350,
 	 .num_p0_dio_channels = 8,
 	 .caldac = {caldac_none},
 	 .has_8255 = 0,
@@ -1111,7 +1111,7 @@ static const struct ni_board_struct ni_boards[] = {
 	 .ao_range_table = &range_ni_M_628x_ao,
 	 .reg_type = ni_reg_628x,
 	 .ao_unipolar = 1,
-	 .ao_speed = 357,
+	 .ao_speed = 350,
 	 .num_p0_dio_channels = 8,
 	 .caldac = {caldac_none},
 	 .has_8255 = 0,
@@ -1147,7 +1147,7 @@ static const struct ni_board_struct ni_boards[] = {
 	 .ao_range_table = &range_ni_M_628x_ao,
 	 .reg_type = ni_reg_628x,
 	 .ao_unipolar = 1,
-	 .ao_speed = 357,
+	 .ao_speed = 350,
 	 .num_p0_dio_channels = 32,
 	 .caldac = {caldac_none},
 	 .has_8255 = 0,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 28/74] staging: comedi: prevent auto-unconfig of manually configured devices
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (26 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 27/74] staging: comedi: fix minimum AO period for NI 625x and NI 628x Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 29/74] staging: comedi: comedi_test: fix race when cancelling command Herton Ronaldo Krzesinski
                   ` (45 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ian Abbott, Greg Kroah-Hartman, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ian Abbott <abbotti@mev.co.uk>

commit 7d3135af399e92cf4c9bbc5f86b6c140aab3b88c upstream.

When a low-level comedi driver auto-configures a device, a `struct
comedi_dev_file_info` is allocated (as well as a `struct
comedi_device`) by `comedi_alloc_board_minor()`.  A pointer to the
hardware `struct device` is stored as a cookie in the `struct
comedi_dev_file_info`.  When the low-level comedi driver
auto-unconfigures the device, `comedi_auto_unconfig()` uses the cookie
to find the `struct comedi_dev_file_info` so it can detach the comedi
device from the driver, clean it up and free it.

A problem arises if the user manually unconfigures and reconfigures the
comedi device using the `COMEDI_DEVCONFIG` ioctl so that is no longer
associated with the original hardware device.  The problem is that the
cookie is not cleared, so that a call to `comedi_auto_unconfig()` from
the low-level driver will still find it, detach it, clean it up and free
it.

Stop this problem occurring by always clearing the `hardware_device`
cookie in the `struct comedi_dev_file_info` whenever the
`COMEDI_DEVCONFIG` ioctl call is successful.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/staging/comedi/comedi_fops.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index d77219a..d231193 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -427,6 +427,9 @@ static long comedi_unlocked_ioctl(struct file *file, unsigned int cmd,
 	if (cmd == COMEDI_DEVCONFIG) {
 		rc = do_devconfig_ioctl(dev,
 					(struct comedi_devconfig __user *)arg);
+		if (rc == 0)
+			/* Evade comedi_auto_unconfig(). */
+			dev_file_info->hardware_device = NULL;
 		goto done;
 	}
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 29/74] staging: comedi: comedi_test: fix race when cancelling command
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (27 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 28/74] staging: comedi: prevent auto-unconfig of manually configured devices Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 30/74] regulator: max8997: Use uV in voltage_map_desc Herton Ronaldo Krzesinski
                   ` (44 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ian Abbott, Greg Kroah-Hartman, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ian Abbott <abbotti@mev.co.uk>

commit c0729eeefdcd76db338f635162bf0739fd2c5f6f upstream.

Éric Piel reported a kernel oops in the "comedi_test" module.  It was a
NULL pointer dereference within `waveform_ai_interrupt()` (actually a
timer function) that sometimes occurred when a running asynchronous
command is cancelled (either by the `COMEDI_CANCEL` ioctl or by closing
the device file).

This seems to be a race between the caller of `waveform_ai_cancel()`
which on return from that function goes and tears down the running
command, and the timer function which uses the command.  In particular,
`async->cmd.chanlist` gets freed (and the pointer set to NULL) by
`do_become_nonbusy()` in "comedi_fops.c" but a previously scheduled
`waveform_ai_interrupt()` timer function will dereference that pointer
regardless, leading to the oops.

Fix it by replacing the `del_timer()` call in `waveform_ai_cancel()`
with `del_timer_sync()`.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reported-by: Éric Piel <piel@delmic.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/staging/comedi/drivers/comedi_test.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c
index 873e374..806c397 100644
--- a/drivers/staging/comedi/drivers/comedi_test.c
+++ b/drivers/staging/comedi/drivers/comedi_test.c
@@ -398,7 +398,7 @@ static int waveform_ai_cancel(struct comedi_device *dev,
 			      struct comedi_subdevice *s)
 {
 	devpriv->timer_running = 0;
-	del_timer(&devpriv->timer);
+	del_timer_sync(&devpriv->timer);
 	return 0;
 }
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 30/74] regulator: max8997: Use uV in voltage_map_desc
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (28 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 29/74] staging: comedi: comedi_test: fix race when cancelling command Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 31/74] regulator: max8998: Convert to regulator_list_voltage_linear() Herton Ronaldo Krzesinski
                   ` (43 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Axel Lin, Mark Brown, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Axel Lin <axel.lin@ingics.com>

commit bc3b7756b5ff66828acf7bc24f148d28b8d61108 upstream.

Current code does integer division (min_vol = min_uV / 1000) before pass
min_vol to max8997_get_voltage_proper_val().
So it is possible min_vol is truncated to a smaller value.

For example, if the request min_uV is 800900 for ldo.
min_vol = 800900 / 1000 = 800 (mV)
Then max8997_get_voltage_proper_val returns 800 mV for this case which is lower
than the requested voltage.

Use uV rather than mV in voltage_map_desc to prevent truncation by integer
division.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/regulator/max8997.c |   36 +++++++++++++++++-------------------
 1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/drivers/regulator/max8997.c b/drivers/regulator/max8997.c
index 704cd49..f57f83f 100644
--- a/drivers/regulator/max8997.c
+++ b/drivers/regulator/max8997.c
@@ -69,26 +69,26 @@ struct voltage_map_desc {
 	int step;
 };
 
-/* Voltage maps in mV */
+/* Voltage maps in uV */
 static const struct voltage_map_desc ldo_voltage_map_desc = {
-	.min = 800,	.max = 3950,	.step = 50,
+	.min = 800000,	.max = 3950000,	.step = 50000,
 }; /* LDO1 ~ 18, 21 all */
 
 static const struct voltage_map_desc buck1245_voltage_map_desc = {
-	.min = 650,	.max = 2225,	.step = 25,
+	.min = 650000,	.max = 2225000,	.step = 25000,
 }; /* Buck1, 2, 4, 5 */
 
 static const struct voltage_map_desc buck37_voltage_map_desc = {
-	.min = 750,	.max = 3900,	.step = 50,
+	.min = 750000,	.max = 3900000,	.step = 50000,
 }; /* Buck3, 7 */
 
-/* current map in mA */
+/* current map in uA */
 static const struct voltage_map_desc charger_current_map_desc = {
-	.min = 200,	.max = 950,	.step = 50,
+	.min = 200000,	.max = 950000,	.step = 50000,
 };
 
 static const struct voltage_map_desc topoff_current_map_desc = {
-	.min = 50,	.max = 200,	.step = 10,
+	.min = 50000,	.max = 200000,	.step = 10000,
 };
 
 static const struct voltage_map_desc *reg_voltage_map[] = {
@@ -192,7 +192,7 @@ static int max8997_list_voltage(struct regulator_dev *rdev,
 	if (val > desc->max)
 		return -EINVAL;
 
-	return val * 1000;
+	return val;
 }
 
 static int max8997_get_enable_register(struct regulator_dev *rdev,
@@ -483,7 +483,6 @@ static int max8997_set_voltage_ldobuck(struct regulator_dev *rdev,
 {
 	struct max8997_data *max8997 = rdev_get_drvdata(rdev);
 	struct i2c_client *i2c = max8997->iodev->i2c;
-	int min_vol = min_uV / 1000, max_vol = max_uV / 1000;
 	const struct voltage_map_desc *desc;
 	int rid = rdev_get_id(rdev);
 	int i, reg, shift, mask, ret;
@@ -507,7 +506,7 @@ static int max8997_set_voltage_ldobuck(struct regulator_dev *rdev,
 
 	desc = reg_voltage_map[rid];
 
-	i = max8997_get_voltage_proper_val(desc, min_vol, max_vol);
+	i = max8997_get_voltage_proper_val(desc, min_uV, max_uV);
 	if (i < 0)
 		return i;
 
@@ -555,7 +554,7 @@ static int max8997_set_voltage_ldobuck_time_sel(struct regulator_dev *rdev,
 	case MAX8997_BUCK4:
 	case MAX8997_BUCK5:
 		return DIV_ROUND_UP(desc->step * (new_selector - old_selector),
-				    max8997->ramp_delay);
+				    max8997->ramp_delay * 1000);
 	}
 
 	return 0;
@@ -654,7 +653,6 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev,
 	const struct voltage_map_desc *desc;
 	int new_val, new_idx, damage, tmp_val, tmp_idx, tmp_dmg;
 	bool gpio_dvs_mode = false;
-	int min_vol = min_uV / 1000, max_vol = max_uV / 1000;
 
 	if (rid < MAX8997_BUCK1 || rid > MAX8997_BUCK7)
 		return -EINVAL;
@@ -679,7 +677,7 @@ static int max8997_set_voltage_buck(struct regulator_dev *rdev,
 						selector);
 
 	desc = reg_voltage_map[rid];
-	new_val = max8997_get_voltage_proper_val(desc, min_vol, max_vol);
+	new_val = max8997_get_voltage_proper_val(desc, min_uV, max_uV);
 	if (new_val < 0)
 		return new_val;
 
@@ -977,8 +975,8 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)
 		max8997->buck1_vol[i] = ret =
 			max8997_get_voltage_proper_val(
 					&buck1245_voltage_map_desc,
-					pdata->buck1_voltage[i] / 1000,
-					pdata->buck1_voltage[i] / 1000 +
+					pdata->buck1_voltage[i],
+					pdata->buck1_voltage[i] +
 					buck1245_voltage_map_desc.step);
 		if (ret < 0)
 			goto err_out;
@@ -986,8 +984,8 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)
 		max8997->buck2_vol[i] = ret =
 			max8997_get_voltage_proper_val(
 					&buck1245_voltage_map_desc,
-					pdata->buck2_voltage[i] / 1000,
-					pdata->buck2_voltage[i] / 1000 +
+					pdata->buck2_voltage[i],
+					pdata->buck2_voltage[i] +
 					buck1245_voltage_map_desc.step);
 		if (ret < 0)
 			goto err_out;
@@ -995,8 +993,8 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)
 		max8997->buck5_vol[i] = ret =
 			max8997_get_voltage_proper_val(
 					&buck1245_voltage_map_desc,
-					pdata->buck5_voltage[i] / 1000,
-					pdata->buck5_voltage[i] / 1000 +
+					pdata->buck5_voltage[i],
+					pdata->buck5_voltage[i] +
 					buck1245_voltage_map_desc.step);
 		if (ret < 0)
 			goto err_out;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 31/74] regulator: max8998: Convert to regulator_list_voltage_linear()
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (29 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 30/74] regulator: max8997: Use uV in voltage_map_desc Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 32/74] regulator: max8998: Convert to set_voltage_sel and regulator_map_voltage_linear Herton Ronaldo Krzesinski
                   ` (42 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Axel Lin, Mark Brown, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Axel Lin <axel.lin@gmail.com>

commit 9a0fbb627cfa86303b8eb57377f536c64812cc85 upstream.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/regulator/max8998.c |   32 +++++++-------------------------
 1 file changed, 7 insertions(+), 25 deletions(-)

diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c
index 18bb58b..105dafc 100644
--- a/drivers/regulator/max8998.c
+++ b/drivers/regulator/max8998.c
@@ -111,27 +111,6 @@ static const struct voltage_map_desc *ldo_voltage_map[] = {
 	&buck4_voltage_map_desc,	/* BUCK4 */
 };
 
-static int max8998_list_voltage(struct regulator_dev *rdev,
-				unsigned int selector)
-{
-	const struct voltage_map_desc *desc;
-	int ldo = rdev_get_id(rdev);
-	int val;
-
-	if (ldo >= ARRAY_SIZE(ldo_voltage_map))
-		return -EINVAL;
-
-	desc = ldo_voltage_map[ldo];
-	if (desc == NULL)
-		return -EINVAL;
-
-	val = desc->min + desc->step * selector;
-	if (val > desc->max)
-		return -EINVAL;
-
-	return val * 1000;
-}
-
 static int max8998_get_enable_register(struct regulator_dev *rdev,
 					int *reg, int *shift)
 {
@@ -392,8 +371,8 @@ static int max8998_set_voltage_buck(struct regulator_dev *rdev,
 	/* if previous_voltage equal new voltage, return */
 	if (previous_sel == i) {
 		dev_dbg(max8998->dev, "No voltage change, old:%d, new:%d\n",
-			max8998_list_voltage(rdev, previous_sel),
-			max8998_list_voltage(rdev, i));
+			regulator_list_voltage_linear(rdev, previous_sel),
+			regulator_list_voltage_linear(rdev, i));
 		return ret;
 	}
 
@@ -519,7 +498,7 @@ static int max8998_set_voltage_buck_time_sel(struct regulator_dev *rdev,
 }
 
 static struct regulator_ops max8998_ldo_ops = {
-	.list_voltage		= max8998_list_voltage,
+	.list_voltage		= regulator_list_voltage_linear,
 	.is_enabled		= max8998_ldo_is_enabled,
 	.enable			= max8998_ldo_enable,
 	.disable		= max8998_ldo_disable,
@@ -530,7 +509,7 @@ static struct regulator_ops max8998_ldo_ops = {
 };
 
 static struct regulator_ops max8998_buck_ops = {
-	.list_voltage		= max8998_list_voltage,
+	.list_voltage		= regulator_list_voltage_linear,
 	.is_enabled		= max8998_ldo_is_enabled,
 	.enable			= max8998_ldo_enable,
 	.disable		= max8998_ldo_disable,
@@ -860,7 +839,10 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev)
 		desc = ldo_voltage_map[id];
 		if (desc && regulators[index].ops != &max8998_others_ops) {
 			int count = (desc->max - desc->min) / desc->step + 1;
+
 			regulators[index].n_voltages = count;
+			regulators[index].min_uV = desc->min * 1000;
+			regulators[index].uV_step = desc->step * 1000;
 		}
 
 		config.dev = max8998->dev;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 32/74] regulator: max8998: Convert to set_voltage_sel and regulator_map_voltage_linear
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (30 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 31/74] regulator: max8998: Convert to regulator_list_voltage_linear() Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 33/74] regulator: max8998: Use uV in voltage_map_desc Herton Ronaldo Krzesinski
                   ` (41 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Axel Lin, Mark Brown, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Axel Lin <axel.lin@gmail.com>

commit baae019efe84b6d2c6d5e7e7e1c9cfa130ad6b2a upstream.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/regulator/max8998.c |   97 ++++++++++++-------------------------------
 1 file changed, 27 insertions(+), 70 deletions(-)

diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c
index 105dafc..a1fa266 100644
--- a/drivers/regulator/max8998.c
+++ b/drivers/regulator/max8998.c
@@ -276,41 +276,18 @@ static int max8998_get_voltage_sel(struct regulator_dev *rdev)
 	return val;
 }
 
-static int max8998_set_voltage_ldo(struct regulator_dev *rdev,
-				   int min_uV, int max_uV, unsigned *selector)
+static int max8998_set_voltage_ldo_sel(struct regulator_dev *rdev,
+				       unsigned selector)
 {
 	struct max8998_data *max8998 = rdev_get_drvdata(rdev);
 	struct i2c_client *i2c = max8998->iodev->i2c;
-	int min_vol = min_uV / 1000, max_vol = max_uV / 1000;
-	const struct voltage_map_desc *desc;
-	int ldo = rdev_get_id(rdev);
-	int reg, shift = 0, mask, ret, i;
-
-	if (ldo >= ARRAY_SIZE(ldo_voltage_map))
-		return -EINVAL;
-
-	desc = ldo_voltage_map[ldo];
-	if (desc == NULL)
-		return -EINVAL;
-
-	if (max_vol < desc->min || min_vol > desc->max)
-		return -EINVAL;
-
-	if (min_vol < desc->min)
-		min_vol = desc->min;
-
-	i = DIV_ROUND_UP(min_vol - desc->min, desc->step);
-
-	if (desc->min + desc->step*i > max_vol)
-		return -EINVAL;
-
-	*selector = i;
+	int reg, shift = 0, mask, ret;
 
 	ret = max8998_get_voltage_register(rdev, &reg, &shift, &mask);
 	if (ret)
 		return ret;
 
-	ret = max8998_update_reg(i2c, reg, i<<shift, mask<<shift);
+	ret = max8998_update_reg(i2c, reg, selector<<shift, mask<<shift);
 
 	return ret;
 }
@@ -326,41 +303,18 @@ static inline void buck2_gpio_set(int gpio, int v)
 	gpio_set_value(gpio, v & 0x1);
 }
 
-static int max8998_set_voltage_buck(struct regulator_dev *rdev,
-				    int min_uV, int max_uV, unsigned *selector)
+static int max8998_set_voltage_buck_sel(struct regulator_dev *rdev,
+					unsigned selector)
 {
 	struct max8998_data *max8998 = rdev_get_drvdata(rdev);
 	struct max8998_platform_data *pdata =
 		dev_get_platdata(max8998->iodev->dev);
 	struct i2c_client *i2c = max8998->iodev->i2c;
-	int min_vol = min_uV / 1000, max_vol = max_uV / 1000;
-	const struct voltage_map_desc *desc;
 	int buck = rdev_get_id(rdev);
 	int reg, shift = 0, mask, ret;
-	int i, j, previous_sel;
+	int j, previous_sel;
 	static u8 buck1_last_val;
 
-	if (buck >= ARRAY_SIZE(ldo_voltage_map))
-		return -EINVAL;
-
-	desc = ldo_voltage_map[buck];
-
-	if (desc == NULL)
-		return -EINVAL;
-
-	if (max_vol < desc->min || min_vol > desc->max)
-		return -EINVAL;
-
-	if (min_vol < desc->min)
-		min_vol = desc->min;
-
-	i = DIV_ROUND_UP(min_vol - desc->min, desc->step);
-
-	if (desc->min + desc->step*i > max_vol)
-		return -EINVAL;
-
-	*selector = i;
-
 	ret = max8998_get_voltage_register(rdev, &reg, &shift, &mask);
 	if (ret)
 		return ret;
@@ -369,19 +323,19 @@ static int max8998_set_voltage_buck(struct regulator_dev *rdev,
 
 	/* Check if voltage needs to be changed */
 	/* if previous_voltage equal new voltage, return */
-	if (previous_sel == i) {
+	if (previous_sel == selector) {
 		dev_dbg(max8998->dev, "No voltage change, old:%d, new:%d\n",
 			regulator_list_voltage_linear(rdev, previous_sel),
-			regulator_list_voltage_linear(rdev, i));
+			regulator_list_voltage_linear(rdev, selector));
 		return ret;
 	}
 
 	switch (buck) {
 	case MAX8998_BUCK1:
 		dev_dbg(max8998->dev,
-			"BUCK1, i:%d, buck1_vol1:%d, buck1_vol2:%d\n"
+			"BUCK1, selector:%d, buck1_vol1:%d, buck1_vol2:%d\n"
 			"buck1_vol3:%d, buck1_vol4:%d\n",
-			i, max8998->buck1_vol[0], max8998->buck1_vol[1],
+			selector, max8998->buck1_vol[0], max8998->buck1_vol[1],
 			max8998->buck1_vol[2], max8998->buck1_vol[3]);
 
 		if (gpio_is_valid(pdata->buck1_set1) &&
@@ -390,7 +344,7 @@ static int max8998_set_voltage_buck(struct regulator_dev *rdev,
 			/* check if requested voltage */
 			/* value is already defined */
 			for (j = 0; j < ARRAY_SIZE(max8998->buck1_vol); j++) {
-				if (max8998->buck1_vol[j] == i) {
+				if (max8998->buck1_vol[j] == selector) {
 					max8998->buck1_idx = j;
 					buck1_gpio_set(pdata->buck1_set1,
 						       pdata->buck1_set2, j);
@@ -405,11 +359,11 @@ static int max8998_set_voltage_buck(struct regulator_dev *rdev,
 			max8998->buck1_idx = (buck1_last_val % 2) + 2;
 			dev_dbg(max8998->dev, "max8998->buck1_idx:%d\n",
 				max8998->buck1_idx);
-			max8998->buck1_vol[max8998->buck1_idx] = i;
+			max8998->buck1_vol[max8998->buck1_idx] = selector;
 			ret = max8998_get_voltage_register(rdev, &reg,
 							   &shift,
 							   &mask);
-			ret = max8998_write_reg(i2c, reg, i);
+			ret = max8998_write_reg(i2c, reg, selector);
 			buck1_gpio_set(pdata->buck1_set1,
 				       pdata->buck1_set2, max8998->buck1_idx);
 			buck1_last_val++;
@@ -419,20 +373,20 @@ buck1_exit:
 				gpio_get_value(pdata->buck1_set2));
 			break;
 		} else {
-			ret = max8998_write_reg(i2c, reg, i);
+			ret = max8998_write_reg(i2c, reg, selector);
 		}
 		break;
 
 	case MAX8998_BUCK2:
 		dev_dbg(max8998->dev,
-			"BUCK2, i:%d buck2_vol1:%d, buck2_vol2:%d\n"
-			, i, max8998->buck2_vol[0], max8998->buck2_vol[1]);
+			"BUCK2, selector:%d buck2_vol1:%d, buck2_vol2:%d\n",
+			selector, max8998->buck2_vol[0], max8998->buck2_vol[1]);
 		if (gpio_is_valid(pdata->buck2_set3)) {
 
 			/* check if requested voltage */
 			/* value is already defined */
 			for (j = 0; j < ARRAY_SIZE(max8998->buck2_vol); j++) {
-				if (max8998->buck2_vol[j] == i) {
+				if (max8998->buck2_vol[j] == selector) {
 					max8998->buck2_idx = j;
 					buck2_gpio_set(pdata->buck2_set3, j);
 					goto buck2_exit;
@@ -444,20 +398,21 @@ buck1_exit:
 
 			max8998_get_voltage_register(rdev,
 					&reg, &shift, &mask);
-			ret = max8998_write_reg(i2c, reg, i);
-			max8998->buck2_vol[max8998->buck2_idx] = i;
+			ret = max8998_write_reg(i2c, reg, selector);
+			max8998->buck2_vol[max8998->buck2_idx] = selector;
 			buck2_gpio_set(pdata->buck2_set3, max8998->buck2_idx);
 buck2_exit:
 			dev_dbg(max8998->dev, "%s: SET3:%d\n", i2c->name,
 				gpio_get_value(pdata->buck2_set3));
 		} else {
-			ret = max8998_write_reg(i2c, reg, i);
+			ret = max8998_write_reg(i2c, reg, selector);
 		}
 		break;
 
 	case MAX8998_BUCK3:
 	case MAX8998_BUCK4:
-		ret = max8998_update_reg(i2c, reg, i<<shift, mask<<shift);
+		ret = max8998_update_reg(i2c, reg, selector<<shift,
+					 mask<<shift);
 		break;
 	}
 
@@ -499,22 +454,24 @@ static int max8998_set_voltage_buck_time_sel(struct regulator_dev *rdev,
 
 static struct regulator_ops max8998_ldo_ops = {
 	.list_voltage		= regulator_list_voltage_linear,
+	.map_voltage		= regulator_map_voltage_linear,
 	.is_enabled		= max8998_ldo_is_enabled,
 	.enable			= max8998_ldo_enable,
 	.disable		= max8998_ldo_disable,
 	.get_voltage_sel	= max8998_get_voltage_sel,
-	.set_voltage		= max8998_set_voltage_ldo,
+	.set_voltage_sel	= max8998_set_voltage_ldo_sel,
 	.set_suspend_enable	= max8998_ldo_enable,
 	.set_suspend_disable	= max8998_ldo_disable,
 };
 
 static struct regulator_ops max8998_buck_ops = {
 	.list_voltage		= regulator_list_voltage_linear,
+	.map_voltage		= regulator_map_voltage_linear,
 	.is_enabled		= max8998_ldo_is_enabled,
 	.enable			= max8998_ldo_enable,
 	.disable		= max8998_ldo_disable,
 	.get_voltage_sel	= max8998_get_voltage_sel,
-	.set_voltage		= max8998_set_voltage_buck,
+	.set_voltage_sel	= max8998_set_voltage_buck_sel,
 	.set_voltage_time_sel	= max8998_set_voltage_buck_time_sel,
 	.set_suspend_enable	= max8998_ldo_enable,
 	.set_suspend_disable	= max8998_ldo_disable,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 33/74] regulator: max8998: Use uV in voltage_map_desc
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (31 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 32/74] regulator: max8998: Convert to set_voltage_sel and regulator_map_voltage_linear Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 34/74] ALSA: pxa27x: fix ac97 cold reset Herton Ronaldo Krzesinski
                   ` (40 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Axel Lin, Mark Brown, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Axel Lin <axel.lin@ingics.com>

commit adf6178ad5552a7f2f742a8c85343c50f080c412 upstream.

Integer division may truncate.
This happens when pdata->buckx_voltagex setting is not align with 1000 uV.
Thus use uV in voltage_map_desc, this ensures the selected voltage won't less
than pdata buckx_voltagex settings.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/regulator/max8998.c |   42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c
index a1fa266..5e56df0 100644
--- a/drivers/regulator/max8998.c
+++ b/drivers/regulator/max8998.c
@@ -51,39 +51,39 @@ struct voltage_map_desc {
 	int step;
 };
 
-/* Voltage maps */
+/* Voltage maps in uV*/
 static const struct voltage_map_desc ldo23_voltage_map_desc = {
-	.min = 800,	.step = 50,	.max = 1300,
+	.min = 800000,	.step = 50000,	.max = 1300000,
 };
 static const struct voltage_map_desc ldo456711_voltage_map_desc = {
-	.min = 1600,	.step = 100,	.max = 3600,
+	.min = 1600000,	.step = 100000,	.max = 3600000,
 };
 static const struct voltage_map_desc ldo8_voltage_map_desc = {
-	.min = 3000,	.step = 100,	.max = 3600,
+	.min = 3000000,	.step = 100000,	.max = 3600000,
 };
 static const struct voltage_map_desc ldo9_voltage_map_desc = {
-	.min = 2800,	.step = 100,	.max = 3100,
+	.min = 2800000,	.step = 100000,	.max = 3100000,
 };
 static const struct voltage_map_desc ldo10_voltage_map_desc = {
-	.min = 950,	.step = 50,	.max = 1300,
+	.min = 95000,	.step = 50000,	.max = 1300000,
 };
 static const struct voltage_map_desc ldo1213_voltage_map_desc = {
-	.min = 800,	.step = 100,	.max = 3300,
+	.min = 800000,	.step = 100000,	.max = 3300000,
 };
 static const struct voltage_map_desc ldo1415_voltage_map_desc = {
-	.min = 1200,	.step = 100,	.max = 3300,
+	.min = 1200000,	.step = 100000,	.max = 3300000,
 };
 static const struct voltage_map_desc ldo1617_voltage_map_desc = {
-	.min = 1600,	.step = 100,	.max = 3600,
+	.min = 1600000,	.step = 100000,	.max = 3600000,
 };
 static const struct voltage_map_desc buck12_voltage_map_desc = {
-	.min = 750,	.step = 25,	.max = 1525,
+	.min = 750000,	.step = 25000,	.max = 1525000,
 };
 static const struct voltage_map_desc buck3_voltage_map_desc = {
-	.min = 1600,	.step = 100,	.max = 3600,
+	.min = 1600000,	.step = 100000,	.max = 3600000,
 };
 static const struct voltage_map_desc buck4_voltage_map_desc = {
-	.min = 800,	.step = 100,	.max = 2300,
+	.min = 800000,	.step = 100000,	.max = 2300000,
 };
 
 static const struct voltage_map_desc *ldo_voltage_map[] = {
@@ -445,7 +445,7 @@ static int max8998_set_voltage_buck_time_sel(struct regulator_dev *rdev,
 	if (max8998->iodev->type == TYPE_MAX8998 && !(val & MAX8998_ENRAMP))
 		return 0;
 
-	difference = (new_selector - old_selector) * desc->step;
+	difference = (new_selector - old_selector) * desc->step / 1000;
 	if (difference > 0)
 		return difference / ((val & 0x0f) + 1);
 
@@ -708,7 +708,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev)
 		i = 0;
 		while (buck12_voltage_map_desc.min +
 		       buck12_voltage_map_desc.step*i
-		       < (pdata->buck1_voltage1 / 1000))
+		       < pdata->buck1_voltage1)
 			i++;
 		max8998->buck1_vol[0] = i;
 		ret = max8998_write_reg(i2c, MAX8998_REG_BUCK1_VOLTAGE1, i);
@@ -719,7 +719,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev)
 		i = 0;
 		while (buck12_voltage_map_desc.min +
 		       buck12_voltage_map_desc.step*i
-		       < (pdata->buck1_voltage2 / 1000))
+		       < pdata->buck1_voltage2)
 			i++;
 
 		max8998->buck1_vol[1] = i;
@@ -731,7 +731,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev)
 		i = 0;
 		while (buck12_voltage_map_desc.min +
 		       buck12_voltage_map_desc.step*i
-		       < (pdata->buck1_voltage3 / 1000))
+		       < pdata->buck1_voltage3)
 			i++;
 
 		max8998->buck1_vol[2] = i;
@@ -743,7 +743,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev)
 		i = 0;
 		while (buck12_voltage_map_desc.min +
 		       buck12_voltage_map_desc.step*i
-		       < (pdata->buck1_voltage4 / 1000))
+		       < pdata->buck1_voltage4)
 			i++;
 
 		max8998->buck1_vol[3] = i;
@@ -769,7 +769,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev)
 		i = 0;
 		while (buck12_voltage_map_desc.min +
 		       buck12_voltage_map_desc.step*i
-		       < (pdata->buck2_voltage1 / 1000))
+		       < pdata->buck2_voltage1)
 			i++;
 		max8998->buck2_vol[0] = i;
 		ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE1, i);
@@ -780,7 +780,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev)
 		i = 0;
 		while (buck12_voltage_map_desc.min +
 		       buck12_voltage_map_desc.step*i
-		       < (pdata->buck2_voltage2 / 1000))
+		       < pdata->buck2_voltage2)
 			i++;
 		max8998->buck2_vol[1] = i;
 		ret = max8998_write_reg(i2c, MAX8998_REG_BUCK2_VOLTAGE2, i);
@@ -798,8 +798,8 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev)
 			int count = (desc->max - desc->min) / desc->step + 1;
 
 			regulators[index].n_voltages = count;
-			regulators[index].min_uV = desc->min * 1000;
-			regulators[index].uV_step = desc->step * 1000;
+			regulators[index].min_uV = desc->min;
+			regulators[index].uV_step = desc->step;
 		}
 
 		config.dev = max8998->dev;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 34/74] ALSA: pxa27x: fix ac97 cold reset
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (32 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 33/74] regulator: max8998: Use uV in voltage_map_desc Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 35/74] ALSA: pxa27x: fix ac97 warm reset Herton Ronaldo Krzesinski
                   ` (39 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mike Dunn, Mark Brown, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mike Dunn <mikedunn@newsguy.com>

commit 41b645c8624df6ace020a8863ad1449d69140f7d upstream.

Cold reset on the pxa27x currently fails and

     pxa2xx_ac97_try_cold_reset: cold reset timeout (GSR=0x44)

appears in the kernel log.  Through trial-and-error (the pxa270 developer's
manual is mostly incoherent on the topic of ac97 reset), I got cold reset to
complete by setting the WARM_RST bit in the GCR register (and later noticed that
pxa3xx does this for cold reset as well).  Also, a timeout loop is needed to
wait for the reset to complete.

Tested on a palm treo 680 machine.

Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 sound/arm/pxa2xx-ac97-lib.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c
index 48d7c0a..8cfb2c0 100644
--- a/sound/arm/pxa2xx-ac97-lib.c
+++ b/sound/arm/pxa2xx-ac97-lib.c
@@ -148,6 +148,8 @@ static inline void pxa_ac97_warm_pxa27x(void)
 
 static inline void pxa_ac97_cold_pxa27x(void)
 {
+	unsigned int timeout;
+
 	GCR &=  GCR_COLD_RST;  /* clear everything but nCRST */
 	GCR &= ~GCR_COLD_RST;  /* then assert nCRST */
 
@@ -157,8 +159,10 @@ static inline void pxa_ac97_cold_pxa27x(void)
 	clk_enable(ac97conf_clk);
 	udelay(5);
 	clk_disable(ac97conf_clk);
-	GCR = GCR_COLD_RST;
-	udelay(50);
+	GCR = GCR_COLD_RST | GCR_WARM_RST;
+	timeout = 100;     /* wait for the codec-ready bit to be set */
+	while (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)) && timeout--)
+		mdelay(1);
 }
 #endif
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 35/74] ALSA: pxa27x: fix ac97 warm reset
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (33 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 34/74] ALSA: pxa27x: fix ac97 cold reset Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 36/74] SUNRPC: Ensure we release the socket write lock if the rpc_task exits early Herton Ronaldo Krzesinski
                   ` (38 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mike Dunn, Igor Grinberg, Mark Brown, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mike Dunn <mikedunn@newsguy.com>

commit 3b4bc7bccc7857274705b05cf81a0c72cfd0b0dd upstream.

This patch fixes some code that implements a work-around to a hardware bug in
the ac97 controller on the pxa27x.  A bug in the controller's warm reset
functionality requires that the mfp used by the controller as the AC97_nRESET
line be temporarily reconfigured as a generic output gpio (AF0) and manually
held high for the duration of the warm reset cycle.  This is what was done in
the original code, but it was broken long ago by commit fb1bf8cd
    ([ARM] pxa: introduce processor specific pxa27x_assert_ac97reset())
which changed the mfp to a GPIO input instead of a high output.

The fix requires the ac97 controller to obtain the gpio via gpio_request_one(),
with arguments that configure the gpio as an output initially driven high.

Tested on a palm treo 680 machine.  Reportedly, this broken code only prevents a
warm reset on hardware that lacks a pull-up on the line, which appears to be the
case for me.

Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 arch/arm/mach-pxa/include/mach/mfp-pxa27x.h |    3 +++
 arch/arm/mach-pxa/pxa27x.c                  |    4 ++--
 sound/arm/pxa2xx-ac97-lib.c                 |   18 +++++++++++++++++-
 3 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
index a611ad3..b6132aa 100644
--- a/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
+++ b/arch/arm/mach-pxa/include/mach/mfp-pxa27x.h
@@ -463,6 +463,9 @@
 	GPIO76_LCD_PCLK,	\
 	GPIO77_LCD_BIAS
 
+/* these enable a work-around for a hw bug in pxa27x during ac97 warm reset */
+#define GPIO113_AC97_nRESET_GPIO_HIGH MFP_CFG_OUT(GPIO113, AF0, DEFAULT)
+#define GPIO95_AC97_nRESET_GPIO_HIGH MFP_CFG_OUT(GPIO95, AF0, DEFAULT)
 
 extern int keypad_set_wake(unsigned int on);
 #endif /* __ASM_ARCH_MFP_PXA27X_H */
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 4726c24..a2fe795 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -47,9 +47,9 @@ void pxa27x_clear_otgph(void)
 EXPORT_SYMBOL(pxa27x_clear_otgph);
 
 static unsigned long ac97_reset_config[] = {
-	GPIO113_GPIO,
+	GPIO113_AC97_nRESET_GPIO_HIGH,
 	GPIO113_AC97_nRESET,
-	GPIO95_GPIO,
+	GPIO95_AC97_nRESET_GPIO_HIGH,
 	GPIO95_AC97_nRESET,
 };
 
diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c
index 8cfb2c0..bd3ba88 100644
--- a/sound/arm/pxa2xx-ac97-lib.c
+++ b/sound/arm/pxa2xx-ac97-lib.c
@@ -18,6 +18,7 @@
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/io.h>
+#include <linux/gpio.h>
 
 #include <sound/ac97_codec.h>
 #include <sound/pxa2xx-lib.h>
@@ -344,8 +345,21 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev)
 	}
 
 	if (cpu_is_pxa27x()) {
-		/* Use GPIO 113 as AC97 Reset on Bulverde */
+		/*
+		 * This gpio is needed for a work-around to a bug in the ac97
+		 * controller during warm reset.  The direction and level is set
+		 * here so that it is an output driven high when switching from
+		 * AC97_nRESET alt function to generic gpio.
+		 */
+		ret = gpio_request_one(reset_gpio, GPIOF_OUT_INIT_HIGH,
+				       "pxa27x ac97 reset");
+		if (ret < 0) {
+			pr_err("%s: gpio_request_one() failed: %d\n",
+			       __func__, ret);
+			goto err_conf;
+		}
 		pxa27x_assert_ac97reset(reset_gpio, 0);
+
 		ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK");
 		if (IS_ERR(ac97conf_clk)) {
 			ret = PTR_ERR(ac97conf_clk);
@@ -388,6 +402,8 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_probe);
 
 void pxa2xx_ac97_hw_remove(struct platform_device *dev)
 {
+	if (cpu_is_pxa27x())
+		gpio_free(reset_gpio);
 	GCR |= GCR_ACLINK_OFF;
 	free_irq(IRQ_AC97, NULL);
 	if (ac97conf_clk) {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 36/74] SUNRPC: Ensure we release the socket write lock if the rpc_task exits early
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (34 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 35/74] ALSA: pxa27x: fix ac97 warm reset Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 37/74] target: use correct sense code for LUN communication failure Herton Ronaldo Krzesinski
                   ` (37 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Trond Myklebust, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Trond Myklebust <Trond.Myklebust@netapp.com>

commit 87ed50036b866db2ec2ba16b2a7aec4a2b0b7c39 upstream.

If the rpc_task exits while holding the socket write lock before it has
allocated an rpc slot, then the usual mechanism for releasing the write
lock in xprt_release() is defeated.

The problem occurs if the call to xprt_lock_write() initially fails, so
that the rpc_task is put on the xprt->sending wait queue. If the task
exits after being assigned the lock by __xprt_lock_write_func, but
before it has retried the call to xprt_lock_and_alloc_slot(), then
it calls xprt_release() while holding the write lock, but will
immediately exit due to the test for task->tk_rqstp != NULL.

Reported-by: Chris Perl <chris.perl@gmail.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 net/sunrpc/sched.c |    3 +--
 net/sunrpc/xprt.c  |   12 ++++++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index fe2cf2f..85b9235 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -953,8 +953,7 @@ static void rpc_async_release(struct work_struct *work)
 
 static void rpc_release_resources_task(struct rpc_task *task)
 {
-	if (task->tk_rqstp)
-		xprt_release(task);
+	xprt_release(task);
 	if (task->tk_msg.rpc_cred) {
 		put_rpccred(task->tk_msg.rpc_cred);
 		task->tk_msg.rpc_cred = NULL;
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index 2d5b811..6329ff3 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -1139,10 +1139,18 @@ static void xprt_request_init(struct rpc_task *task, struct rpc_xprt *xprt)
 void xprt_release(struct rpc_task *task)
 {
 	struct rpc_xprt	*xprt;
-	struct rpc_rqst	*req;
+	struct rpc_rqst	*req = task->tk_rqstp;
 
-	if (!(req = task->tk_rqstp))
+	if (req == NULL) {
+		if (task->tk_client) {
+			rcu_read_lock();
+			xprt = rcu_dereference(task->tk_client->cl_xprt);
+			if (xprt->snd_task == task)
+				xprt_release_write(xprt, task);
+			rcu_read_unlock();
+		}
 		return;
+	}
 
 	xprt = req->rq_xprt;
 	if (task->tk_ops->rpc_count_stats != NULL)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 37/74] target: use correct sense code for LUN communication failure
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (35 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 36/74] SUNRPC: Ensure we release the socket write lock if the rpc_task exits early Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 38/74] Revert "ALSA: hda - Shut up pins at power-saving mode with Conexnat codecs" Herton Ronaldo Krzesinski
                   ` (36 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hannes Reinecke, Nicholas Bellinger, Nicholas Bellinger,
	Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Hannes Reinecke <hare@suse.de>

commit 18a9df42d53fabfa43b78be1104838cc8b9762e1 upstream.

The ASC/ASCQ code for 'Logical Unit Communication failure' is
0x08/0x00; 0x80/0x00 is vendor specific.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: Nicholas Bellinger <nab@risingtidesystems.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
[ herton: adjust context, additional offset added ]
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/target/target_core_transport.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 7879ff4..cf05182 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -4231,7 +4231,7 @@ int transport_send_check_condition_and_sense(
 		/* ILLEGAL REQUEST */
 		buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST;
 		/* LOGICAL UNIT COMMUNICATION FAILURE */
-		buffer[offset+SPC_ASC_KEY_OFFSET] = 0x80;
+		buffer[offset+SPC_ASC_KEY_OFFSET] = 0x08;
 		break;
 	}
 	/*
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 38/74] Revert "ALSA: hda - Shut up pins at power-saving mode with Conexnat codecs"
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (36 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 37/74] target: use correct sense code for LUN communication failure Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 39/74] regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel Herton Ronaldo Krzesinski
                   ` (35 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Henningsson, Takashi Iwai, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Henningsson <david.henningsson@canonical.com>

commit 7ed4165e2d01bdbbb4c1086eb73eadf0f64cbbf0 upstream.

This reverts commit 697c373e34613609cb5450f98b91fefb6e910588.

The original patch was meant to remove clicking, but in fact caused even
more clicking instead.

Thanks to c4pp4 for doing most of the work with this bug.

BugLink: https://bugs.launchpad.net/bugs/886975
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
[ herton: s/CONFIG_PM/CONFIG_SND_HDA_POWER_SAVE/, adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 sound/pci/hda/patch_conexant.c |   16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 808d5fd..908fc7f 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -553,24 +553,12 @@ static int conexant_build_controls(struct hda_codec *codec)
 	return 0;
 }
 
-#ifdef CONFIG_SND_HDA_POWER_SAVE
-static int conexant_suspend(struct hda_codec *codec, pm_message_t state)
-{
-	snd_hda_shutup_pins(codec);
-	return 0;
-}
-#endif
-
 static const struct hda_codec_ops conexant_patch_ops = {
 	.build_controls = conexant_build_controls,
 	.build_pcms = conexant_build_pcms,
 	.init = conexant_init,
 	.free = conexant_free,
 	.set_power_state = conexant_set_power,
-#ifdef CONFIG_SND_HDA_POWER_SAVE
-	.suspend = conexant_suspend,
-#endif
-	.reboot_notify = snd_hda_shutup_pins,
 };
 
 #ifdef CONFIG_SND_HDA_INPUT_BEEP
@@ -4401,10 +4389,6 @@ static const struct hda_codec_ops cx_auto_patch_ops = {
 	.init = cx_auto_init,
 	.free = conexant_free,
 	.unsol_event = cx_auto_unsol_event,
-#ifdef CONFIG_SND_HDA_POWER_SAVE
-	.suspend = conexant_suspend,
-#endif
-	.reboot_notify = snd_hda_shutup_pins,
 };
 
 /*
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 39/74] regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (37 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 38/74] Revert "ALSA: hda - Shut up pins at power-saving mode with Conexnat codecs" Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 40/74] radeon/kms: force rn50 chip to always report connected on analog output Herton Ronaldo Krzesinski
                   ` (34 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Axel Lin, Mark Brown, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Axel Lin <axel.lin@ingics.com>

commit 81d0a6ae7befb24c06f4aa4856af7f8d1f612171 upstream.

Use DIV_ROUND_UP to prevent truncation by integer division issue.
This ensures we return enough delay time.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/regulator/max8998.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c
index 5e56df0..b3b2984 100644
--- a/drivers/regulator/max8998.c
+++ b/drivers/regulator/max8998.c
@@ -447,7 +447,7 @@ static int max8998_set_voltage_buck_time_sel(struct regulator_dev *rdev,
 
 	difference = (new_selector - old_selector) * desc->step / 1000;
 	if (difference > 0)
-		return difference / ((val & 0x0f) + 1);
+		return DIV_ROUND_UP(difference, (val & 0x0f) + 1);
 
 	return 0;
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 40/74] radeon/kms: force rn50 chip to always report connected on analog output
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (38 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 39/74] regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 41/74] tcm_fc: Do not indicate retry capability to initiators Herton Ronaldo Krzesinski
                   ` (33 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jerome Glisse, Alex Deucher, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jerome Glisse <jglisse@redhat.com>

commit 51861d4eebc2ddc25c77084343d060fa79f6e291 upstream.

Those rn50 chip are often connected to console remoting hw and load
detection often fails with those. Just don't try to load detect and
report connect.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/gpu/drm/radeon/radeon_legacy_encoders.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index 8148cf8..e03f90e 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -618,6 +618,14 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc
 	enum drm_connector_status found = connector_status_disconnected;
 	bool color = true;
 
+	/* just don't bother on RN50 those chip are often connected to remoting
+	 * console hw and often we get failure to load detect those. So to make
+	 * everyone happy report the encoder as always connected.
+	 */
+	if (ASIC_IS_RN50(rdev)) {
+		return connector_status_connected;
+	}
+
 	/* save the regs we need */
 	vclk_ecp_cntl = RREG32_PLL(RADEON_VCLK_ECP_CNTL);
 	crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 41/74] tcm_fc: Do not indicate retry capability to initiators
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (39 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 40/74] radeon/kms: force rn50 chip to always report connected on analog output Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 42/74] tcm_fc: Do not report target role when target is not defined Herton Ronaldo Krzesinski
                   ` (32 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mark Rustad, Nicholas Bellinger, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mark Rustad <mark.d.rustad@intel.com>

commit f2eeba214bcd0215b7f558cab6420e5fd153042b upstream.

When generating a PRLI response to an initiator, clear the
FCP_SPPF_RETRY bit in the response.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Reviewed-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Acked by Robert Love <robert.w.love@intel.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/target/tcm_fc/tfc_sess.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c
index a426c40..34d7b25 100644
--- a/drivers/target/tcm_fc/tfc_sess.c
+++ b/drivers/target/tcm_fc/tfc_sess.c
@@ -397,10 +397,10 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len,
 
 	/*
 	 * OR in our service parameters with other provider (initiator), if any.
-	 * TBD XXX - indicate RETRY capability?
 	 */
 fill:
 	fcp_parm = ntohl(spp->spp_params);
+	fcp_parm &= ~FCP_SPPF_RETRY;
 	spp->spp_params = htonl(fcp_parm | FCP_SPPF_TARG_FCN);
 	return FC_SPP_RESP_ACK;
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 42/74] tcm_fc: Do not report target role when target is not defined
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (40 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 41/74] tcm_fc: Do not indicate retry capability to initiators Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 43/74] target: Fix use-after-free in LUN RESET handling Herton Ronaldo Krzesinski
                   ` (31 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Mark Rustad, Nicholas Bellinger, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mark Rustad <mark.d.rustad@intel.com>

commit edec8dfefa1f372b2dd8197da555352e76a10c03 upstream.

Clear the target role when no target is provided for
the node performing a PRLI.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Reviewed-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Acked by Robert Love <robert.w.love@intel.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/target/tcm_fc/tfc_sess.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/target/tcm_fc/tfc_sess.c b/drivers/target/tcm_fc/tfc_sess.c
index 34d7b25..9249998 100644
--- a/drivers/target/tcm_fc/tfc_sess.c
+++ b/drivers/target/tcm_fc/tfc_sess.c
@@ -356,11 +356,11 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len,
 
 	tport = ft_tport_create(rdata->local_port);
 	if (!tport)
-		return 0;	/* not a target for this local port */
+		goto not_target;	/* not a target for this local port */
 
 	acl = ft_acl_get(tport->tpg, rdata);
 	if (!acl)
-		return 0;
+		goto not_target;	/* no target for this remote */
 
 	if (!rspp)
 		goto fill;
@@ -403,6 +403,12 @@ fill:
 	fcp_parm &= ~FCP_SPPF_RETRY;
 	spp->spp_params = htonl(fcp_parm | FCP_SPPF_TARG_FCN);
 	return FC_SPP_RESP_ACK;
+
+not_target:
+	fcp_parm = ntohl(spp->spp_params);
+	fcp_parm &= ~FCP_SPPF_TARG_FCN;
+	spp->spp_params = htonl(fcp_parm);
+	return 0;
 }
 
 /**
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 43/74] target: Fix use-after-free in LUN RESET handling
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (41 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 42/74] tcm_fc: Do not report target role when target is not defined Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 44/74] target: Release se_cmd when LUN lookup fails for TMR Herton Ronaldo Krzesinski
                   ` (30 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Roland Dreier, Nicholas Bellinger, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Roland Dreier <roland@purestorage.com>

commit 72b59d6ee8adaa51f70377db0a1917ed489bead8 upstream.

If a backend IO takes a really long then an initiator might abort a
command, and then when it gives up on the abort, send a LUN reset too,
all before we process any of the original command or the abort.  (The
abort will wait for the backend IO to complete too)

When the backend IO final completes (or fails), the abort handling
will proceed and queue up a "return aborted status" operation.  Then,
while that's still pending, the LUN reset might find the original
command still on the LUN's list of commands and try to return aborted
status again, which leads to a use-after free when the first
se_tfo->queue_status call frees the command and then the second
se_tfo->queue_status call runs.

Fix this by removing a command from the LUN state_list when we first
are about to queue aborted status; we shouldn't do anything
LUN-related after we've started returning status, so this seems like
the correct thing to do.

Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/target/target_core_transport.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index cf05182..d6c73e8 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -586,9 +586,6 @@ static void transport_lun_remove_cmd(struct se_cmd *cmd)
 
 void transport_cmd_finish_abort(struct se_cmd *cmd, int remove)
 {
-	if (!(cmd->se_cmd_flags & SCF_SCSI_TMR_CDB))
-		transport_lun_remove_cmd(cmd);
-
 	if (transport_cmd_check_stop_to_fabric(cmd))
 		return;
 	if (remove) {
@@ -4296,6 +4293,8 @@ void transport_send_task_abort(struct se_cmd *cmd)
 	}
 	cmd->scsi_status = SAM_STAT_TASK_ABORTED;
 
+	transport_lun_remove_cmd(cmd);
+
 	pr_debug("Setting SAM_STAT_TASK_ABORTED status for CDB: 0x%02x,"
 		" ITT: 0x%08x\n", cmd->t_task_cdb[0],
 		cmd->se_tfo->get_task_tag(cmd));
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 44/74] target: Release se_cmd when LUN lookup fails for TMR
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (42 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 43/74] target: Fix use-after-free in LUN RESET handling Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 45/74] sh: Fix FDPIC binary loader Herton Ronaldo Krzesinski
                   ` (29 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Roland Dreier, Nicholas Bellinger, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Roland Dreier <roland@purestorage.com>

commit 5a3b6fc0092c5f8dee7820064ee54d2631d48573 upstream.

When transport_lookup_tmr_lun() fails and we return a task management
response from target_complete_tmr_failure(), we need to call
transport_cmd_check_stop_to_fabric() to release the last ref to the
cmd after calling se_tfo->queue_tm_rsp(), or else we will never remove
the failed TMR from the session command list (and we'll end up waiting
forever when trying to tear down the session).

(nab: Fix minor compile breakage)

Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/target/target_core_transport.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index d6c73e8..047f49a 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1614,6 +1614,8 @@ static void target_complete_tmr_failure(struct work_struct *work)
 
 	se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST;
 	se_cmd->se_tfo->queue_tm_rsp(se_cmd);
+
+	transport_cmd_check_stop_to_fabric(se_cmd);
 }
 
 /**
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 45/74] sh: Fix FDPIC binary loader
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (43 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 44/74] target: Release se_cmd when LUN lookup fails for TMR Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 46/74] USB: option: Add new MEDIATEK PID support Herton Ronaldo Krzesinski
                   ` (28 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Thomas Schwinge, Paul Mundt, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Thomas Schwinge <thomas@codesourcery.com>

commit 4a71997a3279a339e7336ea5d0cd27282e2dea44 upstream.

Ensure that the aux table is properly initialized, even when optional features
are missing.  Without this, the FDPIC loader did not work.  This was meant to
be included in commit d5ab780305bb6d60a7b5a74f18cf84eb6ad153b1.

Signed-off-by: Thomas Schwinge <thomas@codesourcery.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 arch/sh/include/asm/elf.h |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/sh/include/asm/elf.h b/arch/sh/include/asm/elf.h
index f38112b..978b7fd 100644
--- a/arch/sh/include/asm/elf.h
+++ b/arch/sh/include/asm/elf.h
@@ -202,9 +202,9 @@ extern void __kernel_vsyscall;
 	if (vdso_enabled)					\
 		NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE);	\
 	else							\
-		NEW_AUX_ENT(AT_IGNORE, 0);
+		NEW_AUX_ENT(AT_IGNORE, 0)
 #else
-#define VSYSCALL_AUX_ENT
+#define VSYSCALL_AUX_ENT	NEW_AUX_ENT(AT_IGNORE, 0)
 #endif /* CONFIG_VSYSCALL */
 
 #ifdef CONFIG_SH_FPU
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 46/74] USB: option: Add new MEDIATEK PID support
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (44 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 45/74] sh: Fix FDPIC binary loader Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:26 ` [PATCH 47/74] USB: option: blacklist network interface on ZTE MF880 Herton Ronaldo Krzesinski
                   ` (27 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Quentin.Li, Greg Kroah-Hartman, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: "Quentin.Li" <snowmanli88@163.com>

commit 94a85b633829b946eef53fc1825d526312fb856f upstream.

In option.c, add some new MEDIATEK PIDs support for MEDIATEK new products. This
is a MEDIATEK inc. release patch.

Signed-off-by: Quentin.Li <snowmanli88@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/serial/option.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 2896ae5..48d3984 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -429,9 +429,12 @@ static void option_instat_callback(struct urb *urb);
 #define MEDIATEK_VENDOR_ID			0x0e8d
 #define MEDIATEK_PRODUCT_DC_1COM		0x00a0
 #define MEDIATEK_PRODUCT_DC_4COM		0x00a5
+#define MEDIATEK_PRODUCT_DC_4COM2		0x00a7
 #define MEDIATEK_PRODUCT_DC_5COM		0x00a4
 #define MEDIATEK_PRODUCT_7208_1COM		0x7101
 #define MEDIATEK_PRODUCT_7208_2COM		0x7102
+#define MEDIATEK_PRODUCT_7103_2COM		0x7103
+#define MEDIATEK_PRODUCT_7106_2COM		0x7106
 #define MEDIATEK_PRODUCT_FP_1COM		0x0003
 #define MEDIATEK_PRODUCT_FP_2COM		0x0023
 #define MEDIATEK_PRODUCT_FPDC_1COM		0x0043
@@ -1294,6 +1297,10 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FP_2COM, 0x0a, 0x00, 0x00) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_1COM, 0x0a, 0x00, 0x00) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_FPDC_2COM, 0x0a, 0x00, 0x00) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7103_2COM, 0xff, 0x00, 0x00) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_7106_2COM, 0x02, 0x02, 0x01) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x02, 0x01) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x00, 0x00) },
 	{ USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) },
 	{ } /* Terminating entry */
 };
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 47/74] USB: option: blacklist network interface on ZTE MF880
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (45 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 46/74] USB: option: Add new MEDIATEK PID support Herton Ronaldo Krzesinski
@ 2013-01-24  3:26 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 48/74] USB: option: add Telekom Speedstick LTE II Herton Ronaldo Krzesinski
                   ` (26 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:26 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bjørn Mork, Greg Kroah-Hartman, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>

commit fab38246f318edcd0dcb8fd3852a47cf8938878a upstream.

The driver description files gives these names to the vendor specific
functions on this modem:

 diag: VID_19D2&PID_0284&MI_00
 nmea: VID_19D2&PID_0284&MI_01
 at:   VID_19D2&PID_0284&MI_02
 mdm:  VID_19D2&PID_0284&MI_03
 net:  VID_19D2&PID_0284&MI_04

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/serial/option.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 48d3984..ed257a7 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -926,7 +926,8 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0257, 0xff, 0xff, 0xff), /* ZTE MF821 */
 	  .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0265, 0xff, 0xff, 0xff) },
-	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0284, 0xff, 0xff, 0xff) },
+	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0284, 0xff, 0xff, 0xff), /* ZTE MF880 */
+	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0317, 0xff, 0xff, 0xff) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 0xff),
 	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 48/74] USB: option: add Telekom Speedstick LTE II
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (46 preceding siblings ...)
  2013-01-24  3:26 ` [PATCH 47/74] USB: option: blacklist network interface on ZTE MF880 Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 49/74] USB: option: add Nexpring NP10T terminal id Herton Ronaldo Krzesinski
                   ` (25 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Bjørn Mork, Greg Kroah-Hartman, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bjorn@mork.no>

commit 5ec0085440ef8c2cf50002b34d5a504ee12aa2bf upstream.

also known as Alcatel One Touch L100V LTE

The driver description files gives these names to the vendor specific
functions on this modem:

 Application1: VID_1BBB&PID_011E&MI_00
 Application2: VID_1BBB&PID_011E&MI_01
 Modem:        VID_1BBB&PID_011E&MI_03
 Ethernet:     VID_1BBB&PID_011E&MI_04

Reported-by: Thomas Schäfer <tschaefer@t-online.de>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/serial/option.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index ed257a7..425baf5 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -288,6 +288,7 @@ static void option_instat_callback(struct urb *urb);
 #define ALCATEL_VENDOR_ID			0x1bbb
 #define ALCATEL_PRODUCT_X060S_X200		0x0000
 #define ALCATEL_PRODUCT_X220_X500D		0x0017
+#define ALCATEL_PRODUCT_L100V			0x011e
 
 #define PIRELLI_VENDOR_ID			0x1266
 #define PIRELLI_PRODUCT_C100_1			0x1002
@@ -1194,6 +1195,8 @@ static const struct usb_device_id option_ids[] = {
 	  .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist
 	},
 	{ USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D) },
+	{ USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_L100V),
+	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
 	{ USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
 	{ USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
 	{ USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 49/74] USB: option: add Nexpring NP10T terminal id
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (47 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 48/74] USB: option: add Telekom Speedstick LTE II Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 50/74] Add CDC-ACM support for the CX93010-2x UCMxx USB Modem Herton Ronaldo Krzesinski
                   ` (24 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Denis Kaganovich, Greg Kroah-Hartman, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Dzianis Kahanovich <mahatma@bspu.unibel.by>

commit ad86e58661b38b279b7519d4e49c7a19dc1654bb upstream.

Hyundai Petatel Inc. Nexpring NP10T terminal (EV-DO rev.A USB modem) ID

Signed-off-by: Denis Kaganovich <mahatma@eu.by>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/serial/option.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 425baf5..3067de2 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -445,6 +445,10 @@ static void option_instat_callback(struct urb *urb);
 #define CELLIENT_VENDOR_ID			0x2692
 #define CELLIENT_PRODUCT_MEN200			0x9005
 
+/* Hyundai Petatel Inc. products */
+#define PETATEL_VENDOR_ID			0x1ff4
+#define PETATEL_PRODUCT_NP10T			0x600e
+
 /* some devices interfaces need special handling due to a number of reasons */
 enum option_blacklist_reason {
 		OPTION_BLACKLIST_NONE = 0,
@@ -1306,6 +1310,7 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x02, 0x01) },
 	{ USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x00, 0x00) },
 	{ USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) },
+	{ USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T) },
 	{ } /* Terminating entry */
 };
 MODULE_DEVICE_TABLE(usb, option_ids);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 50/74] Add CDC-ACM support for the CX93010-2x UCMxx USB Modem
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (48 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 49/74] USB: option: add Nexpring NP10T terminal id Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 51/74] USB: cdc-acm: Add support for "PSC Scanning, Magellan 800i" Herton Ronaldo Krzesinski
                   ` (23 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jean-Christian de Rivaz, David S. Miller, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jean-Christian de Rivaz <jc@eclis.ch>

commit e7d491a19d3e3aac544070293891a2542ae0c565 upstream.

This USB V.92/V.32bis Controllered Modem have the USB vendor ID 0x0572
and device ID 0x1340. It need the NO_UNION_NORMAL quirk to be recognized.

Reference:
http://www.conexant.com/servlets/DownloadServlet/DSH-201723-005.pdf?docid=1725&revid=5
See idVendor and idProduct in table 6-1. Device Descriptors

Signed-off-by: Jean-Christian de Rivaz <jc@eclis.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/class/cdc-acm.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index d8104c4..3850ca6 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1599,6 +1599,9 @@ static const struct usb_device_id acm_ids[] = {
 					   Maybe we should define a new
 					   quirk for this. */
 	},
+	{ USB_DEVICE(0x0572, 0x1340), /* Conexant CX93010-2x UCMxx */
+	.driver_info = NO_UNION_NORMAL,
+	},
 	{ USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */
 	.driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
 	},
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 51/74] USB: cdc-acm: Add support for "PSC Scanning, Magellan 800i"
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (49 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 50/74] Add CDC-ACM support for the CX93010-2x UCMxx USB Modem Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 52/74] USB: hub: handle claim of enabled remote wakeup after reset Herton Ronaldo Krzesinski
                   ` (22 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Denis N Ladin, Greg Kroah-Hartman, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Denis N Ladin <denladin@gmail.com>

commit 036915a7a402753c05b8d0529f5fd08805ab46d0 upstream.

Adding support "PSC Scanning, Magellan 800i" in cdc-acm

Very simple, but very necessary.
Suitable for all versions of the kernel > 2.6

Signed-off-by: Denis N Ladin <denladin@gmail.com>
Acked-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/class/cdc-acm.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 3850ca6..ec2bba6 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -1602,6 +1602,9 @@ static const struct usb_device_id acm_ids[] = {
 	{ USB_DEVICE(0x0572, 0x1340), /* Conexant CX93010-2x UCMxx */
 	.driver_info = NO_UNION_NORMAL,
 	},
+	{ USB_DEVICE(0x05f9, 0x4002), /* PSC Scanning, Magellan 800i */
+	.driver_info = NO_UNION_NORMAL,
+	},
 	{ USB_DEVICE(0x1bbb, 0x0003), /* Alcatel OT-I650 */
 	.driver_info = NO_UNION_NORMAL, /* reports zero length descriptor */
 	},
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 52/74] USB: hub: handle claim of enabled remote wakeup after reset
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (50 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 51/74] USB: cdc-acm: Add support for "PSC Scanning, Magellan 800i" Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 53/74] mm: compaction: fix echo 1 > compact_memory return error issue Herton Ronaldo Krzesinski
                   ` (21 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Oliver Neukum, Greg Kroah-Hartman, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Oliver Neukum <oliver@neukum.org>

commit 07e72b95f5038cc82304b9a4a2eb7f9fc391ea68 upstream.

Some touchscreens have buggy firmware which claims
remote wakeup to be enabled after a reset. They nevertheless
crash if the feature is cleared by the host.
Add a check for reset resume before checking for
an enabled remote wakeup feature. On compliant
devices the feature must be cleared after a reset anyway.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/core/hub.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 2532bdc..92c0229 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2840,7 +2840,7 @@ int usb_port_suspend(struct usb_device *udev, pm_message_t msg)
 static int finish_port_resume(struct usb_device *udev)
 {
 	int	status = 0;
-	u16	devstatus;
+	u16	devstatus = 0;
 
 	/* caller owns the udev device lock */
 	dev_dbg(&udev->dev, "%s\n",
@@ -2885,7 +2885,13 @@ static int finish_port_resume(struct usb_device *udev)
 	if (status) {
 		dev_dbg(&udev->dev, "gone after usb resume? status %d\n",
 				status);
-	} else if (udev->actconfig) {
+	/*
+	 * There are a few quirky devices which violate the standard
+	 * by claiming to have remote wakeup enabled after a reset,
+	 * which crash if the feature is cleared, hence check for
+	 * udev->reset_resume
+	 */
+	} else if (udev->actconfig && !udev->reset_resume) {
 		le16_to_cpus(&devstatus);
 		if (devstatus & (1 << USB_DEVICE_REMOTE_WAKEUP)) {
 			status = usb_control_msg(udev,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 53/74] mm: compaction: fix echo 1 > compact_memory return error issue
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (51 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 52/74] USB: hub: handle claim of enabled remote wakeup after reset Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 54/74] mm: use aligned zone start for pfn_to_bitidx calculation Herton Ronaldo Krzesinski
                   ` (20 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jason Liu, Rik van Riel, Minchan Kim, KAMEZAWA Hiroyuki,
	Andrew Morton, Linus Torvalds, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jason Liu <r64343@freescale.com>

commit 7964c06d66c76507d8b6b662bffea770c29ef0ce upstream.

when run the folloing command under shell, it will return error

  sh/$ echo 1 > /proc/sys/vm/compact_memory
  sh/$ sh: write error: Bad address

After strace, I found the following log:

  ...
  write(1, "1\n", 2)               = 3
  write(1, "", 4294967295)         = -1 EFAULT (Bad address)
  write(2, "echo: write error: Bad address\n", 31echo: write error: Bad address
  ) = 31

This tells system return 3(COMPACT_COMPLETE) after write data to
compact_memory.

The fix is to make the system just return 0 instead 3(COMPACT_COMPLETE)
from sysctl_compaction_handler after compaction_nodes finished.

Signed-off-by: Jason Liu <r64343@freescale.com>
Suggested-by: David Rientjes <rientjes@google.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 mm/compaction.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index 2f42d95..cf955bb 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -843,7 +843,7 @@ static int compact_node(int nid)
 }
 
 /* Compact all nodes in the system */
-static int compact_nodes(void)
+static void compact_nodes(void)
 {
 	int nid;
 
@@ -852,8 +852,6 @@ static int compact_nodes(void)
 
 	for_each_online_node(nid)
 		compact_node(nid);
-
-	return COMPACT_COMPLETE;
 }
 
 /* The written value is actually unused, all memory is compacted */
@@ -864,7 +862,7 @@ int sysctl_compaction_handler(struct ctl_table *table, int write,
 			void __user *buffer, size_t *length, loff_t *ppos)
 {
 	if (write)
-		return compact_nodes();
+		compact_nodes();
 
 	return 0;
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 54/74] mm: use aligned zone start for pfn_to_bitidx calculation
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (52 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 53/74] mm: compaction: fix echo 1 > compact_memory return error issue Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 55/74] mm: bootmem: fix free_all_bootmem_core() with odd bitmap alignment Herton Ronaldo Krzesinski
                   ` (19 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Laura Abbott, Andrew Morton, Linus Torvalds, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Laura Abbott <lauraa@codeaurora.org>

commit c060f943d0929f3e429c5d9522290584f6281d6e upstream.

The current calculation in pfn_to_bitidx assumes that (pfn -
zone->zone_start_pfn) >> pageblock_order will return the same bit for
all pfn in a pageblock.  If zone_start_pfn is not aligned to
pageblock_nr_pages, this may not always be correct.

Consider the following with pageblock order = 10, zone start 2MB:

  pfn     | pfn - zone start | (pfn - zone start) >> page block order
  ----------------------------------------------------------------
  0x26000 | 0x25e00	   |  0x97
  0x26100 | 0x25f00	   |  0x97
  0x26200 | 0x26000	   |  0x98
  0x26300 | 0x26100	   |  0x98

This means that calling {get,set}_pageblock_migratetype on a single page
will not set the migratetype for the full block.  Fix this by rounding
down zone_start_pfn when doing the bitidx calculation.

For our use case, the effects of this bug were mostly tied to the fact
that CMA allocations would either take a long time or fail to happen.
Depending on the driver using CMA, this could result in anything from
visual glitches to application failures.

Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Acked-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 mm/page_alloc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 9bd526c..007bf3b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5405,7 +5405,7 @@ static inline int pfn_to_bitidx(struct zone *zone, unsigned long pfn)
 	pfn &= (PAGES_PER_SECTION-1);
 	return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS;
 #else
-	pfn = pfn - zone->zone_start_pfn;
+	pfn = pfn - round_down(zone->zone_start_pfn, pageblock_nr_pages);
 	return (pfn >> pageblock_order) * NR_PAGEBLOCK_BITS;
 #endif /* CONFIG_SPARSEMEM */
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 55/74] mm: bootmem: fix free_all_bootmem_core() with odd bitmap alignment
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (53 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 54/74] mm: use aligned zone start for pfn_to_bitidx calculation Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 56/74] audit: create explicit AUDIT_SECCOMP event type Herton Ronaldo Krzesinski
                   ` (18 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Max Filippov, Gavin Shan, Johannes Weiner, Tejun Heo, Yinghai Lu,
	Joonsoo Kim, Prasad Koya, Andrew Morton, Linus Torvalds,
	Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Max Filippov <jcmvbkbc@gmail.com>

commit 10d73e655cef6e86ea8589dca3df4e495e4900b0 upstream.

Currently free_all_bootmem_core ignores that node_min_pfn may be not
multiple of BITS_PER_LONG.  Eg commit 6dccdcbe2c3e ("mm: bootmem: fix
checking the bitmap when finally freeing bootmem") shifts vec by lower
bits of start instead of lower bits of idx.  Also

  if (IS_ALIGNED(start, BITS_PER_LONG) && vec == ~0UL)

assumes that vec bit 0 corresponds to start pfn, which is only true when
node_min_pfn is a multiple of BITS_PER_LONG.  Also loop in the else
clause can double-free pages (e.g.  with node_min_pfn == start == 1,
map[0] == ~0 on 32-bit machine page 32 will be double-freed).

This bug causes the following message during xtensa kernel boot:

  bootmem::free_all_bootmem_core nid=0 start=1 end=8000
  BUG: Bad page state in process swapper  pfn:00001
  page:d04bd020 count:0 mapcount:-127 mapping:  (null) index:0x2
  page flags: 0x0()
  Call Trace:
    bad_page+0x8c/0x9c
    free_pages_prepare+0x5e/0x88
    free_hot_cold_page+0xc/0xa0
    __free_pages+0x24/0x38
    __free_pages_bootmem+0x54/0x56
    free_all_bootmem_core$part$11+0xeb/0x138
    free_all_bootmem+0x46/0x58
    mem_init+0x25/0xa4
    start_kernel+0x11e/0x25c
    should_never_return+0x0/0x3be7

The fix is the following:
 - always align vec so that its bit 0 corresponds to start
 - provide BITS_PER_LONG bits in vec, if those bits are available in the
   map
 - don't free pages past next start position in the else clause.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Cc: Gavin Shan <shangw@linux.vnet.ibm.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Joonsoo Kim <js1304@gmail.com>
Cc: Prasad Koya <prasad.koya@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 mm/bootmem.c |   24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/mm/bootmem.c b/mm/bootmem.c
index bcb63ac..ceca0da 100644
--- a/mm/bootmem.c
+++ b/mm/bootmem.c
@@ -185,10 +185,23 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
 
 	while (start < end) {
 		unsigned long *map, idx, vec;
+		unsigned shift;
 
 		map = bdata->node_bootmem_map;
 		idx = start - bdata->node_min_pfn;
+		shift = idx & (BITS_PER_LONG - 1);
+		/*
+		 * vec holds at most BITS_PER_LONG map bits,
+		 * bit 0 corresponds to start.
+		 */
 		vec = ~map[idx / BITS_PER_LONG];
+
+		if (shift) {
+			vec >>= shift;
+			if (end - start >= BITS_PER_LONG)
+				vec |= ~map[idx / BITS_PER_LONG + 1] <<
+					(BITS_PER_LONG - shift);
+		}
 		/*
 		 * If we have a properly aligned and fully unreserved
 		 * BITS_PER_LONG block of pages in front of us, free
@@ -201,19 +214,18 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata)
 			count += BITS_PER_LONG;
 			start += BITS_PER_LONG;
 		} else {
-			unsigned long off = 0;
+			unsigned long cur = start;
 
-			vec >>= start & (BITS_PER_LONG - 1);
-			while (vec) {
+			start = ALIGN(start + 1, BITS_PER_LONG);
+			while (vec && cur != start) {
 				if (vec & 1) {
-					page = pfn_to_page(start + off);
+					page = pfn_to_page(cur);
 					__free_pages_bootmem(page, 0);
 					count++;
 				}
 				vec >>= 1;
-				off++;
+				++cur;
 			}
-			start = ALIGN(start + 1, BITS_PER_LONG);
 		}
 	}
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 56/74] audit: create explicit AUDIT_SECCOMP event type
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (54 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 55/74] mm: bootmem: fix free_all_bootmem_core() with odd bitmap alignment Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 57/74] USB: Add device quirk for Microsoft VX700 webcam Herton Ronaldo Krzesinski
                   ` (17 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Kees Cook, Al Viro, Eric Paris, Jeff Layton, Eric W. Biederman,
	Julien Tinnes, Andrea Arcangeli, Andrew Morton, Linus Torvalds,
	Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Kees Cook <keescook@chromium.org>

commit 7b9205bd775afc4439ed86d617f9042ee9e76a71 upstream.

The seccomp path was using AUDIT_ANOM_ABEND from when seccomp mode 1
could only kill a process.  While we still want to make sure an audit
record is forced on a kill, this should use a separate record type since
seccomp mode 2 introduces other behaviors.

In the case of "handled" behaviors (process wasn't killed), only emit a
record if the process is under inspection.  This change also fixes
userspace examination of seccomp audit events, since it was considered
malformed due to missing fields of the AUDIT_ANOM_ABEND event type.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Eric Paris <eparis@redhat.com>
Cc: Jeff Layton <jlayton@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Julien Tinnes <jln@google.com>
Acked-by: Will Drewry <wad@chromium.org>
Acked-by: Steve Grubb <sgrubb@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[ herton: adjust context, include/uapi/linux/audit.h -> include/linux/audit.h ]
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 include/linux/audit.h |    4 +++-
 kernel/auditsc.c      |   14 +++++++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/include/linux/audit.h b/include/linux/audit.h
index 22f292a..eaa7c9f 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -106,6 +106,7 @@
 #define AUDIT_MMAP		1323	/* Record showing descriptor and flags in mmap */
 #define AUDIT_NETFILTER_PKT	1324	/* Packets traversing netfilter chains */
 #define AUDIT_NETFILTER_CFG	1325	/* Netfilter chain modifications */
+#define AUDIT_SECCOMP		1326	/* Secure Computing event */
 
 #define AUDIT_AVC		1400	/* SE Linux avc denial or grant */
 #define AUDIT_SELINUX_ERR	1401	/* Internal SE Linux Errors */
@@ -510,7 +511,8 @@ void audit_core_dumps(long signr);
 
 static inline void audit_seccomp(unsigned long syscall, long signr, int code)
 {
-	if (unlikely(!audit_dummy_context()))
+	/* Force a record to be reported if a signal was delivered. */
+	if (signr || unlikely(!audit_dummy_context()))
 		__audit_seccomp(syscall, signr, code);
 }
 
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 4b96415..a0ecca4 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -2670,7 +2670,7 @@ void __audit_mmap_fd(int fd, int flags)
 	context->type = AUDIT_MMAP;
 }
 
-static void audit_log_abend(struct audit_buffer *ab, char *reason, long signr)
+static void audit_log_task(struct audit_buffer *ab)
 {
 	uid_t auid, uid;
 	gid_t gid;
@@ -2685,6 +2685,11 @@ static void audit_log_abend(struct audit_buffer *ab, char *reason, long signr)
 	audit_log_task_context(ab);
 	audit_log_format(ab, " pid=%d comm=", current->pid);
 	audit_log_untrustedstring(ab, current->comm);
+}
+
+static void audit_log_abend(struct audit_buffer *ab, char *reason, long signr)
+{
+	audit_log_task(ab);
 	audit_log_format(ab, " reason=");
 	audit_log_string(ab, reason);
 	audit_log_format(ab, " sig=%ld", signr);
@@ -2715,8 +2720,11 @@ void __audit_seccomp(unsigned long syscall, long signr, int code)
 {
 	struct audit_buffer *ab;
 
-	ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_ANOM_ABEND);
-	audit_log_abend(ab, "seccomp", signr);
+	ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_SECCOMP);
+	if (unlikely(!ab))
+		return;
+	audit_log_task(ab);
+	audit_log_format(ab, " sig=%ld", signr);
 	audit_log_format(ab, " syscall=%ld", syscall);
 	audit_log_format(ab, " compat=%d", is_compat_task());
 	audit_log_format(ab, " ip=0x%lx", KSTK_EIP(current));
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 57/74] USB: Add device quirk for Microsoft VX700 webcam
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (55 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 56/74] audit: create explicit AUDIT_SECCOMP event type Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 58/74] drm/nouveau: fix blank LVDS screen regression on pre-nv50 cards Herton Ronaldo Krzesinski
                   ` (16 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Andreas Fleig, Greg Kroah-Hartman, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Andreas Fleig <andreasfleig@gmail.com>

commit bc009eca8d539162f7271c2daf0ab5e9e3bb90a0 upstream.

Add device quirk for Microsoft Lifecam VX700 v2.0 webcams.
Fixes squeaking noise of the microphone.

Signed-off-by: Andreas Fleig <andreasfleig@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/core/quirks.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 8b2a9d8..3f08c09 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -38,6 +38,9 @@ static const struct usb_device_id usb_quirk_list[] = {
 	/* Creative SB Audigy 2 NX */
 	{ USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME },
 
+	/* Microsoft LifeCam-VX700 v2.0 */
+	{ USB_DEVICE(0x045e, 0x0770), .driver_info = USB_QUIRK_RESET_RESUME },
+
 	/* Logitech Webcam C200 */
 	{ USB_DEVICE(0x046d, 0x0802), .driver_info = USB_QUIRK_RESET_RESUME },
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 58/74] drm/nouveau: fix blank LVDS screen regression on pre-nv50 cards
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (56 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 57/74] USB: Add device quirk for Microsoft VX700 webcam Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 59/74] drm/nv17-50: restore fence buffer on resume Herton Ronaldo Krzesinski
                   ` (15 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marcin Slusarz, Ben Skeggs, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Marcin Slusarz <marcin.slusarz@gmail.com>

commit 92441b2263866c27ef48137be5aa6c8c692652fc upstream.

Commit 2a44e499 ("drm/nouveau/disp: introduce proper init/fini, separate
from create/destroy") started to call display init routines on pre-nv50
hardware on module load. But LVDS init code sets driver state in a way
which prevents modesetting code from operating properly.

nv04_display_init calls nv04_dfp_restore, which sets encoder->last_dpms to
NV_DPMS_CLEARED.

drm_crtc_helper_set_mode
  nv04_dfp_prepare
    nv04_lvds_dpms(DRM_MODE_DPMS_OFF)

nv04_lvds_dpms checks last_dpms mode (which is NV_DPMS_CLEARED) and wrongly
assumes it's a "powersaving mode", the new one (DRM_MODE_DPMS_OFF) is too,
so it skips calling some crucial lvds scripts.

Reported-by: Chris Paulson-Ellis <chris@edesix.com>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/gpu/drm/nouveau/nv04_dfp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau/nv04_dfp.c
index 11c9a1a..28c7a5a 100644
--- a/drivers/gpu/drm/nouveau/nv04_dfp.c
+++ b/drivers/gpu/drm/nouveau/nv04_dfp.c
@@ -504,7 +504,7 @@ static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode)
 
 static inline bool is_powersaving_dpms(int mode)
 {
-	return (mode != DRM_MODE_DPMS_ON);
+	return mode != DRM_MODE_DPMS_ON && mode != NV_DPMS_CLEARED;
 }
 
 static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 59/74] drm/nv17-50: restore fence buffer on resume
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (57 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 58/74] drm/nouveau: fix blank LVDS screen regression on pre-nv50 cards Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24 17:36   ` Marcin Slusarz
  2013-01-24  3:27 ` [PATCH 60/74] usb: ftdi_sio: Crucible Technologies COMET Caller ID - pid added Herton Ronaldo Krzesinski
                   ` (14 subsequent siblings)
  73 siblings, 1 reply; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Marcin Slusarz, Ben Skeggs, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Marcin Slusarz <marcin.slusarz@gmail.com>

commit f20ebd034eab43fd38c58b11c5bb5fb125e5f7d7 upstream.

Since commit 5e120f6e4b3f35b741c5445dfc755f50128c3c44 "drm/nouveau/fence:
convert to exec engine, and improve channel sync" nouveau fence sync
implementation for nv17-50 and nvc0+ started to rely on state of fence buffer
left by previous sync operation. But as pinned bo's (where fence state is
stored) are not saved+restored across suspend/resume, we need to do it
manually.

nvc0+ was fixed by commit d6ba6d215a538a58f0f0026f0961b0b9125e8042
"drm/nvc0/fence: restore pre-suspend fence buffer context on resume".

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=50121

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
[ herton: backport for 3.5, looks like we only need to call
  nouveau_bo_wr32 on nv10_fence_init ]
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/gpu/drm/nouveau/nv10_fence.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/nv10_fence.c b/drivers/gpu/drm/nouveau/nv10_fence.c
index 8a1b750..18932a6 100644
--- a/drivers/gpu/drm/nouveau/nv10_fence.c
+++ b/drivers/gpu/drm/nouveau/nv10_fence.c
@@ -155,6 +155,9 @@ nv10_fence_fini(struct drm_device *dev, int engine, bool suspend)
 static int
 nv10_fence_init(struct drm_device *dev, int engine)
 {
+	struct nv10_fence_priv *priv = nv_engine(dev, engine);
+
+	nouveau_bo_wr32(priv->bo, 0, priv->sequence);
 	return 0;
 }
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 60/74] usb: ftdi_sio: Crucible Technologies COMET Caller ID - pid added
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (58 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 59/74] drm/nv17-50: restore fence buffer on resume Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 61/74] udldrmfb: Fix EDID not working with monitors with EDID extension blocks Herton Ronaldo Krzesinski
                   ` (13 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Tomasz Mloduchowski, Greg Kroah-Hartman, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Tomasz Mloduchowski <q@qdot.me>

commit 8cf65dc386f3634a43312f436cc7a935476a40c4 upstream.

Simple fix to add support for Crucible Technologies COMET Caller ID
USB decoder - a device containing FTDI USB/Serial converter chip,
handling 1200bps CallerID messages decoded from the phone line -
adding correct USB PID is sufficient.

Tested to apply cleanly and work flawlessly against 3.6.9, 3.7.0-rc8
and 3.8.0-rc3 on both amd64 and x86 arches.

Signed-off-by: Tomasz Mloduchowski <q@qdot.me>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/serial/ftdi_sio.c     |    2 ++
 drivers/usb/serial/ftdi_sio_ids.h |    6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 360bdeb..653139b 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -881,6 +881,8 @@ static struct usb_device_id id_table_combined [] = {
 	{ USB_DEVICE(FTDI_VID, FTDI_DISTORTEC_JTAG_LOCK_PICK_PID),
 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
 	{ USB_DEVICE(FTDI_VID, FTDI_LUMEL_PD12_PID) },
+	/* Crucible Devices */
+	{ USB_DEVICE(FTDI_VID, FTDI_CT_COMET_PID) },
 	{ },					/* Optional parameter entry */
 	{ }					/* Terminating entry */
 };
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 049b6e7..fa5d560 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -1259,3 +1259,9 @@
  * ATI command output: Cinterion MC55i
  */
 #define FTDI_CINTERION_MC55I_PID	0xA951
+
+/*
+ * Product: Comet Caller ID decoder
+ * Manufacturer: Crucible Technologies
+ */
+#define FTDI_CT_COMET_PID	0x8e08
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 61/74] udldrmfb: Fix EDID not working with monitors with EDID extension blocks
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (59 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 60/74] usb: ftdi_sio: Crucible Technologies COMET Caller ID - pid added Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 62/74] udldrmfb: udl_get_edid: usb_control_msg buffer must not be on the stack Herton Ronaldo Krzesinski
                   ` (12 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Dave Airlie, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Hans de Goede <hdegoede@redhat.com>

commit c930812fe5ebe725760422c9c351d1f6fde1502d upstream.

udldrmfb only reads the main EDID block, and if that advertises extensions
the drm_edid code expects them to be present, and starts reading beyond the
buffer udldrmfb passes it.

Although it may be possible to read more EDID info with the udl we simpy don't
know how, and even if trial and error gets it working on one device, that is
no guarantee it will work on other revisions. So this patch does a simple fix
in the form of patching the EDID info to report 0 extension blocks, this
fixes udldrmfb only doing 1024x768 on monitors with EDID extension blocks.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
[ herton: adjust context ]
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/gpu/drm/udl/udl_connector.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
index 8d9dc44..1230bc0 100644
--- a/drivers/gpu/drm/udl/udl_connector.c
+++ b/drivers/gpu/drm/udl/udl_connector.c
@@ -59,6 +59,14 @@ static int udl_get_modes(struct drm_connector *connector)
 
 	connector->display_info.raw_edid = (char *)edid;
 
+	/*
+	 * We only read the main block, but if the monitor reports extension
+	 * blocks then the drm edid code expects them to be present, so patch
+	 * the extension count to 0.
+	 */
+	edid->checksum += edid->extensions;
+	edid->extensions = 0;
+
 	drm_mode_connector_update_edid_property(connector, edid);
 	ret = drm_add_edid_modes(connector, edid);
 	connector->display_info.raw_edid = NULL;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 62/74] udldrmfb: udl_get_edid: usb_control_msg buffer must not be on the stack
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (60 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 61/74] udldrmfb: Fix EDID not working with monitors with EDID extension blocks Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 63/74] udldrmfb: udl_get_edid: drop unneeded i-- Herton Ronaldo Krzesinski
                   ` (11 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Dave Airlie, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Hans de Goede <hdegoede@redhat.com>

commit 242187b362555849e8c971dfbbfd55f8bd9fa717 upstream.

The buffer passed to usb_control_msg may end up in scatter-gather list, and
may thus not be on the stack. Having it on the stack usually works on x86, but
not on other archs.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/gpu/drm/udl/udl_connector.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
index 1230bc0..b7780dd 100644
--- a/drivers/gpu/drm/udl/udl_connector.c
+++ b/drivers/gpu/drm/udl/udl_connector.c
@@ -22,13 +22,17 @@
 static u8 *udl_get_edid(struct udl_device *udl)
 {
 	u8 *block;
-	char rbuf[3];
+	char *rbuf;
 	int ret, i;
 
 	block = kmalloc(EDID_LENGTH, GFP_KERNEL);
 	if (block == NULL)
 		return NULL;
 
+	rbuf = kmalloc(2, GFP_KERNEL);
+	if (rbuf == NULL)
+		goto error;
+
 	for (i = 0; i < EDID_LENGTH; i++) {
 		ret = usb_control_msg(udl->ddev->usbdev,
 				      usb_rcvctrlpipe(udl->ddev->usbdev, 0), (0x02),
@@ -42,10 +46,12 @@ static u8 *udl_get_edid(struct udl_device *udl)
 		block[i] = rbuf[1];
 	}
 
+	kfree(rbuf);
 	return block;
 
 error:
 	kfree(block);
+	kfree(rbuf);
 	return NULL;
 }
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 63/74] udldrmfb: udl_get_edid: drop unneeded i--
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (61 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 62/74] udldrmfb: udl_get_edid: usb_control_msg buffer must not be on the stack Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 64/74] s390/time: fix sched_clock() overflow Herton Ronaldo Krzesinski
                   ` (10 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Hans de Goede, Dave Airlie, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Hans de Goede <hdegoede@redhat.com>

commit 7b4cf994e4c6ba48872bb25253cc393b7fb74c82 upstream.

This is a left-over from when udl_get_edid returned the amount of bytes
successfully read, which it no longer does.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/gpu/drm/udl/udl_connector.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/udl/udl_connector.c b/drivers/gpu/drm/udl/udl_connector.c
index b7780dd..3234224 100644
--- a/drivers/gpu/drm/udl/udl_connector.c
+++ b/drivers/gpu/drm/udl/udl_connector.c
@@ -40,7 +40,6 @@ static u8 *udl_get_edid(struct udl_device *udl)
 				      HZ);
 		if (ret < 1) {
 			DRM_ERROR("Read EDID byte %d failed err %x\n", i, ret);
-			i--;
 			goto error;
 		}
 		block[i] = rbuf[1];
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 64/74] s390/time: fix sched_clock() overflow
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (62 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 63/74] udldrmfb: udl_get_edid: drop unneeded i-- Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 65/74] rt2800usb: Add support for 2001:3c1e (D-Link DWA-125 rev B1) USB Wi-Fi adapter Herton Ronaldo Krzesinski
                   ` (9 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Heiko Carstens, Martin Schwidefsky, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Heiko Carstens <heiko.carstens@de.ibm.com>

commit ed4f20943cd4c7b55105c04daedf8d63ab6d499c upstream.

Converting a 64 Bit TOD format value to nanoseconds means that the value
must be divided by 4.096. In order to achieve that we multiply with 125
and divide by 512.
When used within sched_clock() this triggers an overflow after appr.
417 days. Resulting in a sched_clock() return value that is much smaller
than previously and therefore may cause all sort of weird things in
subsystems that rely on a monotonic sched_clock() behaviour.

To fix this implement a tod_to_ns() helper function which converts TOD
values without overflow and call this function from both places that
open coded the conversion: sched_clock() and kvm_s390_handle_wait().

Reviewed-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 arch/s390/include/asm/timex.h |   28 ++++++++++++++++++++++++++++
 arch/s390/kernel/time.c       |    2 +-
 arch/s390/kvm/interrupt.c     |    2 +-
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h
index 239ece9..706c535 100644
--- a/arch/s390/include/asm/timex.h
+++ b/arch/s390/include/asm/timex.h
@@ -130,4 +130,32 @@ static inline unsigned long long get_clock_monotonic(void)
 	return get_clock_xt() - sched_clock_base_cc;
 }
 
+/**
+ * tod_to_ns - convert a TOD format value to nanoseconds
+ * @todval: to be converted TOD format value
+ * Returns: number of nanoseconds that correspond to the TOD format value
+ *
+ * Converting a 64 Bit TOD format value to nanoseconds means that the value
+ * must be divided by 4.096. In order to achieve that we multiply with 125
+ * and divide by 512:
+ *
+ *    ns = (todval * 125) >> 9;
+ *
+ * In order to avoid an overflow with the multiplication we can rewrite this.
+ * With a split todval == 2^32 * th + tl (th upper 32 bits, tl lower 32 bits)
+ * we end up with
+ *
+ *    ns = ((2^32 * th + tl) * 125 ) >> 9;
+ * -> ns = (2^23 * th * 125) + ((tl * 125) >> 9);
+ *
+ */
+static inline unsigned long long tod_to_ns(unsigned long long todval)
+{
+	unsigned long long ns;
+
+	ns = ((todval >> 32) << 23) * 125;
+	ns += ((todval & 0xffffffff) * 125) >> 9;
+	return ns;
+}
+
 #endif
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index d4e1cb1..c5531db 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -64,7 +64,7 @@ static DEFINE_PER_CPU(struct clock_event_device, comparators);
  */
 unsigned long long notrace __kprobes sched_clock(void)
 {
-	return (get_clock_monotonic() * 125) >> 9;
+	return tod_to_ns(get_clock_monotonic());
 }
 
 /*
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 2d9f9a7..10e13b3 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -390,7 +390,7 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu)
 		return 0;
 	}
 
-	sltime = ((vcpu->arch.sie_block->ckc - now)*125)>>9;
+	sltime = tod_to_ns(vcpu->arch.sie_block->ckc - now);
 
 	hrtimer_start(&vcpu->arch.ckc_timer, ktime_set (0, sltime) , HRTIMER_MODE_REL);
 	VCPU_EVENT(vcpu, 5, "enabled wait via clock comparator: %llx ns", sltime);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 65/74] rt2800usb: Add support for 2001:3c1e (D-Link DWA-125 rev B1) USB Wi-Fi adapter
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (63 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 64/74] s390/time: fix sched_clock() overflow Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 66/74] drm/radeon: fix NULL pointer dereference in UMS mode Herton Ronaldo Krzesinski
                   ` (8 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Maia Kozheva, John W. Linville, Leann Ogasawara,
	Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Maia Kozheva <sikon@ubuntu.com>

commit fd7b9270120ca7e53fbf0469febe0c68acf6a0a2 upstream.

D-Link DWA-125/B1 is a relatively new USB Wi-Fi adapter, using a
Ralink chipset supported by the rt2800usb driver. Currently, to work
around the problem (it's missing in all present kernel versions,
up to and including 3.7.x), I had to add this to /etc/rc.local:

echo 2001 3c1e >> /sys/bus/usb/drivers/rt2800usb/new_id

After that, the device works without problems. Been using it for over
a week with no bugs in sight.

The attached patch is trivial and simply adds the new USB ID to the
list of devices handled by rt2800usb.

Signed-off-by: Maia Kozheva <sikon@ubuntu.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Cc: Leann Ogasawara <leann.ogasawara@canonical.com>
BugLink: http://bugs.launchpad.net/bugs/1085351
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/net/wireless/rt2x00/rt2800usb.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 6b4226b..fe42f76 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -1005,6 +1005,7 @@ static struct usb_device_id rt2800usb_device_table[] = {
 	{ USB_DEVICE(0x07d1, 0x3c15) },
 	{ USB_DEVICE(0x07d1, 0x3c16) },
 	{ USB_DEVICE(0x2001, 0x3c1b) },
+	{ USB_DEVICE(0x2001, 0x3c1e) },
 	/* Draytek */
 	{ USB_DEVICE(0x07fa, 0x7712) },
 	/* DVICO */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 66/74] drm/radeon: fix NULL pointer dereference in UMS mode
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (64 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 65/74] rt2800usb: Add support for 2001:3c1e (D-Link DWA-125 rev B1) USB Wi-Fi adapter Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 67/74] drm/radeon: fix a bogus kfree Herton Ronaldo Krzesinski
                   ` (7 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ilija Hadzic, Alex Deucher, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ilija Hadzic <ihadzic@research.bell-labs.com>

commit ff4bd0827764e10a428a9d39e6814c5478863f94 upstream.

In UMS mode parser->rdev is NULL, so dereferencing
will cause an oops.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/gpu/drm/radeon/radeon_cs.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index c84eb1a..66d81ae 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -274,7 +274,7 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
 				  p->chunks[p->chunk_ib_idx].length_dw);
 			return -EINVAL;
 		}
-		if ((p->rdev->flags & RADEON_IS_AGP)) {
+		if (p->rdev && (p->rdev->flags & RADEON_IS_AGP)) {
 			p->chunks[p->chunk_ib_idx].kpage[0] = kmalloc(PAGE_SIZE, GFP_KERNEL);
 			p->chunks[p->chunk_ib_idx].kpage[1] = kmalloc(PAGE_SIZE, GFP_KERNEL);
 			if (p->chunks[p->chunk_ib_idx].kpage[0] == NULL ||
@@ -613,7 +613,8 @@ static int radeon_cs_update_pages(struct radeon_cs_parser *p, int pg_idx)
 	struct radeon_cs_chunk *ibc = &p->chunks[p->chunk_ib_idx];
 	int i;
 	int size = PAGE_SIZE;
-	bool copy1 = (p->rdev->flags & RADEON_IS_AGP) ? false : true;
+	bool copy1 = (p->rdev && (p->rdev->flags & RADEON_IS_AGP)) ?
+		false : true;
 
 	for (i = ibc->last_copied_page + 1; i < pg_idx; i++) {
 		if (DRM_COPY_FROM_USER(p->ib.ptr + (i * (PAGE_SIZE/4)),
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 67/74] drm/radeon: fix a bogus kfree
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (65 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 66/74] drm/radeon: fix NULL pointer dereference in UMS mode Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 68/74] ALSA: usb - fix race in creation of M-Audio Fast track pro driver Herton Ronaldo Krzesinski
                   ` (6 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Ilija Hadzic, Alex Deucher, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ilija Hadzic <ihadzic@research.bell-labs.com>

commit a6b7e1a02b77ab8fe8775d20a88c53d8ba55482e upstream.

parser->chunks[.].kpage[.] is not always kmalloc-ed
by the parser initialization, so parser_fini should
not try to kfree it if it didn't allocate it.

This patch fixes a kernel oops that can be provoked
in UMS mode.

Signed-off-by: Ilija Hadzic <ihadzic@research.bell-labs.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/gpu/drm/radeon/r600_cs.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 1119e31..c05e88a 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -2330,8 +2330,10 @@ static void r600_cs_parser_fini(struct radeon_cs_parser *parser, int error)
 	kfree(parser->relocs);
 	for (i = 0; i < parser->nchunks; i++) {
 		kfree(parser->chunks[i].kdata);
-		kfree(parser->chunks[i].kpage[0]);
-		kfree(parser->chunks[i].kpage[1]);
+		if (parser->rdev && (parser->rdev->flags & RADEON_IS_AGP)) {
+			kfree(parser->chunks[i].kpage[0]);
+			kfree(parser->chunks[i].kpage[1]);
+		}
 	}
 	kfree(parser->chunks);
 	kfree(parser->chunks_array);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 68/74] ALSA: usb - fix race in creation of M-Audio Fast track pro driver
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (66 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 67/74] drm/radeon: fix a bogus kfree Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 69/74] x86/Sandy Bridge: reserve pages when integrated graphics is present Herton Ronaldo Krzesinski
                   ` (5 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: David Henningsson, Takashi Iwai, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: David Henningsson <david.henningsson@canonical.com>

commit b98ae2729dea161edc96c9d177459b6c28bcbba5 upstream.

A patch in the 3.2 kernel caused regression with hotplugging the
M-Audio Fast track pro, or sound after suspend. I don't have the
device so I haven't done a full analysis, but it seems userspace
(both udev and pulseaudio) got confused when a card was created,
immediately destroyed, and then created again.

However, at least one person in the bug report (martin djfun)
reports that this patch resolves the issue for him. It also leaves
a message in the log:
"snd-usb-audio: probe of 1-1.1:1.1 failed with error -5" which is
a bit misleading. It is better than non-working audio, but maybe
there's a more elegant solution?

BugLink: https://bugs.launchpad.net/bugs/1095315
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 sound/usb/quirks.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 2781726..c46171a 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -387,11 +387,13 @@ static int snd_usb_fasttrackpro_boot_quirk(struct usb_device *dev)
 		 * rules
 		 */
 		err = usb_driver_set_configuration(dev, 2);
-		if (err < 0) {
+		if (err < 0)
 			snd_printdd("error usb_driver_set_configuration: %d\n",
 				    err);
-			return -ENODEV;
-		}
+		/* Always return an error, so that we stop creating a device
+		   that will just be destroyed and recreated with a new
+		   configuration */
+		return -ENODEV;
 	} else
 		snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n");
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 69/74] x86/Sandy Bridge: reserve pages when integrated graphics is present
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (67 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 68/74] ALSA: usb - fix race in creation of M-Audio Fast track pro driver Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 70/74] USB: io_ti: Fix NULL dereference in chase_port() Herton Ronaldo Krzesinski
                   ` (4 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Jesse Barnes, H. Peter Anvin, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jesse Barnes <jbarnes@virtuousgeek.org>

commit a9acc5365dbda29f7be2884efb63771dc24bd815 upstream.

SNB graphics devices have a bug that prevent them from accessing certain
memory ranges, namely anything below 1M and in the pages listed in the
table.  So reserve those at boot if set detect a SNB gfx device on the
CPU to avoid GPU hangs.

Stephane Marchesin had a similar patch to the page allocator awhile
back, but rather than reserving pages up front, it leaked them at
allocation time.

[ hpa: made a number of stylistic changes, marked arrays as static
  const, and made less verbose; use "memblock=debug" for full
  verbosity. ]

Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 arch/x86/kernel/setup.c |   78 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index e860517..a0ee620 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -613,6 +613,81 @@ static __init void reserve_ibft_region(void)
 
 static unsigned reserve_low = CONFIG_X86_RESERVE_LOW << 10;
 
+static bool __init snb_gfx_workaround_needed(void)
+{
+	int i;
+	u16 vendor, devid;
+	static const u16 snb_ids[] = {
+		0x0102,
+		0x0112,
+		0x0122,
+		0x0106,
+		0x0116,
+		0x0126,
+		0x010a,
+	};
+
+	/* Assume no if something weird is going on with PCI */
+	if (!early_pci_allowed())
+		return false;
+
+	vendor = read_pci_config_16(0, 2, 0, PCI_VENDOR_ID);
+	if (vendor != 0x8086)
+		return false;
+
+	devid = read_pci_config_16(0, 2, 0, PCI_DEVICE_ID);
+	for (i = 0; i < ARRAY_SIZE(snb_ids); i++)
+		if (devid == snb_ids[i])
+			return true;
+
+	return false;
+}
+
+/*
+ * Sandy Bridge graphics has trouble with certain ranges, exclude
+ * them from allocation.
+ */
+static void __init trim_snb_memory(void)
+{
+	static const unsigned long bad_pages[] = {
+		0x20050000,
+		0x20110000,
+		0x20130000,
+		0x20138000,
+		0x40004000,
+	};
+	int i;
+
+	if (!snb_gfx_workaround_needed())
+		return;
+
+	printk(KERN_DEBUG "reserving inaccessible SNB gfx pages\n");
+
+	/*
+	 * Reserve all memory below the 1 MB mark that has not
+	 * already been reserved.
+	 */
+	memblock_reserve(0, 1<<20);
+	
+	for (i = 0; i < ARRAY_SIZE(bad_pages); i++) {
+		if (memblock_reserve(bad_pages[i], PAGE_SIZE))
+			printk(KERN_WARNING "failed to reserve 0x%08lx\n",
+			       bad_pages[i]);
+	}
+}
+
+/*
+ * Here we put platform-specific memory range workarounds, i.e.
+ * memory known to be corrupt or otherwise in need to be reserved on
+ * specific platforms.
+ *
+ * If this gets used more widely it could use a real dispatch mechanism.
+ */
+static void __init trim_platform_memory_ranges(void)
+{
+	trim_snb_memory();
+}
+
 static void __init trim_bios_range(void)
 {
 	/*
@@ -633,6 +708,7 @@ static void __init trim_bios_range(void)
 	 * take them out.
 	 */
 	e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1);
+
 	sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
 }
 
@@ -911,6 +987,8 @@ void __init setup_arch(char **cmdline_p)
 
 	setup_real_mode();
 
+	trim_platform_memory_ranges();
+
 	init_gbpages();
 
 	/* max_pfn_mapped is updated here */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 70/74] USB: io_ti: Fix NULL dereference in chase_port()
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (68 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 69/74] x86/Sandy Bridge: reserve pages when integrated graphics is present Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 71/74] intel-iommu: Prevent devices with RMRRs from being placed into SI Domain Herton Ronaldo Krzesinski
                   ` (3 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Wolfgang Frisch, Johan Hovold, Greg Kroah-Hartman,
	Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Wolfgang Frisch <wfpub@roembden.net>

commit 1ee0a224bc9aad1de496c795f96bc6ba2c394811 upstream.

The tty is NULL when the port is hanging up.
chase_port() needs to check for this.

This patch is intended for stable series.
The behavior was observed and tested in Linux 3.2 and 3.7.1.

Johan Hovold submitted a more elaborate patch for the mainline kernel.

[   56.277883] usb 1-1: edge_bulk_in_callback - nonzero read bulk status received: -84
[   56.278811] usb 1-1: USB disconnect, device number 3
[   56.278856] usb 1-1: edge_bulk_in_callback - stopping read!
[   56.279562] BUG: unable to handle kernel NULL pointer dereference at 00000000000001c8
[   56.280536] IP: [<ffffffff8144e62a>] _raw_spin_lock_irqsave+0x19/0x35
[   56.281212] PGD 1dc1b067 PUD 1e0f7067 PMD 0
[   56.282085] Oops: 0002 [#1] SMP
[   56.282744] Modules linked in:
[   56.283512] CPU 1
[   56.283512] Pid: 25, comm: khubd Not tainted 3.7.1 #1 innotek GmbH VirtualBox/VirtualBox
[   56.283512] RIP: 0010:[<ffffffff8144e62a>]  [<ffffffff8144e62a>] _raw_spin_lock_irqsave+0x19/0x35
[   56.283512] RSP: 0018:ffff88001fa99ab0  EFLAGS: 00010046
[   56.283512] RAX: 0000000000000046 RBX: 00000000000001c8 RCX: 0000000000640064
[   56.283512] RDX: 0000000000010000 RSI: ffff88001fa99b20 RDI: 00000000000001c8
[   56.283512] RBP: ffff88001fa99b20 R08: 0000000000000000 R09: 0000000000000000
[   56.283512] R10: 0000000000000000 R11: ffffffff812fcb4c R12: ffff88001ddf53c0
[   56.283512] R13: 0000000000000000 R14: 00000000000001c8 R15: ffff88001e19b9f4
[   56.283512] FS:  0000000000000000(0000) GS:ffff88001fd00000(0000) knlGS:0000000000000000
[   56.283512] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[   56.283512] CR2: 00000000000001c8 CR3: 000000001dc51000 CR4: 00000000000006e0
[   56.283512] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   56.283512] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[   56.283512] Process khubd (pid: 25, threadinfo ffff88001fa98000, task ffff88001fa94f80)
[   56.283512] Stack:
[   56.283512]  0000000000000046 00000000000001c8 ffffffff810578ec ffffffff812fcb4c
[   56.283512]  ffff88001e19b980 0000000000002710 ffffffff812ffe81 0000000000000001
[   56.283512]  ffff88001fa94f80 0000000000000202 ffffffff00000001 0000000000000296
[   56.283512] Call Trace:
[   56.283512]  [<ffffffff810578ec>] ? add_wait_queue+0x12/0x3c
[   56.283512]  [<ffffffff812fcb4c>] ? usb_serial_port_work+0x28/0x28
[   56.283512]  [<ffffffff812ffe81>] ? chase_port+0x84/0x2d6
[   56.283512]  [<ffffffff81063f27>] ? try_to_wake_up+0x199/0x199
[   56.283512]  [<ffffffff81263a5c>] ? tty_ldisc_hangup+0x222/0x298
[   56.283512]  [<ffffffff81300171>] ? edge_close+0x64/0x129
[   56.283512]  [<ffffffff810612f7>] ? __wake_up+0x35/0x46
[   56.283512]  [<ffffffff8106135b>] ? should_resched+0x5/0x23
[   56.283512]  [<ffffffff81264916>] ? tty_port_shutdown+0x39/0x44
[   56.283512]  [<ffffffff812fcb4c>] ? usb_serial_port_work+0x28/0x28
[   56.283512]  [<ffffffff8125d38c>] ? __tty_hangup+0x307/0x351
[   56.283512]  [<ffffffff812e6ddc>] ? usb_hcd_flush_endpoint+0xde/0xed
[   56.283512]  [<ffffffff8144e625>] ? _raw_spin_lock_irqsave+0x14/0x35
[   56.283512]  [<ffffffff812fd361>] ? usb_serial_disconnect+0x57/0xc2
[   56.283512]  [<ffffffff812ea99b>] ? usb_unbind_interface+0x5c/0x131
[   56.283512]  [<ffffffff8128d738>] ? __device_release_driver+0x7f/0xd5
[   56.283512]  [<ffffffff8128d9cd>] ? device_release_driver+0x1a/0x25
[   56.283512]  [<ffffffff8128d393>] ? bus_remove_device+0xd2/0xe7
[   56.283512]  [<ffffffff8128b7a3>] ? device_del+0x119/0x167
[   56.283512]  [<ffffffff812e8d9d>] ? usb_disable_device+0x6a/0x180
[   56.283512]  [<ffffffff812e2ae0>] ? usb_disconnect+0x81/0xe6
[   56.283512]  [<ffffffff812e4435>] ? hub_thread+0x577/0xe82
[   56.283512]  [<ffffffff8144daa7>] ? __schedule+0x490/0x4be
[   56.283512]  [<ffffffff8105798f>] ? abort_exclusive_wait+0x79/0x79
[   56.283512]  [<ffffffff812e3ebe>] ? usb_remote_wakeup+0x2f/0x2f
[   56.283512]  [<ffffffff812e3ebe>] ? usb_remote_wakeup+0x2f/0x2f
[   56.283512]  [<ffffffff810570b4>] ? kthread+0x81/0x89
[   56.283512]  [<ffffffff81057033>] ? __kthread_parkme+0x5c/0x5c
[   56.283512]  [<ffffffff8145387c>] ? ret_from_fork+0x7c/0xb0
[   56.283512]  [<ffffffff81057033>] ? __kthread_parkme+0x5c/0x5c
[   56.283512] Code: 8b 7c 24 08 e8 17 0b c3 ff 48 8b 04 24 48 83 c4 10 c3 53 48 89 fb 41 50 e8 e0 0a c3 ff 48 89 04 24 e8 e7 0a c3 ff ba 00 00 01 00
<f0> 0f c1 13 48 8b 04 24 89 d1 c1 ea 10 66 39 d1 74 07 f3 90 66
[   56.283512] RIP  [<ffffffff8144e62a>] _raw_spin_lock_irqsave+0x19/0x35
[   56.283512]  RSP <ffff88001fa99ab0>
[   56.283512] CR2: 00000000000001c8
[   56.283512] ---[ end trace 49714df27e1679ce ]---

Signed-off-by: Wolfgang Frisch <wfpub@roembden.net>
Cc: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/serial/io_ti.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 3936904..ab49912 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -543,6 +543,9 @@ static void chase_port(struct edgeport_port *port, unsigned long timeout,
 	wait_queue_t wait;
 	unsigned long flags;
 
+	if (!tty)
+		return;
+
 	if (!timeout)
 		timeout = (HZ * EDGE_CLOSING_WAIT)/100;
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 71/74] intel-iommu: Prevent devices with RMRRs from being placed into SI Domain
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (69 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 70/74] USB: io_ti: Fix NULL dereference in chase_port() Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 72/74] igb: release already assigned MSI-X interrupts if setup fails Herton Ronaldo Krzesinski
                   ` (2 subsequent siblings)
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Thomas Mingarelli, Joerg Roedel, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Tom Mingarelli <thomas.mingarelli@hp.com>

commit ea2447f700cab264019b52e2b417d689e052dcfd upstream.

This patch is to prevent non-USB devices that have RMRRs associated with them from
being placed into the SI Domain during init. This fixes the issue where the RMRR info
for devices being placed in and out of the SI Domain gets lost.

Signed-off-by: Thomas Mingarelli <thomas.mingarelli@hp.com>
Tested-by: Shuah Khan <shuah.khan@hp.com>
Reviewed-by: Donald Dutile <ddutile@redhat.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Joerg Roedel <joro@8bytes.org>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/iommu/intel-iommu.c |   31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index f3e77a5..92f5912 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2326,8 +2326,39 @@ static int domain_add_dev_info(struct dmar_domain *domain,
 	return 0;
 }
 
+static bool device_has_rmrr(struct pci_dev *dev)
+{
+	struct dmar_rmrr_unit *rmrr;
+	int i;
+
+	for_each_rmrr_units(rmrr) {
+		for (i = 0; i < rmrr->devices_cnt; i++) {
+			/*
+			 * Return TRUE if this RMRR contains the device that
+			 * is passed in.
+			 */
+			if (rmrr->devices[i] == dev)
+				return true;
+		}
+	}
+	return false;
+}
+
 static int iommu_should_identity_map(struct pci_dev *pdev, int startup)
 {
+
+	/*
+	 * We want to prevent any device associated with an RMRR from
+	 * getting placed into the SI Domain. This is done because
+	 * problems exist when devices are moved in and out of domains
+	 * and their respective RMRR info is lost. We exempt USB devices
+	 * from this process due to their usage of RMRRs that are known
+	 * to not be needed after BIOS hand-off to OS.
+	 */
+	if (device_has_rmrr(pdev) &&
+	    (pdev->class >> 8) != PCI_CLASS_SERIAL_USB)
+		return 0;
+
 	if ((iommu_identity_mapping & IDENTMAP_AZALIA) && IS_AZALIA(pdev))
 		return 1;
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 72/74] igb: release already assigned MSI-X interrupts if setup fails
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (70 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 71/74] intel-iommu: Prevent devices with RMRRs from being placed into SI Domain Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 73/74] usb: chipidea: Allow disabling streaming not only in udc mode Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 74/74] [SCSI] sd: Reshuffle init_sd to avoid crash Herton Ronaldo Krzesinski
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Stefan Assmann, Jeff Kirsher, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Stefan Assmann <sassmann@kpanic.de>

commit 52285b762b3681669215bf1d17ca6143448ab7d3 upstream.

During MSI-X setup the system might run out of vectors. If this happens the
already assigned vectors for this NIC should be freed before trying the
disable MSI-X. Failing to do so results in the following oops.

kernel BUG at drivers/pci/msi.c:341!
[...]
Call Trace:
 [<ffffffff8128f39d>] pci_disable_msix+0x3d/0x60
 [<ffffffffa037d1ce>] igb_reset_interrupt_capability+0x27/0x5c [igb]
 [<ffffffffa037d229>] igb_clear_interrupt_scheme+0x26/0x2d [igb]
 [<ffffffffa0384268>] igb_request_irq+0x73/0x297 [igb]
 [<ffffffffa0384554>] __igb_open+0xc8/0x223 [igb]
 [<ffffffffa0384815>] igb_open+0x13/0x15 [igb]
 [<ffffffff8144592f>] __dev_open+0xbf/0x120
 [<ffffffff81443e51>] __dev_change_flags+0xa1/0x180
 [<ffffffff81445828>] dev_change_flags+0x28/0x70
 [<ffffffff814af537>] devinet_ioctl+0x5b7/0x620
 [<ffffffff814b01c8>] inet_ioctl+0x88/0xa0
 [<ffffffff8142e8a0>] sock_do_ioctl+0x30/0x70
 [<ffffffff8142ecf2>] sock_ioctl+0x72/0x270
 [<ffffffff8118062c>] do_vfs_ioctl+0x8c/0x340
 [<ffffffff81180981>] sys_ioctl+0xa1/0xb0
 [<ffffffff815161a9>] system_call_fastpath+0x16/0x1b
Code: 48 89 df e8 1f 40 ed ff 4d 39 e6 49 8b 45 10 75 b6 48 83 c4 18 5b 41 5c 41 5d 41 5e 41 5f c9 c3 48 8b 7b 20 e8 3e 91 db ff eb ae <0f> 0b eb fe 0f 1f 84 00 00 00 00 00 55 48 89 e5 0f 1f 44 00 00
RIP  [<ffffffff8128e144>] free_msi_irqs+0x124/0x130
 RSP <ffff880037503bd8>

Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/net/ethernet/intel/igb/igb_main.c |   22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index dd3bfe8..64a0f74 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -937,17 +937,18 @@ static int igb_request_msix(struct igb_adapter *adapter)
 {
 	struct net_device *netdev = adapter->netdev;
 	struct e1000_hw *hw = &adapter->hw;
-	int i, err = 0, vector = 0;
+	int i, err = 0, vector = 0, free_vector = 0;
 
 	err = request_irq(adapter->msix_entries[vector].vector,
 	                  igb_msix_other, 0, netdev->name, adapter);
 	if (err)
-		goto out;
-	vector++;
+		goto err_out;
 
 	for (i = 0; i < adapter->num_q_vectors; i++) {
 		struct igb_q_vector *q_vector = adapter->q_vector[i];
 
+		vector++;
+
 		q_vector->itr_register = hw->hw_addr + E1000_EITR(vector);
 
 		if (q_vector->rx.ring && q_vector->tx.ring)
@@ -966,13 +967,22 @@ static int igb_request_msix(struct igb_adapter *adapter)
 		                  igb_msix_ring, 0, q_vector->name,
 		                  q_vector);
 		if (err)
-			goto out;
-		vector++;
+			goto err_free;
 	}
 
 	igb_configure_msix(adapter);
 	return 0;
-out:
+
+err_free:
+	/* free already assigned IRQs */
+	free_irq(adapter->msix_entries[free_vector++].vector, adapter);
+
+	vector--;
+	for (i = 0; i < vector; i++) {
+		free_irq(adapter->msix_entries[free_vector++].vector,
+			 adapter->q_vector[i]);
+	}
+err_out:
 	return err;
 }
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 73/74] usb: chipidea: Allow disabling streaming not only in udc mode
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (71 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 72/74] igb: release already assigned MSI-X interrupts if setup fails Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  2013-01-24  3:27 ` [PATCH 74/74] [SCSI] sd: Reshuffle init_sd to avoid crash Herton Ronaldo Krzesinski
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Fabio Estevam, Greg Kroah-Hartman, Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Fabio Estevam <fabio.estevam@freescale.com>

commit 929473ea05db455ad88cdc081f2adc556b8dc48f upstream.

When running a scp transfer using a USB/Ethernet adapter the following crash
happens:

$ scp test.tar.gz fabio@192.168.1.100:/home/fabio
fabio@192.168.1.100's password:
test.tar.gz                                      0%    0     0.0KB/s   --:-- ETA
------------[ cut here ]------------
WARNING: at net/sched/sch_generic.c:255 dev_watchdog+0x2cc/0x2f0()
NETDEV WATCHDOG: eth0 (asix): transmit queue 0 timed out
Modules linked in:
Backtrace:
[<80011c94>] (dump_backtrace+0x0/0x10c) from [<804d3a5c>] (dump_stack+0x18/0x1c)
 r6:000000ff r5:80412388 r4:80685dc0 r3:80696cc0
[<804d3a44>] (dump_stack+0x0/0x1c) from [<80021868>]
(warn_slowpath_common+0x54/0x6c)
[<80021814>] (warn_slowpath_common+0x0/0x6c) from [<80021924>]
(warn_slowpath_fmt+0x38/0x40)
...

Setting SDIS (Stream Disable Mode- bit 4 of USBMODE register) fixes the problem.

However, in current code CI13XXX_DISABLE_STREAMING flag is only set in udc mode,
so allow disabling streaming also in host mode.

Tested on a mx6qsabrelite board.

Suggested-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Reviewed-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ herton: ci->platdata->flags is ci->udc_driver->flags on 3.5 ]
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/usb/chipidea/host.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
index 9eacd21..2400d18 100644
--- a/drivers/usb/chipidea/host.c
+++ b/drivers/usb/chipidea/host.c
@@ -128,6 +128,9 @@ static int host_start(struct ci13xxx *ci)
 	else
 		ci->hcd = hcd;
 
+	if (ci->udc_driver->flags & CI13XXX_DISABLE_STREAMING)
+		hw_write(ci, OP_USBMODE, USBMODE_CI_SDIS, USBMODE_CI_SDIS);
+
 	return ret;
 }
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* [PATCH 74/74] [SCSI] sd: Reshuffle init_sd to avoid crash
  2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
                   ` (72 preceding siblings ...)
  2013-01-24  3:27 ` [PATCH 73/74] usb: chipidea: Allow disabling streaming not only in udc mode Herton Ronaldo Krzesinski
@ 2013-01-24  3:27 ` Herton Ronaldo Krzesinski
  73 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24  3:27 UTC (permalink / raw)
  To: linux-kernel, stable, kernel-team
  Cc: Joel D. Diaz, Hannes Reinecke, James Bottomley,
	Herton Ronaldo Krzesinski

3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: "Joel D. Diaz" <joeldiaz@us.ibm.com>

commit afd5e34b2bb34881d3a789e62486814a49b47faa upstream.

scsi_register_driver will register a prep_fn() function, which
in turn migh need to use the sd_cdp_pool for DIF.
Which hasn't been initialised at this point, leading to
a crash. So reshuffle the init_sd() and exit_sd() paths
to have the driver registered last.

Signed-off-by: Joel D. Diaz <joeldiaz@us.ibm.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/scsi/sd.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 6f72b80..043395d0 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2920,10 +2920,6 @@ static int __init init_sd(void)
 	if (err)
 		goto err_out;
 
-	err = scsi_register_driver(&sd_template.gendrv);
-	if (err)
-		goto err_out_class;
-
 	sd_cdb_cache = kmem_cache_create("sd_ext_cdb", SD_EXT_CDB_SIZE,
 					 0, 0, NULL);
 	if (!sd_cdb_cache) {
@@ -2937,8 +2933,15 @@ static int __init init_sd(void)
 		goto err_out_cache;
 	}
 
+	err = scsi_register_driver(&sd_template.gendrv);
+	if (err)
+		goto err_out_driver;
+
 	return 0;
 
+err_out_driver:
+	mempool_destroy(sd_cdb_pool);
+
 err_out_cache:
 	kmem_cache_destroy(sd_cdb_cache);
 
@@ -2961,10 +2964,10 @@ static void __exit exit_sd(void)
 
 	SCSI_LOG_HLQUEUE(3, printk("exit_sd: exiting sd driver\n"));
 
+	scsi_unregister_driver(&sd_template.gendrv);
 	mempool_destroy(sd_cdb_pool);
 	kmem_cache_destroy(sd_cdb_cache);
 
-	scsi_unregister_driver(&sd_template.gendrv);
 	class_unregister(&sd_disk_class);
 
 	for (i = 0; i < SD_MAJORS; i++)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 77+ messages in thread

* Re: [PATCH 59/74] drm/nv17-50: restore fence buffer on resume
  2013-01-24  3:27 ` [PATCH 59/74] drm/nv17-50: restore fence buffer on resume Herton Ronaldo Krzesinski
@ 2013-01-24 17:36   ` Marcin Slusarz
  2013-01-24 17:52     ` Herton Ronaldo Krzesinski
  0 siblings, 1 reply; 77+ messages in thread
From: Marcin Slusarz @ 2013-01-24 17:36 UTC (permalink / raw)
  To: Herton Ronaldo Krzesinski; +Cc: linux-kernel, stable, kernel-team, Ben Skeggs

On Thu, Jan 24, 2013 at 01:27:11AM -0200, Herton Ronaldo Krzesinski wrote:
> 3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Marcin Slusarz <marcin.slusarz@gmail.com>
> 
> commit f20ebd034eab43fd38c58b11c5bb5fb125e5f7d7 upstream.
> 
> Since commit 5e120f6e4b3f35b741c5445dfc755f50128c3c44 "drm/nouveau/fence:
> convert to exec engine, and improve channel sync" nouveau fence sync
> implementation for nv17-50 and nvc0+ started to rely on state of fence buffer
> left by previous sync operation. But as pinned bo's (where fence state is
> stored) are not saved+restored across suspend/resume, we need to do it
> manually.
> 
> nvc0+ was fixed by commit d6ba6d215a538a58f0f0026f0961b0b9125e8042
> "drm/nvc0/fence: restore pre-suspend fence buffer context on resume".
> 
> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=50121
> 
> Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
> [ herton: backport for 3.5, looks like we only need to call
>   nouveau_bo_wr32 on nv10_fence_init ]
> Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
> ---
>  drivers/gpu/drm/nouveau/nv10_fence.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/nouveau/nv10_fence.c b/drivers/gpu/drm/nouveau/nv10_fence.c
> index 8a1b750..18932a6 100644
> --- a/drivers/gpu/drm/nouveau/nv10_fence.c
> +++ b/drivers/gpu/drm/nouveau/nv10_fence.c
> @@ -155,6 +155,9 @@ nv10_fence_fini(struct drm_device *dev, int engine, bool suspend)
>  static int
>  nv10_fence_init(struct drm_device *dev, int engine)
>  {
> +	struct nv10_fence_priv *priv = nv_engine(dev, engine);
> +
> +	nouveau_bo_wr32(priv->bo, 0, priv->sequence);
>  	return 0;
>  }
>  
> -- 

As I already mentioned in linked bug report, this backport will crash on module
load for nv10-nv17 cards. priv->bo is created only for chipsets >= nv17.

You need to add "if (priv->bo)" before nouveau_bo_wr32.

Marcin

^ permalink raw reply	[flat|nested] 77+ messages in thread

* Re: [PATCH 59/74] drm/nv17-50: restore fence buffer on resume
  2013-01-24 17:36   ` Marcin Slusarz
@ 2013-01-24 17:52     ` Herton Ronaldo Krzesinski
  0 siblings, 0 replies; 77+ messages in thread
From: Herton Ronaldo Krzesinski @ 2013-01-24 17:52 UTC (permalink / raw)
  To: Marcin Slusarz; +Cc: linux-kernel, stable, kernel-team, Ben Skeggs

On Thu, Jan 24, 2013 at 06:36:52PM +0100, Marcin Slusarz wrote:
> On Thu, Jan 24, 2013 at 01:27:11AM -0200, Herton Ronaldo Krzesinski wrote:
> > 3.5.7.4 -stable review patch.  If anyone has any objections, please let me know.
> > 
> > ------------------
> > 
> > From: Marcin Slusarz <marcin.slusarz@gmail.com>
> > 
> > commit f20ebd034eab43fd38c58b11c5bb5fb125e5f7d7 upstream.
> > 
> > Since commit 5e120f6e4b3f35b741c5445dfc755f50128c3c44 "drm/nouveau/fence:
> > convert to exec engine, and improve channel sync" nouveau fence sync
> > implementation for nv17-50 and nvc0+ started to rely on state of fence buffer
> > left by previous sync operation. But as pinned bo's (where fence state is
> > stored) are not saved+restored across suspend/resume, we need to do it
> > manually.
> > 
> > nvc0+ was fixed by commit d6ba6d215a538a58f0f0026f0961b0b9125e8042
> > "drm/nvc0/fence: restore pre-suspend fence buffer context on resume".
> > 
> > Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=50121
> > 
> > Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
> > Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
> > [ herton: backport for 3.5, looks like we only need to call
> >   nouveau_bo_wr32 on nv10_fence_init ]
> > Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
> > ---
> >  drivers/gpu/drm/nouveau/nv10_fence.c |    3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/nouveau/nv10_fence.c b/drivers/gpu/drm/nouveau/nv10_fence.c
> > index 8a1b750..18932a6 100644
> > --- a/drivers/gpu/drm/nouveau/nv10_fence.c
> > +++ b/drivers/gpu/drm/nouveau/nv10_fence.c
> > @@ -155,6 +155,9 @@ nv10_fence_fini(struct drm_device *dev, int engine, bool suspend)
> >  static int
> >  nv10_fence_init(struct drm_device *dev, int engine)
> >  {
> > +	struct nv10_fence_priv *priv = nv_engine(dev, engine);
> > +
> > +	nouveau_bo_wr32(priv->bo, 0, priv->sequence);
> >  	return 0;
> >  }
> >  
> > -- 
> 
> As I already mentioned in linked bug report, this backport will crash on module
> load for nv10-nv17 cards. priv->bo is created only for chipsets >= nv17.
> 
> You need to add "if (priv->bo)" before nouveau_bo_wr32.

Indeed, thanks. I didn't noticed it on nv10_fence_create. This is the
fixed patch:

>From 93b7083831b7c1e5f6e6c8b9f79268b5a52a316d Mon Sep 17 00:00:00 2001
From: Marcin Slusarz <marcin.slusarz@gmail.com>
Date: Tue, 25 Dec 2012 18:13:22 +0100
Subject: [PATCH] drm/nv17-50: restore fence buffer on resume

commit f20ebd034eab43fd38c58b11c5bb5fb125e5f7d7 upstream.

Since commit 5e120f6e4b3f35b741c5445dfc755f50128c3c44 "drm/nouveau/fence:
convert to exec engine, and improve channel sync" nouveau fence sync
implementation for nv17-50 and nvc0+ started to rely on state of fence buffer
left by previous sync operation. But as pinned bo's (where fence state is
stored) are not saved+restored across suspend/resume, we need to do it
manually.

nvc0+ was fixed by commit d6ba6d215a538a58f0f0026f0961b0b9125e8042
"drm/nvc0/fence: restore pre-suspend fence buffer context on resume".

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=50121

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
[ herton: backport for 3.5, looks like we only need to call
  nouveau_bo_wr32 on nv10_fence_init. Also check priv->bo as it's
  conditionally allocated at nv10_fence_create, reported by Marcin
  Slusarz ]
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
 drivers/gpu/drm/nouveau/nv10_fence.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/nv10_fence.c b/drivers/gpu/drm/nouveau/nv10_fence.c
index 8a1b750..c20370c 100644
--- a/drivers/gpu/drm/nouveau/nv10_fence.c
+++ b/drivers/gpu/drm/nouveau/nv10_fence.c
@@ -155,6 +155,10 @@ nv10_fence_fini(struct drm_device *dev, int engine, bool suspend)
 static int
 nv10_fence_init(struct drm_device *dev, int engine)
 {
+	struct nv10_fence_priv *priv = nv_engine(dev, engine);
+
+	if (priv->bo)
+		nouveau_bo_wr32(priv->bo, 0, priv->sequence);
 	return 0;
 }
 
-- 
1.7.9.5

> 
> Marcin
> 

-- 
[]'s
Herton

^ permalink raw reply related	[flat|nested] 77+ messages in thread

end of thread, other threads:[~2013-01-24 17:52 UTC | newest]

Thread overview: 77+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-24  3:26 [ 3.5.y.z extended stable ] Linux 3.5.7.4 stable review Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 01/74] usb: gadget: dummy: fix enumeration with g_multi Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 02/74] usb: musb: core: print new line in the driver banner again Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 03/74] ASoC: pcm: allow backend hardware to be freed in pause state Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 04/74] ASoC: wm2200: Fix setting dai format in wm2200_set_fmt Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 05/74] mac80211: fix ibss scanning Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 06/74] mac80211: use del_timer_sync for final sta cleanup timer deletion Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 07/74] mac80211: fix dtim_period in hidden SSID AP association Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 08/74] xhci: Handle HS bulk/ctrl endpoints that don't NAK Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 09/74] USB: Handle auto-transition from hot to warm reset Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 10/74] USB: Ignore xHCI Reset Device status Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 11/74] USB: Allow USB 3.0 ports to be disabled Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 12/74] USB: Increase reset timeout Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 13/74] USB: Ignore port state until reset completes Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 14/74] USB: Handle warm reset failure on empty port Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 15/74] xhci: Avoid "dead ports", add roothub port polling Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 16/74] ASoC: wm2200: Remove DSP B and left justified AIF modes Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 17/74] ASoC: wm5100: Remove DSP B and left justified formats Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 18/74] mwifiex: check wait_event_interruptible return value Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 19/74] ASoC: wm2000: Fix sense of speech clarity enable Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 20/74] drm/i915; Only increment the user-pin-count after successfully pinning the bo Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 21/74] samsung-laptop: Add quirk for broken acpi_video backlight on N250P Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 22/74] sony-laptop: fix SNC buffer calls when SN06 returns Integers Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 23/74] staging: r8712u: Add new device ID Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 24/74] b43: Fix firmware loading when driver is built into the kernel Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 25/74] staging: speakup: avoid out-of-range access in synth_init() Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 26/74] staging: speakup: avoid out-of-range access in synth_add() Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 27/74] staging: comedi: fix minimum AO period for NI 625x and NI 628x Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 28/74] staging: comedi: prevent auto-unconfig of manually configured devices Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 29/74] staging: comedi: comedi_test: fix race when cancelling command Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 30/74] regulator: max8997: Use uV in voltage_map_desc Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 31/74] regulator: max8998: Convert to regulator_list_voltage_linear() Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 32/74] regulator: max8998: Convert to set_voltage_sel and regulator_map_voltage_linear Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 33/74] regulator: max8998: Use uV in voltage_map_desc Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 34/74] ALSA: pxa27x: fix ac97 cold reset Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 35/74] ALSA: pxa27x: fix ac97 warm reset Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 36/74] SUNRPC: Ensure we release the socket write lock if the rpc_task exits early Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 37/74] target: use correct sense code for LUN communication failure Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 38/74] Revert "ALSA: hda - Shut up pins at power-saving mode with Conexnat codecs" Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 39/74] regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 40/74] radeon/kms: force rn50 chip to always report connected on analog output Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 41/74] tcm_fc: Do not indicate retry capability to initiators Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 42/74] tcm_fc: Do not report target role when target is not defined Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 43/74] target: Fix use-after-free in LUN RESET handling Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 44/74] target: Release se_cmd when LUN lookup fails for TMR Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 45/74] sh: Fix FDPIC binary loader Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 46/74] USB: option: Add new MEDIATEK PID support Herton Ronaldo Krzesinski
2013-01-24  3:26 ` [PATCH 47/74] USB: option: blacklist network interface on ZTE MF880 Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 48/74] USB: option: add Telekom Speedstick LTE II Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 49/74] USB: option: add Nexpring NP10T terminal id Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 50/74] Add CDC-ACM support for the CX93010-2x UCMxx USB Modem Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 51/74] USB: cdc-acm: Add support for "PSC Scanning, Magellan 800i" Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 52/74] USB: hub: handle claim of enabled remote wakeup after reset Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 53/74] mm: compaction: fix echo 1 > compact_memory return error issue Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 54/74] mm: use aligned zone start for pfn_to_bitidx calculation Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 55/74] mm: bootmem: fix free_all_bootmem_core() with odd bitmap alignment Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 56/74] audit: create explicit AUDIT_SECCOMP event type Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 57/74] USB: Add device quirk for Microsoft VX700 webcam Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 58/74] drm/nouveau: fix blank LVDS screen regression on pre-nv50 cards Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 59/74] drm/nv17-50: restore fence buffer on resume Herton Ronaldo Krzesinski
2013-01-24 17:36   ` Marcin Slusarz
2013-01-24 17:52     ` Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 60/74] usb: ftdi_sio: Crucible Technologies COMET Caller ID - pid added Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 61/74] udldrmfb: Fix EDID not working with monitors with EDID extension blocks Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 62/74] udldrmfb: udl_get_edid: usb_control_msg buffer must not be on the stack Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 63/74] udldrmfb: udl_get_edid: drop unneeded i-- Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 64/74] s390/time: fix sched_clock() overflow Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 65/74] rt2800usb: Add support for 2001:3c1e (D-Link DWA-125 rev B1) USB Wi-Fi adapter Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 66/74] drm/radeon: fix NULL pointer dereference in UMS mode Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 67/74] drm/radeon: fix a bogus kfree Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 68/74] ALSA: usb - fix race in creation of M-Audio Fast track pro driver Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 69/74] x86/Sandy Bridge: reserve pages when integrated graphics is present Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 70/74] USB: io_ti: Fix NULL dereference in chase_port() Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 71/74] intel-iommu: Prevent devices with RMRRs from being placed into SI Domain Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 72/74] igb: release already assigned MSI-X interrupts if setup fails Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 73/74] usb: chipidea: Allow disabling streaming not only in udc mode Herton Ronaldo Krzesinski
2013-01-24  3:27 ` [PATCH 74/74] [SCSI] sd: Reshuffle init_sd to avoid crash Herton Ronaldo Krzesinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).