Reapply, with minor tweaks, r338025, from the original commit:

Remove unused and easy to misuse PNP macro parameter

Inspired by r338025, just remove the element size parameter to the
MODULE_PNP_INFO macro entirely.  The 'table' parameter is now required to
have correct pointer (or array) type.  Since all invocations of the macro
already had this property and the emitted PNP data continues to include the
element size, there is no functional change.

Mostly done with the coccinelle 'spatch' tool:

  $ cat modpnpsize0.cocci
    @normaltables@
    identifier b,c;
    expression a,d,e;
    declarer MODULE_PNP_INFO;
    @@
     MODULE_PNP_INFO(a,b,c,d,
    -sizeof(d[0]),
     e);

    @singletons@
    identifier b,c,d;
    expression a;
    declarer MODULE_PNP_INFO;
    @@
     MODULE_PNP_INFO(a,b,c,&d,
    -sizeof(d),
     1);

  $ rg -l MODULE_PNP_INFO -- sys | \
    xargs spatch --in-place --sp-file modpnpsize0.cocci

(Note that coccinelle invokes diff(1) via a PATH search and expects diff to
tolerate the -B flag, which BSD diff does not.  So I had to link gdiff into
PATH as diff to use spatch.)

Tinderbox'd (-DMAKE_JUST_KERNELS).
Approved by: re (glen)
This commit is contained in:
Warner Losh 2018-09-26 17:12:14 +00:00
parent c5bf4b1bc6
commit 329e817fcc
46 changed files with 50 additions and 50 deletions

View File

@ -735,7 +735,7 @@ MODULE_VERSION(ccp, 1);
MODULE_DEPEND(ccp, crypto, 1, 1, 1);
MODULE_DEPEND(ccp, random_device, 1, 1, 1);
#if 0 /* There are enough known issues that we shouldn't load automatically */
MODULE_PNP_INFO("W32:vendor/device", pci, ccp, ccp_ids, sizeof(ccp_ids[0]),
MODULE_PNP_INFO("W32:vendor/device", pci, ccp, ccp_ids,
nitems(ccp_ids));
#endif

View File

@ -494,7 +494,7 @@ static driver_t aacch_driver = {
static devclass_t aacch_devclass;
DRIVER_MODULE(aacch, pci, aacch_driver, aacch_devclass, NULL, NULL);
MODULE_PNP_INFO("U16:vendor;U16:device;", pci, aac,
aac_identifiers, sizeof(aac_identifiers[0]), nitems(aac_identifiers) - 1);
aac_identifiers, nitems(aac_identifiers) - 1);
static int
aacch_probe(device_t dev)

View File

@ -106,7 +106,7 @@ struct aac_ident
DRIVER_MODULE(aacraid, pci, aacraid_pci_driver, aacraid_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device", pci, aacraid,
aacraid_family_identifiers, sizeof(aacraid_family_identifiers[0]),
aacraid_family_identifiers,
nitems(aacraid_family_identifiers) - 1);
MODULE_DEPEND(aacraid, pci, 1, 1, 1);

View File

@ -438,6 +438,6 @@ static driver_t adlink_driver = {
};
DRIVER_MODULE(adlink, pci, adlink_driver, adlink_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, adlink, adlink_id, sizeof(adlink_id[0]),
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, adlink, adlink_id,
nitems(adlink_id));
#endif /* _KERNEL */

View File

@ -178,7 +178,7 @@ static devclass_t ae_devclass;
DRIVER_MODULE(ae, pci, ae_driver, ae_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, ae, ae_devs,
sizeof(ae_devs[0]), nitems(ae_devs));
nitems(ae_devs));
DRIVER_MODULE(miibus, ae, miibus_driver, miibus_devclass, 0, 0);
MODULE_DEPEND(ae, pci, 1, 1, 1);
MODULE_DEPEND(ae, ether, 1, 1, 1);

View File

