2022-08-01 10:42:58

by Daniel Lezcano

[permalink] [raw]
Subject: [PATCH 1/2] Revert "mlxsw: core: Use different get_trend() callbacks for different thermal zones"

This reverts commit 2dc2f760052da4925482ecdcdc5c94d4a599153c.

As discussed in the thread:

https://lore.kernel.org/all/[email protected]/

the feature provided by commits 2dc2f760052da and 6f73862fabd93 is
actually already handled by the thermal framework via the cooling
device state aggregation, thus all this code is pointless.

No conflict happened when reverting the patch.

Signed-off-by: Daniel Lezcano <[email protected]>
---
.../ethernet/mellanox/mlxsw/core_thermal.c | 23 ++++---------------
1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
index 05f54bd982c0..f5751242653b 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
@@ -345,7 +345,8 @@ static int mlxsw_thermal_set_trip_hyst(struct thermal_zone_device *tzdev,
static int mlxsw_thermal_trend_get(struct thermal_zone_device *tzdev,
int trip, enum thermal_trend *trend)
{
- struct mlxsw_thermal *thermal = tzdev->devdata;
+ struct mlxsw_thermal_module *tz = tzdev->devdata;
+ struct mlxsw_thermal *thermal = tz->parent;

if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
return -EINVAL;
@@ -537,22 +538,6 @@ mlxsw_thermal_module_trip_hyst_set(struct thermal_zone_device *tzdev, int trip,
return 0;
}

-static int mlxsw_thermal_module_trend_get(struct thermal_zone_device *tzdev,
- int trip, enum thermal_trend *trend)
-{
- struct mlxsw_thermal_module *tz = tzdev->devdata;
- struct mlxsw_thermal *thermal = tz->parent;
-
- if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
- return -EINVAL;
-
- if (tzdev == thermal->tz_highest_dev)
- return 1;
-
- *trend = THERMAL_TREND_STABLE;
- return 0;
-}
-
static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {
.bind = mlxsw_thermal_module_bind,
.unbind = mlxsw_thermal_module_unbind,
@@ -562,7 +547,7 @@ static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {
.set_trip_temp = mlxsw_thermal_module_trip_temp_set,
.get_trip_hyst = mlxsw_thermal_module_trip_hyst_get,
.set_trip_hyst = mlxsw_thermal_module_trip_hyst_set,
- .get_trend = mlxsw_thermal_module_trend_get,
+ .get_trend = mlxsw_thermal_trend_get,
};

static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device *tzdev,
@@ -599,7 +584,7 @@ static struct thermal_zone_device_ops mlxsw_thermal_gearbox_ops = {
.set_trip_temp = mlxsw_thermal_module_trip_temp_set,
.get_trip_hyst = mlxsw_thermal_module_trip_hyst_get,
.set_trip_hyst = mlxsw_thermal_module_trip_hyst_set,
- .get_trend = mlxsw_thermal_module_trend_get,
+ .get_trend = mlxsw_thermal_trend_get,
};

static int mlxsw_thermal_get_max_state(struct thermal_cooling_device *cdev,
--
2.25.1



2022-08-01 11:26:17

by Vadim Pasternak

[permalink] [raw]
Subject: RE: [PATCH 1/2] Revert "mlxsw: core: Use different get_trend() callbacks for different thermal zones"



> -----Original Message-----
> From: Daniel Lezcano <[email protected]>
> Sent: Monday, August 1, 2022 12:56 PM
> To: [email protected]; [email protected]
> Cc: Vadim Pasternak <[email protected]>; [email protected];
> [email protected]; [email protected]; Ido Schimmel
> <[email protected]>; Petr Machata <[email protected]>; Eric Dumazet
> <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni
> <[email protected]>
> Subject: [PATCH 1/2] Revert "mlxsw: core: Use different get_trend()
> callbacks for different thermal zones"
>
> This reverts commit 2dc2f760052da4925482ecdcdc5c94d4a599153c.
>
> As discussed in the thread:
>
> https://lore.kernel.org/all/f3c62ebe-7d59-c537-a010-
> [email protected]/
>
> the feature provided by commits 2dc2f760052da and 6f73862fabd93 is
> actually already handled by the thermal framework via the cooling device
> state aggregation, thus all this code is pointless.
>
> No conflict happened when reverting the patch.

Hi Daniel,


I am sorry, I didn't run emulation yet to validate this change.
Will do it in tomorrow and will send ACK if it is OK.

Thanks,
Vadim.

>
> Signed-off-by: Daniel Lezcano <[email protected]>
> ---
> .../ethernet/mellanox/mlxsw/core_thermal.c | 23 ++++---------------
> 1 file changed, 4 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
> b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
> index 05f54bd982c0..f5751242653b 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
> @@ -345,7 +345,8 @@ static int mlxsw_thermal_set_trip_hyst(struct
> thermal_zone_device *tzdev, static int mlxsw_thermal_trend_get(struct
> thermal_zone_device *tzdev,
> int trip, enum thermal_trend *trend) {
> - struct mlxsw_thermal *thermal = tzdev->devdata;
> + struct mlxsw_thermal_module *tz = tzdev->devdata;
> + struct mlxsw_thermal *thermal = tz->parent;
>
> if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
> return -EINVAL;
> @@ -537,22 +538,6 @@ mlxsw_thermal_module_trip_hyst_set(struct
> thermal_zone_device *tzdev, int trip,
> return 0;
> }
>
> -static int mlxsw_thermal_module_trend_get(struct thermal_zone_device
> *tzdev,
> - int trip, enum thermal_trend
> *trend)
> -{
> - struct mlxsw_thermal_module *tz = tzdev->devdata;
> - struct mlxsw_thermal *thermal = tz->parent;
> -
> - if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
> - return -EINVAL;
> -
> - if (tzdev == thermal->tz_highest_dev)
> - return 1;
> -
> - *trend = THERMAL_TREND_STABLE;
> - return 0;
> -}
> -
> static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {
> .bind = mlxsw_thermal_module_bind,
> .unbind = mlxsw_thermal_module_unbind,
> @@ -562,7 +547,7 @@ static struct thermal_zone_device_ops
> mlxsw_thermal_module_ops = {
> .set_trip_temp = mlxsw_thermal_module_trip_temp_set,
> .get_trip_hyst = mlxsw_thermal_module_trip_hyst_get,
> .set_trip_hyst = mlxsw_thermal_module_trip_hyst_set,
> - .get_trend = mlxsw_thermal_module_trend_get,
> + .get_trend = mlxsw_thermal_trend_get,
> };
>
> static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device
> *tzdev, @@ -599,7 +584,7 @@ static struct thermal_zone_device_ops
> mlxsw_thermal_gearbox_ops = {
> .set_trip_temp = mlxsw_thermal_module_trip_temp_set,
> .get_trip_hyst = mlxsw_thermal_module_trip_hyst_get,
> .set_trip_hyst = mlxsw_thermal_module_trip_hyst_set,
> - .get_trend = mlxsw_thermal_module_trend_get,
> + .get_trend = mlxsw_thermal_trend_get,
> };
>
> static int mlxsw_thermal_get_max_state(struct thermal_cooling_device
> *cdev,
> --
> 2.25.1


2022-08-02 03:22:45

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH 1/2] Revert "mlxsw: core: Use different get_trend() callbacks for different thermal zones"

On Mon, 1 Aug 2022 11:13:36 +0000 Vadim Pasternak wrote:
> > This reverts commit 2dc2f760052da4925482ecdcdc5c94d4a599153c.
> >
> > As discussed in the thread:
> >
> > https://lore.kernel.org/all/f3c62ebe-7d59-c537-a010-
> > [email protected]/
> >
> > the feature provided by commits 2dc2f760052da and 6f73862fabd93 is
> > actually already handled by the thermal framework via the cooling device
> > state aggregation, thus all this code is pointless.
> >
> > No conflict happened when reverting the patch.
>
> I am sorry, I didn't run emulation yet to validate this change.
> Will do it in tomorrow and will send ACK if it is OK.

We'll also need a rebase on top of net-next, the patch as is does not
apply to either of the networking trees.

2022-08-04 12:41:09

by Vadim Pasternak

[permalink] [raw]
Subject: RE: [PATCH 1/2] Revert "mlxsw: core: Use different get_trend() callbacks for different thermal zones"



> -----Original Message-----
> From: Daniel Lezcano <[email protected]>
> Sent: Monday, August 1, 2022 12:56 PM
> To: [email protected]; [email protected]
> Cc: Vadim Pasternak <[email protected]>; [email protected];
> [email protected]; [email protected]; Ido Schimmel
> <[email protected]>; Petr Machata <[email protected]>; Eric Dumazet
> <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni
> <[email protected]>
> Subject: [PATCH 1/2] Revert "mlxsw: core: Use different get_trend()
> callbacks for different thermal zones"
>
> This reverts commit 2dc2f760052da4925482ecdcdc5c94d4a599153c.
>
> As discussed in the thread:
>
> https://lore.kernel.org/all/f3c62ebe-7d59-c537-a010-
> [email protected]/
>
> the feature provided by commits 2dc2f760052da and 6f73862fabd93 is
> actually already handled by the thermal framework via the cooling device
> state aggregation, thus all this code is pointless.
>
> No conflict happened when reverting the patch.
>
> Signed-off-by: Daniel Lezcano <[email protected]>
Tested-by: Vadim Pasternak <[email protected]>

> ---
> .../ethernet/mellanox/mlxsw/core_thermal.c | 23 ++++---------------
> 1 file changed, 4 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
> b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
> index 05f54bd982c0..f5751242653b 100644
> --- a/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/core_thermal.c
> @@ -345,7 +345,8 @@ static int mlxsw_thermal_set_trip_hyst(struct
> thermal_zone_device *tzdev, static int mlxsw_thermal_trend_get(struct
> thermal_zone_device *tzdev,
> int trip, enum thermal_trend *trend) {
> - struct mlxsw_thermal *thermal = tzdev->devdata;
> + struct mlxsw_thermal_module *tz = tzdev->devdata;
> + struct mlxsw_thermal *thermal = tz->parent;
>
> if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
> return -EINVAL;
> @@ -537,22 +538,6 @@ mlxsw_thermal_module_trip_hyst_set(struct
> thermal_zone_device *tzdev, int trip,
> return 0;
> }
>
> -static int mlxsw_thermal_module_trend_get(struct thermal_zone_device
> *tzdev,
> - int trip, enum thermal_trend
> *trend)
> -{
> - struct mlxsw_thermal_module *tz = tzdev->devdata;
> - struct mlxsw_thermal *thermal = tz->parent;
> -
> - if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
> - return -EINVAL;
> -
> - if (tzdev == thermal->tz_highest_dev)
> - return 1;
> -
> - *trend = THERMAL_TREND_STABLE;
> - return 0;
> -}
> -
> static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {
> .bind = mlxsw_thermal_module_bind,
> .unbind = mlxsw_thermal_module_unbind,
> @@ -562,7 +547,7 @@ static struct thermal_zone_device_ops
> mlxsw_thermal_module_ops = {
> .set_trip_temp = mlxsw_thermal_module_trip_temp_set,
> .get_trip_hyst = mlxsw_thermal_module_trip_hyst_get,
> .set_trip_hyst = mlxsw_thermal_module_trip_hyst_set,
> - .get_trend = mlxsw_thermal_module_trend_get,
> + .get_trend = mlxsw_thermal_trend_get,
> };
>
> static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device
> *tzdev, @@ -599,7 +584,7 @@ static struct thermal_zone_device_ops
> mlxsw_thermal_gearbox_ops = {
> .set_trip_temp = mlxsw_thermal_module_trip_temp_set,
> .get_trip_hyst = mlxsw_thermal_module_trip_hyst_get,
> .set_trip_hyst = mlxsw_thermal_module_trip_hyst_set,
> - .get_trend = mlxsw_thermal_module_trend_get,
> + .get_trend = mlxsw_thermal_trend_get,
> };
>
> static int mlxsw_thermal_get_max_state(struct thermal_cooling_device
> *cdev,
> --
> 2.25.1