mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-14 19:03:13 +00:00
Now that sensors_get_ignored() is an internal function, we can change
its prototype to suit our needs better. * Pass the chip name by address. * Pass the feature directly rather than its number. * Switch to a sane convention for the returned value. * Don't check for errors that can't happen. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4646 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
9896986247
commit
eaec35491e
1 file changed
+18
-23
+18
-23
@@ -193,34 +193,29 @@ sensors_get_label_exit:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Looks up whether a feature should be ignored. Returns <0 on failure,
|
/* Looks up whether a feature should be ignored. Returns
|
||||||
0 if it should be ignored, 1 if it is valid. This function takes
|
1 if it should be ignored, 0 if not. This function takes
|
||||||
logical mappings into account. */
|
logical mappings into account. */
|
||||||
static int sensors_get_ignored(sensors_chip_name name, int feature)
|
static int sensors_get_ignored(const sensors_chip_name *name,
|
||||||
|
const sensors_chip_feature *feature)
|
||||||
{
|
{
|
||||||
const sensors_chip *chip;
|
const sensors_chip *chip;
|
||||||
const sensors_chip_feature *featureptr;
|
const char *main_feature_name;
|
||||||
const sensors_chip_feature *alt_featureptr;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (sensors_chip_name_has_wildcards(name))
|
if (feature->data.mapping == SENSORS_NO_MAPPING)
|
||||||
return -SENSORS_ERR_WILDCARDS;
|
main_feature_name = NULL;
|
||||||
if (!(featureptr = sensors_lookup_feature_nr(&name, feature)))
|
else
|
||||||
return -SENSORS_ERR_NO_ENTRY;
|
main_feature_name = sensors_lookup_feature_nr(name,
|
||||||
if (featureptr->data.mapping == SENSORS_NO_MAPPING)
|
feature->data.mapping)->data.name;
|
||||||
alt_featureptr = NULL;
|
|
||||||
else if (!(alt_featureptr =
|
for (chip = NULL; (chip = sensors_for_all_config_chips(*name, chip));)
|
||||||
sensors_lookup_feature_nr(&name,
|
|
||||||
featureptr->data.mapping)))
|
|
||||||
return -SENSORS_ERR_NO_ENTRY;
|
|
||||||
for (chip = NULL; (chip = sensors_for_all_config_chips(name, chip));)
|
|
||||||
for (i = 0; i < chip->ignores_count; i++)
|
for (i = 0; i < chip->ignores_count; i++)
|
||||||
if (!strcasecmp(featureptr->data.name, chip->ignores[i].name) ||
|
if (!strcasecmp(feature->data.name, chip->ignores[i].name) ||
|
||||||
(alt_featureptr &&
|
(main_feature_name &&
|
||||||
!strcasecmp(alt_featureptr->data.name, chip->ignores[i].name)))
|
!strcasecmp(main_feature_name, chip->ignores[i].name)))
|
||||||
return 0;
|
return 1;
|
||||||
/* valid */
|
return 0;
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the value of a feature of a certain chip. Note that chip should not
|
/* Read the value of a feature of a certain chip. Note that chip should not
|
||||||
@@ -347,7 +342,7 @@ const sensors_feature_data *sensors_get_all_features(sensors_chip_name name,
|
|||||||
if (sensors_match_chip(sensors_proc_chips[i].chip, name)) {
|
if (sensors_match_chip(sensors_proc_chips[i].chip, name)) {
|
||||||
feature_list = sensors_proc_chips[i].feature;
|
feature_list = sensors_proc_chips[i].feature;
|
||||||
while (feature_list[*nr].data.name
|
while (feature_list[*nr].data.name
|
||||||
&& sensors_get_ignored(name, feature_list[*nr].data.number) != 1)
|
&& sensors_get_ignored(&name, &feature_list[*nr]))
|
||||||
(*nr)++;
|
(*nr)++;
|
||||||
if (!feature_list[*nr].data.name)
|
if (!feature_list[*nr].data.name)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in new issue
Block a user