@ -184,7 +184,7 @@ static devclass_t age_devclass;
DRIVER_MODULE(age, pci, age_driver, age_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, age, age_devs,
sizeof(age_devs[0]), nitems(age_devs));
nitems(age_devs));
DRIVER_MODULE(miibus, age, miibus_driver, miibus_devclass, 0, 0);
static struct resource_spec age_res_spec_mem[] = {

View File

@ -667,7 +667,7 @@ static driver_t ahci_driver = {
DRIVER_MODULE(ahci, pci, ahci_driver, ahci_devclass, NULL, NULL);
/* Also matches class / subclass / progid XXX need to add when we have masking support */
MODULE_PNP_INFO("W32:vendor/device", pci, ahci, ahci_ids,
sizeof(ahci_ids[0]), nitems(ahci_ids) - 1);
nitems(ahci_ids) - 1);
static device_method_t ahci_ata_methods[] = {
DEVMETHOD(device_probe, ahci_ata_probe),
DEVMETHOD(device_attach, ahci_pci_attach),

View File

@ -244,7 +244,7 @@ static devclass_t alc_devclass;
DRIVER_MODULE(alc, pci, alc_driver, alc_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device", pci, alc, alc_ident_table,
sizeof(alc_ident_table[0]), nitems(alc_ident_table) - 1);
nitems(alc_ident_table) - 1);
DRIVER_MODULE(miibus, alc, miibus_driver, miibus_devclass, 0, 0);
static struct resource_spec alc_res_spec_mem[] = {

View File

@ -179,7 +179,7 @@ static devclass_t ale_devclass;
DRIVER_MODULE(ale, pci, ale_driver, ale_devclass, NULL, NULL);
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, ale, ale_devs,
sizeof(ale_devs[0]), nitems(ale_devs));
nitems(ale_devs));
DRIVER_MODULE(miibus, ale, miibus_driver, miibus_devclass, NULL, NULL);
static struct resource_spec ale_res_spec_mem[] = {

View File

@ -90,7 +90,7 @@ static devclass_t amdsmn_devclass;
DRIVER_MODULE(amdsmn, hostb, amdsmn_driver, amdsmn_devclass, NULL, NULL);
MODULE_VERSION(amdsmn, 1);
MODULE_PNP_INFO("W32:vendor/device", pci, amdsmn, amdsmn_ids,
sizeof(amdsmn_ids[0]), nitems(amdsmn_ids));
nitems(amdsmn_ids));
static bool
amdsmn_match(device_t parent)

View File

@ -167,7 +167,7 @@ DRIVER_MODULE(amdtemp, hostb, amdtemp_driver, amdtemp_devclass, NULL, NULL);
MODULE_VERSION(amdtemp, 1);
MODULE_DEPEND(amdtemp, amdsmn, 1, 1, 1);
MODULE_PNP_INFO("U16:vendor;U16:device", pci, amdtemp, amdtemp_products,
sizeof(amdtemp_products[0]), nitems(amdtemp_products));
nitems(amdtemp_products));
static int
amdtemp_match(device_t dev)

View File

@ -142,7 +142,7 @@ static struct amr_ident
static devclass_t amr_devclass;
DRIVER_MODULE(amr, pci, amr_pci_driver, amr_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device", pci, amr, amr_device_ids,
sizeof(amr_device_ids[0]), nitems(amr_device_ids) - 1);
nitems(amr_device_ids) - 1);
MODULE_DEPEND(amr, pci, 1, 1, 1);
MODULE_DEPEND(amr, cam, 1, 1, 1);

View File

@ -274,6 +274,6 @@ static devclass_t an_devclass;
DRIVER_MODULE(an, pci, an_pci_driver, an_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, an,
an_devs, sizeof(an_devs[0]), nitems(an_devs) - 1);
an_devs, nitems(an_devs) - 1);
MODULE_DEPEND(an, pci, 1, 1, 1);
MODULE_DEPEND(an, wlan, 1, 1, 1);

View File

@ -530,7 +530,7 @@ MODULE_DEPEND(bce, miibus, 1, 1, 1);
DRIVER_MODULE(bce, pci, bce_driver, bce_devclass, NULL, NULL);
DRIVER_MODULE(miibus, bce, miibus_driver, miibus_devclass, NULL, NULL);
MODULE_PNP_INFO("U16:vendor;U16:device;U16:#;U16:#;D:#", pci, bce,
bce_devs, sizeof(bce_devs[0]), nitems(bce_devs) - 1);
bce_devs, nitems(bce_devs) - 1);
/****************************************************************************/
/* Tunable device values */

View File

