git: 1177a6c8dcfd - main - gve: Unobfuscate code by using nitems directly for loop.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 07 Jun 2023 04:14:45 UTC
The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=1177a6c8dcfd6625c541d6ffc3c6915b8b6354f7 commit 1177a6c8dcfd6625c541d6ffc3c6915b8b6354f7 Author: Xin LI <delphij@FreeBSD.org> AuthorDate: 2023-06-07 04:14:30 +0000 Commit: Xin LI <delphij@FreeBSD.org> CommitDate: 2023-06-07 04:14:30 +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 --- 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));