Skip to contentSkip to conversation

drm/amdgpu: various cleanups for uvd/vce.

PATCH In review Rex Zhu 2 participants 2 messages Mar 30, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/1 drm/amdgpu: various cleanups for uvd/vce.

Change-Id I3e3dfc7e9a0f18b9c8562650e6b118f2fdd4ec8c
---
 drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 19 ++++---------------
 drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | 18 +++---------------
 drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 17 +++--------------
 drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 17 +++--------------
 drivers/gpu/drm/amd/amdgpu/vce_v2_0.c | 18 +++---------------
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 18 +++---------------
 drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | 18 +++---------------
 7 files changed, 22 insertions(+), 103 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +4 -15
index 9a4129d..8ab0f78 100644
@@ -135,12 +135,9 @@ static int uvd_v4_2_sw_fini(void *handle)
 	if (r)
 		return r;
 
-	r = amdgpu_uvd_sw_fini(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_uvd_sw_fini(adev);
 }
+
 static void uvd_v4_2_enable_mgcg(struct amdgpu_device *adev,
 				 bool enable);
 /**
@@ -230,11 +227,7 @@ static int uvd_v4_2_suspend(void *handle)
 	if (r)
 		return r;
 
-	r = amdgpu_uvd_suspend(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_uvd_suspend(adev);
 }
 
 static int uvd_v4_2_resume(void *handle)
@@ -246,11 +239,7 @@ static int uvd_v4_2_resume(void *handle)
 	if (r)
 		return r;
 
-	r = uvd_v4_2_hw_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return uvd_v4_2_hw_init(adev);
 }
 
 /**
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +3 -15
index e448f7d..bb6d46e 100644
@@ -131,11 +131,7 @@ static int uvd_v5_0_sw_fini(void *handle)
 	if (r)
 		return r;
 
-	r = amdgpu_uvd_sw_fini(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_uvd_sw_fini(adev);
 }
 
 /**
@@ -228,11 +224,7 @@ static int uvd_v5_0_suspend(void *handle)
 		return r;
 	uvd_v5_0_set_clockgating_state(adev, AMD_CG_STATE_GATE);
 
-	r = amdgpu_uvd_suspend(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_uvd_suspend(adev);
 }
 
 static int uvd_v5_0_resume(void *handle)
@@ -244,11 +236,7 @@ static int uvd_v5_0_resume(void *handle)
 	if (r)
 		return r;
 
-	r = uvd_v5_0_hw_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return uvd_v5_0_hw_init(adev);
 }
 
 /**
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +3 -14
index 5679a42..31db356 100644
@@ -134,11 +134,7 @@ static int uvd_v6_0_sw_fini(void *handle)
 	if (r)
 		return r;
 
-	r = amdgpu_uvd_sw_fini(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_uvd_sw_fini(adev);
 }
 
 /**
@@ -230,11 +226,8 @@ static int uvd_v6_0_suspend(void *handle)
 		return r;
 
 	/* Skip this for APU for now */
-	if (!(adev->flags & AMD_IS_APU)) {
+	if (!(adev->flags & AMD_IS_APU))
 		r = amdgpu_uvd_suspend(adev);
-		if (r)
-			return r;
-	}
 
 	return r;
 }
@@ -250,11 +243,7 @@ static int uvd_v6_0_resume(void *handle)
 		if (r)
 			return r;
 	}
-	r = uvd_v6_0_hw_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return uvd_v6_0_hw_init(adev);
 }
 
 /**
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +3 -14
index 3457546..6024aef 100644
@@ -438,11 +438,7 @@ static int uvd_v7_0_sw_fini(void *handle)
 	for (i = 0; i < adev->uvd.num_enc_rings; ++i)
 		amdgpu_ring_fini(&adev->uvd.ring_enc[i]);
 
-	r = amdgpu_uvd_sw_fini(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_uvd_sw_fini(adev);
 }
 
 /**
@@ -547,11 +543,8 @@ static int uvd_v7_0_suspend(void *handle)
 		return r;
 
 	/* Skip this for APU for now */
-	if (!(adev->flags & AMD_IS_APU)) {
+	if (!(adev->flags & AMD_IS_APU))
 		r = amdgpu_uvd_suspend(adev);
-		if (r)
-			return r;
-	}
 
 	return r;
 }
@@ -567,11 +560,7 @@ static int uvd_v7_0_resume(void *handle)
 		if (r)
 			return r;
 	}