@ -158,7 +158,7 @@ static devclass_t bfe_devclass;
DRIVER_MODULE(bfe, pci, bfe_driver, bfe_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, bfe, bfe_devs,
sizeof(bfe_devs[0]), nitems(bfe_devs) - 1);
nitems(bfe_devs) - 1);
DRIVER_MODULE(miibus, bfe, miibus_driver, miibus_devclass, 0, 0);
/*

View File

@ -548,7 +548,7 @@ static devclass_t bge_devclass;
DRIVER_MODULE(bge, pci, bge_driver, bge_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device", pci, bge, bge_devs,
sizeof(bge_devs[0]), nitems(bge_devs) - 1);
nitems(bge_devs) - 1);
DRIVER_MODULE(miibus, bge, miibus_driver, miibus_devclass, 0, 0);
static int bge_allow_asf = 1;

View File

@ -257,7 +257,7 @@ static driver_t bwi_driver = {
static devclass_t bwi_devclass;
DRIVER_MODULE(bwi, pci, bwi_driver, bwi_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, bwi, bwi_devices,
sizeof(bwi_devices[0]), nitems(bwi_devices) - 1);
nitems(bwi_devices) - 1);
MODULE_DEPEND(bwi, wlan, 1, 1, 1); /* 802.11 media layer */
MODULE_DEPEND(bwi, firmware, 1, 1, 1); /* firmware support */
MODULE_DEPEND(bwi, wlan_amrr, 1, 1, 1);

View File

@ -296,9 +296,9 @@ DEFINE_CLASS_0(bwn_pci, bwn_pci_driver, bwn_pci_methods,
DRIVER_MODULE_ORDERED(bwn_pci, pci, bwn_pci_driver, bwn_pci_devclass, NULL,
NULL, SI_ORDER_ANY);
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, bwn_siba,
siba_devices, sizeof(siba_devices[0]), nitems(siba_devices) - 1);
siba_devices, nitems(siba_devices) - 1);
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, bwn_bcma,
bcma_devices, sizeof(bcma_devices[0]), nitems(bcma_devices) - 1);
bcma_devices, nitems(bcma_devices) - 1);
DRIVER_MODULE(bhndb, bwn_pci, bhndb_pci_driver, bhndb_devclass, NULL, NULL);
MODULE_DEPEND(bwn_pci, bwn, 1, 1, 1);

View File

@ -2617,7 +2617,7 @@ static const struct cas_pci_dev {
DRIVER_MODULE(cas, pci, cas_pci_driver, cas_devclass, 0, 0);
MODULE_PNP_INFO("W32:vendor/device", pci, cas, cas_pci_devlist,
sizeof(cas_pci_devlist[0]), nitems(cas_pci_devlist) - 1);
nitems(cas_pci_devlist) - 1);
DRIVER_MODULE(miibus, cas, miibus_driver, miibus_devclass, 0, 0);
MODULE_DEPEND(cas, pci, 1, 1, 1);

View File

@ -365,7 +365,7 @@ static struct
static devclass_t ciss_devclass;
DRIVER_MODULE(ciss, pci, ciss_pci_driver, ciss_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device;", pci, ciss, ciss_vendor_data,
sizeof(ciss_vendor_data[0]), nitems(ciss_vendor_data) - 1);
nitems(ciss_vendor_data) - 1);
MODULE_DEPEND(ciss, cam, 1, 1, 1);
MODULE_DEPEND(ciss, pci, 1, 1, 1);

View File

@ -360,7 +360,7 @@ static devclass_t dc_devclass;
DRIVER_MODULE_ORDERED(dc, pci, dc_driver, dc_devclass, NULL, NULL,
SI_ORDER_ANY);
MODULE_PNP_INFO("W32:vendor/device;U8:revision;D:#", pci, dc, dc_devs,
sizeof(dc_devs[0]), nitems(dc_devs) - 1);
nitems(dc_devs) - 1);
DRIVER_MODULE(miibus, dc, miibus_driver, miibus_devclass, NULL, NULL);
#define DC_SETBIT(sc, reg, x) \

View File

@ -1237,7 +1237,7 @@ MODULE_DEPEND(i915kms, iicbus, 1, 1, 1);
MODULE_DEPEND(i915kms, iic, 1, 1, 1);
MODULE_DEPEND(i915kms, iicbb, 1, 1, 1);
MODULE_PNP_INFO("U32:vendor;U32:device;P:#;D:#", vgapci, i915, pciidlist,
sizeof(pciidlist[0]), nitems(pciidlist) - 1);
nitems(pciidlist) - 1);
/* We give fast paths for the really cool registers */
#define NEEDS_FORCE_WAKE(dev_priv, reg) \

View File

