aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu.h
diff options
context:
space:
mode:
authorNikola Pajkovsky <npajkovsky@suse.cz>2017-05-04 12:39:50 -0400
committerAlex Deucher <alexander.deucher@amd.com>2017-05-24 17:40:28 -0400
commit5b9c58f9978fb17692966173262ef05f9a1f9a1e (patch)
tree3591f2058b857931bfdc98b9e11a82e5611ece65 /drivers/gpu/drm/amd/amdgpu/amdgpu.h
parent503bb31be42e3fea15c5e81bb2d84a0123438c85 (diff)
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>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu.h')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h45
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index 8e828cda9baa..3bd709600a15 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1734,30 +1734,31 @@ static inline void amdgpu_ring_write_multiple(struct amdgpu_ring *ring, void *sr
1734 unsigned occupied, chunk1, chunk2; 1734 unsigned occupied, chunk1, chunk2;
1735 void *dst; 1735 void *dst;
1736 1736
1737 if (ring->count_dw < count_dw) { 1737 if (unlikely(ring->count_dw < count_dw)) {
1738 DRM_ERROR("amdgpu: writing more dwords to the ring than expected!\n"); 1738 DRM_ERROR("amdgpu: writing more dwords to the ring than expected!\n");
1739 } else { 1739 return;
1740 occupied = ring->wptr & ring->buf_mask;
1741 dst = (void *)&ring->ring[occupied];
1742 chunk1 = ring->buf_mask + 1 - occupied;
1743 chunk1 = (chunk1 >= count_dw) ? count_dw: chunk1;
1744 chunk2 = count_dw - chunk1;
1745 chunk1 <<= 2;
1746 chunk2 <<= 2;
1747
1748 if (chunk1)
1749 memcpy(dst, src, chunk1);
1750
1751 if (chunk2) {
1752 src += chunk1;
1753 dst = (void *)ring->ring;
1754 memcpy(dst, src, chunk2);
1755 }
1756
1757 ring->wptr += count_dw;
1758 ring->wptr &= ring->ptr_mask;
1759 ring->count_dw -= count_dw;
1760 } 1740 }
1741
1742 occupied = ring->wptr & ring->buf_mask;
1743 dst = (void *)&ring->ring[occupied];
1744 chunk1 = ring->buf_mask + 1 - occupied;
1745 chunk1 = (chunk1 >= count_dw) ? count_dw: chunk1;
1746 chunk2 = count_dw - chunk1;
1747 chunk1 <<= 2;
1748 chunk2 <<= 2;
1749
1750 if (chunk1)
1751 memcpy(dst, src, chunk1);
1752
1753 if (chunk2) {
1754 src += chunk1;
1755 dst = (void *)ring->ring;
1756 memcpy(dst, src, chunk2);
1757 }
1758
1759 ring->wptr += count_dw;
1760 ring->wptr &= ring->ptr_mask;
1761 ring->count_dw -= count_dw;
1761} 1762}
1762 1763
1763static inline struct amdgpu_sdma_instance * 1764static inline struct amdgpu_sdma_instance *