From nobody Fri Aug 18 23:18:47 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RSHqq6jZNz4fs3B; Fri, 18 Aug 2023 23:18:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RSHqq23GLz4nNZ; Fri, 18 Aug 2023 23:18:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692400727; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6UuCi8GqzM68uneb8rwSRdx4JXrz76Fodu+Ip2WwI8c=; b=IP9HLHT978tzQKbxQlE74ub60jxbCGpEzdyxkbIkuYAnj3lfSsjGxp98ACMon2iRz2IIRc 8PC4w/g5a7tMqruLfVFA8TcinCgDBLdtHBAFmphSKo9e2+l5zeGpYGEhoVwtI7Yj45xeZ9 6ZKydEI6qu0n6bmLpOC4AZwreLWrbNvr98jwoLB9CJ6tfjyLLJpQu9QXxFIA+XnG6jDHev Q4oCVTMW2o/fTW8LnG0LErysx3291Otd1Z7ByeCANArBamzA4hOlrIE+6SyvsP8N1B2aYQ FCNxSEujPOupRTR3s+Q9tz/Ok7/Gzpd+0sUgPaVlDY7j2Fk9pMKT8oyyQ6MFew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692400727; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=6UuCi8GqzM68uneb8rwSRdx4JXrz76Fodu+Ip2WwI8c=; b=IHKYZuhxn31BHeGEH3/iuARvXRbCAMz9/EX4cuoY6ZQrus7QMKE8RBCNqxqJMOsBT7Sdwx cbpQ6dNaRyeR78tU1Iygg6p/WQT05sIrUZmJgM0MdPeMEfBgWWXcw3Y+aNnC8St7tu/Su8 p2ql8608c7HkYoMwcdyqk8BPUUOpDkt2xaBabk6CxGDMEb8SQDQOMVQWzm0IgXjOr+i4vL bOYN4qUiYs7qikvBoyhOAAIBB+phm24TDLTL+7vQ6/94VtU+BTYL+DUVoH7E50RnnFY85y sucfU4MCIZ5PvZFx/usaJaYPpG3nUjDLN+X7u8AzPtjQB7KNa1JWRyF1Bfxrrw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1692400727; a=rsa-sha256; cv=none; b=pTrsuo8Te9QOoAp+ijixqmiev+tqFMX4zsWi+lHddhExdj7xz5C/LtycQc1yi96HGUmzhR EmJQwZ6duO8nKIY7e3zr9weK9Zll3jFJE3qzEewjbttue9IqboYTOJQSoeirSiOS2IJyDV xZeTAwZhyfVF9u0hTY2o54ksjJXkJ5r84id5cywN9gmT975+/sblz5WGYY1aSx/ZKVL2ZR Oc0ljfrbICok0jPEglZYV1G/6xsLya4fzaRUP0VIiOnNfdCngq0WnwHPRDCyIzpk3nKybD rJbDa3BjNaQXKblJpBXgyWUxKUMdOtOJEjEBhDy+DP//yE7IulZioE2cAotXsQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RSHqq15zjzb41; Fri, 18 Aug 2023 23:18:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 37INIldN018671; Fri, 18 Aug 2023 23:18:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37INIlcJ018668; Fri, 18 Aug 2023 23:18:47 GMT (envelope-from git) Date: Fri, 18 Aug 2023 23:18:47 GMT Message-Id: <202308182318.37INIlcJ018668@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Xin LI Subject: git: 06d98c3bf47e - stable/13 - gve: Unobfuscate code by using nitems directly for loop. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 06d98c3bf47ec79f2e0c2942088eade399ea78b5 Auto-Submitted: auto-generated The branch stable/13 has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=06d98c3bf47ec79f2e0c2942088eade399ea78b5 commit 06d98c3bf47ec79f2e0c2942088eade399ea78b5 Author: Xin LI AuthorDate: 2023-06-07 04:14:30 +0000 Commit: Xin LI CommitDate: 2023-08-18 23:18:15 +0000 gve: Unobfuscate code by using nitems directly for loop. While there, also make MODULE_PNP_INFO to reflect that the device description is provided. Reported-by: jrtc27 Reviewed-by: jrtc27, imp Differential Revision: https://reviews.freebsd.org/D40430 (cherry picked from commit 1177a6c8dcfd6625c541d6ffc3c6915b8b6354f7) --- sys/dev/gve/gve_main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/dev/gve/gve_main.c b/sys/dev/gve/gve_main.c index 383fd326d33a..c3ee6d5c3433 100644 --- a/sys/dev/gve/gve_main.c +++ b/sys/dev/gve/gve_main.c @@ -46,7 +46,6 @@ static struct gve_dev { } gve_devs[] = { { PCI_VENDOR_ID_GOOGLE, PCI_DEV_ID_GVNIC, "gVNIC" } }; -#define GVE_DEVS_COUNT nitems(gve_devs) struct sx gve_global_lock; @@ -717,7 +716,7 @@ gve_probe(device_t dev) vendorid = pci_get_vendor(dev); deviceid = pci_get_device(dev); - for (i = 0; i < GVE_DEVS_COUNT; i++) { + for (i = 0; i < nitems(gve_devs); i++) { if (vendorid == gve_devs[i].vendor_id && deviceid == gve_devs[i].device_id) { device_set_desc(dev, gve_devs[i].name); @@ -869,5 +868,5 @@ DRIVER_MODULE(gve, pci, gve_driver, gve_devclass, 0, 0); #else DRIVER_MODULE(gve, pci, gve_driver, 0, 0); #endif -MODULE_PNP_INFO("U16:vendor;U16:device", pci, gve, gve_devs, - GVE_DEVS_COUNT); +MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, gve, gve_devs, + nitems(gve_devs));