mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-13 22:25:03 +00:00
drm/amd/amdgpu: get rid of else branch
else branch is pointless if it's right at the end of function and use unlikely() on err path. Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Nikola Pajkovsky <npajkovsky@suse.cz> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
503bb31be4
commit
5b9c58f997
1 changed files with 23 additions and 22 deletions
|
@ -1734,30 +1734,31 @@ static inline void amdgpu_ring_write_multiple(struct amdgpu_ring *ring, void *sr
|
|||
unsigned occupied, chunk1, chunk2;
|
||||
void *dst;
|
||||
|
||||
if (ring->count_dw < count_dw) {
|
||||
if (unlikely(ring->count_dw < count_dw)) {
|
||||
DRM_ERROR("amdgpu: writing more dwords to the ring than expected!\n");
|
||||
} else {
|
||||
occupied = ring->wptr & ring->buf_mask;
|
||||
dst = (void *)&ring->ring[occupied];
|
||||
chunk1 = ring->buf_mask + 1 - occupied;
|
||||
chunk1 = (chunk1 >= count_dw) ? count_dw: chunk1;
|
||||
chunk2 = count_dw - chunk1;
|
||||
chunk1 <<= 2;
|
||||
chunk2 <<= 2;
|
||||
|
||||
if (chunk1)
|
||||
memcpy(dst, src, chunk1);
|
||||
|
||||
if (chunk2) {
|
||||
src += chunk1;
|
||||
dst = (void *)ring->ring;
|
||||
memcpy(dst, src, chunk2);
|
||||
}
|
||||
|
||||
ring->wptr += count_dw;
|
||||
ring->wptr &= ring->ptr_mask;
|
||||
ring->count_dw -= count_dw;
|
||||
return;
|
||||
}
|
||||
|
||||
occupied = ring->wptr & ring->buf_mask;
|
||||
dst = (void *)&ring->ring[occupied];
|
||||
chunk1 = ring->buf_mask + 1 - occupied;
|
||||
chunk1 = (chunk1 >= count_dw) ? count_dw: chunk1;
|
||||
chunk2 = count_dw - chunk1;
|
||||
chunk1 <<= 2;
|
||||
chunk2 <<= 2;
|
||||
|
||||
if (chunk1)
|
||||
memcpy(dst, src, chunk1);
|
||||
|
||||
if (chunk2) {
|
||||
src += chunk1;
|
||||
dst = (void *)ring->ring;
|
||||
memcpy(dst, src, chunk2);
|
||||
}
|
||||
|
||||
ring->wptr += count_dw;
|
||||
ring->wptr &= ring->ptr_mask;
|
||||
ring->count_dw -= count_dw;
|
||||
}
|
||||
|
||||
static inline struct amdgpu_sdma_instance *
|
||||
|
|
Loading…
Reference in a new issue