From patchwork Tue Sep 15 19:16:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 53702 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by patches.linaro.org (Postfix) with ESMTPS id 09A0922A0D for ; Tue, 15 Sep 2015 19:16:24 +0000 (UTC) Received: by lanb10 with SMTP id b10sf64770004lan.3 for ; Tue, 15 Sep 2015 12:16:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=b79DpvmdIj1W0PELR7c7nbK9uWxGu7RHMvDS6UzCsgA=; b=EkkVM0tPojtmYJJX9WvXcc1LBZy/n2FGDVH5NTJmmq6/Te//39voihHCoy1NhYBCO8 OvWKm8VuenqwhtfjAr201A1/Up+TR97W1YJe7P+zzK+a8RAjrEhKFpRKO5XdWzXCFMt4 cFrCh5i7GNRLToJYknmjDZ7nZkKHSu65mLQSxagGLFhReSnk5V0rH0QYmGHjUhFp7aHP Sqrxf0h6Qkk+RxMcMt6sWI81dgLb7x4ioBJAQGfGwY9yLuTZILwsPwb6wByDEVrbGl/e dP95nblZ9T8/UjkaiD88sfdg+SXa/X1OglqJpBnIiy1VNUBSZ1Y6O+ZD/5HwxIvVziCR tsyA== X-Gm-Message-State: ALoCoQkkTgpPVHjfjd6DhqsqxLzKOI+NM8wOeswHfwXqwo/FJiszbxzhfsXKYSGFChNtK1fXc7b5 X-Received: by 10.180.106.197 with SMTP id gw5mr1125615wib.7.1442344583038; Tue, 15 Sep 2015 12:16:23 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.22.10 with SMTP id z10ls410456lae.88.gmail; Tue, 15 Sep 2015 12:16:22 -0700 (PDT) X-Received: by 10.112.189.161 with SMTP id gj1mr24096818lbc.20.1442344582874; Tue, 15 Sep 2015 12:16:22 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id ua1si15459204lbb.29.2015.09.15.12.16.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Sep 2015 12:16:22 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbpo4 with SMTP id o4so91381794lbp.2 for ; Tue, 15 Sep 2015 12:16:22 -0700 (PDT) X-Received: by 10.112.199.70 with SMTP id ji6mr24112654lbc.73.1442344582772; Tue, 15 Sep 2015 12:16:22 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1990109lbq; Tue, 15 Sep 2015 12:16:21 -0700 (PDT) X-Received: by 10.50.80.12 with SMTP id n12mr217894igx.5.1442344578336; Tue, 15 Sep 2015 12:16:18 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7si13572503igo.56.2015.09.15.12.16.18; Tue, 15 Sep 2015 12:16:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751797AbbIOTQP (ORCPT + 4 others); Tue, 15 Sep 2015 15:16:15 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:36349 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750965AbbIOTQO (ORCPT ); Tue, 15 Sep 2015 15:16:14 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id t8FJGEgb020633 for ; Tue, 15 Sep 2015 14:16:14 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8FJGElI009541 for ; Tue, 15 Sep 2015 14:16:14 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.224.2; Tue, 15 Sep 2015 14:16:14 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8FJGDeM023973; Tue, 15 Sep 2015 14:16:14 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Felipe Balbi Subject: [PATCH v2 4/5] usb: dwc3: gadget: remove 'start_new' parameter Date: Tue, 15 Sep 2015 14:16:07 -0500 Message-ID: <1442344568-1820-5-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1442344568-1820-1-git-send-email-balbi@ti.com> References: <1442344568-1820-1-git-send-email-balbi@ti.com> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The start_new parameter for dwc3_gadget_kick_transfer() is now rendered pointless since driver understands that it should use Update Transfer command when the queue is busy. Let's remove that parameter and make sure we can update transfers which are still in flight. Signed-off-by: Felipe Balbi --- drivers/usb/dwc3/gadget.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index a0d77b231b77..ab9db6b8d707 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -935,8 +935,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting) } } -static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param, - int start_new) +static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param) { struct dwc3_gadget_ep_cmd_params params; struct dwc3_request *req; @@ -944,11 +943,6 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param, int ret; u32 cmd; - if (start_new && (dep->flags & DWC3_EP_BUSY)) { - dwc3_trace(trace_dwc3_gadget, "%s: endpoint busy", dep->name); - return -EBUSY; - } - cmd = DWC3_DEPCMD_UPDATETRANSFER | DWC3_DEPCMD_PARAM(cmd_param); @@ -958,7 +952,7 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param, */ if (list_empty(&dep->req_queued) && !(dep->flags & DWC3_EP_BUSY)) { - dwc3_prepare_trbs(dep, start_new); + dwc3_prepare_trbs(dep, true); cmd = DWC3_DEPCMD_STARTTRANSFER; } @@ -992,7 +986,7 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param, dep->flags |= DWC3_EP_BUSY; - if (start_new) { + if (cmd == DWC3_DEPCMD_STARTTRANSFER) { dep->resource_index = dwc3_gadget_ep_get_transfer_index(dwc, dep->number); WARN_ON_ONCE(!dep->resource_index); @@ -1017,7 +1011,7 @@ static void __dwc3_gadget_start_isoc(struct dwc3 *dwc, /* 4 micro frames in the future */ uf = cur_uf + dep->interval * 4; - __dwc3_gadget_kick_transfer(dep, uf, 1); + __dwc3_gadget_kick_transfer(dep, uf); } static void dwc3_gadget_start_isoc(struct dwc3 *dwc, @@ -1071,7 +1065,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) */ if (!usb_endpoint_xfer_isoc(dep->endpoint.desc) && !(dep->flags & DWC3_EP_BUSY)) { - ret = __dwc3_gadget_kick_transfer(dep, 0, true); + ret = __dwc3_gadget_kick_transfer(dep, 0); if (ret && ret != -EBUSY) dev_dbg(dwc->dev, "%s: failed to kick transfers\n", dep->name); @@ -1104,7 +1098,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) return 0; } - ret = __dwc3_gadget_kick_transfer(dep, 0, true); + ret = __dwc3_gadget_kick_transfer(dep, 0); if (ret && ret != -EBUSY) dev_dbg(dwc->dev, "%s: failed to kick transfers\n", dep->name); @@ -1124,8 +1118,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) (dep->flags & DWC3_EP_BUSY) && !(dep->flags & DWC3_EP_MISSED_ISOC)) { WARN_ON_ONCE(!dep->resource_index); - ret = __dwc3_gadget_kick_transfer(dep, dep->resource_index, - false); + ret = __dwc3_gadget_kick_transfer(dep, dep->resource_index); if (ret && ret != -EBUSY) dev_dbg(dwc->dev, "%s: failed to kick transfers\n", dep->name); @@ -1138,7 +1131,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) * handled. */ if (dep->stream_capable) { - ret = __dwc3_gadget_kick_transfer(dep, 0, true); + ret = __dwc3_gadget_kick_transfer(dep, 0); if (ret && ret != -EBUSY) dev_dbg(dwc->dev, "%s: failed to kick transfers\n", dep->name); @@ -2011,7 +2004,7 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc, ? "Transfer Active" : "Transfer Not Active"); - ret = __dwc3_gadget_kick_transfer(dep, 0, 1); + ret = __dwc3_gadget_kick_transfer(dep, 0); if (!ret || ret == -EBUSY) return;