svn commit: r359078 - stable/12/sys/dev/rtwn/pci

Hiroki Sato hrs at FreeBSD.org
Wed Mar 18 18:16:01 UTC 2020


Author: hrs
Date: Wed Mar 18 18:16:00 2020
New Revision: 359078
URL: https://svnweb.freebsd.org/changeset/base/359078

Log:
  MFC of r358402:
  
  Add MODULE_PNP_INFO() to autoload the rtwn_pci(4) kernel module.
  
  Reviewed by:	imp
  Differential Revision:	https://reviews.freebsd.org/D23807

Modified:
  stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.c
  stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.c
==============================================================================
--- stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.c	Wed Mar 18 18:10:44 2020	(r359077)
+++ stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.c	Wed Mar 18 18:16:00 2020	(r359078)
@@ -96,15 +96,16 @@ static void	rtwn_pci_attach_methods(struct rtwn_softc 
 static const struct rtwn_pci_ident *
 rtwn_pci_probe_sub(device_t dev)
 {
-	const struct rtwn_pci_ident *ident;
-	int vendor_id, device_id;
+	int i, vendor_id, device_id;
 
 	vendor_id = pci_get_vendor(dev);
 	device_id = pci_get_device(dev);
 
-	for (ident = rtwn_pci_ident_table; ident->name != NULL; ident++)
-		if (vendor_id == ident->vendor && device_id == ident->device)
-			return (ident);
+	for (i = 0; i < nitems(rtwn_pci_ident_table); i++) {
+		if (vendor_id == rtwn_pci_ident_table[i].vendor &&
+		    device_id == rtwn_pci_ident_table[i].device)
+			return (&rtwn_pci_ident_table[i]);
+	}
 
 	return (NULL);
 }
@@ -788,6 +789,8 @@ static devclass_t rtwn_pci_devclass;
 
 DRIVER_MODULE(rtwn_pci, pci, rtwn_pci_driver, rtwn_pci_devclass, NULL, NULL);
 MODULE_VERSION(rtwn_pci, 1);
+MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, rtwn, rtwn_pci_ident_table,
+    nitems(rtwn_pci_ident_table));
 MODULE_DEPEND(rtwn_pci, pci, 1, 1, 1);
 MODULE_DEPEND(rtwn_pci, wlan, 1, 1, 1);
 MODULE_DEPEND(rtwn_pci, rtwn, 2, 2, 2);

Modified: stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.h
==============================================================================
--- stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.h	Wed Mar 18 18:10:44 2020	(r359077)
+++ stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.h	Wed Mar 18 18:16:00 2020	(r359078)
@@ -35,7 +35,6 @@ struct rtwn_pci_ident {
 static const struct rtwn_pci_ident rtwn_pci_ident_table[] = {
 	{ 0x10ec, 0x8176, "Realtek RTL8188CE", RTWN_CHIP_RTL8192CE },
 	{ 0x10ec, 0x8179, "Realtek RTL8188EE", RTWN_CHIP_RTL8188EE },
-	{ 0, 0, NULL, RTWN_CHIP_MAX_PCI }
 };
 
 typedef void	(*chip_pci_attach)(struct rtwn_pci_softc *);


More information about the svn-src-all mailing list