mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-22 01:50:16 -05:00
drm/nouveau/volt: use clamp() in nvkm_volt_map()
When it needs to get a value within a certain interval, using clamp() makes the code easier to understand than min(max()). Reviewed-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Li Zetao <lizetao1@huawei.com> Signed-off-by: Lyude Paul <lyude@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240831012803.3950100-4-lizetao1@huawei.com
This commit is contained in:
@@ -142,7 +142,7 @@ nvkm_volt_map(struct nvkm_volt *volt, u8 id, u8 temp)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
result = min(max(result, (s64)info.min), (s64)info.max);
|
||||
result = clamp(result, (s64)info.min, (s64)info.max);
|
||||
|
||||
if (info.link != 0xff) {
|
||||
int ret = nvkm_volt_map(volt, info.link, temp);
|
||||
|
||||
Reference in New Issue
Block a user