From patchwork Tue Sep 15 17:52:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 53697 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by patches.linaro.org (Postfix) with ESMTPS id D590C22A0D for ; Tue, 15 Sep 2015 17:52:38 +0000 (UTC) Received: by wisv5 with SMTP id v5sf11111796wis.0 for ; Tue, 15 Sep 2015 10:52:38 -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=AH3pcMlYt3KXSrtHFzl0hPaY8iRXaMN6Ue1phfV2sbw=; b=OjmDac7TwDlh1KY/hMyWUw7TLYlpdAsw/DIIa3lKm1PoSeOwjlNtqonjPP5ri1o2ro awJEEz0ru6wyVgNI62U+4Ez3v1BNabFeby3cRsHdP6DY0pDPzWZmddbCky/mrIiIYN/2 Gs+g4z0NIs3m5DTsMGsSSiEzLOVIvaNnC62HyKe/9s8QJwu0/xKFjoxc+KLIb6eT8i3U 4EbuyxdUbo3PVBm3ppxpgFuy4PATfYg/Xr1uOUGqGg9mu5B4AizU+AwXd+Eq1FBGVCtY xEgC6AZqEwkmVS6f5O6sp82+fAMeqsksHLAgiNTWaS/Z7bkoYBeQuW/keb3An5l0iLIz f11w== X-Gm-Message-State: ALoCoQkSkijmhVP7JbAtx7FfKmX/I8yspKwtUuBsXSuhyOfkA4h0x/85BxJt3fxVnw1C4nTC7NpQ X-Received: by 10.180.81.165 with SMTP id b5mr1052199wiy.1.1442339558166; Tue, 15 Sep 2015 10:52:38 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.138 with SMTP id lc10ls480597lab.90.gmail; Tue, 15 Sep 2015 10:52:38 -0700 (PDT) X-Received: by 10.112.181.162 with SMTP id dx2mr23257048lbc.75.1442339558000; Tue, 15 Sep 2015 10:52:38 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id m10si15111927lae.1.2015.09.15.10.52.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Sep 2015 10:52:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lamp12 with SMTP id p12so111671029lam.0 for ; Tue, 15 Sep 2015 10:52:37 -0700 (PDT) X-Received: by 10.152.170.225 with SMTP id ap1mr14263785lac.72.1442339557914; Tue, 15 Sep 2015 10:52:37 -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 w3csp1949363lbq; Tue, 15 Sep 2015 10:52:37 -0700 (PDT) X-Received: by 10.68.166.97 with SMTP id zf1mr49442711pbb.72.1442339553974; Tue, 15 Sep 2015 10:52:33 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qp7si33602949pbc.93.2015.09.15.10.52.33; Tue, 15 Sep 2015 10:52:33 -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 S1751809AbbIORwb (ORCPT + 4 others); Tue, 15 Sep 2015 13:52:31 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:43664 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751694AbbIORw1 (ORCPT ); Tue, 15 Sep 2015 13:52:27 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id t8FHqRED003764 for ; Tue, 15 Sep 2015 12:52:27 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8FHqQ72022305 for ; Tue, 15 Sep 2015 12:52:26 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.224.2; Tue, 15 Sep 2015 12:52:27 -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 t8FHqQIa017712; Tue, 15 Sep 2015 12:52:26 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Felipe Balbi Subject: [PATCH 3/5] usb: dwc3: gadget: clear DWC3_PENDING_REQUEST when request is queued Date: Tue, 15 Sep 2015 12:52:20 -0500 Message-ID: <1442339542-17090-4-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1442339542-17090-1-git-send-email-balbi@ti.com> References: <1442339542-17090-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.215.50 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 a0d3a4e762c5..8ef6c57ab918 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); @@ -1108,6 +1107,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; }