Skip to content

Commit 68b1482

Browse files
miquelraynalEduardo Valentin
authored andcommitted
thermal: armada: move validity check out of the read function
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>
1 parent 00707e4 commit 68b1482

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/thermal/armada_thermal.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -329,13 +329,6 @@ static int armada_read_sensor(struct armada_thermal_priv *priv, int *temp)
329329
u32 reg, div;
330330
s64 sample, b, m;
331331

332-
/* Valid check */
333-
if (priv->data->is_valid && !priv->data->is_valid(priv)) {
334-
dev_err(priv->dev,
335-
"Temperature sensor reading not valid\n");
336-
return -EIO;
337-
}
338-
339332
regmap_read(priv->syscon, priv->data->syscon_status_off, &reg);
340333
reg = (reg >> priv->data->temp_shift) & priv->data->temp_mask;
341334
if (priv->data->signed_sample)
@@ -363,6 +356,13 @@ static int armada_get_temp_legacy(struct thermal_zone_device *thermal,
363356
struct armada_thermal_priv *priv = thermal->devdata;
364357
int ret;
365358

359+
/* Valid check */
360+
if (priv->data->is_valid && !priv->data->is_valid(priv)) {
361+
dev_err(priv->dev,
362+
"Temperature sensor reading not valid\n");
363+
return -EIO;
364+
}
365+
366366
/* Do the actual reading */
367367
ret = armada_read_sensor(priv, temp);
368368

0 commit comments

Comments
 (0)