From patchwork Tue Nov 22 15:35:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 24435 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2283105wrr; Tue, 22 Nov 2022 07:38:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf4H+nqaEurTb7MqkhIx6yVCa8fo+oLRkUjL0UdCuaaLa1iicJgUYbXqbWX5Q17fZ+QraTy3 X-Received: by 2002:a05:6402:2409:b0:45c:935b:ae15 with SMTP id t9-20020a056402240900b0045c935bae15mr21289984eda.357.1669131517079; Tue, 22 Nov 2022 07:38:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669131517; cv=none; d=google.com; s=arc-20160816; b=K/tta2ZzGKqT82vG06ZgmRWxketnqklwR4Hlj2Iw311DNgfkmFD9oplbsNAtprjnZW oRV4o91OLVAOElvi9yNZ8yo7rQ1vh+nog4MyuUAyULkMUVWPfFnmbXbxA7JxC8IjfisP rz7VGzl4s95DrjgTXNYYbJSFQdMCnZTqbzwuml4qxvnna7cdfopX0BiCwTe7ZEC7CReZ IK+swffhem7j0kqyLS499ri+r7WEca08BV8a8e6TeE6phPbFtKHxAH6y9pVKGBH6ZXEL gjOhqgz4ykP55JxVL2r1LlmyjKcQ3VbaPC2943Qm4re2b5S7rbDNerWXrjb0ImUsD3lR fbKQ== 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=YQIS0gcgfBFPI2C8qqtw5XvCokGnWTUTgHpuj0usshE=; b=MLMQANmNrV02MrQxvtlXRkKrqBJpG35WfoaEunlItq193CVlitd7An6vBmeEBEXBXB fZbe1EyFTDv0oaZKyMY3EV3h9I5Kj0mfalj7+EpeWos1tc/eWNdAL4d9cn/3tFc9xlRY G7VEEG10t6mPYUfQhano7H2HiOVhvLkcHdYCoWCIqrVU8F+DuGpFwpKijLmJ4qLgvSNA AG3Y/IkMmS1tA5k+iHut4P7MAvuMj6Cj6x+6wRq3KzJtfYzDz/Km63BUKWHtSECLrm4Z eDq3fUYhIxQ3Pxkyuj61MLnQQyC2yjcyOY9fBfU6eunbyXyxvB8kZD+4tgY6OLwx1wBg KaHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=md3N+GrG; 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 gs40-20020a1709072d2800b0077b21283d09si409231ejc.349.2022.11.22.07.38.12; Tue, 22 Nov 2022 07:38:37 -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=md3N+GrG; 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 S233269AbiKVPfU (ORCPT + 99 others); Tue, 22 Nov 2022 10:35:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232132AbiKVPfP (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 DC39069DC3; Tue, 22 Nov 2022 07:35:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669131314; x=1700667314; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zu4U5AcdMvxjBbkfIRJ4d3Ua9ejTwnth+3FLNezefWw=; b=md3N+GrGvwUf6QOWLknExsDuy5ZH8A0ClL+DOWmPyuIORQhgSwNgmrDr +7ClffdZ2he0tn/dqWNPpHmtoy/FFMNNzoU2Xc6e8glQkNZfrg/D9/Pv5 13yCZkIWN2ZgcFxxF6TtDwjBkfEv2vk+hfFFVS6+aDrlQOYupJN8RTDAn r6FrM4iDo77PI792VkmP/tHELLe3o/hsh5oZ6COTIZcAUm/azEAXocdz7 fOKKYhzLQL6hDCyrAOOmUoN3/r+7RWurukdwl6909/nWev+R0adD1OekO /KU3kAhQUJJI2f4ZQobJFMWOVcXZDbW+eMSKF5NL0DEEyZwpWUi8X+L+9 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10539"; a="315662394" X-IronPort-AV: E=Sophos;i="5.96,184,1665471600"; d="scan'208";a="315662394" 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="747395671" X-IronPort-AV: E=Sophos;i="5.96,184,1665471600"; d="scan'208";a="747395671" 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 5B37D184; 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 3/4] usb: gadget: udc: bcm63xx: Convert to use list_count() Date: Tue, 22 Nov 2022 17:35:15 +0200 Message-Id: <20221122153516.52577-3-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?1750211249886329857?= X-GMAIL-MSGID: =?utf-8?q?1750211249886329857?= The list API now provides the list_count() to help with counting existing nodes in the list. Utilise it. Signed-off-by: Andy Shevchenko --- v3: no change v2: no change drivers/usb/gadget/udc/bcm63xx_udc.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/gadget/udc/bcm63xx_udc.c b/drivers/usb/gadget/udc/bcm63xx_udc.c index 2cdb07905bde..0762e49e85f8 100644 --- a/drivers/usb/gadget/udc/bcm63xx_udc.c +++ b/drivers/usb/gadget/udc/bcm63xx_udc.c @@ -2172,7 +2172,6 @@ static int bcm63xx_iudma_dbg_show(struct seq_file *s, void *p) for (ch_idx = 0; ch_idx < BCM63XX_NUM_IUDMA; ch_idx++) { struct iudma_ch *iudma = &udc->iudma[ch_idx]; - struct list_head *pos; seq_printf(s, "IUDMA channel %d -- ", ch_idx); switch (iudma_defaults[ch_idx].ep_type) { @@ -2205,14 +2204,10 @@ static int bcm63xx_iudma_dbg_show(struct seq_file *s, void *p) seq_printf(s, " desc: %d/%d used", iudma->n_bds_used, iudma->n_bds); - if (iudma->bep) { - i = 0; - list_for_each(pos, &iudma->bep->queue) - i++; - seq_printf(s, "; %d queued\n", i); - } else { + if (iudma->bep) + seq_printf(s, "; %zu queued\n", list_count(&iudma->bep->queue)); + else seq_printf(s, "\n"); - } for (i = 0; i < iudma->n_bds; i++) { struct bcm_enet_desc *d = &iudma->bd_ring[i];