From 4fa2e4dc3dd56a73f22eba4755532d2996d2bb88 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 28 Nov 2019 13:33:29 +0100 Subject: scripts/pcidev: skip the alias resolution phase for loaded drivers If a driver is already loaded for a device and we're looking for new devices only, it's pointless to try to resolve its aliases, because 1) it needlessly costs time, and 2) if the driver is builtin, the call will inevitably fail since there's no module for this. --- scripts/pcidev | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/pcidev b/scripts/pcidev index a8cecc2..20309c9 100755 --- a/scripts/pcidev +++ b/scripts/pcidev @@ -174,8 +174,11 @@ for device in $pcidev; do # look for modules supporting these devices. We exclude the rare modules # which pretend to support any vendor/product/subsys for PCI bridges because - # they tend to pop up everywhere there is a bridge. - if [ ! -z "$MAPFILE" -a -s "${MAPFILE%.pcimap}.alias" ]; then + # they tend to pop up everywhere there is a bridge. If we're only called to + # look for new devices, we skip those already supported by a driver. + if [ -n "$driver" -a $ONLYNEW -gt 0 ]; then + : + elif [ ! -z "$MAPFILE" -a -s "${MAPFILE%.pcimap}.alias" ]; then alias=$(printf "pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02X" $xvid $xpid $xsvid $xspid $(((xclass >> 16) & 0xff)) $(((xclass >> 8) & 0xff)) $((xclass & 0xff))) list="" for f1 in $(modprobe -q -R "$alias"); do -- 2.20.1