From: Li Zetao Date: Sat, 31 Aug 2024 01:28:03 +0000 (+0800) Subject: drm/nouveau/volt: use clamp() in nvkm_volt_map() X-Git-Tag: v6.13-rc1~122^2~23^2~109 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c6430a8eb08d73f79a0f6cd8dbbc7e71037faac0;p=thirdparty%2Flinux.git 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 Signed-off-by: Li Zetao Signed-off-by: Lyude Paul Link: https://patchwork.freedesktop.org/patch/msgid/20240831012803.3950100-4-lizetao1@huawei.com --- diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/base.c index a17a6dd8d3de9..803b98df4858f 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/base.c @@ -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);