@ -402,4 +402,4 @@ MODULE_DEPEND(radeonkms, iic, 1, 1, 1);
MODULE_DEPEND(radeonkms, iicbb, 1, 1, 1);
MODULE_DEPEND(radeonkms, firmware, 1, 1, 1);
MODULE_PNP_INFO("U32:vendor;U32:device;P:#;D:#", vgapci, radeonkms,
pciidlist, sizeof(pciidlist[0]), nitems(pciidlist) - 1);
pciidlist, nitems(pciidlist) - 1);

View File

@ -145,5 +145,5 @@ static driver_t ed_pci_driver = {
DRIVER_MODULE(ed, pci, ed_pci_driver, ed_devclass, 0, 0);
MODULE_DEPEND(ed, pci, 1, 1, 1);
MODULE_DEPEND(ed, ether, 1, 1, 1);
MODULE_PNP_INFO("W32:vendor/device;D:#", pci, ed, pci_ids, sizeof(pci_ids[0]),
MODULE_PNP_INFO("W32:vendor/device;D:#", pci, ed, pci_ids,
nitems(pci_ids) - 1);

View File

@ -3948,7 +3948,7 @@ static driver_t ena_driver = {
devclass_t ena_devclass;
DRIVER_MODULE(ena, pci, ena_driver, ena_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device", pci, ena, ena_vendor_info_array,
sizeof(ena_vendor_info_array[0]), nitems(ena_vendor_info_array) - 1);
nitems(ena_vendor_info_array) - 1);
MODULE_DEPEND(ena, pci, 1, 1, 1);
MODULE_DEPEND(ena, ether, 1, 1, 1);

View File

@ -189,7 +189,7 @@ static devclass_t et_devclass;
DRIVER_MODULE(et, pci, et_driver, et_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, et, et_devices,
sizeof(et_devices[0]), nitems(et_devices) - 1);
nitems(et_devices) - 1);
DRIVER_MODULE(miibus, et, miibus_driver, miibus_devclass, 0, 0);
static int et_rx_intr_npkts = 32;

View File

@ -308,7 +308,7 @@ static devclass_t fxp_devclass;
DRIVER_MODULE_ORDERED(fxp, pci, fxp_driver, fxp_devclass, NULL, NULL,
SI_ORDER_ANY);
MODULE_PNP_INFO("U16:vendor;U16:device", pci, fxp, fxp_ident_table,
sizeof(fxp_ident_table[0]), nitems(fxp_ident_table) - 1);
nitems(fxp_ident_table) - 1);
DRIVER_MODULE(miibus, fxp, miibus_driver, miibus_devclass, NULL, NULL);
static struct resource_spec fxp_res_spec_mem[] = {

View File

@ -116,7 +116,7 @@ static driver_t gem_pci_driver = {
DRIVER_MODULE(gem, pci, gem_pci_driver, gem_devclass, 0, 0);
MODULE_PNP_INFO("W32:vendor/device", pci, gem, gem_pci_devlist,
sizeof(gem_pci_devlist[0]), nitems(gem_pci_devlist) - 1);
nitems(gem_pci_devlist) - 1);
MODULE_DEPEND(gem, pci, 1, 1, 1);
MODULE_DEPEND(gem, ether, 1, 1, 1);

View File

@ -896,4 +896,4 @@ DRIVER_MODULE(smbus, intsmb, smbus_driver, smbus_devclass, 0, 0);
MODULE_DEPEND(intsmb, smbus, SMBUS_MINVER, SMBUS_PREFVER, SMBUS_MAXVER);
MODULE_VERSION(intsmb, 1);
MODULE_PNP_INFO("W32:vendor/device;D:#", pci, intpm, intsmb_products,
sizeof(intsmb_products[0]), nitems(intsmb_products));
nitems(intsmb_products));

View File

