From patchwork Tue Sep 15 19:16:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 53704 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 1DE3F22A0D for ; Tue, 15 Sep 2015 19:16:29 +0000 (UTC) Received: by wicmn1 with SMTP id mn1sf12025150wic.1 for ; Tue, 15 Sep 2015 12:16:28 -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=s65dQH4dFKYXqnHjKalmN0XIMyN35TaS/+W62LEf9uk=; b=ma8uorVg+KaHeb6s4bWVRvGlXdIvmipy/Xy/uXPrwfLmtX4HAQqLE2wvJAz69Bf9h9 mEGeAaH5yb3jOu6FEXT5jeB4cSgfU95bI+DsQlHF9grwMiY2VwohoJigJRjrpezvEuxc 3qBXItz1tBDMySaeKSTnd8rcaz35GFqsDFEdi4qfBhusE3wu6kVXNb5fZwH3jWtTnZFY qTiKvTFC2br5bmX8PnqzekKH2777QZ17kSvU+M7oFGNNzdwhdoc+Wkpko7gYTYQXhLVU AFkwxdk46sJJAgyZ3b1Tl3V0cAduGSvHi0rXu02NqHWuf7TlgCEb2wzZ1uaEmTN1gVfo JPsQ== X-Gm-Message-State: ALoCoQkEjml1KrM18EnmKR3d9TP1Tk4EILagMrWWk02+AlxLJ8kZHJ68a1Obz2KerygsR0D29N5F X-Received: by 10.180.87.199 with SMTP id ba7mr1126469wib.5.1442344588419; Tue, 15 Sep 2015 12:16:28 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.28.170 with SMTP id c10ls770631lah.14.gmail; Tue, 15 Sep 2015 12:16:28 -0700 (PDT) X-Received: by 10.112.146.104 with SMTP id tb8mr22195940lbb.35.1442344588250; Tue, 15 Sep 2015 12:16:28 -0700 (PDT) Received: from mail-lb0-f170.google.com (mail-lb0-f170.google.com. [209.85.217.170]) by mx.google.com with ESMTPS id az8si15436571lbc.148.2015.09.15.12.16.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Sep 2015 12:16:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.170 as permitted sender) client-ip=209.85.217.170; Received: by lbbmp1 with SMTP id mp1so91150931lbb.1 for ; Tue, 15 Sep 2015 12:16:28 -0700 (PDT) X-Received: by 10.112.125.134 with SMTP id mq6mr24109810lbb.19.1442344588156; Tue, 15 Sep 2015 12:16:28 -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 w3csp1990155lbq; Tue, 15 Sep 2015 12:16:27 -0700 (PDT) X-Received: by 10.50.93.42 with SMTP id cr10mr8690058igb.19.1442344580482; Tue, 15 Sep 2015 12:16:20 -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.20; Tue, 15 Sep 2015 12:16:20 -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 S1752110AbbIOTQP (ORCPT + 4 others); Tue, 15 Sep 2015 15:16:15 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:49889 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751622AbbIOTQO (ORCPT ); Tue, 15 Sep 2015 15:16:14 -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 t8FJGDd9016032 for ; Tue, 15 Sep 2015 14:16:13 -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 t8FJGDRm002799 for ; Tue, 15 Sep 2015 14:16:13 -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:13 -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 t8FJGC4M023942; Tue, 15 Sep 2015 14:16:13 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Felipe Balbi Subject: [PATCH v2 3/5] usb: dwc3: gadget: clear DWC3_PENDING_REQUEST when request is queued Date: Tue, 15 Sep 2015 14:16:06 -0500 Message-ID: <1442344568-1820-4-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.170 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: , Instead of clearing DWC3_PENDING_REQUEST when we start transfer, let's do it when the request is actually queued, that way we know for sure that we're clearing in the right time. Signed-off-by: Felipe Balbi --- drivers/usb/dwc3/gadget.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 6df473427b6d..a0d77b231b77 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -948,7 +948,6 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param, dwc3_trace(trace_dwc3_gadget, "%s: endpoint busy", dep->name); return -EBUSY; } - dep->flags &= ~DWC3_EP_PENDING_REQUEST; cmd = DWC3_DEPCMD_UPDATETRANSFER | DWC3_DEPCMD_PARAM(cmd_param); @@ -1109,6 +1108,10 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) if (ret && ret != -EBUSY) dev_dbg(dwc->dev, "%s: failed to kick transfers\n", dep->name); + + if (!ret) + dep->flags &= ~DWC3_EP_PENDING_REQUEST; + return ret; }