drm/ttm: Simplify ttm_eu_reserve_buffers()

Hoist the comparison of the ret to -EDEADLK above
the two code paths to simplify the function.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Tom St Denis 2018-01-26 10:13:42 -05:00 committed by Alex Deucher
parent de8dfb8e34
commit 07d48da4f4
1 changed files with 8 additions and 6 deletions

View File

@ -139,12 +139,14 @@ int ttm_eu_reserve_buffers(struct ww_acquire_ctx *ticket,
*/
ttm_eu_backoff_reservation_reverse(list, entry);
if (ret == -EDEADLK && intr) {
ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock,
ticket);
} else if (ret == -EDEADLK) {
ww_mutex_lock_slow(&bo->resv->lock, ticket);
ret = 0;
if (ret == -EDEADLK) {
if (intr) {
ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock,
ticket);
} else {
ww_mutex_lock_slow(&bo->resv->lock, ticket);
ret = 0;
}
}
if (!ret && entry->shared)