All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Ido Schimmel <idosch@idosch.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net, jiri@mellanox.com,
	mlxsw@mellanox.com, Vadim Pasternak <vadimp@mellanox.com>,
	Ido Schimmel <idosch@mellanox.com>
Subject: Re: [PATCH net-next 3/3] mlxsw: core: Add support for negative temperature readout
Date: Sun, 23 Jun 2019 17:44:07 +0200	[thread overview]
Message-ID: <20190623154407.GE28942@lunn.ch> (raw)
In-Reply-To: <20190623125645.2663-4-idosch@idosch.org>

> --- a/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
> +++ b/drivers/net/ethernet/mellanox/mlxsw/core_hwmon.c
> @@ -52,8 +52,7 @@ static ssize_t mlxsw_hwmon_temp_show(struct device *dev,
>  			container_of(attr, struct mlxsw_hwmon_attr, dev_attr);
>  	struct mlxsw_hwmon *mlxsw_hwmon = mlwsw_hwmon_attr->hwmon;
>  	char mtmp_pl[MLXSW_REG_MTMP_LEN];
> -	unsigned int temp;
> -	int index;
> +	int temp, index;
>  	int err;
>  
>  	index = mlxsw_hwmon_get_attr_index(mlwsw_hwmon_attr->type_index,
> @@ -65,7 +64,7 @@ static ssize_t mlxsw_hwmon_temp_show(struct device *dev,
>  		return err;
>  	}
>  	mlxsw_reg_mtmp_unpack(mtmp_pl, &temp, NULL, NULL);
> -	return sprintf(buf, "%u\n", temp);
> +	return sprintf(buf, "%d\n", temp);
>  }

If you had used the hwmon core, rather than implementing it yourself,
you could of avoided this part of the bug.

>  static ssize_t mlxsw_hwmon_temp_rst_store(struct device *dev,
> @@ -215,8 +213,8 @@ static ssize_t mlxsw_hwmon_module_temp_show(struct device *dev,
>  			container_of(attr, struct mlxsw_hwmon_attr, dev_attr);
>  	struct mlxsw_hwmon *mlxsw_hwmon = mlwsw_hwmon_attr->hwmon;
>  	char mtmp_pl[MLXSW_REG_MTMP_LEN];
> -	unsigned int temp;
>  	u8 module;
> +	int temp;
>  	int err;
>  
>  	module = mlwsw_hwmon_attr->type_index - mlxsw_hwmon->sensor_count;

I think you missed changing the %u to %d in this function.

> @@ -519,14 +519,14 @@ static int mlxsw_thermal_module_temp_get(struct thermal_zone_device *tzdev,
>  		return 0;
>  	}
>  	mlxsw_reg_mtmp_unpack(mtmp_pl, &temp, NULL, NULL);
> -	*p_temp = (int) temp;
> +	*p_temp = temp;
>  
>  	if (!temp)
>  		return 0;
>  
>  	/* Update trip points. */
>  	err = mlxsw_thermal_module_trips_update(dev, thermal->core, tz);
> -	if (!err)
> +	if (!err && temp > 0)
>  		mlxsw_thermal_tz_score_update(thermal, tzdev, tz->trips, temp);

Why the > 0?

    Andrew

  reply	other threads:[~2019-06-23 15:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-23 12:56 [PATCH net-next 0/3] mlxsw: Thermal and hwmon extensions Ido Schimmel
2019-06-23 12:56 ` [PATCH net-next 1/3] mlxsw: core: Extend thermal core with per inter-connect device thermal zones Ido Schimmel
2019-06-23 12:56 ` [PATCH net-next 2/3] mlxsw: core: Add the hottest thermal zone detection Ido Schimmel
2019-06-23 12:56 ` [PATCH net-next 3/3] mlxsw: core: Add support for negative temperature readout Ido Schimmel
2019-06-23 15:44   ` Andrew Lunn [this message]
2019-06-23 16:00     ` Vadim Pasternak
2019-06-23 16:11       ` Vadim Pasternak
2019-06-23 16:25       ` Andrew Lunn
2019-06-23 16:34         ` Vadim Pasternak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190623154407.GE28942@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=idosch@idosch.org \
    --cc=idosch@mellanox.com \
    --cc=jiri@mellanox.com \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=vadimp@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.