]> www.infradead.org Git - users/jedix/linux-maple.git/commit
thermal: core: Rearrange checks in thermal_bind_cdev_to_trip()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 19 Aug 2024 15:51:36 +0000 (17:51 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 22 Aug 2024 15:43:14 +0000 (17:43 +0200)
commitb4e6d39817312919f907da266de202a30a7bc43b
tree3868177aa3ac92f6a1789bed5b993425ca68abc6
parenta8bbe6f10f78f85243ff821432c5d798a6d99ed4
thermal: core: Rearrange checks in thermal_bind_cdev_to_trip()

It is not necessary to look up the thermal zone and the cooling device
in the respective global lists to check whether or not they are
registered.  It is sufficient to check whether or not their respective
list nodes are empty for this purpose.

Use the above observation to simplify thermal_bind_cdev_to_trip().  In
addition, eliminate an unnecessary ternary operator from it.

Moreover, add lockdep_assert_held() for thermal_list_lock to it because
that lock must be held by its callers when it is running.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Zhang Rui <rui.zhang@intel.com>
Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://patch.msgid.link/3324214.44csPzL39Z@rjwysocki.net
drivers/thermal/thermal_core.c