Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3050655ybi; Tue, 2 Jul 2019 01:09:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzBFHBgnZBfX7+eFoouGSPsTKkD4e22b4BKwx4az3YnB8etQ2gLVWY1C7dPPu454jdgOhoy X-Received: by 2002:a17:90a:ae12:: with SMTP id t18mr4241021pjq.32.1562054972997; Tue, 02 Jul 2019 01:09:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562054972; cv=none; d=google.com; s=arc-20160816; b=C9uIE39sQiVCWUHmyGQed8lbvgIf3w9gi4tRJST+3LlYRVI7Q+nRH5fTDmfwEd0pe0 AXRqonQCNYz0U5ftaDxYjIGzrZQBoDza4k53liSfw5opGk8mNWApDboHZrmJRj8spn2V CkZmZmO53eqVhs5uult9WSXTb0lD0FKqhM+Fb3PtCySlhmux5v8JR5OOL1ALlNKYh3qh Ma/bQOpz9RQUAb+ITySSiWmNmUlvD1mQE1CeUOriu0rXhjLAsG0kM7T73ZuL0w4zhvP2 lkP2bYNZ4zRX06ryUvxkZhzAq49B6nyYCaXTqX30COuMEwVAydwH6aScLb4AYBMgmNX5 cpPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/xX+KdhPdUILs3LATprqc9S6r+hhqpfYqcQhdFIbqrg=; b=Ky+yQT8DQ5OPQxiimMABVp8Q/LjQNhiJb+L2CRJWFSLw6iK4aShF7MKos08pbeaW0W /6rJVtWMrrrKJ9m6gzeDqIJ4QKyJzfRsru85aBMIKrPRRehjS+AmIy0wAOX1XSu3MiMg TlPqpK5LuJiOFo74BrCORzeTWoGjzNqTi/TNQxlQ6E+6O4Xvm9voFbMOu05dAuT9essO /IX3d2PuFgSMx57b0RSWgfa051YG910pUjpQb4KdL1oJxyyS/OoTsVYzm0nIGm3O6SAa gAwcTdml5eHz8pZJVqfM0YKZkWRLrLktfxsMCs+GagH1sBswyk5nhfvBYYao0ceop3NM g+kA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="CR/KZ8It"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cx20si1659249pjb.97.2019.07.02.01.09.18; Tue, 02 Jul 2019 01:09:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="CR/KZ8It"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728033AbfGBIIJ (ORCPT + 99 others); Tue, 2 Jul 2019 04:08:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:55564 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727269AbfGBIIH (ORCPT ); Tue, 2 Jul 2019 04:08:07 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BE7EE20665; Tue, 2 Jul 2019 08:08:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562054886; bh=jfaFKRwODgzpe5m0PyRnqYrbY6UgLRoTY0gkJzjgTx4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CR/KZ8ItQoL3weAWfrnvTnXanjqB0mHDiNRiX7x0G1mHr4Hfav9ihVyEuejZ3Ijpd F0Z54w3xbUgr5984jlS7sjXzfHm558AiHY/GLWO5lAoM2YZ9C/0AqN2bjQiqPAyat2 Tn9jH7BW7TG1VxC7MED1ELdj8guDTGx0R87E5AQY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fei Yang , Sam Protsenko , Felipe Balbi , linux-usb@vger.kernel.org, Felipe Balbi , John Stultz , Sasha Levin Subject: [PATCH 4.19 25/72] usb: dwc3: gadget: track number of TRBs per request Date: Tue, 2 Jul 2019 10:01:26 +0200 Message-Id: <20190702080125.974366303@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190702080124.564652899@linuxfoundation.org> References: <20190702080124.564652899@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit 09fe1f8d7e2f461275b1cdd832f2cfa5e9be346d upstream This will help us remove the wait_event() from our ->dequeue(). Cc: Fei Yang Cc: Sam Protsenko Cc: Felipe Balbi Cc: linux-usb@vger.kernel.org Cc: stable@vger.kernel.org # 4.19.y Signed-off-by: Felipe Balbi (cherry picked from commit 09fe1f8d7e2f461275b1cdd832f2cfa5e9be346d) Signed-off-by: John Stultz Signed-off-by: Sasha Levin --- drivers/usb/dwc3/core.h | 3 +++ drivers/usb/dwc3/gadget.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 4872cba8699b..0de78cb29f2c 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -847,6 +847,7 @@ struct dwc3_hwparams { * @epnum: endpoint number to which this request refers * @trb: pointer to struct dwc3_trb * @trb_dma: DMA address of @trb + * @num_trbs: number of TRBs used by this request * @needs_extra_trb: true when request needs one extra TRB (either due to ZLP * or unaligned OUT) * @direction: IN or OUT direction flag @@ -867,6 +868,8 @@ struct dwc3_request { struct dwc3_trb *trb; dma_addr_t trb_dma; + unsigned num_trbs; + unsigned needs_extra_trb:1; unsigned direction:1; unsigned mapped:1; diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 8db7466e4f76..fd91c494307c 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1041,6 +1041,8 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep, req->trb_dma = dwc3_trb_dma_offset(dep, trb); } + req->num_trbs++; + __dwc3_prepare_one_trb(dep, trb, dma, length, chain, node, stream_id, short_not_ok, no_interrupt); } @@ -1075,6 +1077,7 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep, /* Now prepare one extra TRB to align transfer size */ trb = &dep->trb_pool[dep->trb_enqueue]; + req->num_trbs++; __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, maxp - rem, false, 1, req->request.stream_id, @@ -1119,6 +1122,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep, /* Now prepare one extra TRB to align transfer size */ trb = &dep->trb_pool[dep->trb_enqueue]; + req->num_trbs++; __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, maxp - rem, false, 1, req->request.stream_id, req->request.short_not_ok, @@ -1135,6 +1139,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep, /* Now prepare one extra TRB to handle ZLP */ trb = &dep->trb_pool[dep->trb_enqueue]; + req->num_trbs++; __dwc3_prepare_one_trb(dep, trb, dwc->bounce_addr, 0, false, 1, req->request.stream_id, req->request.short_not_ok, @@ -2231,6 +2236,7 @@ static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep, dwc3_ep_inc_deq(dep); trace_dwc3_complete_trb(dep, trb); + req->num_trbs--; /* * If we're in the middle of series of chained TRBs and we -- 2.20.1