[1/3] drm/amdgpu: move check from cpu address to bo

Submitted by Huang, Ray on July 4, 2017, 6:10 a.m.

Details

Message ID 1499148650-22409-1-git-send-email-ray.huang@amd.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Huang, Ray July 4, 2017, 6:10 a.m.
Signed-off-by: Huang Rui <ray.huang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 4 ++--
 drivers/gpu/drm/amd/amdgpu/psp_v3_1.c   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index 79db294..1469e6d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -435,10 +435,10 @@  static int psp_hw_fini(void *handle)
 
 	psp_ring_destroy(psp, PSP_RING_TYPE__KM);
 
-	if (psp->tmr_buf)
+	if (psp->tmr_bo)
 		amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);
 
-	if (psp->fw_pri_buf)
+	if (psp->fw_pri_bo)
 		amdgpu_bo_free_kernel(&psp->fw_pri_bo,
 				      &psp->fw_pri_mc_addr, &psp->fw_pri_buf);
 
diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c
index 988ebd9..3d057d8 100644
--- a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c
@@ -341,7 +341,7 @@  int psp_v3_1_ring_destroy(struct psp_context *psp, enum psp_ring_type ring_type)
 	ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
 			   0x80000000, 0x80000000, false);
 
-	if (ring->ring_mem)
+	if (adev->firmware.rbuf)
 		amdgpu_bo_free_kernel(&adev->firmware.rbuf,
 				      &ring->ring_mem_mc_addr,
 				      (void **)&ring->ring_mem);

Comments

Actually amdgpu_bo_free_kernel is NULL save, so you should rather remove 
the "if"s here altogether.

Christian.

Am 04.07.2017 um 08:10 schrieb Huang Rui:
> Signed-off-by: Huang Rui <ray.huang@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 4 ++--
>   drivers/gpu/drm/amd/amdgpu/psp_v3_1.c   | 2 +-
>   2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index 79db294..1469e6d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -435,10 +435,10 @@ static int psp_hw_fini(void *handle)
>   
>   	psp_ring_destroy(psp, PSP_RING_TYPE__KM);
>   
> -	if (psp->tmr_buf)
> +	if (psp->tmr_bo)
>   		amdgpu_bo_free_kernel(&psp->tmr_bo, &psp->tmr_mc_addr, &psp->tmr_buf);
>   
> -	if (psp->fw_pri_buf)
> +	if (psp->fw_pri_bo)
>   		amdgpu_bo_free_kernel(&psp->fw_pri_bo,
>   				      &psp->fw_pri_mc_addr, &psp->fw_pri_buf);
>   
> diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c
> index 988ebd9..3d057d8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c
> +++ b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c
> @@ -341,7 +341,7 @@ int psp_v3_1_ring_destroy(struct psp_context *psp, enum psp_ring_type ring_type)
>   	ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
>   			   0x80000000, 0x80000000, false);
>   
> -	if (ring->ring_mem)
> +	if (adev->firmware.rbuf)
>   		amdgpu_bo_free_kernel(&adev->firmware.rbuf,
>   				      &ring->ring_mem_mc_addr,
>   				      (void **)&ring->ring_mem);
On Tue, Jul 04, 2017 at 03:19:17PM +0800, Koenig, Christian wrote:
> Actually amdgpu_bo_free_kernel is NULL save, so you should rather remove
> the "if"s here altogether.
> 

I see, will remove all "if" in front of bo free.

Thanks,
Rui