From patchwork Mon Sep 28 15:05:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 54205 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id A38E422B1E for ; Mon, 28 Sep 2015 15:05:22 +0000 (UTC) Received: by laak17 with SMTP id k17sf11451901laa.3 for ; Mon, 28 Sep 2015 08:05:21 -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 :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=0YqmJPXT0MqsAX18ta0KNi77aBmmMSJuJTWVwQWMDT4=; b=V39S8ySIbOaWR2FwbqQc6n4S5afIjBqaHAgt/zAbH1TRy50O2b2j9h6hFc+lyno+pR 1O/nKJI6YssqROsSh4S2iS3R+h1Ht0aM4KskXExQAvtKX5i7rfReB5CeW9MnwXA529OK vBY+lmRBgaFqM7BEo9d1o9LOsgfpsT4ui+fk9Otyzv3EKueZI0NE5ggcBPLM8qdoAQny 1y8lMQB5LGZGsg7338SgWgRh0r6dMDHVD7nXO7HNOXmU9uVL/jkDB5+7hWY9hBD+kScC Tz2sMs9OV5pNAeYgUUkxxwobLqSdctaiMw/UReJJWii5tkDDzWZcuICFyv1hyDwwR6MN LUoQ== X-Gm-Message-State: ALoCoQkvbH7uHs5PLJJGWt7a6jPW7KoYT1yTS5VN4efk78L3ExV+aTXx0STdbYlU/qowKiSyCPDD X-Received: by 10.180.105.98 with SMTP id gl2mr2956184wib.0.1443452721502; Mon, 28 Sep 2015 08:05:21 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.84.1 with SMTP id i1ls335454lfb.15.gmail; Mon, 28 Sep 2015 08:05:21 -0700 (PDT) X-Received: by 10.112.13.40 with SMTP id e8mr5532966lbc.82.1443452721197; Mon, 28 Sep 2015 08:05:21 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com. [209.85.215.46]) by mx.google.com with ESMTPS id x6si8477392lag.4.2015.09.28.08.05.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Sep 2015 08:05:20 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by laclj5 with SMTP id lj5so69683702lac.3 for ; Mon, 28 Sep 2015 08:05:20 -0700 (PDT) X-Received: by 10.25.40.130 with SMTP id o124mr3666056lfo.41.1443452720760; Mon, 28 Sep 2015 08:05:20 -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 w3csp1606283lbq; Mon, 28 Sep 2015 08:05:19 -0700 (PDT) X-Received: by 10.69.1.5 with SMTP id bc5mr23784442pbd.151.1443452719691; Mon, 28 Sep 2015 08:05:19 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qz6si29090219pac.212.2015.09.28.08.05.19; Mon, 28 Sep 2015 08:05:19 -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 S933787AbbI1PFQ (ORCPT + 4 others); Mon, 28 Sep 2015 11:05:16 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:41681 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933483AbbI1PFP (ORCPT ); Mon, 28 Sep 2015 11:05:15 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id t8SF5FSE025589 for ; Mon, 28 Sep 2015 10:05:15 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8SF5Fur009618 for ; Mon, 28 Sep 2015 10:05:15 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.224.2; Mon, 28 Sep 2015 10:05:15 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8SF5EGP026433; Mon, 28 Sep 2015 10:05:14 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Felipe Balbi Subject: [PATCH] usb: dwc3: gadget: start transfer on XFER_COMPLETE Date: Mon, 28 Sep 2015 10:05:12 -0500 Message-ID: <1443452712-8228-1-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.5.0.GIT 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.215.46 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: , if by the time we get to XFER_COMPLETE we have pending requests to be processed, instead of waiting for a following XFER_NOT_READY, let's start the request right away and, maybe, save the time of a few NAKs due to lack of started transfers. Signed-off-by: Felipe Balbi --- drivers/usb/dwc3/gadget.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 201e12342447..c57e2002bcff 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1967,6 +1967,14 @@ static void dwc3_endpoint_transfer_complete(struct dwc3 *dwc, dwc->u1u2 = 0; } + + if (is_xfer_complete && !usb_endpoint_xfer_isoc(dep->endpoint.desc)) { + int ret; + + ret = __dwc3_gadget_kick_transfer(dep, 0, 1); + if (!ret || ret == -EBUSY) + return; + } } static void dwc3_endpoint_interrupt(struct dwc3 *dwc,