]> www.infradead.org Git - users/jedix/linux-maple.git/commit
thermal: core: Build sorted lists instead of sorting them later
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 16 Oct 2024 11:21:42 +0000 (13:21 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 24 Oct 2024 15:15:06 +0000 (17:15 +0200)
commitc12629f832d21e2a87f014174387e605661e91c7
treee90bc2dbd4b80e47557a6bbe72afb2d5367cdfd6
parent7569406e95f2353070d88ebc88e8c13698542317
thermal: core: Build sorted lists instead of sorting them later

Since it is not expected that multiple trip points will be crossed
in one go very often (if this happens, there are too many trip points
in the given thermal zone or they are checked too rarely), quite likely
it is more efficient to build a sorted list of crossed trip points than
to put them on an unsorted list and sort it later.

Moreover, trip points are often sorted in ascending temperature order
during thermal zone registration, so building a sorted list out of
them is quite straightforward and relatively inexpensive.

Accordingly, make handle_thermal_trip() maintain list ordering when
adding trip points to the lists and get rid of separate list sorting
in __thermal_zone_device_update().

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Link: https://patch.msgid.link/4930656.GXAFRqVoOG@rjwysocki.net
drivers/thermal/thermal_core.c