Re: [PATCH v3 3/3] thermal: create a helper __thermal_cdev_update() without a lock

From: Lukasz Luba
Date: Thu Apr 22 2021 - 04:21:38 EST




On 4/22/21 8:58 AM, Daniel Lezcano wrote:
On 21/04/2021 19:41, Lukasz Luba wrote:
There is a need to have a helper function which updates cooling device
state from the governors code. With this change governor can use
lock and unlock while calling helper function. This avoid unnecessary
second time lock/unlock which was in previous solution present in
governor implementation. This new helper function must be called
with mutex 'cdev->lock' hold.

The changed been discussed and part of code presented in thread:
https://lore.kernel.org/linux-pm/20210419084536.25000-1-lukasz.luba@xxxxxxx/

Co-developed-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
Signed-off-by: Lukasz Luba <lukasz.luba@xxxxxxx>
---
drivers/thermal/gov_power_allocator.c | 5 +----
drivers/thermal/thermal_core.h | 1 +
drivers/thermal/thermal_helpers.c | 28 +++++++++++++++++----------

Why not add this patch first (without the ipa changes) and then replace
patch 2 by using the new function ? That will prevent to go back and forth.

I thought that it would show also the motivation and usage in the
governor. I can had this patch as first in the set, but then I thought
about this example.
I can change it if you like in v4.