From patchwork Wed Nov 23 14:49:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 25030 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2835529wrr; Wed, 23 Nov 2022 06:51:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf5mkmAgGfUPq0xKONhNgn5IVMjGl//C/HPmuUk7leIsTz0RFRD0bMIBXwdBTCLnoLyRM8/p X-Received: by 2002:a05:6402:3808:b0:468:c911:d843 with SMTP id es8-20020a056402380800b00468c911d843mr25811714edb.422.1669215116663; Wed, 23 Nov 2022 06:51:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669215116; cv=none; d=google.com; s=arc-20160816; b=gmNWK5vlWtBuUeVOfQynShZCMH7ZZxxKNGo9WR3LwhFoHsu4oN7q9xRxR68zR/rN9B susc1o3c10RCXxRmu9WKbF0pglp/U3KWaWAMQRxop+L/w0BdxelVaQ813FPY/xB4Pq81 Toob4MPpp9NARFy6nQ5CcHbDvij7Zonl3hmVMmcSWvKV6dBs/Fn/v/HUUbn9z8o3fbOv 3917UBtaLWPReQ4LJPCqX5/x7iFSF/Tihs3x71dVVoXIwnOFGjiZ1b4vlFbB5bO2y22C yGGgc9i0HA8vUU1myjQJD6nMfSFgtMIP0Hj8XyjuIJbX2/hEcc1McdrJm62MOtZNkfng Z3ag== 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=adpYtAW7sCnKq/12s/rJUKK7mXCu21bBwa2aEnJ0hqY=; b=fn1ERmu/4e18UTVW8YReABYi+NHuE7dbf7tsd34Swaw2Wb9Z0BspNeFL35oStzyeUC ul1+Aiwt55pBzg5tWVSioRJRFKJYjTfPMaTFhiiuz3N6COP8wmKQW3ufvAr74waUakFr PVVzElemLlAdgLBYWKbT78n3yVJdtliZq7BWGlHzirViqjoKOUp0H53xvyx06To8fy9z pP1JxvJ3fHdUwC62EIzttWRJLz1VOHrN/g3KztRpT3gP6wQ7dQ3Tq+1uiwlLUi2XdE+7 uMX103KY3UpA1B0AN4gM3Ofz5+1kvn3+vnQFWY6AruqXyeYTIonkIkd/O3IWW+pQCPc0 iuPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="XFhha/N/"; 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 xg12-20020a170907320c00b007ae100a7255si15331892ejb.709.2022.11.23.06.51.32; Wed, 23 Nov 2022 06:51:56 -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="XFhha/N/"; 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 S236142AbiKWOs5 (ORCPT + 99 others); Wed, 23 Nov 2022 09:48:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236447AbiKWOsz (ORCPT ); Wed, 23 Nov 2022 09:48:55 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 146626DCD3; Wed, 23 Nov 2022 06:48:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669214934; x=1700750934; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pgt4N39lUyQv8Pv+snAd9Kisc2GhpoYqnvOX9T/Og/g=; b=XFhha/N/4Phk105vFiRUe2SNqGNuMxCLetT2tDEKEMTkyE1a7ER5UqDl 3gmp6E+tmY9yN8SYnXuYVgZZ+GyJgbh2aO4KfJSmiPo2w+xe1FEuaduvQ CtNyDaXg4PWIxR882WxOL4tr1Rb+fma6gI0S2t/kFrkAn2sN/VqVBbcLL BB5qzvKM0A4GebLSAIZSXsBxWI7WOsiUzkEwYWvd25XMxvg6m8b6fNsle aMp1miY13ktIr739llA+Tx+F0l7WWk7obCTM9c2dOad8ng6Gk0yCqQvJp gUOxfjdqN7+aRjvLYj7/xP41ztYwPedAZeHlo2P0KW+OkWvu8ANtVMr78 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="315231755" X-IronPort-AV: E=Sophos;i="5.96,187,1665471600"; d="scan'208";a="315231755" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2022 06:48:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="970883660" X-IronPort-AV: E=Sophos;i="5.96,187,1665471600"; d="scan'208";a="970883660" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga005.fm.intel.com with ESMTP; 23 Nov 2022 06:48:37 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id B03FC24A; Wed, 23 Nov 2022 16:49:03 +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 v4 4/4] xhci: Convert to use list_count() Date: Wed, 23 Nov 2022 16:49:01 +0200 Message-Id: <20221123144901.40493-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221123144901.40493-1-andriy.shevchenko@linux.intel.com> References: <20221123144901.40493-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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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?1750298909904179872?= X-GMAIL-MSGID: =?utf-8?q?1750298909904179872?= 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 --- v4: added tag (Mathias) 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) {