Re: [PATCH] drm/amdxcp: fix amdxcp unloads incompletely

2023-10-23 Thread Deucher, Alexander
[Public]

Acked-by: Alex Deucher 

From: amd-gfx  on behalf of James Zhu 

Sent: Thursday, September 7, 2023 10:41 AM
To: amd-gfx@lists.freedesktop.org 
Cc: Lin, Amber ; Zhu, James ; Kamal, Asad 

Subject: [PATCH] drm/amdxcp: fix amdxcp unloads incompletely

amdxcp unloads incompletely, and below error will be seen during load/unload,
sysfs: cannot create duplicate filename '/devices/platform/amdgpu_xcp.0'

devres_release_group will free xcp device at first, platform device will be
unregistered later in platform_device_unregister.

Signed-off-by: James Zhu 
---
 drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c 
b/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c
index 353597fc908d..90ddd8371176 100644
--- a/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c
+++ b/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c
@@ -89,9 +89,10 @@ EXPORT_SYMBOL(amdgpu_xcp_drm_dev_alloc);
 void amdgpu_xcp_drv_release(void)
 {
 for (--pdev_num; pdev_num >= 0; --pdev_num) {
-   devres_release_group(_dev[pdev_num]->pdev->dev, NULL);
-   platform_device_unregister(xcp_dev[pdev_num]->pdev);
-   xcp_dev[pdev_num]->pdev = NULL;
+   struct platform_device *pdev = xcp_dev[pdev_num]->pdev;
+
+   devres_release_group(>dev, NULL);
+   platform_device_unregister(pdev);
 xcp_dev[pdev_num] = NULL;
 }
 pdev_num = 0;
--
2.34.1



Re: [PATCH] drm/amdxcp: fix amdxcp unloads incompletely

2023-10-23 Thread Zhu, James
[AMD Official Use Only - General]

ping ...


Thanks & Best Regards!


James Zhu


From: Zhu, James 
Sent: Thursday, September 7, 2023 10:41 AM
To: amd-gfx@lists.freedesktop.org 
Cc: Kamal, Asad ; Lin, Amber ; Zhu, 
James 
Subject: [PATCH] drm/amdxcp: fix amdxcp unloads incompletely

amdxcp unloads incompletely, and below error will be seen during load/unload,
sysfs: cannot create duplicate filename '/devices/platform/amdgpu_xcp.0'

devres_release_group will free xcp device at first, platform device will be
unregistered later in platform_device_unregister.

Signed-off-by: James Zhu 
---
 drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c 
b/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c
index 353597fc908d..90ddd8371176 100644
--- a/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c
+++ b/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c
@@ -89,9 +89,10 @@ EXPORT_SYMBOL(amdgpu_xcp_drm_dev_alloc);
 void amdgpu_xcp_drv_release(void)
 {
 for (--pdev_num; pdev_num >= 0; --pdev_num) {
-   devres_release_group(_dev[pdev_num]->pdev->dev, NULL);
-   platform_device_unregister(xcp_dev[pdev_num]->pdev);
-   xcp_dev[pdev_num]->pdev = NULL;
+   struct platform_device *pdev = xcp_dev[pdev_num]->pdev;
+
+   devres_release_group(>dev, NULL);
+   platform_device_unregister(pdev);
 xcp_dev[pdev_num] = NULL;
 }
 pdev_num = 0;
--
2.34.1



[PATCH] drm/amdxcp: fix amdxcp unloads incompletely

2023-09-07 Thread James Zhu
amdxcp unloads incompletely, and below error will be seen during load/unload,
sysfs: cannot create duplicate filename '/devices/platform/amdgpu_xcp.0'

devres_release_group will free xcp device at first, platform device will be
unregistered later in platform_device_unregister.

Signed-off-by: James Zhu 
---
 drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c 
b/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c
index 353597fc908d..90ddd8371176 100644
--- a/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c
+++ b/drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c
@@ -89,9 +89,10 @@ EXPORT_SYMBOL(amdgpu_xcp_drm_dev_alloc);
 void amdgpu_xcp_drv_release(void)
 {
for (--pdev_num; pdev_num >= 0; --pdev_num) {
-   devres_release_group(_dev[pdev_num]->pdev->dev, NULL);
-   platform_device_unregister(xcp_dev[pdev_num]->pdev);
-   xcp_dev[pdev_num]->pdev = NULL;
+   struct platform_device *pdev = xcp_dev[pdev_num]->pdev;
+
+   devres_release_group(>dev, NULL);
+   platform_device_unregister(pdev);
xcp_dev[pdev_num] = NULL;
}
pdev_num = 0;
-- 
2.34.1