Skip to content

Commit c7ebf8e

Browse files
committed
mlxsw: core_thermal: Set THERMAL_TRIP_FLAG_RW_TEMP directly
It is now possible to flag trip points with THERMAL_TRIP_FLAG_RW_TEMP to allow their temperature to be set from user space via sysfs instead of using a nonzero writable trips mask during thermal zone registration, so make the mlxsw code do that. No intentional functional impact. Note that this change is requisite for dropping the mask argument from thermal_zone_device_register_with_trips() going forward. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
1 parent cca52f6 commit c7ebf8e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,19 @@ static const struct thermal_trip default_thermal_trips[] = {
4444
.type = THERMAL_TRIP_ACTIVE,
4545
.temperature = MLXSW_THERMAL_ASIC_TEMP_NORM,
4646
.hysteresis = MLXSW_THERMAL_HYSTERESIS_TEMP,
47+
.flags = THERMAL_TRIP_FLAG_RW_TEMP,
4748
},
4849
{
4950
/* In range - 40-100% PWM */
5051
.type = THERMAL_TRIP_ACTIVE,
5152
.temperature = MLXSW_THERMAL_ASIC_TEMP_HIGH,
5253
.hysteresis = MLXSW_THERMAL_HYSTERESIS_TEMP,
54+
.flags = THERMAL_TRIP_FLAG_RW_TEMP,
5355
},
5456
{ /* Warning */
5557
.type = THERMAL_TRIP_HOT,
5658
.temperature = MLXSW_THERMAL_ASIC_TEMP_HOT,
59+
.flags = THERMAL_TRIP_FLAG_RW_TEMP,
5760
},
5861
};
5962

@@ -62,16 +65,19 @@ static const struct thermal_trip default_thermal_module_trips[] = {
6265
.type = THERMAL_TRIP_ACTIVE,
6366
.temperature = MLXSW_THERMAL_MODULE_TEMP_NORM,
6467
.hysteresis = MLXSW_THERMAL_HYSTERESIS_TEMP,
68+
.flags = THERMAL_TRIP_FLAG_RW_TEMP,
6569
},
6670
{
6771
/* In range - 40-100% PWM */
6872
.type = THERMAL_TRIP_ACTIVE,
6973
.temperature = MLXSW_THERMAL_MODULE_TEMP_HIGH,
7074
.hysteresis = MLXSW_THERMAL_HYSTERESIS_TEMP,
75+
.flags = THERMAL_TRIP_FLAG_RW_TEMP,
7176
},
7277
{ /* Warning */
7378
.type = THERMAL_TRIP_HOT,
7479
.temperature = MLXSW_THERMAL_MODULE_TEMP_HOT,
80+
.flags = THERMAL_TRIP_FLAG_RW_TEMP,
7581
},
7682
};
7783

@@ -92,9 +98,6 @@ static const struct mlxsw_cooling_states default_cooling_states[] = {
9298

9399
#define MLXSW_THERMAL_NUM_TRIPS ARRAY_SIZE(default_thermal_trips)
94100

95-
/* Make sure all trips are writable */
96-
#define MLXSW_THERMAL_TRIP_MASK (BIT(MLXSW_THERMAL_NUM_TRIPS) - 1)
97-
98101
struct mlxsw_thermal;
99102

100103
struct mlxsw_thermal_module {
@@ -420,7 +423,7 @@ mlxsw_thermal_module_tz_init(struct mlxsw_thermal_module *module_tz)
420423
module_tz->tzdev = thermal_zone_device_register_with_trips(tz_name,
421424
module_tz->trips,
422425
MLXSW_THERMAL_NUM_TRIPS,
423-
MLXSW_THERMAL_TRIP_MASK,
426+
0,
424427
module_tz,
425428
&mlxsw_thermal_module_ops,
426429
&mlxsw_thermal_params,
@@ -548,7 +551,7 @@ mlxsw_thermal_gearbox_tz_init(struct mlxsw_thermal_module *gearbox_tz)
548551
gearbox_tz->tzdev = thermal_zone_device_register_with_trips(tz_name,
549552
gearbox_tz->trips,
550553
MLXSW_THERMAL_NUM_TRIPS,
551-
MLXSW_THERMAL_TRIP_MASK,
554+
0,
552555
gearbox_tz,
553556
&mlxsw_thermal_gearbox_ops,
554557
&mlxsw_thermal_params, 0,
@@ -773,7 +776,7 @@ int mlxsw_thermal_init(struct mlxsw_core *core,
773776
thermal->tzdev = thermal_zone_device_register_with_trips("mlxsw",
774777
thermal->trips,
775778
MLXSW_THERMAL_NUM_TRIPS,
776-
MLXSW_THERMAL_TRIP_MASK,
779+
0,
777780
thermal,
778781
&mlxsw_thermal_ops,
779782
&mlxsw_thermal_params, 0,

0 commit comments

Comments
 (0)