thermal: gov_fair_share: Eliminate unnecessary integer divisions
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 10 Apr 2024 17:00:10 +0000 (19:00 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 24 Apr 2024 08:15:08 +0000 (10:15 +0200)
commitc98e24795e8b53ff68b317ed31ddcc37cf8b6a26
tree0a07856f501a6efc4bd7f8d6ce6b19ea0351e1b0
parent0292991ce46c75c28d6ccfe7a7f8ac962a824291
thermal: gov_fair_share: Eliminate unnecessary integer divisions

The computations carried out by fair_share_throttle() for each trip
point include at least one redundant integer division which introduces
superfluous rounding errors.  Also the multiplications by 100 in it are
not really necessary and can be eliminated.

Rearrange fair_share_throttle() to carry out only one integer division per
trip and only as many integer multiplications as necessary and rename one
variable in it (while at it).

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
drivers/thermal/gov_fair_share.c