Skip to content

Commit 679d10d

Browse files
Niklas Söderlunddlezcano
authored andcommitted
thermal: rcar_gen3_thermal: Do not shadow thcode variable
The function rcar_gen3_thermal_calc_coefs() takes an argument called 'thcode' which shadows the static global 'thcode' variable. This is not harmful but bad for readability and is harmful for planned changes to the driver. The THCODE values should be read from hardware fuses if they are available and only fallback to the global 'thcode' variable if they are not fused. Rename the global 'thcode' variable to 'thcodes' to avoid shadowing the symbol in functions that take it as an argument. Signed-off-by: Niklas Söderlund <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent cff1d29 commit 679d10d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/thermal/rcar_gen3_thermal.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
#define TSC_MAX_NUM 3
6464

6565
/* default THCODE values if FUSEs are missing */
66-
static const int thcode[TSC_MAX_NUM][3] = {
66+
static const int thcodes[TSC_MAX_NUM][3] = {
6767
{ 3397, 2800, 2221 },
6868
{ 3393, 2795, 2216 },
6969
{ 3389, 2805, 2237 },
@@ -172,7 +172,7 @@ static int rcar_gen3_thermal_get_temp(void *devdata, int *temp)
172172
/* Read register and convert to mili Celsius */
173173
reg = rcar_gen3_thermal_read(tsc, REG_GEN3_TEMP) & CTEMP_MASK;
174174

175-
if (reg <= thcode[tsc->id][1])
175+
if (reg <= thcodes[tsc->id][1])
176176
val = FIXPT_DIV(FIXPT_INT(reg) - tsc->coef.b1,
177177
tsc->coef.a1);
178178
else
@@ -434,7 +434,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
434434
priv->tscs[i] = tsc;
435435

436436
priv->thermal_init(tsc);
437-
rcar_gen3_thermal_calc_coefs(tsc, ptat, thcode[i],
437+
rcar_gen3_thermal_calc_coefs(tsc, ptat, thcodes[i],
438438
*rcar_gen3_ths_tj_1);
439439

440440
zone = devm_thermal_zone_of_sensor_register(dev, i, tsc,

0 commit comments

Comments
 (0)