From patchwork Tue Nov 22 15:35:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 24434 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2282952wrr; Tue, 22 Nov 2022 07:38:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf7G+PcjV9618mLV1bOph+1WNhkoYf8/A8580/4MDQcDSkEH/gJLO4YrLPGH00oO6kvVxGFk X-Received: by 2002:a05:6402:14ce:b0:469:9395:beef with SMTP id f14-20020a05640214ce00b004699395beefmr9665924edx.316.1669131499756; Tue, 22 Nov 2022 07:38:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669131499; cv=none; d=google.com; s=arc-20160816; b=NcJ+akjZeU/kFPB63BUvg4U5Wcd0k84IBK1hgdnPIQrJaWyemfQoHND9uM1C365pdg epvZsapUCkNQGGJmp7h6s6UdRj7ZfyXrfZ4IgbEqtM/pUcYc08oh2Y1dSK9peVs8kWDi DwJbEqMXi9tzmtp5Kv7Us6hfy+90uGNSbwmSWF18Os2wKetMGtCAoYIvglvdpQ/Ogi4D pDwEfFLvOUFI6fYh3g+DgQfHzclbTS6F0j/FStXfbtmxco11WwsBQPckgIYQKQJZzUT7 7V1orvIHw8fwvZXcrK+geZc1Sv+/EsY6EFg+S5zMglDL5/xRnUxJZUw/Sy9eAwscSW+N PXXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=F5A701C6n+FPIHNaC9Wwb0EcSRrUB1P+PDAk8BYJBzc=; b=jJTMQFQ3+nCwMiK1x0cV58i40pUmTBFgXXyZtajoezOvul0fIbdOIQmXTpg6WKPjMg s+ZtzeY+UGB3x5oVFlODo3UVofMBDxibQaqtH5cRgWCA9yZVlGQjCXAFVZ6dKf5gDl2L sLMyslHezC8qLJmiqArLWO0E1I9pdlYLdpiKExllHZgCc7e0Twd64zAAXcjRhvwWICn3 1pMRvShPvA68u6aSCysFQhM/0ODw8Ce8DlhpSy9TH4jgSEA0NATCzwOAhJsVm9fHXOJB KnlN8Jl733Uopz+Y3Df9F5fYVIKahQQONBUei35eIW+NSe/QBxFoXrYDnYItcdxSVGfB 1Ebw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=j7UA7UP+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh41-20020a1709076ea900b00781c1645926si549984ejc.524.2022.11.22.07.37.55; Tue, 22 Nov 2022 07:38:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=j7UA7UP+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233004AbiKVPfQ (ORCPT + 99 others); Tue, 22 Nov 2022 10:35:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbiKVPfP (ORCPT ); Tue, 22 Nov 2022 10:35:15 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D40E2697ED; Tue, 22 Nov 2022 07:35:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669131313; x=1700667313; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=QhFQ1vvgWJPcpF58xWVY2cCZqGcl+FTrvlc1UL7N3w0=; b=j7UA7UP+Q5zsxG1RqVs9XwX37ODWcb5/c1L13pUfo9vHx7XRasBmIfGM OkmuDeXJAj7QKd6wDpNDI77UGtSBbdtmcUUgqAY3F72Yl52YD26cT4T7z ta0ndf4KmJDiiE/+87r8+uzNQ7VxVqEqoZo3Ou3qdYSJf87WiXVin90md dWVBNY6CU3HExyGJEZniAAHjWqPF5mlsz/ZRcyk8JKK9YuewkU19BsI06 hZANuiFxW7t7emLcMD70ou6SjKvsG4tkdE4Lwe7iyTeq+KNT8OuZAElYn 5BZtNphUDJQslq5w9dZXEGmKag82EM/9qqYYUdVaAG/6ZvDKvQRJb01B/ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10539"; a="315662392" X-IronPort-AV: E=Sophos;i="5.96,184,1665471600"; d="scan'208";a="315662392" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2022 07:35:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10539"; a="747395669" X-IronPort-AV: E=Sophos;i="5.96,184,1665471600"; d="scan'208";a="747395669" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 22 Nov 2022 07:35:00 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 6623724A; Tue, 22 Nov 2022 17:35:26 +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 Cc: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Daniel Vetter , Kevin Cernekee , Mathias Nyman , Hans de Goede Subject: [PATCH v3 4/4] xhci: Convert to use list_count() Date: Tue, 22 Nov 2022 17:35:16 +0200 Message-Id: <20221122153516.52577-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221122153516.52577-1-andriy.shevchenko@linux.intel.com> References: <20221122153516.52577-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750211231636395877?= X-GMAIL-MSGID: =?utf-8?q?1750211231636395877?= The list API now provides the list_count() to help with counting existing nodes in the list. Utilise it. Signed-off-by: Andy Shevchenko Acked-by: Mathias Nyman --- v3: no change 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) {