Skip to contentSkip to conversation

soc: ti: knav_qmss_queue: free resources in remove callback

PATCH In review Md Shofiqul Islam 2 participants 4 messages Nov 5, 2025 – Nov 10, 2025 TI Keystone multicore navigator drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc: ti: knav_qmss_queue: free resources in remove callback

Implement the TODO in knav_queue_remove() by stopping PDSPs and freeing queue regions and queue ranges before disabling runtime PM, mirroring the allocations performed in the probe path.

This ensures resources are released on driver unbind and avoids leaking queue/region state.

---
 drivers/soc/ti/knav_qmss_queue.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/soc/ti/knav_qmss_queue.c +8 -3
index 6e56e7609ccd..1e5f3e9faa99 100644
@@ -1884,9 +1884,14 @@ static int knav_queue_probe(struct platform_device *pdev)
 
 static void knav_queue_remove(struct platform_device *pdev)
 {
-	/* TODO: Free resources */
-	pm_runtime_put_sync(&pdev->dev);
-	pm_runtime_disable(&pdev->dev);
+    struct knav_device *kdev = platform_get_drvdata(pdev);
+
+    knav_queue_stop_pdsps(kdev);
+    knav_queue_free_regions(kdev);
+    knav_free_queue_ranges(kdev);
+
+    pm_runtime_put_sync(&pdev->dev);
+    pm_runtime_disable(&pdev->dev);
 }
 
 static struct platform_driver keystone_qmss_driver = {
Signature · 1 line
2.51.1
maintainer
#1 lore raw
Quoted 37 lines · Md Shofiqul Islam

Implement the TODO in knav_queue_remove() by stopping PDSPs and freeing queue regions and queue ranges before disabling runtime PM, mirroring the allocations performed in the probe path.

This ensures resources are released on driver unbind and avoids leaking queue/region state.

---
 drivers/soc/ti/knav_qmss_queue.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/soc/ti/knav_qmss_queue.c +8 -3
index 6e56e7609ccd..1e5f3e9faa99 100644
@@ -1884,9 +1884,14 @@ static int knav_queue_probe(struct platform_device *pdev)
 
 static void knav_queue_remove(struct platform_device *pdev)
 {
-	/* TODO: Free resources */
-	pm_runtime_put_sync(&pdev->dev);
-	pm_runtime_disable(&pdev->dev);
+    struct knav_device *kdev = platform_get_drvdata(pdev);
+
+    knav_queue_stop_pdsps(kdev);
+    knav_queue_free_regions(kdev);
+    knav_free_queue_ranges(kdev);
+
+    pm_runtime_put_sync(&pdev->dev);
+    pm_runtime_disable(&pdev->dev);
 }
 
 static struct platform_driver keystone_qmss_driver = {
Signature · 1 line
2.51.1

Please follow linux coding conventions about usage of tabs - this should be exposed by running checkpatch.pl --strict on the patch.

Signature · 4 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
https://ti.com/opensource
#2 lore raw

PATCH 1/1 soc: ti: knav_qmss_queue: free resources in remove callback

In reply to Md Shofiqul Islam

Implement the TODO in knav_queue_remove() by stopping PDSPs and freeing queue regions and queue ranges before disabling runtime PM, mirroring the allocations performed in the probe path.

This ensures resources are released on driver unbind and avoids leaking queue/region state.

---
 drivers/soc/ti/knav_qmss_queue.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/soc/ti/knav_qmss_queue.c +8 -3
index 6e56e7609ccd..1e5f3e9faa99 100644
@@ -1884,9 +1884,14 @@ static int knav_queue_probe(struct platform_device *pdev)
 
 static void knav_queue_remove(struct platform_device *pdev)
 {
-	/* TODO: Free resources */
-	pm_runtime_put_sync(&pdev->dev);
-	pm_runtime_disable(&pdev->dev);
+    struct knav_device *kdev = platform_get_drvdata(pdev);
+
+    knav_queue_stop_pdsps(kdev);
+    knav_queue_free_regions(kdev);
+    knav_free_queue_ranges(kdev);
+
+    pm_runtime_put_sync(&pdev->dev);
+    pm_runtime_disable(&pdev->dev);
 }
 
 static struct platform_driver keystone_qmss_driver = {
Signature · 1 line
2.51.1
maintainer
#3 lore raw
Quoted 37 lines · Md Shofiqul Islam

Implement the TODO in knav_queue_remove() by stopping PDSPs and freeing queue regions and queue ranges before disabling runtime PM, mirroring the allocations performed in the probe path.

This ensures resources are released on driver unbind and avoids leaking queue/region state.

---
 drivers/soc/ti/knav_qmss_queue.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/soc/ti/knav_qmss_queue.c +8 -3
index 6e56e7609ccd..1e5f3e9faa99 100644
@@ -1884,9 +1884,14 @@ static int knav_queue_probe(struct platform_device *pdev)
 
 static void knav_queue_remove(struct platform_device *pdev)
 {
-	/* TODO: Free resources */
-	pm_runtime_put_sync(&pdev->dev);
-	pm_runtime_disable(&pdev->dev);
+    struct knav_device *kdev = platform_get_drvdata(pdev);
+
+    knav_queue_stop_pdsps(kdev);
+    knav_queue_free_regions(kdev);
+    knav_free_queue_ranges(kdev);
+
+    pm_runtime_put_sync(&pdev->dev);
+    pm_runtime_disable(&pdev->dev);
 }
 
 static struct platform_driver keystone_qmss_driver = {
Signature · 1 line
2.51.1

Did you happen to send the same patch as previous? it has the exact same formatting issues that i flagged.

Signature · 4 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
https://ti.com/opensource