OSDN Git Service

mlxsw: core_thermal: Avoid creation of virtual hwmon objects by thermal module
authorVadim Pasternak <vadimp@nvidia.com>
Tue, 22 Feb 2022 17:16:54 +0000 (19:16 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Feb 2022 12:38:16 +0000 (12:38 +0000)
The driver registers with both the hwmon and thermal subsystems.
Therefore, there is no need for the thermal subsystem to automatically
create hwmon entries upon registration of a thermal zone, as this
results in duplicate information.

Avoid creation of virtual hwmon objects by thermal subsystem by
registering a thermal zone with 'no_hwmon' set to 'true'.

Signed-off-by: Vadim Pasternak <vadimp@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c

index b298244..e20ac2b 100644 (file)
@@ -357,6 +357,10 @@ static int mlxsw_thermal_trend_get(struct thermal_zone_device *tzdev,
        return 0;
 }
 
+static struct thermal_zone_params mlxsw_thermal_params = {
+       .no_hwmon = true,
+};
+
 static struct thermal_zone_device_ops mlxsw_thermal_ops = {
        .bind = mlxsw_thermal_bind,
        .unbind = mlxsw_thermal_unbind,
@@ -678,7 +682,8 @@ mlxsw_thermal_module_tz_init(struct mlxsw_thermal_module *module_tz)
                                                        MLXSW_THERMAL_TRIP_MASK,
                                                        module_tz,
                                                        &mlxsw_thermal_module_ops,
-                                                       NULL, 0,
+                                                       &mlxsw_thermal_params,
+                                                       0,
                                                        module_tz->parent->polling_delay);
        if (IS_ERR(module_tz->tzdev)) {
                err = PTR_ERR(module_tz->tzdev);
@@ -808,7 +813,7 @@ mlxsw_thermal_gearbox_tz_init(struct mlxsw_thermal_module *gearbox_tz)
                                                MLXSW_THERMAL_TRIP_MASK,
                                                gearbox_tz,
                                                &mlxsw_thermal_gearbox_ops,
-                                               NULL, 0,
+                                               &mlxsw_thermal_params, 0,
                                                gearbox_tz->parent->polling_delay);
        if (IS_ERR(gearbox_tz->tzdev))
                return PTR_ERR(gearbox_tz->tzdev);
@@ -968,7 +973,7 @@ int mlxsw_thermal_init(struct mlxsw_core *core,
                                                      MLXSW_THERMAL_TRIP_MASK,
                                                      thermal,
                                                      &mlxsw_thermal_ops,
-                                                     NULL, 0,
+                                                     &mlxsw_thermal_params, 0,
                                                      thermal->polling_delay);
        if (IS_ERR(thermal->tzdev)) {
                err = PTR_ERR(thermal->tzdev);