@ -241,7 +241,7 @@ static struct _pcsid
};
MODULE_PNP_INFO("W32:vendor/device;D:#", pci, ioat, pci_ids,
sizeof(pci_ids[0]), nitems(pci_ids));
nitems(pci_ids));
/*
* OS <-> Driver linkage functions

View File

@ -203,7 +203,7 @@ static devclass_t ipw_devclass;
DRIVER_MODULE(ipw, pci, ipw_driver, ipw_devclass, NULL, NULL);
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, ipw, ipw_ident_table,
sizeof(ipw_ident_table[0]), nitems(ipw_ident_table) - 1);
nitems(ipw_ident_table) - 1);
MODULE_VERSION(ipw, 1);

View File

@ -238,7 +238,7 @@ static driver_t ix_driver = {
devclass_t ix_devclass;
DRIVER_MODULE(ix, pci, ix_driver, ix_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device", pci, ix, ixgbe_vendor_info_array,
sizeof(ixgbe_vendor_info_array[0]), nitems(ixgbe_vendor_info_array) - 1);
nitems(ixgbe_vendor_info_array) - 1);
MODULE_DEPEND(ix, pci, 1, 1, 1);
MODULE_DEPEND(ix, ether, 1, 1, 1);

View File

@ -144,7 +144,7 @@ static driver_t ixv_driver = {
devclass_t ixv_devclass;
DRIVER_MODULE(ixv, pci, ixv_driver, ixv_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device", pci, ixv, ixv_vendor_info_array,
sizeof(ixv_vendor_info_array[0]), nitems(ixv_vendor_info_array) - 1);
nitems(ixv_vendor_info_array) - 1);
MODULE_DEPEND(ixv, pci, 1, 1, 1);
MODULE_DEPEND(ixv, ether, 1, 1, 1);
#ifdef DEV_NETMAP

View File

@ -7109,7 +7109,7 @@ static devclass_t ncr_devclass;
DRIVER_MODULE(ncr, pci, ncr_driver, ncr_devclass, 0, 0);
MODULE_PNP_INFO("W32:vendor/device;U16:#;D:#", pci, ncr, ncr_chip_table,
sizeof(ncr_chip_table[0]), nitems(ncr_chip_table));
nitems(ncr_chip_table));
MODULE_DEPEND(ncr, cam, 1, 1, 1);
MODULE_DEPEND(ncr, pci, 1, 1, 1);

View File

@ -3120,4 +3120,4 @@ DRIVER_MODULE(ntb_hw_intel, pci, ntb_intel_driver, ntb_hw_devclass, NULL, NULL);
MODULE_DEPEND(ntb_hw_intel, ntb, 1, 1, 1);
MODULE_VERSION(ntb_hw_intel, 1);
MODULE_PNP_INFO("W32:vendor/device;D:#", pci, ntb_hw_intel, pci_ids,
sizeof(pci_ids[0]), nitems(pci_ids));
nitems(pci_ids));

View File

@ -67,7 +67,7 @@ struct intr_map_data_fdt {
#define SIMPLEBUS_PNP_DESCR "Z:compat;P:#;"
#define SIMPLEBUS_PNP_INFO(t) \
MODULE_PNP_INFO(SIMPLEBUS_PNP_DESCR, simplebus, t, t, sizeof(t[0]), sizeof(t) / sizeof(t[0]));
MODULE_PNP_INFO(SIMPLEBUS_PNP_DESCR, simplebus, t, t, sizeof(t) / sizeof(t[0]));
/* Generic implementation of ofw_bus_if.m methods and helper routines */
int ofw_bus_gen_setup_devinfo(struct ofw_bus_devinfo *, phandle_t);

View File

