Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1603364 > unrolled thread

[PATCH] drm/amdgpu: remove redundant outer loop and remove commented out code

Started byColin King <colin.king@canonical.com>
First post2017-03-17 15:40 +0100
Last post2017-03-17 19:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drm/amdgpu: remove redundant outer loop and remove commented out code Colin King <colin.king@canonical.com> - 2017-03-17 15:40 +0100
    Re: [PATCH] drm/amdgpu: remove redundant outer loop and remove  commented out code Alex Deucher <alexdeucher@gmail.com> - 2017-03-17 19:50 +0100

#1603364 — [PATCH] drm/amdgpu: remove redundant outer loop and remove commented out code

FromColin King <colin.king@canonical.com>
Date2017-03-17 15:40 +0100
Subject[PATCH] drm/amdgpu: remove redundant outer loop and remove commented out code
Message-ID<tm1cS-7LG-17@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

The outer loop is redundant and can be removed as it is doing nothing
useful. Also remove some commented out code that is not being used.

Detected by CoverityScan, CID#1402073

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/gpu/drm/amd/amdgpu/vce_v2_0.c | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
index 9ea99348e493..72dea663f113 100644
--- a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
@@ -273,24 +273,14 @@ static int vce_v2_0_start(struct amdgpu_device *adev)
 
 static int vce_v2_0_stop(struct amdgpu_device *adev)
 {
-	int i, j;
+	int i;
 	int status;
 
 	if (vce_v2_0_lmi_clean(adev)) {
 		DRM_INFO("vce is not idle \n");
 		return 0;
 	}
-/*
-	for (i = 0; i < 10; ++i) {
-		for (j = 0; j < 100; ++j) {
-			status = RREG32(mmVCE_FW_REG_STATUS);
-			if (!(status & 1))
-				break;
-			mdelay(1);
-		}
-		break;
-	}
-*/
+
 	if (vce_v2_0_wait_for_idle(adev)) {
 		DRM_INFO("VCE is busy, Can't set clock gateing");
 		return 0;
@@ -299,14 +289,11 @@ static int vce_v2_0_stop(struct amdgpu_device *adev)
 	/* Stall UMC and register bus before resetting VCPU */
 	WREG32_P(mmVCE_LMI_CTRL2, 1 << 8, ~(1 << 8));
 
-	for (i = 0; i < 10; ++i) {
-		for (j = 0; j < 100; ++j) {
-			status = RREG32(mmVCE_LMI_STATUS);
-			if (status & 0x240)
-				break;
-			mdelay(1);
-		}
-		break;
+	for (i = 0; i < 100; ++i) {
+		status = RREG32(mmVCE_LMI_STATUS);
+		if (status & 0x240)
+			break;
+		mdelay(1);
 	}
 
 	WREG32_P(mmVCE_VCPU_CNTL, 0, ~0x80001);
-- 
2.11.0

[toc] | [next] | [standalone]


#1603547 — Re: [PATCH] drm/amdgpu: remove redundant outer loop and remove commented out code

FromAlex Deucher <alexdeucher@gmail.com>
Date2017-03-17 19:50 +0100
SubjectRe: [PATCH] drm/amdgpu: remove redundant outer loop and remove commented out code
Message-ID<tm56O-2jb-7@gated-at.bofh.it>
In reply to#1603364
On Fri, Mar 17, 2017 at 10:37 AM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The outer loop is redundant and can be removed as it is doing nothing
> useful. Also remove some commented out code that is not being used.
>
> Detected by CoverityScan, CID#1402073
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied.  thanks!

Alex


> ---
>  drivers/gpu/drm/amd/amdgpu/vce_v2_0.c | 27 +++++++--------------------
>  1 file changed, 7 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
> index 9ea99348e493..72dea663f113 100644
> --- a/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/vce_v2_0.c
> @@ -273,24 +273,14 @@ static int vce_v2_0_start(struct amdgpu_device *adev)
>
>  static int vce_v2_0_stop(struct amdgpu_device *adev)
>  {
> -       int i, j;
> +       int i;
>         int status;
>
>         if (vce_v2_0_lmi_clean(adev)) {
>                 DRM_INFO("vce is not idle \n");
>                 return 0;
>         }
> -/*
> -       for (i = 0; i < 10; ++i) {
> -               for (j = 0; j < 100; ++j) {
> -                       status = RREG32(mmVCE_FW_REG_STATUS);
> -                       if (!(status & 1))
> -                               break;
> -                       mdelay(1);
> -               }
> -               break;
> -       }
> -*/
> +
>         if (vce_v2_0_wait_for_idle(adev)) {
>                 DRM_INFO("VCE is busy, Can't set clock gateing");
>                 return 0;
> @@ -299,14 +289,11 @@ static int vce_v2_0_stop(struct amdgpu_device *adev)
>         /* Stall UMC and register bus before resetting VCPU */
>         WREG32_P(mmVCE_LMI_CTRL2, 1 << 8, ~(1 << 8));
>
> -       for (i = 0; i < 10; ++i) {
> -               for (j = 0; j < 100; ++j) {
> -                       status = RREG32(mmVCE_LMI_STATUS);
> -                       if (status & 0x240)
> -                               break;
> -                       mdelay(1);
> -               }
> -               break;
> +       for (i = 0; i < 100; ++i) {
> +               status = RREG32(mmVCE_LMI_STATUS);
> +               if (status & 0x240)
> +                       break;
> +               mdelay(1);
>         }
>
>         WREG32_P(mmVCE_VCPU_CNTL, 0, ~0x80001);
> --
> 2.11.0
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web