mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Deucher, Alexander" <Alexander.Deucher@amd.com>
To: "'David Binderman'" <linuxdev.baldrick@gmail.com>,
	"Koenig, Christian" <Christian.Koenig@amd.com>,
	"airlied@linux.ie" <airlied@linux.ie>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"dcb314@hotmail.com" <dcb314@hotmail.com>
Subject: RE: linux-4.7-rc3/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4836: wierd condition ?
Date: Mon, 13 Jun 2016 22:52:47 +0000	[thread overview]
Message-ID: <DM2PR12MB0140EB44009F5C3F6ADE0E36F7530@DM2PR12MB0140.namprd12.prod.outlook.com> (raw)
In-Reply-To: <CAMzoamaeEJzDXJ4r5Gp4Y15NZOVCcUx==SyYL9s7mT3183LHaw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1496 bytes --]

> -----Original Message-----
> From: David Binderman [mailto:linuxdev.baldrick@gmail.com]
> Sent: Monday, June 13, 2016 4:16 AM
> To: Deucher, Alexander; Koenig, Christian; airlied@linux.ie; dri-
> devel@lists.freedesktop.org; linux-kernel@vger.kernel.org;
> dcb314@hotmail.com
> Subject: linux-4.7-rc3/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4836:
> wierd condition ?
> 
> Hello there,
> 
> linux-4.7-rc3/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4836]: (style)
> Boolean result is used in bitwise operation. Clarify expression with
> parentheses.
> 
> Source code is
> 
>             if ((ring->me == me_id) & (ring->pipe == pipe_id))
> 
> Maybe better code
> 
>             if ((ring->me == me_id) && (ring->pipe == pipe_id))
> 

Good catch.  Fixed in the attached patch.

> Also in the same file:
> 
> [drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:3866]: (style) Variable 'data'
> is assigned a value that is never used.

The readback of the register here is needed to wake up the block after disabling powergating.

> [drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4321]: (style) Variable
> 'mc_shared_chmap' is assigned a value that is never used.

I think this one can be dropped.

> [drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c:4657]: (style) Variable 'tmp'
> is assigned a value that is never used.
> 

This operation requires a posted write (i.e., a read back of the register to make sure the write has completed).

Thanks!

Alex

> Regards
> 
> David Binderman

[-- Attachment #2: 0001-drm-amdgpu-gfx7-fix-broken-condition-check.patch --]
[-- Type: application/octet-stream, Size: 1036 bytes --]

From 8b18300c13a1e08e152f6b6a430faac84f986231 Mon Sep 17 00:00:00 2001
From: Alex Deucher <alexander.deucher@amd.com>
Date: Mon, 13 Jun 2016 18:26:24 -0400
Subject: [PATCH] drm/amdgpu/gfx7: fix broken condition check

Wrong operator.

Reported-by: David Binderman <linuxdev.baldrick@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
index 8c6ad1e..fc8ff4d 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c
@@ -4833,7 +4833,7 @@ static int gfx_v7_0_eop_irq(struct amdgpu_device *adev,
 	case 2:
 		for (i = 0; i < adev->gfx.num_compute_rings; i++) {
 			ring = &adev->gfx.compute_ring[i];
-			if ((ring->me == me_id) & (ring->pipe == pipe_id))
+			if ((ring->me == me_id) && (ring->pipe == pipe_id))
 				amdgpu_fence_process(ring);
 		}
 		break;
-- 
2.5.5


      reply	other threads:[~2016-06-13 22:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13  8:16 David Binderman
2016-06-13 22:52 ` Deucher, Alexander [this message]

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=DM2PR12MB0140EB44009F5C3F6ADE0E36F7530@DM2PR12MB0140.namprd12.prod.outlook.com \
    --to=alexander.deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=airlied@linux.ie \
    --cc=dcb314@hotmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxdev.baldrick@gmail.com \
    /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

all inboxes | Powered by JetHome®