2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 22:35:23 +00:00

Clean up the PCI device probing, reducing complexity from O(N^2) to O(N).

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4110 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare
2006-08-25 14:00:59 +00:00
parent 8c235d29a9
commit 9ac1c6caa0

View File

@@ -2384,11 +2384,10 @@ sub adapter_pci_detection
adapter_pci_detection_sis_96x();
# Generic detection loop
while ( ($key, $device) = each %pci_list) {
foreach $try (@pci_adapters) {
if ($try->{vendid} == $device->{vendid} &&
$try->{devid} == $device->{devid} &&
(!defined($try->{func}) || $try->{func} == $device->{func})) {
foreach $try (@pci_adapters) {
$key = sprintf("%04x:%04x", $try->{vendid}, $try->{devid});
if (exists $pci_list{$key}) {
$device = $pci_list{$key};
printf "Use driver `%s' for device %02x:%02x.%x: %s\n",
$try->{driver},
$device->{bus},$device->{slot},$device->{func},$try->{procid};
@@ -2401,7 +2400,6 @@ sub adapter_pci_detection
print "\n";
}
push @res,$try->{driver};
}
}
}
if (! @res) {