From patchwork Fri Sep 22 17:20:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Wallis X-Patchwork-Id: 9966683 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 89985600C5 for ; Fri, 22 Sep 2017 17:21:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7104B2998B for ; Fri, 22 Sep 2017 17:21:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65CB52998E; Fri, 22 Sep 2017 17:21:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E61FE2998B for ; Fri, 22 Sep 2017 17:21:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=XtoUI2UwYOZKg51eLgCQ+k3IjMKY4SOI4TKcfd3v568=; b=qGv eqKpxYvR/VEBtsRYAXvaZ8jO5Y0TgH4SPrL+vYjt70cAWqzJRrVr2bp7doyVpQ9EI87nktAF/0lTj 5s8vyb6wKMuuPdswcWIK5e6HVFOa+xKXQPzOYoa8xr97SWs1wmVodv3SDmibUlEu/5WpJkHiQgZqh sUGKYhHtISqgSyr0NZYhxsZR+N0dNy6uCmuuvVEWJoZ6exH5/XCS5iwNriOB0e3S6Uya8ONjDJqpY c9IAp722obAu5BwX0cojXXGG2IVJj+EFxDxX3/GdSlOaIR2hd4Y1zKjLztMl+f7kspTcGvbA8P+qb 9YppXrxpjNbhGRJNhsI207RrmZIdWpg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dvRe0-0007dK-24; Fri, 22 Sep 2017 17:21:40 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dvRdw-0007PN-B7 for linux-arm-kernel@lists.infradead.org; Fri, 22 Sep 2017 17:21:38 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 74067609F2; Fri, 22 Sep 2017 17:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1506100875; bh=E/ocbuakPcbr17nEtVWcbvm+shTTHtNdRJDoGeJ17fc=; h=From:To:Cc:Subject:Date:From; b=UlM/jUeTnPvA6AdpLbKny70WVmQlYGKLxpMh0J5NsIqUtYqYUKXJdrxaoACI+dDzJ EYGwxxw9AkQesMa5qQIhDXt30NOXorj/f4WL7GlznLLGv1lcerngDbOnCyorVoVpif hsQt2ISsHdq+9Bc4+FxRCf81ZpiNIcIPFb8Cf7Co= Received: from chromaggus.qualcomm.com (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: awallis@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id E582A609F2; Fri, 22 Sep 2017 17:21:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1506100874; bh=E/ocbuakPcbr17nEtVWcbvm+shTTHtNdRJDoGeJ17fc=; h=From:To:Cc:Subject:Date:From; b=HCqq5kgBOG4C8MfEDYlwq7Rd1Rgxt0dQaUVAPNCV+iSZ7/j8pS5fpsVa76uRuolH7 VkjmFgIevyeuYBky/0VOV3VYJnOEtA0IDH4I0YtIVwJQjdRD8q6WjS57TepjeJ0fFG aKSvZULc3zg3Qoq74fYWkZ288E9MyipiZoiw9IJI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E582A609F2 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=awallis@codeaurora.org From: Adam Wallis To: linux-arm-kernel@lists.infradead.org, Mathias Nyman , Greg Kroah-Hartman , linux-usb@vger.kernel.org Subject: [PATCH][for 4.14] xhci: allow TRACE to work with EVENT ring dequeue Date: Fri, 22 Sep 2017 13:20:59 -0400 Message-Id: <1506100859-14521-1-git-send-email-awallis@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170922_102136_493947_438E2131 X-CRM114-Status: GOOD ( 12.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: timur@codeaurora.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP inc_deq() currently bails earlier for EVENT rings than the common return point of the function, due to the fact that EVENT rings do not have link TRBs. The unfortunate side effect of this is that the very useful trace_xhci_inc_deq() function is not called/usable for EVENT ring debug. This patch provides a refactor by removing the multiple return exit points into a single return which additionally allows for all rings to use the trace function. Signed-off-by: Adam Wallis --- drivers/usb/host/xhci-ring.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index a944365..10afd50 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -171,25 +171,24 @@ static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring) if (ring->type == TYPE_EVENT) { if (!last_trb_on_seg(ring->deq_seg, ring->dequeue)) { ring->dequeue++; - return; + } else { + if (last_trb_on_ring(ring, ring->deq_seg, + ring->dequeue)) + ring->cycle_state ^= 1; + ring->deq_seg = ring->deq_seg->next; + ring->dequeue = ring->deq_seg->trbs; + } + } else { + /* All other rings have link trbs */ + if (!trb_is_link(ring->dequeue)) { + ring->dequeue++; + ring->num_trbs_free++; + } + while (trb_is_link(ring->dequeue)) { + ring->deq_seg = ring->deq_seg->next; + ring->dequeue = ring->deq_seg->trbs; } - if (last_trb_on_ring(ring, ring->deq_seg, ring->dequeue)) - ring->cycle_state ^= 1; - ring->deq_seg = ring->deq_seg->next; - ring->dequeue = ring->deq_seg->trbs; - return; - } - - /* All other rings have link trbs */ - if (!trb_is_link(ring->dequeue)) { - ring->dequeue++; - ring->num_trbs_free++; - } - while (trb_is_link(ring->dequeue)) { - ring->deq_seg = ring->deq_seg->next; - ring->dequeue = ring->deq_seg->trbs; } - trace_xhci_inc_deq(ring); return;