Show
Ignore:
Timestamp:
09/05/07 10:17:22 (6 years ago)
Author:
khali
Message:

The compute mapping value is either SENSORS_NO_MAPPING or the same
feature number as the logical mapping. This means that the compute
mapping can be turned into a simple boolean flag. Doing so makes
struct sensors_feature_data smaller, which saves some memory (about
17 kB in my tests.)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/branches/lm-sensors-3.0.0/lib/sysfs.c

    r4757 r4758  
    143143                        /* main feature */ 
    144144                        feature.data.mapping = SENSORS_NO_MAPPING; 
    145                         feature.data.compute_mapping = SENSORS_NO_MAPPING; 
    146                 } else if (type & 0x10) { 
    147                         /* sub feature without compute mapping */ 
     145                } else { 
     146                        /* sub feature */ 
    148147                        feature.data.mapping = i - i % MAX_SUB_FEATURES; 
    149                         feature.data.compute_mapping = SENSORS_NO_MAPPING; 
    150                 } else { 
    151                         feature.data.mapping = i - i % MAX_SUB_FEATURES; 
    152                         feature.data.compute_mapping = feature.data.mapping; 
     148                        if (!(type & 0x10)) 
     149                                feature.data.flags |= SENSORS_COMPUTE_MAPPING; 
    153150                } 
    154151