public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: <linux-usb@vger.kernel.org>
Cc: <sarah.a.sharp@linux.intel.com>, <dan.j.williams@intel.com>,
	<linux-kernel@vger.kernel.org>,
	Mathias Nyman <mathias.nyman@linux.intel.com>
Subject: [RFCv2 06/10] xhci: use command structures for xhci_queue_reset_ep()
Date: Thu, 30 Jan 2014 16:10:23 +0200	[thread overview]
Message-ID: <1391091027-31783-7-git-send-email-mathias.nyman@linux.intel.com> (raw)
In-Reply-To: <1391091027-31783-1-git-send-email-mathias.nyman@linux.intel.com>

Prepare for the global command ring by using command structures
internally in functions calling xhci_queue_reset_ep()

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
 drivers/usb/host/xhci-ring.c | 5 +++++
 drivers/usb/host/xhci.c      | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index df5b0f8..bf50d28 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1913,6 +1913,10 @@ static void xhci_cleanup_halted_endpoint(struct xhci_hcd *xhci,
 		struct xhci_td *td, union xhci_trb *event_trb)
 {
 	struct xhci_virt_ep *ep = &xhci->devs[slot_id]->eps[ep_index];
+	struct xhci_command *command;
+	command = xhci_alloc_command(xhci, false, false, GFP_ATOMIC);
+	if (!command)
+		return;
 	ep->ep_state |= EP_HALTED;
 	ep->stopped_td = td;
 	ep->stopped_trb = event_trb;
@@ -1926,6 +1930,7 @@ static void xhci_cleanup_halted_endpoint(struct xhci_hcd *xhci,
 	ep->stopped_stream = 0;
 
 	xhci_ring_cmd_db(xhci);
+	kfree(command);
 }
 
 /* Check if an error has halted the endpoint ring.  The class driver will
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 0c3f0bc..37a1a7e 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -2908,6 +2908,7 @@ void xhci_endpoint_reset(struct usb_hcd *hcd,
 	unsigned long flags;
 	int ret;
 	struct xhci_virt_ep *virt_ep;
+	struct xhci_command *command;
 
 	xhci = hcd_to_xhci(hcd);
 	udev = (struct usb_device *) ep->hcpriv;
@@ -2930,6 +2931,10 @@ void xhci_endpoint_reset(struct usb_hcd *hcd,
 		return;
 	}
 
+	command = xhci_alloc_command(xhci, false, false, GFP_ATOMIC);
+	if (!command)
+		return;
+
 	xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep,
 			"Queueing reset endpoint command");
 	spin_lock_irqsave(&xhci->lock, flags);
@@ -2948,6 +2953,7 @@ void xhci_endpoint_reset(struct usb_hcd *hcd,
 	virt_ep->stopped_trb = NULL;
 	virt_ep->stopped_stream = 0;
 	spin_unlock_irqrestore(&xhci->lock, flags);
+	kfree(command);
 
 	if (ret)
 		xhci_warn(xhci, "FIXME allocate a new ring segment\n");
-- 
1.8.1.2


  parent reply	other threads:[~2014-01-30 14:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-30 14:10 [RFCv2 00/10] xhci: re-work command queue management Mathias Nyman
2014-01-30 14:10 ` [RFCv2 01/10] xhci: Use command structures when calling xhci_configure_endpoint Mathias Nyman
2014-02-05  2:21   ` Dan Williams
2014-02-05 15:00     ` Mathias Nyman
2014-01-30 14:10 ` [RFCv2 02/10] xhci: use a command structure internally in xhci_address_device() Mathias Nyman
2014-01-30 14:10 ` [RFCv2 03/10] xhci: use command structures for xhci_queue_slot_control() Mathias Nyman
2014-01-30 14:10 ` [RFCv2 04/10] xhci: use command structures for xhci_queue_stop_endpoint() Mathias Nyman
2014-01-30 14:10 ` [RFCv2 05/10] xhci: use command structure for xhci_queue_new_dequeue_state() Mathias Nyman
2014-01-30 14:10 ` Mathias Nyman [this message]
2014-01-30 14:10 ` [RFCv2 07/10] xhci: Use command structured when queuing commands Mathias Nyman
2014-01-30 14:10 ` [RFCv2 08/10] xhci: Add a global command queue Mathias Nyman
2014-02-05  6:57   ` Dan Williams
2014-02-05 22:23     ` Sarah Sharp
2014-01-30 14:10 ` [RFCv2 09/10] xhci: Use completion and status in " Mathias Nyman
2014-01-30 14:10 ` [RFCv2 10/10] xhci: rework command timeout and cancellation, Mathias Nyman
2014-01-30 14:25 ` [RFCv2 00/10] xhci: re-work command queue management David Laight
2014-01-30 22:39   ` Sarah Sharp
2014-02-05  2:35   ` Dan Williams
2014-02-05  9:22     ` David Laight
2014-02-05 16:48       ` Dan Williams
2014-02-05 17:05         ` David Laight
2014-02-05 17:27           ` Dan Williams

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=1391091027-31783-7-git-send-email-mathias.nyman@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sarah.a.sharp@linux.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