Skip to content
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.

Commit

Permalink
mlxsw: core_thermal: Add line card id prefix to line card thermal zon…
Browse files Browse the repository at this point in the history
…e name

Add prefix "lc#n" to thermal zones associated with the thermal objects
found on line cards.

For example thermal zone for module #9 located at line card #7 will
have type:
mlxsw-lc7-module9.
And thermal zone for gearbox #3 located at line card #5 will have type:
mlxsw-lc5-gearbox3.

Signed-off-by: Vadim Pasternak <[email protected]>
Reviewed-by: Jiri Pirko <[email protected]>
Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
vadimp-nvidia authored and davem330 committed Apr 15, 2022
1 parent ef0df4f commit 6d94449
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,12 @@ mlxsw_thermal_module_tz_init(struct mlxsw_thermal_module *module_tz)
char tz_name[MLXSW_THERMAL_ZONE_MAX_NAME];
int err;

snprintf(tz_name, sizeof(tz_name), "mlxsw-module%d",
module_tz->module + 1);
if (module_tz->slot_index)
snprintf(tz_name, sizeof(tz_name), "mlxsw-lc%d-module%d",
module_tz->slot_index, module_tz->module + 1);
else
snprintf(tz_name, sizeof(tz_name), "mlxsw-module%d",
module_tz->module + 1);
module_tz->tzdev = thermal_zone_device_register(tz_name,
MLXSW_THERMAL_NUM_TRIPS,
MLXSW_THERMAL_TRIP_MASK,
Expand Down Expand Up @@ -820,8 +824,12 @@ mlxsw_thermal_gearbox_tz_init(struct mlxsw_thermal_module *gearbox_tz)
char tz_name[MLXSW_THERMAL_ZONE_MAX_NAME];
int ret;

snprintf(tz_name, sizeof(tz_name), "mlxsw-gearbox%d",
gearbox_tz->module + 1);
if (gearbox_tz->slot_index)
snprintf(tz_name, sizeof(tz_name), "mlxsw-lc%d-gearbox%d",
gearbox_tz->slot_index, gearbox_tz->module + 1);
else
snprintf(tz_name, sizeof(tz_name), "mlxsw-gearbox%d",
gearbox_tz->module + 1);
gearbox_tz->tzdev = thermal_zone_device_register(tz_name,
MLXSW_THERMAL_NUM_TRIPS,
MLXSW_THERMAL_TRIP_MASK,
Expand Down

0 comments on commit 6d94449

Please sign in to comment.