mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-12-05 22:08:19 +00:00
Work with the feature type instead of the shifted subfeature type where
possible. This makes the code more readable. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5875 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
62fd781722
commit
9b44cc2819
1 file changed
+15
-13
+15
-13
@@ -382,16 +382,19 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
|
|||||||
sftype = sensors_subfeature_get_type(name, &nr);
|
sftype = sensors_subfeature_get_type(name, &nr);
|
||||||
if (sftype == SENSORS_SUBFEATURE_UNKNOWN)
|
if (sftype == SENSORS_SUBFEATURE_UNKNOWN)
|
||||||
continue;
|
continue;
|
||||||
|
ftype = sftype >> 8;
|
||||||
|
|
||||||
/* Adjust the channel number */
|
/* Adjust the channel number */
|
||||||
switch (sftype & 0xFF00) {
|
switch (ftype) {
|
||||||
case SENSORS_SUBFEATURE_FAN_INPUT:
|
case SENSORS_FEATURE_FAN:
|
||||||
case SENSORS_SUBFEATURE_TEMP_INPUT:
|
case SENSORS_FEATURE_TEMP:
|
||||||
case SENSORS_SUBFEATURE_POWER_AVERAGE:
|
case SENSORS_FEATURE_POWER:
|
||||||
case SENSORS_SUBFEATURE_ENERGY_INPUT:
|
case SENSORS_FEATURE_ENERGY:
|
||||||
case SENSORS_SUBFEATURE_CURR_INPUT:
|
case SENSORS_FEATURE_CURR:
|
||||||
nr--;
|
nr--;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nr < 0 || nr >= MAX_SENSORS_PER_TYPE) {
|
if (nr < 0 || nr >= MAX_SENSORS_PER_TYPE) {
|
||||||
@@ -406,19 +409,18 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
|
|||||||
|
|
||||||
/* "calculate" a place to store the subfeature in our sparse,
|
/* "calculate" a place to store the subfeature in our sparse,
|
||||||
sorted table */
|
sorted table */
|
||||||
switch (sftype) {
|
switch (ftype) {
|
||||||
case SENSORS_SUBFEATURE_VID:
|
case SENSORS_FEATURE_VID:
|
||||||
i = SUB_OFFSET_OTHER +
|
i = SUB_OFFSET_OTHER +
|
||||||
((sftype >> 8) - SENSORS_FEATURE_VID) *
|
(ftype - SENSORS_FEATURE_VID) * FEATURE_TYPE_SIZE +
|
||||||
FEATURE_TYPE_SIZE +
|
|
||||||
nr * FEATURE_SIZE + (sftype & 0xFF);
|
nr * FEATURE_SIZE + (sftype & 0xFF);
|
||||||
break;
|
break;
|
||||||
case SENSORS_SUBFEATURE_BEEP_ENABLE:
|
case SENSORS_FEATURE_BEEP_ENABLE:
|
||||||
i = SUB_OFFSET_MISC +
|
i = SUB_OFFSET_MISC +
|
||||||
((sftype >> 8) - SENSORS_FEATURE_BEEP_ENABLE);
|
(ftype - SENSORS_FEATURE_BEEP_ENABLE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
i = (sftype >> 8) * FEATURE_TYPE_SIZE +
|
i = ftype * FEATURE_TYPE_SIZE +
|
||||||
nr * FEATURE_SIZE +
|
nr * FEATURE_SIZE +
|
||||||
((sftype & 0x80) >> 7) * MAX_SUBFEATURES +
|
((sftype & 0x80) >> 7) * MAX_SUBFEATURES +
|
||||||
(sftype & 0x7F);
|
(sftype & 0x7F);
|
||||||
|
|||||||
Reference in new issue
Block a user