]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
thermal: armada: move validity check out of the read function
authorMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 16 Jul 2018 14:41:54 +0000 (16:41 +0200)
committerEduardo Valentin <edubezval@gmail.com>
Fri, 27 Jul 2018 21:43:11 +0000 (14:43 -0700)
Sensor selection when using multiple sensors already checks for the
sensor validity. Move it to the legacy ->get_temp() hook, where it is
still needed.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
drivers/thermal/armada_thermal.c

index 1f6bc317748d0ae66ffcb72360d408c2d86ec28e..53e757a2850617bf944649ca41efcf4358a49147 100644 (file)
@@ -329,13 +329,6 @@ static int armada_read_sensor(struct armada_thermal_priv *priv, int *temp)
        u32 reg, div;
        s64 sample, b, m;
 
-       /* Valid check */
-       if (priv->data->is_valid && !priv->data->is_valid(priv)) {
-               dev_err(priv->dev,
-                       "Temperature sensor reading not valid\n");
-               return -EIO;
-       }
-
        regmap_read(priv->syscon, priv->data->syscon_status_off, &reg);
        reg = (reg >> priv->data->temp_shift) & priv->data->temp_mask;
        if (priv->data->signed_sample)
@@ -363,6 +356,13 @@ static int armada_get_temp_legacy(struct thermal_zone_device *thermal,
        struct armada_thermal_priv *priv = thermal->devdata;
        int ret;
 
+       /* Valid check */
+       if (priv->data->is_valid && !priv->data->is_valid(priv)) {
+               dev_err(priv->dev,
+                       "Temperature sensor reading not valid\n");
+               return -EIO;
+       }
+
        /* Do the actual reading */
        ret = armada_read_sensor(priv, temp);