thermal: rcar_gen3_thermal: Fix Wshift-negative-value
Subsystems (2)
PATCH 1/1 thermal: rcar_gen3_thermal: Fix Wshift-negative-value
Clang produces the following warning
vers/thermal/rcar_gen3_thermal.c:147:33: warning: shifting a negative signed value is undefined [-Wshift-negative-value] / (ptat[0] - ptat[2])) + FIXPT_INT(TJ_3); ^~~~~~~~~~~~~~~ drivers/thermal/rcar_gen3_thermal.c:126:29
note: expanded from macro 'FIXPT_INT' #define FIXPT_INT(_x) ((_x) << FIXPT_SHIFT) ~~~~ ^ drivers/thermal/rcar_gen3_thermal.c:150:18: warning:
shifting a negative signed value is undefined [-Wshift-negative-value] tsc->tj_t - FIXPT_INT(TJ_3)); ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
Upon further investigating it looks like there is no real reason for TJ_3 to be -41. Usages subtract -41, code would be cleaner to just add.
--- drivers/thermal/rcar_gen3_thermal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/thermal/rcar_gen3_thermal.c +4 -4
@@ -131,7 +131,7 @@ static inline void rcar_gen3_thermal_write(struct rcar_gen3_thermal_tsc *tsc,#define RCAR3_THERMAL_GRAN 500/* mili Celsius */ /* no idea where these constants come from */ -#define TJ_3 -41 +#define TJ_3 41 static void rcar_gen3_thermal_calc_coefs(struct rcar_gen3_thermal_tsc *tsc, int *ptat, const int *thcode,
@@ -144,11 +144,11 @@ static void rcar_gen3_thermal_calc_coefs(struct rcar_gen3_thermal_tsc *tsc,* the dividend (4095 * 4095 << 14 > INT_MAX) so keep it unscaled */ tsc->tj_t = (FIXPT_INT ((ptat[1 ] - ptat[2 ]) *157 ) - / (ptat[0 ] - ptat[2 ])) +FIXPT_INT (TJ_3 ); + / (ptat[0 ] - ptat[2 ])) -FIXPT_INT (TJ_3 ); tsc->coef.a1 =FIXPT_DIV (FIXPT_INT (thcode[1 ] - thcode[2 ]), - tsc->tj_t -FIXPT_INT (TJ_3 )); - tsc->coef.b1 =FIXPT_INT (thcode[2 ]) - tsc->coef.a1 *TJ_3 ; + tsc->tj_t +FIXPT_INT (TJ_3 )); + tsc->coef.b1 =FIXPT_INT (thcode[2 ]) + tsc->coef.a1 *TJ_3 ; tsc->coef.a2 =FIXPT_DIV (FIXPT_INT (thcode[1 ] - thcode[0 ]), tsc->tj_t -FIXPT_INT (ths_tj_1));
Signature · 1 line
2.22.0.rc2.383.gf4fbbf30c2-goog
Hi Nathan,
Quoted 10 lines · Nathan Huckleberry
Clang produces the following warning
vers/thermal/rcar_gen3_thermal.c:147:33: warning: shifting a negative signed value is undefined [-Wshift-negative-value] / (ptat[0] - ptat[2])) +FIXPT_INT(TJ_3); ^~~~~~~~~~~~~~~drivers/thermal/rcar_gen3_thermal.c:126:29
note: expanded from macro 'FIXPT_INT' #defineFIXPT_INT(_x)((_x) <<FIXPT_SHIFT) ~~~~ ^drivers/thermal/rcar_gen3_thermal.c:150:18: warning:
shifting a negative signed value is undefined [-Wshift-negative-value]tsc->tj_t-FIXPT_INT(TJ_3)); ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
Quoted 2 lines
Upon further investigating it looks like there is no real reason for
TJ_3to be -41. Usages subtract -41, code would be cleaner to just add.
All the code seems broken regarding the negative value shifting as the macros pass an integer:
eg.
tsc->coef.a2 = FIXPT_DIV(FIXPT_INT(thcode[1] - thcode[0]),
tsc->tj_t - FIXPT_INT(ths_tj_1));thcode[1] is always < than thcode[0],
thcode[1] - thcode[0] < 0
FIXPT_INT(thcode[1] - thcode[0]) is undefined
Is it done on purpose FIXPT_DIV(FIXPT_INT(thcode[1] - thcode[0]) ?
Try developing the macro with the coef.a2 computation ...
The code quality of this driver could be better, it deserves a rework IMHO ...
I suggest to revert:
4eb39f79ef443fa566d36bd43f1f578d5c140305bdc4480a669d476814061b4da6bb006f7048c8e56a310f8f97bb8bc2e2bb9db6f49a1b8678c8d144
Rework the coefficient computation and re-introduce what was reverted in a nicer way.
Quoted 37 lines
Fixes 4eb39f79ef44 ("thermal: rcar_gen3_thermal: Update value of Tj_1")Signed-off-by Nathan Huckleberry <[email protected]>--- drivers/thermal/rcar_gen3_thermal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/thermal/rcar_gen3_thermal.c +4
-4@@ -131,7 +131,7 @@ static inline void rcar_gen3_thermal_write(struct rcar_gen3_thermal_tsc *tsc,#define RCAR3_THERMAL_GRAN 500/* mili Celsius */ /* no idea where these constants come from */ -#define TJ_3 -41 +#define TJ_3 41 static void rcar_gen3_thermal_calc_coefs(struct rcar_gen3_thermal_tsc *tsc, int *ptat, const int *thcode,@@ -144,11 +144,11 @@ static void rcar_gen3_thermal_calc_coefs(struct rcar_gen3_thermal_tsc *tsc,* the dividend (4095 * 4095 << 14 > INT_MAX) so keep it unscaled */ tsc->tj_t = (FIXPT_INT ((ptat[1 ] - ptat[2 ]) *157 ) - / (ptat[0 ] - ptat[2 ])) +FIXPT_INT (TJ_3 ); + / (ptat[0 ] - ptat[2 ])) -FIXPT_INT (TJ_3 ); tsc->coef.a1 =FIXPT_DIV (FIXPT_INT (thcode[1 ] - thcode[2 ]), - tsc->tj_t -FIXPT_INT (TJ_3 )); - tsc->coef.b1 =FIXPT_INT (thcode[2 ]) - tsc->coef.a1 *TJ_3 ; + tsc->tj_t +FIXPT_INT (TJ_3 )); + tsc->coef.b1 =FIXPT_INT (thcode[2 ]) + tsc->coef.a1 *TJ_3 ; tsc->coef.a2 =FIXPT_DIV (FIXPT_INT (thcode[1 ] - thcode[0 ]), tsc->tj_t -FIXPT_INT (ths_tj_1));
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
I'm not familiar enough with the code to rewrite these parts of the driver. Silencing the warnings while maintaining the same functionality was the goal of this patch.
Quoted 95 lines · Daniel Lezcano
Hi Nathan,
Quoted 10 lines · Nathan Huckleberry
Clang produces the following warning
vers/thermal/rcar_gen3_thermal.c:147:33: warning: shifting a negative signed value is undefined [-Wshift-negative-value] / (ptat[0] - ptat[2])) +FIXPT_INT(TJ_3); ^~~~~~~~~~~~~~~drivers/thermal/rcar_gen3_thermal.c:126:29
note: expanded from macro 'FIXPT_INT' #defineFIXPT_INT(_x)((_x) <<FIXPT_SHIFT) ~~~~ ^drivers/thermal/rcar_gen3_thermal.c:150:18: warning:
shifting a negative signed value is undefined [-Wshift-negative-value]tsc->tj_t-FIXPT_INT(TJ_3)); ~~~~~~~~~~~~^~~~~~~~~~~~~~~~Quoted 2 lines
Upon further investigating it looks like there is no real reason for
TJ_3to be -41. Usages subtract -41, code would be cleaner to just add.All the code seems broken regarding the negative value shifting as the macros pass an integer:
eg.
tsc->coef.a2 = FIXPT_DIV(FIXPT_INT(thcode[1] - thcode[0]), tsc->tj_t - FIXPT_INT(ths_tj_1));thcode[1] is always < than thcode[0],
thcode[1] - thcode[0] < 0
FIXPT_INT(thcode[1] - thcode[0])is undefinedIs it done on purpose FIXPT_DIV(FIXPT_INT(thcode[1] - thcode[0]) ?
Try developing the macro with the coef.a2 computation ...
The code quality of this driver could be better, it deserves a rework IMHO ...
I suggest to revert:
4eb39f79ef443fa566d36bd43f1f578d5c140305bdc4480a669d476814061b4da6bb006f7048c8e56a310f8f97bb8bc2e2bb9db6f49a1b8678c8d144Rework the coefficient computation and re-introduce what was reverted in a nicer way.
Quoted 27 lines
Fixes 4eb39f79ef44 ("thermal: rcar_gen3_thermal: Update value of Tj_1")Signed-off-by Nathan Huckleberry <[email protected]>--- drivers/thermal/rcar_gen3_thermal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/thermal/rcar_gen3_thermal.c +1
-2@@ -131,7 +131,7 @@ static inline void rcar_gen3_thermal_write(struct rcar_gen3_thermal_tsc *tsc,#define RCAR3_THERMAL_GRAN 500/* mili Celsius */ /* no idea where these constants come from */ -#define TJ_3 -41 +#define TJ_3 41 static void rcar_gen3_thermal_calc_coefs(struct rcar_gen3_thermal_tsc *tsc, int *ptat, const int *thcode,@@ -144,11 +144,11 @@ static void rcar_gen3_thermal_calc_coefs(struct rcar_gen3_thermal_tsc *tsc,* the dividend (4095 * 4095 << 14 > INT_MAX) so keep it unscaled */ tsc->tj_t = (FIXPT_INT((ptat[1] - ptat[2]) * 157) - / (ptat[0 ] - ptat[2 ])) +FIXPT_INT (TJ_3 );drivers/thermal/rcar_gen3_thermal.c static void rcar_gen3_thermal_calc_coefs(struct rcar_gen3_thermal_tsc *tsc, · line 154
Quoted 10 lines
drivers/thermal/rcar_gen3_thermal.c +3
-2+ / (ptat[0] - ptat[2])) - FIXPT_INT(TJ_3); tsc->coef.a1 =FIXPT_DIV (FIXPT_INT (thcode[1 ] - thcode[2 ]), - tsc->tj_t -FIXPT_INT (TJ_3 )); - tsc->coef.b1 =FIXPT_INT (thcode[2 ]) - tsc->coef.a1 *TJ_3 ; + tsc->tj_t +FIXPT_INT (TJ_3 )); + tsc->coef.b1 =FIXPT_INT (thcode[2 ]) + tsc->coef.a1 *TJ_3 ; tsc->coef.a2 =FIXPT_DIV (FIXPT_INT (thcode[1 ] - thcode[0 ]), tsc->tj_t -FIXPT_INT (ths_tj_1));--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCsFollow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Zhang Rui
reviewerQuoted 48 lines · Daniel Lezcano
Hi Nathan,
Quoted 16 lines · Nathan Huckleberry
Clang produces the following warning
vers/thermal/rcar_gen3_thermal.c:147:33: warning: shifting a negative
signed value is undefined [-Wshift-negative-value] / (ptat[0] - ptat[2])) +FIXPT_INT(TJ_3); ^~~~~~~~~~~~~~~drivers/thermal/rcar_gen3_thermal.c:126:29
note: expanded from macro 'FIXPT_INT' #defineFIXPT_INT(_x)((_x) <<FIXPT_SHIFT) ~~~~ ^drivers/thermal/rcar_gen3_thermal.c:150:18:
warning:
shifting a negative signed value is undefined [-Wshift-negative- value]tsc->tj_t-FIXPT_INT(TJ_3)); ~~~~~~~~~~~~^~~~~~~~~~~~~~~~Quoted 4 lines
Upon further investigating it looks like there is no real reason for
TJ_3to be -41. Usages subtract -41, code would be cleaner to just add.All the code seems broken regarding the negative value shifting as the
macros pass an integer:eg.
tsc->coef.a2 = FIXPT_DIV(FIXPT_INT(thcode[1] - thcode[0]), tsc->tj_t - FIXPT_INT(ths_tj_1));thcode[1] is always < than thcode[0],
thcode[1] - thcode[0] < 0
FIXPT_INT(thcode[1] - thcode[0])is undefinedIs it done on purpose FIXPT_DIV(FIXPT_INT(thcode[1] - thcode[0]) ?
Try developing the macro with the coef.a2 computation ...
The code quality of this driver could be better, it deserves a rework IMHO ...
I suggest to revert:
Quoted 7 lines
4eb39f79ef443fa566d36bd43f1f578d5c140305bdc4480a669d476814061b4da6bb006f7048c8e56a310f8f97bb8bc2e2bb9db6f49a1b8678c8d144Rework the coefficient computation and re-introduce what was reverted in
a nicer way.
Sounds reasonable to me.
Yoshihiro,
can you please clarify on this? Or else I will revert the above commits first?
Also CC Wolfram Sang, the driver author.
thanks,
rui
Quoted 47 lines
Quoted 45 lines
Fixes 4eb39f79ef44 ("thermal: rcar_gen3_thermal: Update value of
Tj_1")Signed-off-by Nathan Huckleberry <[email protected]>--- drivers/thermal/rcar_gen3_thermal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/thermal/rcar_gen3_thermal.c +1
-1@@ -131,7 +131,7 @@ static inline void rcar_gen3_thermal_write(struct rcar_gen3_thermal_tsc *tsc,#define RCAR3_THERMAL_GRAN 500/* mili Celsius */ /* no idea where these constants come from */ -#define TJ_3 -41 +#define TJ_3 41 static void rcar_gen3_thermal_calc_coefs(struct
rcar_gen3_thermal_tsc*tsc,drivers/thermal/rcar_gen3_thermal.c +0
-0int *ptat, const int *thcode,@@ -144,11 +144,11 @@ static void rcar_gen3_thermal_calc_coefs(struct rcar_gen3_thermal_tsc *tsc, * the dividend (4095 * 4095 << 14 > INT_MAX) so keep itunscaled
drivers/thermal/rcar_gen3_thermal.c +3
-3*/ tsc->tj_t = (FIXPT_INT ((ptat[1 ] - ptat[2 ]) *157 ) - / (ptat[0 ] - ptat[2 ])) +FIXPT_INT (TJ_3 ); + / (ptat[0 ] - ptat[2 ])) -FIXPT_INT (TJ_3 ); tsc->coef.a1 =FIXPT_DIV (FIXPT_INT (thcode[1 ] - thcode[2 ]), - tsc->tj_t -FIXPT_INT (TJ_3 )); - tsc->coef.b1 =FIXPT_INT (thcode[2 ]) - tsc->coef.a1 *TJ_3 ; + tsc->tj_t +FIXPT_INT (TJ_3 )); + tsc->coef.b1 =FIXPT_INT (thcode[2 ]) + tsc->coef.a1 *TJ_3 ; tsc->coef.a2 =FIXPT_DIV (FIXPT_INT (thcode[1 ] - thcode[0 ]), tsc->tj_t -FIXPT_INT (ths_tj_1));
Quoted 57 lines · Zhang Rui
Quoted 48 lines · Daniel Lezcano
Hi Nathan,
Quoted 16 lines · Nathan Huckleberry
Clang produces the following warning
vers/thermal/rcar_gen3_thermal.c:147:33: warning: shifting a negative
signed value is undefined [-Wshift-negative-value] / (ptat[0] - ptat[2])) +FIXPT_INT(TJ_3); ^~~~~~~~~~~~~~~drivers/thermal/rcar_gen3_thermal.c:126:29
note: expanded from macro 'FIXPT_INT' #defineFIXPT_INT(_x)((_x) <<FIXPT_SHIFT) ~~~~ ^drivers/thermal/rcar_gen3_thermal.c:150:18:
warning:
shifting a negative signed value is undefined [-Wshift-negative- value]tsc->tj_t-FIXPT_INT(TJ_3)); ~~~~~~~~~~~~^~~~~~~~~~~~~~~~Quoted 4 lines
Upon further investigating it looks like there is no real reason for
TJ_3to be -41. Usages subtract -41, code would be cleaner to just add.All the code seems broken regarding the negative value shifting as the
macros pass an integer:eg.
tsc->coef.a2 = FIXPT_DIV(FIXPT_INT(thcode[1] - thcode[0]), tsc->tj_t - FIXPT_INT(ths_tj_1));thcode[1] is always < than thcode[0],
thcode[1] - thcode[0] < 0
FIXPT_INT(thcode[1] - thcode[0])is undefinedIs it done on purpose FIXPT_DIV(FIXPT_INT(thcode[1] - thcode[0]) ?
Try developing the macro with the coef.a2 computation ...
The code quality of this driver could be better, it deserves a rework IMHO ...
I suggest to revert:
Quoted 7 lines
4eb39f79ef443fa566d36bd43f1f578d5c140305bdc4480a669d476814061b4da6bb006f7048c8e56a310f8f97bb8bc2e2bb9db6f49a1b8678c8d144Rework the coefficient computation and re-introduce what was reverted in
a nicer way.
Quoted 7 lines
Sounds reasonable to me.
Yoshihiro,
can you please clarify on this? Or else I will revert the above commits first?Also CC Wolfram Sang, the driver author.
CCing Simon Horman who worked with Kaneko-san on these changes.
Quoted 50 lines
thanks,
ruiQuoted 47 lines
Quoted 45 lines
Fixes 4eb39f79ef44 ("thermal: rcar_gen3_thermal: Update value of
Tj_1")Signed-off-by Nathan Huckleberry <[email protected]>--- drivers/thermal/rcar_gen3_thermal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/thermal/rcar_gen3_thermal.c +1
-1@@ -131,7 +131,7 @@ static inline void rcar_gen3_thermal_write(struct rcar_gen3_thermal_tsc *tsc,#define RCAR3_THERMAL_GRAN 500/* mili Celsius */ /* no idea where these constants come from */ -#define TJ_3 -41 +#define TJ_3 41 static void rcar_gen3_thermal_calc_coefs(struct
rcar_gen3_thermal_tsc*tsc,drivers/thermal/rcar_gen3_thermal.c +0
-0int *ptat, const int *thcode,@@ -144,11 +144,11 @@ static void rcar_gen3_thermal_calc_coefs(struct rcar_gen3_thermal_tsc *tsc, * the dividend (4095 * 4095 << 14 > INT_MAX) so keep itunscaled
drivers/thermal/rcar_gen3_thermal.c +3
-3*/ tsc->tj_t = (FIXPT_INT ((ptat[1 ] - ptat[2 ]) *157 ) - / (ptat[0 ] - ptat[2 ])) +FIXPT_INT (TJ_3 ); + / (ptat[0 ] - ptat[2 ])) -FIXPT_INT (TJ_3 ); tsc->coef.a1 =FIXPT_DIV (FIXPT_INT (thcode[1 ] - thcode[2 ]), - tsc->tj_t -FIXPT_INT (TJ_3 )); - tsc->coef.b1 =FIXPT_INT (thcode[2 ]) - tsc->coef.a1 *TJ_3 ; + tsc->tj_t +FIXPT_INT (TJ_3 )); + tsc->coef.b1 =FIXPT_INT (thcode[2 ]) + tsc->coef.a1 *TJ_3 ; tsc->coef.a2 =FIXPT_DIV (FIXPT_INT (thcode[1 ] - thcode[0 ]), tsc->tj_t -FIXPT_INT (ths_tj_1));
Quoted 60 lines · Wolfram Sang
Quoted 59 lines · Zhang Rui
Quoted 48 lines · Daniel Lezcano
Hi Nathan,
Quoted 16 lines · Nathan Huckleberry
Clang produces the following warning
vers/thermal/rcar_gen3_thermal.c:147:33: warning: shifting a negative
signed value is undefined [-Wshift-negative-value] / (ptat[0] - ptat[2])) +FIXPT_INT(TJ_3); ^~~~~~~~~~~~~~~drivers/thermal/rcar_gen3_thermal.c:126:29
note: expanded from macro 'FIXPT_INT' #defineFIXPT_INT(_x)((_x) <<FIXPT_SHIFT) ~~~~ ^drivers/thermal/rcar_gen3_thermal.c:150:18:
warning:
shifting a negative signed value is undefined [-Wshift-negative- value]tsc->tj_t-FIXPT_INT(TJ_3)); ~~~~~~~~~~~~^~~~~~~~~~~~~~~~Quoted 4 lines
Upon further investigating it looks like there is no real reason for
TJ_3to be -41. Usages subtract -41, code would be cleaner to just add.All the code seems broken regarding the negative value shifting as the
macros pass an integer:eg.
tsc->coef.a2 = FIXPT_DIV(FIXPT_INT(thcode[1] - thcode[0]), tsc->tj_t - FIXPT_INT(ths_tj_1));thcode[1] is always < than thcode[0],
thcode[1] - thcode[0] < 0
FIXPT_INT(thcode[1] - thcode[0])is undefinedIs it done on purpose FIXPT_DIV(FIXPT_INT(thcode[1] - thcode[0]) ?
Try developing the macro with the coef.a2 computation ...
The code quality of this driver could be better, it deserves a rework IMHO ...
I suggest to revert:
Quoted 7 lines
4eb39f79ef443fa566d36bd43f1f578d5c140305bdc4480a669d476814061b4da6bb006f7048c8e56a310f8f97bb8bc2e2bb9db6f49a1b8678c8d144Rework the coefficient computation and re-introduce what was reverted in
a nicer way.Sounds reasonable to me.
Quoted 7 lines
Quoted 5 lines
Yoshihiro,
can you please clarify on this? Or else I will revert the above commits first?Also CC Wolfram Sang, the driver author.
CCing Simon Horman who worked with Kaneko-san on these changes.
Hi,
I think that what has happened here is that these patches and moreover the driver has been through quite a few hands and I agree that zooming out and cleaning things up would make a lot of sense. Personally I would take the approach of incrementally cleaning things up. But I don't feel strongly about this.
As for the specific question about a negative constant, I don't know of a specific reason that approach was taken and I don't recall investigating it at the time.
Kind regards,
Simon
Quoted 23 lines
Quoted 23 lines
thanks,
ruiQuoted 20 lines
Quoted 20 lines
Fixes 4eb39f79ef44 ("thermal: rcar_gen3_thermal: Update value of
Tj_1")Signed-off-by Nathan Huckleberry <[email protected]>--- drivers/thermal/rcar_gen3_thermal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/thermal/rcar_gen3_thermal.c +0
-0@@ -131,7 +131,7 @@ static inline void rcar_gen3_thermal_write(struct rcar_gen3_thermal_tsc *tsc,#define RCAR3_THERMAL_GRAN 500/* mili Celsius */
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/thermal/rcar_gen3_thermal.c static inline void rcar_gen3_thermal_write(struct rcar_gen3_thermal_tsc *tsc, · line 133
Quoted 1 line
drivers/thermal/rcar_gen3_thermal.c +0
-0/* no idea where these constants come from */
Regarding the line above, I believe the constant comes from the documentation.
Quoted 27 lines
Quoted 27 lines
Quoted 26 lines
Quoted 24 lines
drivers/thermal/rcar_gen3_thermal.c +1
-1-#define TJ_3 -41 +#define TJ_3 41 static void rcar_gen3_thermal_calc_coefs(struct
rcar_gen3_thermal_tsc*tsc,drivers/thermal/rcar_gen3_thermal.c +0
-0int *ptat, const int *thcode,@@ -144,11 +144,11 @@ static void rcar_gen3_thermal_calc_coefs(struct rcar_gen3_thermal_tsc *tsc, * the dividend (4095 * 4095 << 14 > INT_MAX) so keep itunscaled
drivers/thermal/rcar_gen3_thermal.c +3
-3*/ tsc->tj_t = (FIXPT_INT ((ptat[1 ] - ptat[2 ]) *157 ) - / (ptat[0 ] - ptat[2 ])) +FIXPT_INT (TJ_3 ); + / (ptat[0 ] - ptat[2 ])) -FIXPT_INT (TJ_3 ); tsc->coef.a1 =FIXPT_DIV (FIXPT_INT (thcode[1 ] - thcode[2 ]), - tsc->tj_t -FIXPT_INT (TJ_3 )); - tsc->coef.b1 =FIXPT_INT (thcode[2 ]) - tsc->coef.a1 *TJ_3 ; + tsc->tj_t +FIXPT_INT (TJ_3 )); + tsc->coef.b1 =FIXPT_INT (thcode[2 ]) + tsc->coef.a1 *TJ_3 ; tsc->coef.a2 =FIXPT_DIV (FIXPT_INT (thcode[1 ] - thcode[0 ]), tsc->tj_t -FIXPT_INT (ths_tj_1));