diff mbox series

[v2,1/2] thermal: rcar_thermal: Remove temperature bound

Message ID 20200117152242.3804288-2-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
State Superseded, archived
Headers show
Series thermal: rcar_{gen3_}thermal: Remove temperature | expand

Commit Message

Niklas Söderlund Jan. 17, 2020, 3:22 p.m. UTC
The hardware manual states that the operation of the sensor is not
guaranteed outside the range of -45°C to 125°C, not that the readings
are invalid. Remove the bound check and try to deliver temperature
readings even if we are outside the guaranteed operation range.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
* Changes since v2
- Preserver the guaranteed operating range in a comment.
---
 drivers/thermal/rcar_thermal.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Niklas Söderlund Jan. 17, 2020, 4:05 p.m. UTC | #1
On 2020-01-17 16:22:41 +0100, Niklas Söderlund wrote:
> The hardware manual states that the operation of the sensor is not
> guaranteed outside the range of -45°C to 125°C, not that the readings
> are invalid. Remove the bound check and try to deliver temperature
> readings even if we are outside the guaranteed operation range.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
> * Changes since v2
> - Preserver the guaranteed operating range in a comment.
> ---
>  drivers/thermal/rcar_thermal.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> index d0873de718da9218..f9c1fa10e6a2b3fd 100644
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -275,12 +275,7 @@ static int rcar_thermal_get_current_temp(struct rcar_thermal_priv *priv,
>  		tmp = MCELSIUS((priv->ctemp * 5) - 60);
>  	mutex_unlock(&priv->lock);
>  
> -	if ((tmp < MCELSIUS(-45)) || (tmp > MCELSIUS(125))) {
> -		struct device *dev = rcar_priv_to_dev(priv);
> -
> -		dev_err(dev, "it couldn't measure temperature correctly\n");
> -		return -EIO;
> -	}
> +	/* Guaranteed operating ragne is -45C to 125C. */

s/ragne/range/

A bit embarrassing, sometime my hands can't keep up... Will send v3.

>  
>  	*temp = tmp;
>  
> -- 
> 2.24.1
>
diff mbox series

Patch

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index d0873de718da9218..f9c1fa10e6a2b3fd 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -275,12 +275,7 @@  static int rcar_thermal_get_current_temp(struct rcar_thermal_priv *priv,
 		tmp = MCELSIUS((priv->ctemp * 5) - 60);
 	mutex_unlock(&priv->lock);
 
-	if ((tmp < MCELSIUS(-45)) || (tmp > MCELSIUS(125))) {
-		struct device *dev = rcar_priv_to_dev(priv);
-
-		dev_err(dev, "it couldn't measure temperature correctly\n");
-		return -EIO;
-	}
+	/* Guaranteed operating ragne is -45C to 125C. */
 
 	*temp = tmp;