mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-24 20:21:43 +00:00
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.) git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4758 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
87efbc06c5
commit
20c98f41b7
5 files changed
+22
-28
No files matched your search
+9
-9
@@ -190,7 +190,7 @@ sensors_get_label_exit:
|
||||
|
||||
/* Looks up whether a feature should be ignored. Returns
|
||||
1 if it should be ignored, 0 if not. This function takes
|
||||
logical mappings into account. */
|
||||
mappings into account. */
|
||||
static int sensors_get_ignored(const sensors_chip_name *name,
|
||||
const sensors_chip_feature *feature)
|
||||
{
|
||||
@@ -232,11 +232,11 @@ int sensors_get_value(const sensors_chip_name *name, int feature,
|
||||
if (!(main_feature = sensors_lookup_feature_nr(name, feature)))
|
||||
return -SENSORS_ERR_NO_ENTRY;
|
||||
|
||||
if (main_feature->data.compute_mapping == SENSORS_NO_MAPPING)
|
||||
alt_feature = NULL;
|
||||
else
|
||||
if (main_feature->data.flags & SENSORS_COMPUTE_MAPPING)
|
||||
alt_feature = sensors_lookup_feature_nr(name,
|
||||
main_feature->data.compute_mapping);
|
||||
main_feature->data.mapping);
|
||||
else
|
||||
alt_feature = NULL;
|
||||
|
||||
if (!(main_feature->data.flags & SENSORS_MODE_R))
|
||||
return -SENSORS_ERR_ACCESS_R;
|
||||
@@ -279,11 +279,11 @@ int sensors_set_value(const sensors_chip_name *name, int feature,
|
||||
if (!(main_feature = sensors_lookup_feature_nr(name, feature)))
|
||||
return -SENSORS_ERR_NO_ENTRY;
|
||||
|
||||
if (main_feature->data.compute_mapping == SENSORS_NO_MAPPING)
|
||||
alt_feature = NULL;
|
||||
else
|
||||
if (main_feature->data.flags & SENSORS_COMPUTE_MAPPING)
|
||||
alt_feature = sensors_lookup_feature_nr(name,
|
||||
main_feature->data.compute_mapping);
|
||||
main_feature->data.mapping);
|
||||
else
|
||||
alt_feature = NULL;
|
||||
|
||||
if (!(main_feature->data.flags & SENSORS_MODE_W))
|
||||
return -SENSORS_ERR_ACCESS_W;
|
||||
|
||||
Reference in new issue
Block a user