sysfs: Specific match has to go before generic match

This is not really a problem when the specific scaling factors happen to
be for factors not matched by a generic match but this may not hold in
general over time.

Fixes: 1bd92120 ("Fill the magnitude field of dynamically generated device entries.")
This commit is contained in:
Michal Suchanek committed 2023-12-27 13:17:16 +01:00
1 parent aa87b54d43
commit b76cd8a5f6
1 file changed
+12 -10
+12 -10
View File
@@ -141,6 +141,17 @@ char sensors_sysfs_mount[NAME_MAX];
static
int get_type_scaling(sensors_subfeature_type type)
{
/* Multipliers for second class subfeatures
that need their own multiplier */
switch (type) {
case SENSORS_SUBFEATURE_POWER_AVERAGE_INTERVAL:
case SENSORS_SUBFEATURE_VID:
case SENSORS_SUBFEATURE_TEMP_OFFSET:
return 1000;
default:
break;
}
/* Multipliers for subfeatures */
switch (type & 0xFF80) {
case SENSORS_SUBFEATURE_IN_INPUT:
@@ -157,16 +168,7 @@ int get_type_scaling(sensors_subfeature_type type)
return 1000000;
}
/* Multipliers for second class subfeatures
that need their own multiplier */
switch (type) {
case SENSORS_SUBFEATURE_POWER_AVERAGE_INTERVAL:
case SENSORS_SUBFEATURE_VID:
case SENSORS_SUBFEATURE_TEMP_OFFSET:
return 1000;
default:
return 1;
}
return 1;
}
static