]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Remove unused and easy to misuse PNP macro parameter
authorcem <cem@FreeBSD.org>
Sun, 19 Aug 2018 00:22:21 +0000 (00:22 +0000)
committercem <cem@FreeBSD.org>
Sun, 19 Aug 2018 00:22:21 +0000 (00:22 +0000)
commit3d8ae7a0f486874af060f67d597575c9ca7f9957
tree83d929a61077c1eee88b03c7698a3fcbfab6df73
parent576f60d45098b8de343fcd2c0268a5826f6375a6
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).
46 files changed:
sys/crypto/ccp/ccp.c
sys/dev/aac/aac_pci.c
sys/dev/aacraid/aacraid_pci.c
sys/dev/adlink/adlink.c
sys/dev/ae/if_ae.c
sys/dev/age/if_age.c
sys/dev/ahci/ahci_pci.c
sys/dev/alc/if_alc.c
sys/dev/ale/if_ale.c
sys/dev/amdsmn/amdsmn.c
sys/dev/amdtemp/amdtemp.c
sys/dev/amr/amr_pci.c
sys/dev/an/if_an_pci.c
sys/dev/bce/if_bce.c
sys/dev/bfe/if_bfe.c
sys/dev/bge/if_bge.c
sys/dev/bwi/if_bwi_pci.c
sys/dev/bwn/if_bwn_pci.c
sys/dev/cas/if_cas.c
sys/dev/ciss/ciss.c
sys/dev/dc/if_dc.c
sys/dev/drm2/i915/i915_drv.c
sys/dev/drm2/radeon/radeon_drv.c
sys/dev/ed/if_ed_pci.c
sys/dev/ena/ena.c
sys/dev/et/if_et.c
sys/dev/fxp/if_fxp.c
sys/dev/gem/if_gem_pci.c
sys/dev/intpm/intpm.c
sys/dev/ioat/ioat.c
sys/dev/ipw/if_ipw.c
sys/dev/ixgbe/if_ix.c
sys/dev/ixgbe/if_ixv.c
sys/dev/ncr/ncr.c
sys/dev/ntb/ntb_hw/ntb_hw_intel.c
sys/dev/ofw/ofw_bus_subr.h
sys/dev/pccard/pccardvar.h
sys/dev/pci/pcivar.h
sys/dev/puc/puc_pci.c
sys/dev/spibus/spi.h
sys/dev/uart/uart_bus_pccard.c
sys/dev/usb/usbdi.h
sys/dev/xl/if_xl.c
sys/isa/isavar.h
sys/net/iflib.h
sys/sys/module.h