Commit c6430a8e authored by Li Zetao's avatar Li Zetao Committed by Lyude Paul
Browse files

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: default avatarLyude Paul <lyude@redhat.com>
Signed-off-by: default avatarLi Zetao <lizetao1@huawei.com>
Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240831012803.3950100-4-lizetao1@huawei.com
parent bf7835fa
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);