Skip to content

Commit 8c0e64a

Browse files
miquelraynalEduardo Valentin
authored andcommitted
thermal: armada: get rid of the ->is_valid() pointer
The implementation of armada_is_valid() is very simple and is the same across all the versions of the IP since the ->is_valid_bit has been introduced. Simplify the structure by getting rid of the function pointer and calling directly the function. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
1 parent 68b1482 commit 8c0e64a

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

drivers/thermal/armada_thermal.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ struct armada_thermal_data {
8383
void (*init)(struct platform_device *pdev,
8484
struct armada_thermal_priv *priv);
8585

86-
/* Test for a valid sensor value (optional) */
87-
bool (*is_valid)(struct armada_thermal_priv *);
88-
8986
/* Formula coeficients: temp = (b - m * reg) / div */
9087
s64 coef_b;
9188
s64 coef_m;
@@ -267,6 +264,9 @@ static bool armada_is_valid(struct armada_thermal_priv *priv)
267264
{
268265
u32 reg;
269266

267+
if (!priv->data->is_valid_bit)
268+
return true;
269+
270270
regmap_read(priv->syscon, priv->data->syscon_status_off, &reg);
271271

272272
return reg & priv->data->is_valid_bit;
@@ -357,7 +357,7 @@ static int armada_get_temp_legacy(struct thermal_zone_device *thermal,
357357
int ret;
358358

359359
/* Valid check */
360-
if (priv->data->is_valid && !priv->data->is_valid(priv)) {
360+
if (armada_is_valid(priv)) {
361361
dev_err(priv->dev,
362362
"Temperature sensor reading not valid\n");
363363
return -EIO;
@@ -411,7 +411,6 @@ static const struct armada_thermal_data armadaxp_data = {
411411
};
412412

413413
static const struct armada_thermal_data armada370_data = {
414-
.is_valid = armada_is_valid,
415414
.init = armada370_init,
416415
.is_valid_bit = BIT(9),
417416
.temp_shift = 10,
@@ -424,7 +423,6 @@ static const struct armada_thermal_data armada370_data = {
424423
};
425424

426425
static const struct armada_thermal_data armada375_data = {
427-
.is_valid = armada_is_valid,
428426
.init = armada375_init,
429427
.is_valid_bit = BIT(10),
430428
.temp_shift = 0,
@@ -438,7 +436,6 @@ static const struct armada_thermal_data armada375_data = {
438436
};
439437

440438
static const struct armada_thermal_data armada380_data = {
441-
.is_valid = armada_is_valid,
442439
.init = armada380_init,
443440
.is_valid_bit = BIT(10),
444441
.temp_shift = 0,
@@ -453,7 +450,6 @@ static const struct armada_thermal_data armada380_data = {
453450
};
454451

455452
static const struct armada_thermal_data armada_ap806_data = {
456-
.is_valid = armada_is_valid,
457453
.init = armada_ap806_init,
458454
.is_valid_bit = BIT(16),
459455
.temp_shift = 0,
@@ -470,7 +466,6 @@ static const struct armada_thermal_data armada_ap806_data = {
470466
};
471467

472468
static const struct armada_thermal_data armada_cp110_data = {
473-
.is_valid = armada_is_valid,
474469
.init = armada_cp110_init,
475470
.is_valid_bit = BIT(10),
476471
.temp_shift = 0,

0 commit comments

Comments
 (0)