summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLi Zetao <lizetao1@huawei.com>2024-08-30 09:22:15 +0800
committerAlex Deucher <alexander.deucher@amd.com>2024-09-06 17:38:57 -0400
commit760e3c8b3288279841aa8a71e6d65c67a3934d01 (patch)
tree5f91a912fe492bbef47c7142edf03bab52b03629 /drivers
parent6fbbb660b1d423a777d7567b7475a6a01aa7fd91 (diff)
downloadlinux-stable-760e3c8b3288279841aa8a71e6d65c67a3934d01.tar.gz
linux-stable-760e3c8b3288279841aa8a71e6d65c67a3934d01.tar.bz2
linux-stable-760e3c8b3288279841aa8a71e6d65c67a3934d01.zip
drm/amdgpu: use clamp() in amdgpu_vm_adjust_size()
When it needs to get a value within a certain interval, using clamp() makes the code easier to understand than min(max()). Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Li Zetao <lizetao1@huawei.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 75740e08630d..9eca247d8f02 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -2244,7 +2244,7 @@ void amdgpu_vm_adjust_size(struct amdgpu_device *adev, uint32_t min_vm_size,
phys_ram_gb = ((uint64_t)si.totalram * si.mem_unit +
(1 << 30) - 1) >> 30;
vm_size = roundup_pow_of_two(
- min(max(phys_ram_gb * 3, min_vm_size), max_size));
+ clamp(phys_ram_gb * 3, min_vm_size, max_size));
}
adev->vm_manager.max_pfn = (uint64_t)vm_size << 18;