drivers/devfreq: fix qos_get_value returning wrong min/max aggregation

QOS_REQ_MIN should return the highest value among all min requests
(most restrictive lower bound), but plist_first returns the lowest.
QOS_REQ_MAX should return the lowest value among all max requests
(most restrictive upper bound), but plist_last returns the highest.

This caused qos constraints to be ineffective. For example, two
requests (32, 208000) and (104000, 104000) would merge to (32, 208000)
instead of the correct (104000, 104000).

Fix by using plist_last for QOS_REQ_MIN and plist_first for QOS_REQ_MAX.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
This commit is contained in:
guanyi3 2026-03-06 16:26:00 +08:00 committed by Alan C. Assis
parent 674e5ef4d8
commit 31041f84ea

View file

@ -191,12 +191,12 @@ uint32_t qos_get_value(FAR struct qos_constraints_s *constraints,
{
case QOS_REQ_MIN:
{
return plist_first(&constraints->min_requests)->prio;
return plist_last(&constraints->min_requests)->prio;
}
case QOS_REQ_MAX:
{
return plist_last(&constraints->max_requests)->prio;
return plist_first(&constraints->max_requests)->prio;
}
}