Skip to content

Commit 3fc134a

Browse files
vadimp-nvidiadavem330
authored andcommitted
mlxsw: core_hwmon: Adjust module label names based on MTCAP sensor counter
Transceiver module temperature sensors are indexed after ASIC and platform sensors. The current label printing method does not take this into account and simply prints the index of the transceiver module sensor. On new systems that have platform sensors this results in incorrect (shifted) transceiver module labels being printed: $ sensors [...] front panel 002: +37.0°C (crit = +70.0°C, emerg = +75.0°C) front panel 003: +47.0°C (crit = +70.0°C, emerg = +75.0°C) [...] Fix by taking the sensor count into account. After the fix: $ sensors [...] front panel 001: +37.0°C (crit = +70.0°C, emerg = +75.0°C) front panel 002: +47.0°C (crit = +70.0°C, emerg = +75.0°C) [...] Fixes: a53779d ("mlxsw: core: Add QSFP module temperature label attribute to hwmon") Signed-off-by: Vadim Pasternak <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Signed-off-by: Petr Machata <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d7248f1 commit 3fc134a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,8 @@ mlxsw_hwmon_module_temp_label_show(struct device *dev,
405405
container_of(attr, struct mlxsw_hwmon_attr, dev_attr);
406406

407407
return sprintf(buf, "front panel %03u\n",
408-
mlxsw_hwmon_attr->type_index);
408+
mlxsw_hwmon_attr->type_index + 1 -
409+
mlxsw_hwmon_attr->mlxsw_hwmon_dev->sensor_count);
409410
}
410411

411412
static ssize_t

0 commit comments

Comments
 (0)