Skip to contentSkip to conversation

drm/amd/amdxcp: Use unique name for partition dev

PATCH In review Lijo Lazar 5 participants 5 messages Apr 30, 2024

Subsystems (2)
lore
Share & tools
lore

Lijo Lazar

author
#0 lore raw

PATCH 1/1 drm/amd/amdxcp: Use unique name for partition dev

amdxcp is a platform driver for creating partition devices. libdrm library identifies a platform device based on 'OF_FULLNAME' or 'MODALIAS'. If two or more devices have the same platform name, drm library only picks the first device. Platform driver core uses name of the device to populate 'MODALIAS'. When 'amdxcp' is used as the base name, only first partition device gets identified. Assign unique name so that drm library identifies partition devices separately.

amdxcp doesn't support probe of partitions, it doesn't bother about modaliases.

---
 drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c +3 -1
index 90ddd8371176..b4131053b31b 100644
@@ -50,12 +50,14 @@ int amdgpu_xcp_drm_dev_alloc(struct drm_device **ddev)
 {
 	struct platform_device *pdev;
 	struct xcp_device *pxcp_dev;
+	char dev_name[20];
 	int ret;
 
 	if (pdev_num >= MAX_XCP_PLATFORM_DEVICE)
 		return -ENODEV;
 
-	pdev = platform_device_register_simple("amdgpu_xcp", pdev_num, NULL, 0);
+	snprintf(dev_name, sizeof(dev_name), "amdgpu_xcp_%d", pdev_num);
+	pdev = platform_device_register_simple(dev_name, -1, NULL, 0);
 	if (IS_ERR(pdev))
 		return PTR_ERR(pdev);
 
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Lijo Lazar

amdxcp is a platform driver for creating partition devices. libdrm library identifies a platform device based on 'OF_FULLNAME' or 'MODALIAS'. If two or more devices have the same platform name, drm library only picks the first device. Platform driver core uses name of the device to populate 'MODALIAS'. When 'amdxcp' is used as the base name, only first partition device gets identified. Assign unique name so that drm library identifies partition devices separately.

Quoted 4 lines

amdxcp doesn't support probe of partitions, it doesn't bother about modaliases.

Quoted 27 lines
---
 drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c +3 -2
index 90ddd8371176..b4131053b31b 100644
@@ -50,12 +50,14 @@ int amdgpu_xcp_drm_dev_alloc(struct drm_device **ddev)
 {
        struct platform_device *pdev;
        struct xcp_device *pxcp_dev;
+       char dev_name[20];
        int ret;
 
        if (pdev_num >= MAX_XCP_PLATFORM_DEVICE)
                return -ENODEV;
 
-       pdev = platform_device_register_simple("amdgpu_xcp", pdev_num, NULL, 0);
+       snprintf(dev_name, sizeof(dev_name), "amdgpu_xcp_%d", pdev_num);
+       pdev = platform_device_register_simple(dev_name, -1, NULL, 0);
        if (IS_ERR(pdev))
                return PTR_ERR(pdev);
 
--

2.25.1

Reviewed-by on v1 1/1
#2 lore raw
In reply to Lijo Lazar

[AMD Official Use Only - General]

Thanks & Regards
Asad

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lijo Lazar
Sent: Tuesday, April 30, 2024 5:06 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Zhu, James <[email protected]>
Subject: [PATCH] drm/amd/amdxcp: Use unique name for partition dev

amdxcp is a platform driver for creating partition devices. libdrm library identifies a platform device based on 'OF_FULLNAME' or 'MODALIAS'. If two or more devices have the same platform name, drm library only picks the first device. Platform driver core uses name of the device to populate 'MODALIAS'. When 'amdxcp' is used as the base name, only first partition device gets identified. Assign unique name so that drm library identifies partition devices separately.

amdxcp doesn't support probe of partitions, it doesn't bother about modaliases.

---
 drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c +3 -2
index 90ddd8371176..b4131053b31b 100644
@@ -50,12 +50,14 @@ int amdgpu_xcp_drm_dev_alloc(struct drm_device **ddev)  {
        struct platform_device *pdev;
        struct xcp_device *pxcp_dev;
+       char dev_name[20];
        int ret;
 
        if (pdev_num >= MAX_XCP_PLATFORM_DEVICE)
                return -ENODEV;
 
-       pdev = platform_device_register_simple("amdgpu_xcp", pdev_num, NULL, 0);
+       snprintf(dev_name, sizeof(dev_name), "amdgpu_xcp_%d", pdev_num);
+       pdev = platform_device_register_simple(dev_name, -1, NULL, 0);
        if (IS_ERR(pdev))
                return PTR_ERR(pdev);
 
--

2.25.1

maintainer Acked-by on v1 1/1
#3 lore raw
In reply to Lijo Lazar

Am 30.04.24 um 13:36 schrieb Lijo Lazar:

Quoted 8 lines

amdxcp is a platform driver for creating partition devices. libdrm library identifies a platform device based on 'OF_FULLNAME' or 'MODALIAS'. If two or more devices have the same platform name, drm library only picks the first device. Platform driver core uses name of the device to populate 'MODALIAS'. When 'amdxcp' is used as the base name, only first partition device gets identified. Assign unique name so that drm library identifies partition devices separately.

Quoted 4 lines

amdxcp doesn't support probe of partitions, it doesn't bother about modaliases.

Quoted 24 lines
---
  drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c +3 -1
index 90ddd8371176..b4131053b31b 100644
@@ -50,12 +50,14 @@ int amdgpu_xcp_drm_dev_alloc(struct drm_device **ddev)
  {
  	struct platform_device *pdev;
  	struct xcp_device *pxcp_dev;
+	char dev_name[20];
  	int ret;
 
  	if (pdev_num >= MAX_XCP_PLATFORM_DEVICE)
  		return -ENODEV;
 
-	pdev = platform_device_register_simple("amdgpu_xcp", pdev_num, NULL, 0);
+	snprintf(dev_name, sizeof(dev_name), "amdgpu_xcp_%d", pdev_num);
+	pdev = platform_device_register_simple(dev_name, -1, NULL, 0);
  	if (IS_ERR(pdev))
  		return PTR_ERR(pdev);
 
Acked-by JamesZhu on v1 1/1
#4 lore raw
In reply to Lijo Lazar
Quoted 8 lines · Lijo Lazar

amdxcp is a platform driver for creating partition devices. libdrm library identifies a platform device based on 'OF_FULLNAME' or 'MODALIAS'. If two or more devices have the same platform name, drm library only picks the first device. Platform driver core uses name of the device to populate 'MODALIAS'. When 'amdxcp' is used as the base name, only first partition device gets identified. Assign unique name so that drm library identifies partition devices separately.

Quoted 4 lines

amdxcp doesn't support probe of partitions, it doesn't bother about modaliases.

Quoted 24 lines
---
  drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdxcp/amdgpu_xcp_drv.c +3 -1
index 90ddd8371176..b4131053b31b 100644
@@ -50,12 +50,14 @@ int amdgpu_xcp_drm_dev_alloc(struct drm_device **ddev)
  {
  	struct platform_device *pdev;
  	struct xcp_device *pxcp_dev;
+	char dev_name[20];
  	int ret;
 
  	if (pdev_num >= MAX_XCP_PLATFORM_DEVICE)
  		return -ENODEV;
 
-	pdev = platform_device_register_simple("amdgpu_xcp", pdev_num, NULL, 0);
+	snprintf(dev_name, sizeof(dev_name), "amdgpu_xcp_%d", pdev_num);
+	pdev = platform_device_register_simple(dev_name, -1, NULL, 0);
  	if (IS_ERR(pdev))
  		return PTR_ERR(pdev);