From patchwork Thu Sep 17 16:44:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 53837 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by patches.linaro.org (Postfix) with ESMTPS id 7242D22A0D for ; Thu, 17 Sep 2015 16:45:50 +0000 (UTC) Received: by wicmn1 with SMTP id mn1sf9683633wic.1 for ; Thu, 17 Sep 2015 09:45:49 -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=kYQJQ64R5/GR1wtvRH2ZmNSCvQt5NTiQ8pt4ncaQuSA=; b=UpSMrWy8ypMAdtE7PsR2wIWDpzlct3B7a8GHuKAqFwT0VCFEr/DmXUEzoH2PJwUpVB zSGRC8IGOH8GSbqS23y+mM6C99L69oRgxkjo04/SpNgF0pW07vI0ZEVNvwZuQinD+nZa ooJDgXQBhusPHd3fJaskBg32Mu/ApkilSdDe/yArROr+JSMKNC2RVRDzfIaWGivvVFe6 t2Cj50K1x6cHU69Z7y+bbkaiXvZyY4IOoHLl5FcTeREuCsDNba0z40Cx7emA480n8Oy8 TcGi+tOilih5G46K2MFGaKiw1ACM+IrhWJzz9mHj2eI4y0gI1KHs5vmlxHFAqzJV+z6i 5vHg== X-Gm-Message-State: ALoCoQkwsmga2AnP/yky1c9afv0x4K0L2hBtmcR3q4nWW4JzrPZh7g3B3b2+IswIqSP9BLAMxo86 X-Received: by 10.112.189.105 with SMTP id gh9mr20263lbc.16.1442508349782; Thu, 17 Sep 2015 09:45:49 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.143.4 with SMTP id sa4ls109171lab.44.gmail; Thu, 17 Sep 2015 09:45:49 -0700 (PDT) X-Received: by 10.112.144.101 with SMTP id sl5mr66111lbb.115.1442508349634; Thu, 17 Sep 2015 09:45:49 -0700 (PDT) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id h5si2907882lam.118.2015.09.17.09.45.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Sep 2015 09:45:49 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by lbbmp1 with SMTP id mp1so12494449lbb.1 for ; Thu, 17 Sep 2015 09:45:49 -0700 (PDT) X-Received: by 10.112.125.134 with SMTP id mq6mr117914lbb.19.1442508349543; Thu, 17 Sep 2015 09:45:49 -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 w3csp3179161lbq; Thu, 17 Sep 2015 09:45:48 -0700 (PDT) X-Received: by 10.50.110.73 with SMTP id hy9mr8288097igb.8.1442508348441; Thu, 17 Sep 2015 09:45:48 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x9si6535874pbt.15.2015.09.17.09.45.48; Thu, 17 Sep 2015 09:45:48 -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 S1751175AbbIQQpp (ORCPT + 4 others); Thu, 17 Sep 2015 12:45:45 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:48408 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751697AbbIQQpF (ORCPT ); Thu, 17 Sep 2015 12:45:05 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id t8HGj5B3019911 for ; Thu, 17 Sep 2015 11:45:05 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8HGj437011892 for ; Thu, 17 Sep 2015 11:45:05 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.224.2; Thu, 17 Sep 2015 11:45:05 -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 t8HGj4Se008112; Thu, 17 Sep 2015 11:45:04 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Felipe Balbi Subject: [PATCH RESEND 3/4] usb: dwc3: gadget: improve ep_queue's error reporting Date: Thu, 17 Sep 2015 11:44:59 -0500 Message-ID: <1442508300-20858-3-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1442508300-20858-1-git-send-email-balbi@ti.com> References: <1442508300-20858-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.177 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: , We shouldn't return -EBUSY, that's used only internally when the core still has transfers in flight on a given endpoint. Also, combine the error reporting so that we don't have to duplicate it. Signed-off-by: Felipe Balbi --- drivers/usb/dwc3/gadget.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 2cc6a33438dc..858d88373305 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1080,10 +1080,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); - if (ret && ret != -EBUSY) - dev_dbg(dwc->dev, "%s: failed to kick transfers\n", - dep->name); - return ret; + goto out; } /* @@ -1113,14 +1110,10 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) } ret = __dwc3_gadget_kick_transfer(dep, 0, true); - 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; + goto out; } /* @@ -1134,10 +1127,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) WARN_ON_ONCE(!dep->resource_index); ret = __dwc3_gadget_kick_transfer(dep, dep->resource_index, false); - if (ret && ret != -EBUSY) - dev_dbg(dwc->dev, "%s: failed to kick transfers\n", - dep->name); - return ret; + goto out; } /* @@ -1145,14 +1135,17 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) * right away, otherwise host will not know we have streams to be * handled. */ - if (dep->stream_capable) { + if (dep->stream_capable) ret = __dwc3_gadget_kick_transfer(dep, 0, true); - if (ret && ret != -EBUSY) - dev_dbg(dwc->dev, "%s: failed to kick transfers\n", - dep->name); - } - return 0; +out: + if (ret && ret != -EBUSY) + dev_dbg(dwc->dev, "%s: failed to kick transfers\n", + dep->name); + if (ret == -EBUSY) + ret = 0; + + return ret; } static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,