summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/mellanox/mlxsw
diff options
context:
space:
mode:
authorAndrzej Pietrasiewicz <andrzej.p@collabora.com>2020-06-29 15:29:18 +0300
committerDaniel Lezcano <daniel.lezcano@linaro.org>2020-06-29 21:26:34 +0300
commit5a3506657f71d7ca124c040aff98639673c5dc97 (patch)
tree7cae0f77b9bb04ff0281c62b85b1506e467a572f /drivers/net/ethernet/mellanox/mlxsw
parentcbba1d719534b77b857267890b0f54f0f0a90de4 (diff)
downloadlinux-5a3506657f71d7ca124c040aff98639673c5dc97.tar.xz
thermal: Store device mode in struct thermal_zone_device
Prepare for eliminating get_mode(). Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> [for acerhdf] Acked-by: Peter Kaestle <peter@piie.net> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20200629122925.21729-5-andrzej.p@collabora.com
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlxsw')
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/core_thermal.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
index 05f8d5a92862..51667ed99c21 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
@@ -98,7 +98,6 @@ struct mlxsw_thermal_module {
struct mlxsw_thermal *parent;
struct thermal_zone_device *tzdev;
struct mlxsw_thermal_trip trips[MLXSW_THERMAL_NUM_TRIPS];
- enum thermal_device_mode mode;
int module; /* Module or gearbox number */
};
@@ -110,7 +109,6 @@ struct mlxsw_thermal {
struct thermal_cooling_device *cdevs[MLXSW_MFCR_PWMS_MAX];
u8 cooling_levels[MLXSW_THERMAL_MAX_STATE + 1];
struct mlxsw_thermal_trip trips[MLXSW_THERMAL_NUM_TRIPS];
- enum thermal_device_mode mode;
struct mlxsw_thermal_module *tz_module_arr;
u8 tz_module_num;
struct mlxsw_thermal_module *tz_gearbox_arr;
@@ -280,9 +278,7 @@ static int mlxsw_thermal_unbind(struct thermal_zone_device *tzdev,
static int mlxsw_thermal_get_mode(struct thermal_zone_device *tzdev,
enum thermal_device_mode *mode)
{
- struct mlxsw_thermal *thermal = tzdev->devdata;
-
- *mode = thermal->mode;
+ *mode = tzdev->mode;
return 0;
}
@@ -299,9 +295,9 @@ static int mlxsw_thermal_set_mode(struct thermal_zone_device *tzdev,
else
tzdev->polling_delay = 0;
+ tzdev->mode = mode;
mutex_unlock(&tzdev->lock);
- thermal->mode = mode;
thermal_zone_device_update(tzdev, THERMAL_EVENT_UNSPECIFIED);
return 0;
@@ -468,9 +464,7 @@ static int mlxsw_thermal_module_unbind(struct thermal_zone_device *tzdev,
static int mlxsw_thermal_module_mode_get(struct thermal_zone_device *tzdev,
enum thermal_device_mode *mode)
{
- struct mlxsw_thermal_module *tz = tzdev->devdata;
-
- *mode = tz->mode;
+ *mode = tzdev->mode;
return 0;
}
@@ -488,9 +482,10 @@ static int mlxsw_thermal_module_mode_set(struct thermal_zone_device *tzdev,
else
tzdev->polling_delay = 0;
+ tzdev->mode = mode;
+
mutex_unlock(&tzdev->lock);
- tz->mode = mode;
thermal_zone_device_update(tzdev, THERMAL_EVENT_UNSPECIFIED);
return 0;
@@ -780,7 +775,7 @@ mlxsw_thermal_module_tz_init(struct mlxsw_thermal_module *module_tz)
return err;
}
- module_tz->mode = THERMAL_DEVICE_ENABLED;
+ module_tz->tzdev->mode = THERMAL_DEVICE_ENABLED;
return 0;
}
@@ -896,7 +891,7 @@ mlxsw_thermal_gearbox_tz_init(struct mlxsw_thermal_module *gearbox_tz)
if (IS_ERR(gearbox_tz->tzdev))
return PTR_ERR(gearbox_tz->tzdev);
- gearbox_tz->mode = THERMAL_DEVICE_ENABLED;
+ gearbox_tz->tzdev->mode = THERMAL_DEVICE_ENABLED;
return 0;
}
@@ -1065,7 +1060,7 @@ int mlxsw_thermal_init(struct mlxsw_core *core,
if (err)
goto err_unreg_modules_tzdev;
- thermal->mode = THERMAL_DEVICE_ENABLED;
+ thermal->tzdev->mode = THERMAL_DEVICE_ENABLED;
*p_thermal = thermal;
return 0;