mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
drm/amdgpu: Simplify sorting of the bo list
Sort function only cares about the sign so we can replace the conditionals with a single subtraction. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
f7e0678651
commit
dda702172d
@@ -60,11 +60,9 @@ static int amdgpu_bo_list_entry_cmp(const void *_a, const void *_b)
|
||||
{
|
||||
const struct amdgpu_bo_list_entry *a = _a, *b = _b;
|
||||
|
||||
if (a->priority > b->priority)
|
||||
return 1;
|
||||
if (a->priority < b->priority)
|
||||
return -1;
|
||||
return 0;
|
||||
BUILD_BUG_ON(AMDGPU_BO_LIST_MAX_PRIORITY >= INT_MAX);
|
||||
|
||||
return (int)a->priority - (int)b->priority;
|
||||
}
|
||||
|
||||
int amdgpu_bo_list_create(struct amdgpu_device *adev, struct drm_file *filp,
|
||||
|
||||
Reference in New Issue
Block a user