-	r = uvd_v7_0_hw_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return uvd_v7_0_hw_init(adev);
 }
 
 /**
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +3 -15
index 49a6c45..47f7082 100644
@@ -451,11 +451,7 @@ static int vce_v2_0_sw_fini(void *handle)
 	if (r)
 		return r;
 
-	r = amdgpu_vce_sw_fini(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_vce_sw_fini(adev);
 }
 
 static int vce_v2_0_hw_init(void *handle)
@@ -495,11 +491,7 @@ static int vce_v2_0_suspend(void *handle)
 	if (r)
 		return r;
 
-	r = amdgpu_vce_suspend(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_vce_suspend(adev);
 }
 
 static int vce_v2_0_resume(void *handle)
@@ -511,11 +503,7 @@ static int vce_v2_0_resume(void *handle)
 	if (r)
 		return r;
 
-	r = vce_v2_0_hw_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return vce_v2_0_hw_init(adev);
 }
 
 static int vce_v2_0_soft_reset(void *handle)
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +3 -15
index db0adac..fb08193 100644
@@ -417,11 +417,7 @@ static int vce_v3_0_sw_fini(void *handle)
 	if (r)
 		return r;
 
-	r = amdgpu_vce_sw_fini(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_vce_sw_fini(adev);
 }
 
 static int vce_v3_0_hw_init(void *handle)
@@ -471,11 +467,7 @@ static int vce_v3_0_suspend(void *handle)
 	if (r)
 		return r;
 
-	r = amdgpu_vce_suspend(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_vce_suspend(adev);
 }
 
 static int vce_v3_0_resume(void *handle)
@@ -487,11 +479,7 @@ static int vce_v3_0_resume(void *handle)
 	if (r)
 		return r;
 
-	r = vce_v3_0_hw_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return vce_v3_0_hw_init(adev);
 }
 
 static void vce_v3_0_mc_resume(struct amdgpu_device *adev, int idx)
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +3 -15
index ad5fd98..ae9a93c 100644
@@ -527,11 +527,7 @@ static int vce_v4_0_sw_fini(void *handle)
 	if (r)
 		return r;
 
-	r = amdgpu_vce_sw_fini(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_vce_sw_fini(adev);
 }
 
 static int vce_v4_0_hw_init(void *handle)
@@ -584,11 +580,7 @@ static int vce_v4_0_suspend(void *handle)
 	if (r)
 		return r;
 
-	r = amdgpu_vce_suspend(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_vce_suspend(adev);
 }
 
 static int vce_v4_0_resume(void *handle)
@@ -600,11 +592,7 @@ static int vce_v4_0_resume(void *handle)
 	if (r)
 		return r;
 
-	r = vce_v4_0_hw_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return vce_v4_0_hw_init(adev);
 }
 
 static void vce_v4_0_mc_resume(struct amdgpu_device *adev)
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1490860403-25712-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw

Am 30.03.2017 um 09:53 schrieb Rex Zhu:

Quoted 2 lines
Change-Id I3e3dfc7e9a0f18b9c8562650e6b118f2fdd4ec8c
Quoted 303 lines
---
  drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c | 19 ++++---------------
  drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c | 18 +++---------------
  drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c | 17 +++--------------
  drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 17 +++--------------
  drivers/gpu/drm/amd/amdgpu/vce_v2_0.c | 18 +++---------------
  drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 18 +++---------------
  drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | 18 +++---------------
  7 files changed, 22 insertions(+), 103 deletions(-)
drivers/gpu/drm/amd/amdgpu/uvd_v4_2.c +4 -15
index 9a4129d..8ab0f78 100644
@@ -135,12 +135,9 @@ static int uvd_v4_2_sw_fini(void *handle)
  	if (r)
  		return r;
 
-	r = amdgpu_uvd_sw_fini(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_uvd_sw_fini(adev);
  }
+
  static void uvd_v4_2_enable_mgcg(struct amdgpu_device *adev,
  				 bool enable);
  /**
@@ -230,11 +227,7 @@ static int uvd_v4_2_suspend(void *handle)
  	if (r)
  		return r;
 
-	r = amdgpu_uvd_suspend(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_uvd_suspend(adev);
  }
 
  static int uvd_v4_2_resume(void *handle)
@@ -246,11 +239,7 @@ static int uvd_v4_2_resume(void *handle)
  	if (r)
  		return r;
 
-	r = uvd_v4_2_hw_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return uvd_v4_2_hw_init(adev);
  }
 
  /**
drivers/gpu/drm/amd/amdgpu/uvd_v5_0.c +3 -15
index e448f7d..bb6d46e 100644
@@ -131,11 +131,7 @@ static int uvd_v5_0_sw_fini(void *handle)
  	if (r)
  		return r;
 
-	r = amdgpu_uvd_sw_fini(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_uvd_sw_fini(adev);
  }
 
  /**
@@ -228,11 +224,7 @@ static int uvd_v5_0_suspend(void *handle)
  		return r;
  	uvd_v5_0_set_clockgating_state(adev, AMD_CG_STATE_GATE);
 
-	r = amdgpu_uvd_suspend(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_uvd_suspend(adev);
  }
 
  static int uvd_v5_0_resume(void *handle)
@@ -244,11 +236,7 @@ static int uvd_v5_0_resume(void *handle)
  	if (r)
  		return r;
 
-	r = uvd_v5_0_hw_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return uvd_v5_0_hw_init(adev);
  }
 
  /**
drivers/gpu/drm/amd/amdgpu/uvd_v6_0.c +3 -14
index 5679a42..31db356 100644
@@ -134,11 +134,7 @@ static int uvd_v6_0_sw_fini(void *handle)
  	if (r)
  		return r;
 
-	r = amdgpu_uvd_sw_fini(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_uvd_sw_fini(adev);
  }
 
  /**
@@ -230,11 +226,8 @@ static int uvd_v6_0_suspend(void *handle)
  		return r;
 
  	/* Skip this for APU for now */
