Skip to content

Commit 760e3c8

Browse files
Li Zetaoalexdeucher
authored andcommitted
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>
1 parent 6fbbb66 commit 760e3c8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2244,7 +2244,7 @@ void amdgpu_vm_adjust_size(struct amdgpu_device *adev, uint32_t min_vm_size,
22442244
phys_ram_gb = ((uint64_t)si.totalram * si.mem_unit +
22452245
(1 << 30) - 1) >> 30;
22462246
vm_size = roundup_pow_of_two(
2247-
min(max(phys_ram_gb * 3, min_vm_size), max_size));
2247+
clamp(phys_ram_gb * 3, min_vm_size, max_size));
22482248
}
22492249

22502250
adev->vm_manager.max_pfn = (uint64_t)vm_size << 18;

0 commit comments

Comments
 (0)