@ -102,7 +102,7 @@ struct pccard_product {
*/
#define PCCARD_PNP_DESCR "D:#;V32:manufacturer;V32:product;Z:cisvendor;Z:cisproduct;"
#define PCCARD_PNP_INFO(t) \
MODULE_PNP_INFO(PCCARD_PNP_DESCR, pccard, t, t, sizeof(t[0]), nitems(t) - 1); \
MODULE_PNP_INFO(PCCARD_PNP_DESCR, pccard, t, t, nitems(t) - 1)
typedef int (*pccard_product_match_fn) (device_t dev,
const struct pccard_product *ent, int vpfmatch);

View File

@ -311,7 +311,7 @@ struct pci_device_table {
"M16:mask;U16:vendor;U16:device;U16:subvendor;U16:subdevice;" \
"U16:class;U16:subclass;U16:revid;"
#define PCI_PNP_INFO(table) \
MODULE_PNP_INFO(PCI_PNP_STR, pci, table, table, sizeof(table[0]), \
MODULE_PNP_INFO(PCI_PNP_STR, pci, table, table, \
sizeof(table) / sizeof(table[0]))
const struct pci_device_table *pci_match_device(device_t child,

View File

@ -200,4 +200,4 @@ static driver_t puc_pci_driver = {
DRIVER_MODULE(puc, pci, puc_pci_driver, puc_devclass, 0, 0);
MODULE_PNP_INFO("U16:vendor;U16:device;U16:#;U16:#;D:#", pci, puc,
puc_pci_devices, sizeof(puc_pci_devices[0]), nitems(puc_pci_devices) - 1);
puc_pci_devices, nitems(puc_pci_devices) - 1);

View File

@ -43,4 +43,4 @@ struct spi_command {
#define SPIBUS_PNP_DESCR "Z:compat;P:#;"
#define SPIBUS_PNP_INFO(t) \
MODULE_PNP_INFO(SPIBUS_PNP_DESCR, spibus, t, t, sizeof(t[0]), sizeof(t) / sizeof(t[0]));
MODULE_PNP_INFO(SPIBUS_PNP_DESCR, spibus, t, t, sizeof(t) / sizeof(t[0]));

View File

@ -103,4 +103,4 @@ uart_pccard_attach(device_t dev)
DRIVER_MODULE(uart, pccard, uart_pccard_driver, uart_devclass, 0, 0);
MODULE_PNP_INFO("U32:function_type;", pccard, uart, &uart_pccard_function,
sizeof(uart_pccard_function), 1);
1);

View File

@ -342,13 +342,13 @@ struct usb_device_id {
#define USB_STD_PNP_HOST_INFO USB_STD_PNP_INFO "T:mode=host;"
#define USB_STD_PNP_DEVICE_INFO USB_STD_PNP_INFO "T:mode=device;"
#define USB_PNP_HOST_INFO(table) \
MODULE_PNP_INFO(USB_STD_PNP_HOST_INFO, uhub, table, table, sizeof(table[0]), \
MODULE_PNP_INFO(USB_STD_PNP_HOST_INFO, uhub, table, table, \
sizeof(table) / sizeof(table[0]))
#define USB_PNP_DEVICE_INFO(table) \
MODULE_PNP_INFO(USB_STD_PNP_DEVICE_INFO, uhub, table, table, sizeof(table[0]), \
MODULE_PNP_INFO(USB_STD_PNP_DEVICE_INFO, uhub, table, table, \
sizeof(table) / sizeof(table[0]))
#define USB_PNP_DUAL_INFO(table) \
MODULE_PNP_INFO(USB_STD_PNP_INFO, uhub, table, table, sizeof(table[0]), \
MODULE_PNP_INFO(USB_STD_PNP_INFO, uhub, table, table, \
sizeof(table) / sizeof(table[0]))
/* check that the size of the structure above is correct */

View File

@ -334,7 +334,7 @@ static devclass_t xl_devclass;
DRIVER_MODULE_ORDERED(xl, pci, xl_driver, xl_devclass, NULL, NULL,
SI_ORDER_ANY);
DRIVER_MODULE(miibus, xl, miibus_driver, miibus_devclass, NULL, NULL);
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, xl, xl_devs, sizeof(xl_devs[0]),
MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, xl, xl_devs,
nitems(xl_devs) - 1);
static void

View File

@ -142,7 +142,7 @@ enum isa_device_ivars {
#define ISA_PNP_DESCR "E:pnpid;D:#"
#define ISA_PNP_INFO(t) \
MODULE_PNP_INFO(ISA_PNP_DESCR, isa, t, t, sizeof(t[0]), nitems(t) - 1); \
MODULE_PNP_INFO(ISA_PNP_DESCR, isa, t, t, nitems(t) - 1); \
/*
* Simplified accessors for isa devices

View File

@ -173,7 +173,7 @@ typedef struct pci_vendor_info {
#define IFLIB_PNP_DESCR "U32:vendor;U32:device;U32:subvendor;U32:subdevice;" \
"U32:revision;U32:class;D:#"
#define IFLIB_PNP_INFO(b, u, t) \
MODULE_PNP_INFO(IFLIB_PNP_DESCR, b, u, t, sizeof(t[0]), nitems(t) - 1)
MODULE_PNP_INFO(IFLIB_PNP_DESCR, b, u, t, nitems(t) - 1)
typedef struct if_txrx {
int (*ift_txd_encap) (void *, if_pkt_info_t);

View File

@ -178,12 +178,12 @@ struct mod_pnp_match_info
* to allow external tools to parse their internal device tables
* to make an informed guess about what driver(s) to load.
*/
#define MODULE_PNP_INFO(d, b, unique, t, l, n) \
#define MODULE_PNP_INFO(d, b, unique, t, n) \
static const struct mod_pnp_match_info _module_pnp_##b##_##unique = { \
.descr = d, \
.bus = #b, \
.table = t, \
.entry_len = l, \
.entry_len = sizeof((t)[0]), \
.num_entry = n \
}; \
MODULE_METADATA(_md_##b##_pnpinfo_##unique, MDT_PNP_INFO, \