dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Alex Deucher <alexdeucher@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Alex Deucher <alexander.deucher@amd.com>
Subject: [PATCH 3/6] drm/amdgpu/si: replace some hardcoded 2s with dma num_instances
Date: Fri, 20 May 2016 17:50:36 -0400	[thread overview]
Message-ID: <1463781039-722-3-git-send-email-alexander.deucher@amd.com> (raw)
In-Reply-To: <1463781039-722-1-git-send-email-alexander.deucher@amd.com>

Fix up a few cases that were previously missed.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/si_dma.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/si_dma.c b/drivers/gpu/drm/amd/amdgpu/si_dma.c
index 03c11a1..7e65b64 100644
--- a/drivers/gpu/drm/amd/amdgpu/si_dma.c
+++ b/drivers/gpu/drm/amd/amdgpu/si_dma.c
@@ -140,7 +140,7 @@ static void si_dma_stop(struct amdgpu_device *adev)
 	u32 rb_cntl;
 	unsigned i;
 
-	for (i = 0; i < 2; i++) {
+	for (i = 0; i < adev->sdma.num_instances; i++) {
 		ring = &adev->sdma.instance[i].ring;
 		/* dma0 */
 		rb_cntl = RREG32(DMA_RB_CNTL + sdma_offsets[i]);
@@ -158,7 +158,7 @@ static int si_dma_start(struct amdgpu_device *adev)
 	int i, r;
 	uint64_t rptr_addr;
 
-	for (i = 0; i < 2; i++) {
+	for (i = 0; i < adev->sdma.num_instances; i++) {
 		ring = &adev->sdma.instance[i].ring;
 		reg_offset = sdma_offsets[i];
 
@@ -755,13 +755,12 @@ static int si_dma_set_clockgating_state(void *handle,
 	u32 orig, data, offset;
 	int i;
 	bool enable;
-
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
 	enable = (state == AMD_CG_STATE_GATE) ? true : false;
 
 	if (enable && (adev->cg_flags & AMD_CG_SUPPORT_SDMA_MGCG)) {
-		for (i = 0; i < 2; i++) {
+		for (i = 0; i < adev->sdma.num_instances; i++) {
 			if (i == 0)
 				offset = DMA0_REGISTER_OFFSET;
 			else
@@ -773,7 +772,7 @@ static int si_dma_set_clockgating_state(void *handle,
 			WREG32(DMA_CLK_CTRL + offset, 0x00000100);
 		}
 	} else {
-		for (i = 0; i < 2; i++) {
+		for (i = 0; i < adev->sdma.num_instances; i++) {
 			if (i == 0)
 				offset = DMA0_REGISTER_OFFSET;
 			else
-- 
2.5.5

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-05-20 21:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-20 21:50 [PATCH 1/6] drm/amdgpu/si: stop dma engines on hw fini and suspend Alex Deucher
2016-05-20 21:50 ` [PATCH 2/6] drm/amdgpu/si: simplify si_dma_start Alex Deucher
2016-05-20 21:50 ` Alex Deucher [this message]
2016-05-20 21:50 ` [PATCH 4/6] drm/amdgpu/si: use dma instance offset array directly Alex Deucher
2016-05-20 21:50 ` [PATCH 5/6] drm/amdgpu/si: reduce dma ring size Alex Deucher
2016-05-20 21:50 ` [PATCH 6/6] drm/amdgpu/si: reduce gfx " Alex Deucher
2016-05-21 10:39 ` [PATCH 1/6] drm/amdgpu/si: stop dma engines on hw fini and suspend Christian König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1463781039-722-3-git-send-email-alexander.deucher@amd.com \
    --to=alexdeucher@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).