From patchwork Mon Nov 14 16:22:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13042541 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C380FC4332F for ; Mon, 14 Nov 2022 16:22:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5E56010E2F1; Mon, 14 Nov 2022 16:22:15 +0000 (UTC) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id E98F110E2EE; Mon, 14 Nov 2022 16:22:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668442929; x=1699978929; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w8JnsSQEeOM8g80fNSiY85GCK9KLByACfZ2G33EPHKE=; b=Py3ByptcAz7P3jEc8n4V+FHyXHRjzEYME+CqHKP0MWeQLkweP0HhoQtY Kxo4w5hN5mGBmgzLNlmNZpmqbm4MzcPw4KPhXjuuLQOVbxFLLJRfJQYoP 9KpddBM5r15x8njQw/GB4OkehIHTMKZAMl4JlOhEwBow3JwyRzaAJ/nV9 To7WvFLK3d6PYZe427MMVc39aYMULozj0XxPSesXvDguk9iKf4bN2UTtw H57367PbbwHsrblq3WDRa5z4XKvF7mNkWWZGfk49Q1OcL2KBt4B//mU6N DTD5FtH3wSfkNV1qF8NPsZqACbyBz5un4TIDc6EuHtmQX1Fc6WIDn/unT Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="299531490" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="299531490" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Nov 2022 08:21:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10531"; a="616372363" X-IronPort-AV: E=Sophos;i="5.96,164,1665471600"; d="scan'208";a="616372363" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 14 Nov 2022 08:21:46 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id D065D346; Mon, 14 Nov 2022 18:22:10 +0200 (EET) From: Andy Shevchenko To: Jakob Koschel , Andy Shevchenko , Greg Kroah-Hartman , Mathias Nyman , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Date: Mon, 14 Nov 2022 18:22:07 +0200 Message-Id: <20221114162207.62559-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221114162207.62559-1-andriy.shevchenko@linux.intel.com> References: <20221114162207.62559-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH v2 4/4] xhci: Convert to use list_count() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Cernekee , Mathias Nyman , Daniel Vetter , Rodrigo Vivi , Andrew Morton , David Airlie Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The list API now provides the list_count() to help with counting existing nodes in the list. Uilise it. Signed-off-by: Andy Shevchenko --- v2: no change drivers/usb/host/xhci-ring.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index ad81e9a508b1..817c31e3b0c8 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -2532,7 +2532,6 @@ static int handle_tx_event(struct xhci_hcd *xhci, union xhci_trb *ep_trb; int status = -EINPROGRESS; struct xhci_ep_ctx *ep_ctx; - struct list_head *tmp; u32 trb_comp_code; int td_num = 0; bool handling_skipped_tds = false; @@ -2580,10 +2579,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, } /* Count current td numbers if ep->skip is set */ - if (ep->skip) { - list_for_each(tmp, &ep_ring->td_list) - td_num++; - } + if (ep->skip) + td_num += list_count(&ep_ring->td_list); /* Look for common error cases */ switch (trb_comp_code) {