Show
Ignore:
Timestamp:
08/25/06 16:00:59 (8 years ago)
Author:
khali
Message:

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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/prog/detect/sensors-detect

    r4108 r4110  
    23852385 
    23862386  # Generic detection loop 
    2387   while ( ($key, $device) = each %pci_list) { 
    2388     foreach $try (@pci_adapters) { 
    2389       if ($try->{vendid} == $device->{vendid} && 
    2390           $try->{devid} == $device->{devid} && 
    2391           (!defined($try->{func}) || $try->{func} == $device->{func})) { 
     2387  foreach $try (@pci_adapters) { 
     2388    $key = sprintf("%04x:%04x", $try->{vendid}, $try->{devid}); 
     2389    if (exists $pci_list{$key}) { 
     2390        $device = $pci_list{$key}; 
    23922391        printf "Use driver `%s' for device %02x:%02x.%x: %s\n", 
    23932392               $try->{driver}, 
     
    24022401        } 
    24032402        push @res,$try->{driver}; 
    2404       } 
    24052403    } 
    24062404  }