From patchwork Wed Nov 23 14:49:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 25032 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2835614wrr; Wed, 23 Nov 2022 06:52:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf68pmds+s4JRnhx+FPAMVlseQ31b/QK1pJhyQJQtTRS6iv2pA0jZW/Cmrbbp0YAwwYUU8Op X-Received: by 2002:a17:902:a5cc:b0:186:de87:7ffd with SMTP id t12-20020a170902a5cc00b00186de877ffdmr21472363plq.94.1669215127693; Wed, 23 Nov 2022 06:52:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669215127; cv=none; d=google.com; s=arc-20160816; b=dN0vi4LxhbJewpfGzfN+t8e41/i8dgUpwFwn0azF02eEHnavOdX9suhOVXWyTZIs+Z XE8PfGBorsK9j+GAFyJF9Xzobp76hnI5cOMfBwQhmC4Fy9AjKorAFogmXGx916nDiy/X 1XGYjuSAeC5JIZodBs8wR7McOl2ytQcPe/nzIQYlSLyi4wWsxrsFllIYeeCAMJBcd9ZY vFKYXIb4QWuq4tugF5Nj9xU/l3Y96O+5TM1aRokwm31/nf/tanp4w+JXz+ljeQG6n5nu I9xrSKN3Lce8JshG4LNUlz0s/ag/I/dtVclRtc4RmsEL1SD/zCB6cC5ED9fkSJ0BuP8A F9xg== 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=bcvnQL3fjsLSAjxWAHOQp/RM4LK2n9tyx2Y958WJ0ys=; b=VB24TKdigrPnPjKgysqnaXM3PZRPDQMVJtfxwoBj4KvinD0KR987aFH2ZRq3AgyU2J wtvvhl3PHa1TDUzrY+4yjfWoHN3DhWqetuU/wzfRNGB2IGPxaaYH/vaLSCrqXI5+E2cG toHngW3jk9ZyOSZLfT5G3hdOEeA6c09DtxUj+2mT4iBxnpvyuiDpT1VtegojclKvqSxe 4HbCIpGGAcwmi2yD6Rk0WJJLyrfNHgaL4DVUfSgjgClLqWMHPD0SEAfahv0Q20kGXyHQ XKRcacfDjMaGWg6j4DodBQuOX1U802ww7/r/ul/Fb2HKporf7fknYNhA2Xh7ZudODGyB d0Yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Kvg0AP4U; 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 cp5-20020a170902e78500b0017deb323079si787063plb.142.2022.11.23.06.51.54; Wed, 23 Nov 2022 06:52:07 -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=Kvg0AP4U; 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 S237340AbiKWOtZ (ORCPT + 99 others); Wed, 23 Nov 2022 09:49:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237549AbiKWOtP (ORCPT ); Wed, 23 Nov 2022 09:49:15 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36A0B70188; Wed, 23 Nov 2022 06:49:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669214952; x=1700750952; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yNdh/hk4prTZOSg8R5rGTM68n79WKoKNAojMOq62B0c=; b=Kvg0AP4UY358dpDgJDZEWma9ql/q39sFfEyD+KkhQS7PbE0b1+trDHs/ Yr8a/t9Xibxrzs36qRToPA0W8FLgKv0wmXR3k99r+6fsBQtwlLjw7JFpb UR/XUXyZrKH+C/w+/DFbE0viosSOpHinhXQ2vcxVNDjTHRa5rGKUf1htR xaNqeJpz+mSBwioyAgqgQ4qO5P3qP4RPfmpsHe5JJeA+jEg5rqNZvJaTV 1m2ZLThQwdWDDtQP8unRU6OZJlpjK0oLvGmSrzzzM4cGwlDPplJp/3Kaa J96sIeJ51qg0laE05HUXpUTJIhV70DZB5HGcSAWAg/C0KH0LTsdye2mY6 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="376225206" X-IronPort-AV: E=Sophos;i="5.96,187,1665471600"; d="scan'208";a="376225206" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Nov 2022 06:48:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10540"; a="635936971" X-IronPort-AV: E=Sophos;i="5.96,187,1665471600"; d="scan'208";a="635936971" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 23 Nov 2022 06:48:37 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id A0A95184; 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 3/4] usb: gadget: udc: bcm63xx: Convert to use list_count() Date: Wed, 23 Nov 2022 16:49:00 +0200 Message-Id: <20221123144901.40493-3-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,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?1750298921683292089?= X-GMAIL-MSGID: =?utf-8?q?1750298921683292089?= The list API now provides the list_count() to help with counting existing nodes in the list. Utilise it. Signed-off-by: Andy Shevchenko --- v4: no change 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];