diff --git a/lib/access.c b/lib/access.c index 6469da6d..6e39f989 100644 --- a/lib/access.c +++ b/lib/access.c @@ -193,7 +193,10 @@ sensors_get_label_exit: return 0; } -int sensors_get_ignored(sensors_chip_name name, int feature) +/* Looks up whether a feature should be ignored. Returns <0 on failure, + 0 if it should be ignored, 1 if it is valid. This function takes + logical mappings into account. */ +static int sensors_get_ignored(sensors_chip_name name, int feature) { const sensors_chip *chip; const sensors_chip_feature *featureptr; @@ -343,6 +346,9 @@ const sensors_feature_data *sensors_get_all_features(sensors_chip_name name, for (i = 0; i < sensors_proc_chips_count; i++) if (sensors_match_chip(sensors_proc_chips[i].chip, name)) { feature_list = sensors_proc_chips[i].feature; + while (feature_list[*nr].data.name + && sensors_get_ignored(name, feature_list[*nr].data.number) != 1) + (*nr)++; if (!feature_list[*nr].data.name) return NULL; return &feature_list[(*nr)++].data; diff --git a/lib/sensors.h b/lib/sensors.h index 7ae4cb80..01e86909 100644 --- a/lib/sensors.h +++ b/lib/sensors.h @@ -83,11 +83,6 @@ extern const char *sensors_get_adapter_name(int bus_nr); extern int sensors_get_label(sensors_chip_name name, int feature, char **result); -/* Looks up whether a feature should be ignored. Returns <0 on failure, - 0 if it should be ignored, 1 if it is valid. This function takes - logical mappings into account. */ -extern int sensors_get_ignored(sensors_chip_name name, int fature); - /* Read the value of a feature of a certain chip. Note that chip should not contain wildcard values! This function will return 0 on success, and <0 on failure. */ diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 71f9300a..96bb801e 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -91,12 +91,7 @@ int sensors_get_label_and_valid(sensors_chip_name name, int feature, char **labe { int err; err = sensors_get_label(name,feature,label); - if (!err) - err = sensors_get_ignored(name,feature); - if (err >= 0) { - *valid = err; - err = 0; - } + *valid = !err; return err; }