Changeset 5402

Show
Ignore:
Timestamp:
11/22/08 19:04:50 (5 years ago)
Author:
khali
Message:

Handle special case chips more efficiently. Instead of listing every
chip twice with just the driver field differing, we put the chip entry
in the main list directly and resolve the driver field at run-time.

Location:
lm-sensors/branches/lm-sensors-3.0.0
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/branches/lm-sensors-3.0.0/CHANGES

    r5399 r5402  
    1616                  Add SMSC LPC47M233 support 
    1717                  Drop support for Linux 2.4 (#2325) 
     18                  Handle special case chips more efficiently 
    1819 
    19203.0.3 (2008-09-28) 
  • lm-sensors/branches/lm-sensors-3.0.0/prog/detect/sensors-detect

    r5401 r5402  
    12881288     }, 
    12891289     { 
     1290       name => "FSC Poseidon I", 
     1291       driver => sub { kernel_version_at_least(2, 6, 24) ? "fschmd" : "fscpos" }, 
     1292       i2c_addrs => [0x73], 
     1293       i2c_detect => sub { fsc_detect(0, @_); }, 
     1294     }, 
     1295     { 
    12901296       name => "FSC Poseidon II", 
    12911297       driver => "to-be-written", 
     
    13001306     }, 
    13011307     { 
     1308       name => "FSC Hermes", 
     1309       driver => sub { kernel_version_at_least(2, 6, 24) ? "fschmd" : "fscher" }, 
     1310       i2c_addrs => [0x73], 
     1311       i2c_detect => sub { fsc_detect(3, @_); }, 
     1312     }, 
     1313     { 
    13021314       name => "FSC Heimdal", 
    13031315       driver => "fschmd", 
     
    14001412       isa_addrs => [0x0ca8], 
    14011413       isa_detect => sub { ipmi_smic_detect(@_); }, 
    1402      }, 
    1403 ); 
    1404  
    1405 # Special case chip information goes here and would be included in 
    1406 # the chip_special_cases routine below 
    1407 use vars qw(@chip_oldfsc_ids @chip_fschmd_ids); 
    1408  
    1409 # sigh special case for old seperate FSC drivers to new merged one mapping 
    1410 @chip_oldfsc_ids = ( 
    1411      { 
    1412        name => "FSC Poseidon I", 
    1413        driver => "fscpos", 
    1414        i2c_addrs => [0x73], 
    1415        i2c_detect => sub { fsc_detect(0, @_); }, 
    1416      }, 
    1417      { 
    1418        name => "FSC Hermes", 
    1419        driver => "fscher", 
    1420        i2c_addrs => [0x73], 
    1421        i2c_detect => sub { fsc_detect(3, @_); }, 
    1422      }, 
    1423 ); 
    1424  
    1425 @chip_fschmd_ids = ( 
    1426      { 
    1427        name => "FSC Poseidon I", 
    1428        driver => "fschmd", 
    1429        i2c_addrs => [0x73], 
    1430        i2c_detect => sub { fsc_detect(0, @_); }, 
    1431      }, 
    1432      { 
    1433        name => "FSC Hermes", 
    1434        driver => "fschmd", 
    1435        i2c_addrs => [0x73], 
    1436        i2c_detect => sub { fsc_detect(3, @_); }, 
    14371414     }, 
    14381415); 
     
    34383415################## 
    34393416 
    3440 # This routine allows you to select which chips are optionally added to the 
    3441 # chip detection list. The most common use is to allow for different chip 
    3442 # detection/drivers based on different linux kernels 
    3443 # This routine follows the pattern of the SiS adapter special cases 
     3417# This routine allows you to dynamically update the chip detection list. 
     3418# The most common use is to allow for different chip to driver mappings 
     3419# based on different linux kernels 
    34443420sub chip_special_cases 
    34453421{ 
    3446         # Based on the kernel, add the appropriate chip structures to the 
    3447         # chip_ids detection list 
    3448         if (kernel_version_at_least(2, 6, 24)) { 
    3449                 push @chip_ids, @chip_fschmd_ids; 
    3450         } else { 
    3451                 push @chip_ids, @chip_oldfsc_ids; 
     3422        # Some chip to driver mappings depend on the environment 
     3423        foreach my $chip (@chip_ids) { 
     3424                if (ref($chip->{driver}) eq 'CODE') { 
     3425                        $chip->{driver} = $chip->{driver}->(); 
     3426                } 
    34523427        } 
    34533428}