From patchwork Fri Sep 22 19:55:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Wallis X-Patchwork-Id: 9966935 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 89FA26035E for ; Fri, 22 Sep 2017 19:55:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 74E931FE85 for ; Fri, 22 Sep 2017 19:55:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6848B27F7F; Fri, 22 Sep 2017 19:55:53 +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 4AE0D1FE85 for ; Fri, 22 Sep 2017 19:55:52 +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=yEloiq5fFRDJcDaCKOqHYrkQuH5fLDXblncmhE//fXw=; b=rDc Zd3RaB9IzQbydNlixsCELlubDE7jbn6XycqEy5lOXORENXmp+lWjL7QlPc2cR5M1Pj79tlXEscnrp pKz42ehZhyamgj/U4o6/TVg+qPOhzzetdaqpWr1wzCUPAR0kOXoWRIZQFkWJnmGcDwtRwVbKGgScR b+OlMGq1bQ3zCv5LlGPwRyqO8UixfSOblSSsFjXTN3eF5u3Ta+GqI6v8k90nn1pdWBHIspGuMOzcY 1TydDuLM8FGOyqfMpKjmd2h+FtpIcYpet0yPb/M5IyRDf0POwUzlUqMjEK/o9+eLtwBJKfraA/ZXN Z28LemMXNA8hmUoQX8vYJpJPXsnjRXg==; 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 1dvU39-0005a9-GL; Fri, 22 Sep 2017 19:55:47 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dvU36-0005W0-7Y for linux-arm-kernel@lists.infradead.org; Fri, 22 Sep 2017 19:55:45 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 4B58C60272; Fri, 22 Sep 2017 19:55:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1506110123; bh=OTZPQ/SuJDGiIgEELu7BaWRKClQ6Qp4g9ocn5o7rKsE=; h=From:To:Cc:Subject:Date:From; b=JBrlF9plOxA9ONUHfIqf3DWFttywnOJrJfW2+MYjf7Arr3rAxHmGC2fGI9NCE3GA0 pwxuenHBf0gmDaj1p7rvMTwjxkJ7fl4ziDYvB/CS7fXncetEO4W2Udm+19OQfMRsqs wAVmAw6zUDyldJ6rakoJB0WcvhqAaWK7wOW2bLCs= 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 F222D60272; Fri, 22 Sep 2017 19:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1506110122; bh=OTZPQ/SuJDGiIgEELu7BaWRKClQ6Qp4g9ocn5o7rKsE=; h=From:To:Cc:Subject:Date:From; b=FzAnKoahz8roF9BAR86pLxsZQ8CQK4t+mwOcBST+z9jM4UHK8GcsoJtzZ1g2uU3ss pQsN67JbP3iPdlTCqAInNAXBpvD2V5CZJwvtET+INSZkMnrLm683Sj85jd+hukjLN7 qMNXmF4jkcNLyx4chr1dLoBuRRrjJAIzTGxTGYdo= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org F222D60272 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, Adam Wallis Subject: [PATCH v2][for 4.14] xhci: allow TRACE to work with EVENT ring dequeue Date: Fri, 22 Sep 2017 15:55:13 -0400 Message-Id: <1506110113-21707-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_125544_344267_BC2530A2 X-CRM114-Status: GOOD ( 12.80 ) 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 --- Changes in v2: undo accidental line removal at end of patch drivers/usb/host/xhci-ring.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index a944365..3960ba9 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -171,23 +171,23 @@ 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);