Re: [PATCH v3 1/4] devfreq: Register devfreq as a cooling device on demand

From: Chanwoo Choi
Date: Sun Mar 07 2021 - 10:15:29 EST


On 21. 3. 7. 오후 11:28, Daniel Lezcano wrote:
On 07/03/2021 15:16, Chanwoo Choi wrote:
On 21. 3. 7. 오후 6:45, Daniel Lezcano wrote:
Currently the default behavior is to manually having the devfreq
backend to register themselves as a devfreq cooling device.

Instead of adding the code in the drivers for the thermal cooling
device registering, let's provide a flag in the devfreq's profile to
tell the common devfreq code to register the newly created devfreq as
a cooling device.

Suggested-by: Chanwoo Choi <cwchoi00@xxxxxxxxx>
Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx>
---
V3:
- Rebased on linux-pm branch without units.h
- Set the cdev to NULL in case of error
- Added description for the cdev field in the devfreq structure
V2:
- Added is_cooling_device boolean in profile structure
- Register cooling device when the is_cooling_device boolean is set
- Remove devfreq cooling device registration in the backend drivers
V1:
- Register devfreq as a cooling device unconditionnally
---


[ ... ]

return devfreq;

err_init:
@@ -960,6 +971,8 @@ int devfreq_remove_device(struct devfreq *devfreq)
if (!devfreq)
return -EINVAL;

+ thermal_cooling_device_unregister(devfreq->cdev);

I have a question. Why don't you use devfreq_cooling_unregister()?
When thermal_cooling_device_unregister(), how can we remove
the pm_qos_request of devfreq device?

You are perfectly right. I failed to call the right function :/

Will fix it with a v4.


Thanks. And, please add 'PM /' prefix for patch in order to
keep the consistent patch title format.

PM / devfreq: Register devfreq as a cooling device on demand

--
Best Regards,
Samsung Electronics
Chanwoo Choi