-	if (!(adev->flags & AMD_IS_APU)) {
+	if (!(adev->flags & AMD_IS_APU))
  		r = amdgpu_uvd_suspend(adev);
-		if (r)
-			return r;
-	}
 
  	return r;
  }
@@ -250,11 +243,7 @@ static int uvd_v6_0_resume(void *handle)
  		if (r)
  			return r;
  	}
-	r = uvd_v6_0_hw_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return uvd_v6_0_hw_init(adev);
  }
 
  /**
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +3 -14
index 3457546..6024aef 100644
@@ -438,11 +438,7 @@ static int uvd_v7_0_sw_fini(void *handle)
  	for (i = 0; i < adev->uvd.num_enc_rings; ++i)
  		amdgpu_ring_fini(&adev->uvd.ring_enc[i]);
 
-	r = amdgpu_uvd_sw_fini(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_uvd_sw_fini(adev);
  }
 
  /**
@@ -547,11 +543,8 @@ static int uvd_v7_0_suspend(void *handle)
  		return r;
 
  	/* Skip this for APU for now */
-	if (!(adev->flags & AMD_IS_APU)) {
+	if (!(adev->flags & AMD_IS_APU))
  		r = amdgpu_uvd_suspend(adev);
-		if (r)
-			return r;
-	}
 
  	return r;
  }
@@ -567,11 +560,7 @@ static int uvd_v7_0_resume(void *handle)
  		if (r)
  			return r;
  	}
-	r = uvd_v7_0_hw_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return uvd_v7_0_hw_init(adev);
  }
 
  /**
drivers/gpu/drm/amd/amdgpu/vce_v2_0.c +3 -15
index 49a6c45..47f7082 100644
@@ -451,11 +451,7 @@ static int vce_v2_0_sw_fini(void *handle)
  	if (r)
  		return r;
 
-	r = amdgpu_vce_sw_fini(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_vce_sw_fini(adev);
  }
 
  static int vce_v2_0_hw_init(void *handle)
@@ -495,11 +491,7 @@ static int vce_v2_0_suspend(void *handle)
  	if (r)
  		return r;
 
-	r = amdgpu_vce_suspend(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_vce_suspend(adev);
  }
 
  static int vce_v2_0_resume(void *handle)
@@ -511,11 +503,7 @@ static int vce_v2_0_resume(void *handle)
  	if (r)
  		return r;
 
-	r = vce_v2_0_hw_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return vce_v2_0_hw_init(adev);
  }
 
  static int vce_v2_0_soft_reset(void *handle)
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +3 -15
index db0adac..fb08193 100644
@@ -417,11 +417,7 @@ static int vce_v3_0_sw_fini(void *handle)
  	if (r)
  		return r;
 
-	r = amdgpu_vce_sw_fini(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_vce_sw_fini(adev);
  }
 
  static int vce_v3_0_hw_init(void *handle)
@@ -471,11 +467,7 @@ static int vce_v3_0_suspend(void *handle)
  	if (r)
  		return r;
 
-	r = amdgpu_vce_suspend(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_vce_suspend(adev);
  }
 
  static int vce_v3_0_resume(void *handle)
@@ -487,11 +479,7 @@ static int vce_v3_0_resume(void *handle)
  	if (r)
  		return r;
 
-	r = vce_v3_0_hw_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return vce_v3_0_hw_init(adev);
  }
 
  static void vce_v3_0_mc_resume(struct amdgpu_device *adev, int idx)
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +2 -10
index ad5fd98..ae9a93c 100644
@@ -527,11 +527,7 @@ static int vce_v4_0_sw_fini(void *handle)
  	if (r)
  		return r;
 
-	r = amdgpu_vce_sw_fini(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_vce_sw_fini(adev);
  }
 
  static int vce_v4_0_hw_init(void *handle)
@@ -584,11 +580,7 @@ static int vce_v4_0_suspend(void *handle)
  	if (r)
  		return r;
 
-	r = amdgpu_vce_suspend(adev);
-	if (r)
-		return r;
-
-	return r;
+	return amdgpu_vce_suspend(adev);
  }
 
  static int vce_v4_0_resume(void *handle)
@@ -600,11 +592,7 @@ static int vce_v4_0_resume(void *handle)
  	if (r)
  		return r;

drivers/gpu/drm/amd/amdgpu/vce_v4_0.c static int vce_v4_0_resume(void *handle) · line 598

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +1 -5
 
-	r = vce_v4_0_hw_init(adev);
-	if (r)
-		return r;
-
-	return r;
+	return vce_v4_0_hw_init(adev);
  }
 
  static void vce_v4_0_mc_resume(struct amdgpu_device *adev)

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx