From patchwork Mon Apr 16 12:29:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 10342903 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DE98A601D7 for ; Mon, 16 Apr 2018 12:31:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFB7B286F3 for ; Mon, 16 Apr 2018 12:31:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDF662870B; Mon, 16 Apr 2018 12:31:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 160F628727 for ; Mon, 16 Apr 2018 12:31:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753316AbeDPMbb (ORCPT ); Mon, 16 Apr 2018 08:31:31 -0400 Received: from mga14.intel.com ([192.55.52.115]:52808 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753696AbeDPMa2 (ORCPT ); Mon, 16 Apr 2018 08:30:28 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Apr 2018 05:30:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,459,1517904000"; d="scan'208";a="220773833" Received: from pipin.fi.intel.com (HELO localhost) ([10.237.68.37]) by fmsmga005.fm.intel.com with ESMTP; 16 Apr 2018 05:30:26 -0700 From: Felipe Balbi To: Mathias Nyman Cc: Linux USB , Felipe Balbi Subject: [PATCH 01/20] usb: host: xhci: rename queue_bulk_tx() to queue_bulk_intr_tx() Date: Mon, 16 Apr 2018 15:29:11 +0300 Message-Id: <20180416122930.15697-1-felipe.balbi@linux.intel.com> X-Mailer: git-send-email 2.16.1 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP That function is used for both Bulk and Interrupt transfer types, let's make it clear on the function name and provide one extra helper for queueing bulk transfers. Signed-off-by: Felipe Balbi --- drivers/usb/host/xhci-ring.c | 23 +++++++++++++++++++++-- drivers/usb/host/xhci.c | 6 ------ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 91a1a824673d..e9c6053f90c5 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -3064,6 +3064,9 @@ static void check_interval(struct xhci_hcd *xhci, struct urb *urb, } } +static int xhci_queue_bulk_intr_tx(struct xhci_hcd *xhci, gfp_t mem_flags, + struct urb *urb, int slot_id, unsigned int ep_index); + /* * xHCI uses normal TRBs for both bulk and interrupt. When the interrupt * endpoint is to be serviced, the xHC will consume (at most) one TD. A TD @@ -3078,7 +3081,23 @@ int xhci_queue_intr_tx(struct xhci_hcd *xhci, gfp_t mem_flags, ep_ctx = xhci_get_ep_ctx(xhci, xhci->devs[slot_id]->out_ctx, ep_index); check_interval(xhci, urb, ep_ctx); - return xhci_queue_bulk_tx(xhci, mem_flags, urb, slot_id, ep_index); + return xhci_queue_bulk_intr_tx(xhci, mem_flags, urb, slot_id, ep_index); +} + +int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, + struct urb *urb, int slot_id, unsigned int ep_index) +{ + unsigned int ep_state; + + ep_state = xhci->devs[slot_id]->eps[ep_index].ep_state; + + if (ep_state & (EP_GETTING_STREAMS | EP_GETTING_NO_STREAMS)) { + xhci_warn(xhci, "WARN: Can't enqueue URB, ep in streams transition state %x\n", + ep_state); + return -EINVAL; + } + + return xhci_queue_bulk_intr_tx(xhci, mem_flags, urb, slot_id, ep_index); } /* @@ -3189,7 +3208,7 @@ static int xhci_align_td(struct xhci_hcd *xhci, struct urb *urb, u32 enqd_len, } /* This is very similar to what ehci-q.c qtd_fill() does */ -int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, +static int xhci_queue_bulk_intr_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, int slot_id, unsigned int ep_index) { struct xhci_ring *ring; diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 9b27798ecce5..65c454b94165 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1353,12 +1353,6 @@ static int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag ret = -ESHUTDOWN; goto free_priv; } - if (*ep_state & (EP_GETTING_STREAMS | EP_GETTING_NO_STREAMS)) { - xhci_warn(xhci, "WARN: Can't enqueue URB, ep in streams transition state %x\n", - *ep_state); - ret = -EINVAL; - goto free_priv; - } if (*ep_state & EP_SOFT_CLEAR_TOGGLE) { xhci_warn(xhci, "Can't enqueue URB while manually clearing toggle\n"); ret = -EINVAL;