mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@ti.com>
To: <mathias.nyman@intel.com>
Cc: <balbi@ti.com>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, Roger Quadros <rogerq@ti.com>
Subject: [PATCH 1/5] usb: xhci: lock mutex on xhci_stop
Date: Tue, 18 Aug 2015 13:39:10 +0300	[thread overview]
Message-ID: <1439894354-6160-2-git-send-email-rogerq@ti.com> (raw)
In-Reply-To: <1439894354-6160-1-git-send-email-rogerq@ti.com>

Else it races with xhci_setup_device

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/host/xhci.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 526ebc0..f998ddf 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -677,8 +677,11 @@ void xhci_stop(struct usb_hcd *hcd)
 	u32 temp;
 	struct xhci_hcd *xhci = hcd_to_xhci(hcd);
 
+	mutex_lock(&xhci->mutex);
+
 	if (!usb_hcd_is_primary_hcd(hcd)) {
 		xhci_only_stop_hcd(xhci->shared_hcd);
+		mutex_unlock(&xhci->mutex);
 		return;
 	}
 
@@ -717,6 +720,7 @@ void xhci_stop(struct usb_hcd *hcd)
 	xhci_dbg_trace(xhci, trace_xhci_dbg_init,
 			"xhci_stop completed - status = %x",
 			readl(&xhci->op_regs->status));
+	mutex_unlock(&xhci->mutex);
 }
 
 /*
-- 
2.1.4


  reply	other threads:[~2015-08-18 10:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-18 10:39 [PATCH 0/5] usb: xhci: Fix breakage on dual-role case Roger Quadros
2015-08-18 10:39 ` Roger Quadros [this message]
2015-08-18 11:39   ` [PATCH 1/5] usb: xhci: lock mutex on xhci_stop Mathias Nyman
2015-08-18 10:39 ` [PATCH 2/5] usb: hcd: Initialize hcd->flags to 0 Roger Quadros
2015-08-18 10:39 ` [PATCH 3/5] usb: xhci: Clear XHCI_STATE_DYING on start Roger Quadros
2015-08-18 11:43   ` Mathias Nyman
2015-08-18 10:39 ` [PATCH 4/5] usb: xhci: stop everything on the first call to xhci_stop Roger Quadros
2015-08-18 12:14   ` Mathias Nyman
2015-08-20  6:42     ` Roger Quadros
2015-08-18 10:39 ` [PATCH 5/5] usb: xhci: exit early in xhci_setup_device() if we're halted or dying Roger Quadros
2015-08-18 12:17   ` Mathias Nyman
2015-08-20  7:09 ` [PATCH 0/5] usb: xhci: Fix breakage on dual-role case Roger Quadros
2015-08-27 11:18   ` Mathias Nyman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1439894354-6160-2-git-send-email-rogerq@ti.com \
    --to=rogerq@ti.com \
    --cc=balbi@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome