thermal: rcar_gen3_thermal: Do not shadow thcode variable
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Wed, 10 Jun 2020 00:33:00 +0000 (02:33 +0200)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Tue, 21 Jul 2020 13:01:43 +0000 (15:01 +0200)
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 <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20200610003300.884258-1-niklas.soderlund+renesas@ragnatech.se
drivers/thermal/rcar_gen3_thermal.c

index d4d73e88d5d16eecea5724cd08cd2cd70354600b..8333f92aff744c10abb1f48b785e97d0c9374c98 100644 (file)
@@ -63,7 +63,7 @@
 #define TSC_MAX_NUM    3
 
 /* default THCODE values if FUSEs are missing */
-static const int thcode[TSC_MAX_NUM][3] = {
+static const int thcodes[TSC_MAX_NUM][3] = {
        { 3397, 2800, 2221 },
        { 3393, 2795, 2216 },
        { 3389, 2805, 2237 },
@@ -172,7 +172,7 @@ static int rcar_gen3_thermal_get_temp(void *devdata, int *temp)
        /* Read register and convert to mili Celsius */
        reg = rcar_gen3_thermal_read(tsc, REG_GEN3_TEMP) & CTEMP_MASK;
 
-       if (reg <= thcode[tsc->id][1])
+       if (reg <= thcodes[tsc->id][1])
                val = FIXPT_DIV(FIXPT_INT(reg) - tsc->coef.b1,
                                tsc->coef.a1);
        else
@@ -434,7 +434,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
                priv->tscs[i] = tsc;
 
                priv->thermal_init(tsc);
-               rcar_gen3_thermal_calc_coefs(tsc, ptat, thcode[i],
+               rcar_gen3_thermal_calc_coefs(tsc, ptat, thcodes[i],
                                             *rcar_gen3_ths_tj_1);
 
                zone = devm_thermal_zone_of_sensor_register(dev, i, tsc,