From patchwork Thu Sep 17 16:42:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 53832 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 4FD8922A0D for ; Thu, 17 Sep 2015 16:42:59 +0000 (UTC) Received: by wicgb1 with SMTP id gb1sf9628092wic.3 for ; Thu, 17 Sep 2015 09:42:58 -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=jKrHrpQNrWuqsr05EHO/+zSfJmy4oidPMLjoA2l6wDn4gUV64hTMhFC2ZfKLn5yslH l+Lo6oUcxaao+kLrnXuFi0CURWmTyy6Ahw6Bz3PaD+PEI5VNTM7orXz7thi1ovxCLZrJ U7rPFPPYG5rmaa1zfFqi74YLWCECAyy52p11O3sJcynC8BqvJK4LmDXC587VM72LoE6k eDWPTNFwjQcUIo2l7ADubKFj3OazG/OCVi1Y8ZKnW/Dc63UGTzhC0Ajhgsq6xQyC8/5Z 4v5qQ72IJYAhWxNr/+AZpP2UUxKfEAt44i/PjTG+Ne0FGHqeOFz4fEIiVIJbT31Kp28N FWJQ== X-Gm-Message-State: ALoCoQmAchp7U3UbTsckvZTyAgo2UKIn00cdXORVot2CZHsovGGjtv9x4IhL1NF6hBbp03Atdu4m X-Received: by 10.180.35.132 with SMTP id h4mr3297717wij.5.1442508178610; Thu, 17 Sep 2015 09:42:58 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.199 with SMTP id a7ls108647lak.75.gmail; Thu, 17 Sep 2015 09:42:58 -0700 (PDT) X-Received: by 10.112.157.68 with SMTP id wk4mr45072lbb.119.1442508178447; Thu, 17 Sep 2015 09:42:58 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id h4si2785186lbj.32.2015.09.17.09.42.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Sep 2015 09:42:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by lamp12 with SMTP id p12so14694336lam.0 for ; Thu, 17 Sep 2015 09:42:58 -0700 (PDT) X-Received: by 10.112.130.70 with SMTP id oc6mr165598lbb.32.1442508178351; Thu, 17 Sep 2015 09:42:58 -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 w3csp3177697lbq; Thu, 17 Sep 2015 09:42:57 -0700 (PDT) X-Received: by 10.68.180.131 with SMTP id do3mr56361pbc.133.1442508175364; Thu, 17 Sep 2015 09:42:55 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id dn2si6446320pbb.210.2015.09.17.09.42.55; Thu, 17 Sep 2015 09:42:55 -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 S1752663AbbIQQmw (ORCPT + 4 others); Thu, 17 Sep 2015 12:42:52 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:57711 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752632AbbIQQmv (ORCPT ); Thu, 17 Sep 2015 12:42:51 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id t8HGgp1t016928 for ; Thu, 17 Sep 2015 11:42:51 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8HGgo7P008636 for ; Thu, 17 Sep 2015 11:42:51 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Thu, 17 Sep 2015 11:42:51 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8HGgoeb004990; Thu, 17 Sep 2015 11:42:50 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Felipe Balbi Subject: [PATCH 2/3] usb: dwc3: gadget: improve ep_queue's error reporting Date: Thu, 17 Sep 2015 11:42:39 -0500 Message-ID: <1442508160-20601-2-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1442508160-20601-1-git-send-email-balbi@ti.com> References: <1442508160-20601-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.52 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,