Skip to contentSkip to conversation

soc: ti: knav_qmss_queue: free resources in remove callback

PATCH In review Md Shofiqul Islam 2 participants 2 messages May 5 – May 6 TI Keystone multicore navigator drivers

lore
Share & tools
lore
#0 lore raw

PATCH v3 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 cleanup performed in the probe error path.

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

---
 drivers/soc/ti/knav_qmss_queue.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/soc/ti/knav_qmss_queue.c +5 -1
index 86d7a9c9a..8d8245352 100644
@@ -1873,7 +1873,11 @@ static int knav_queue_probe(struct platform_device *pdev)
 
 static void knav_queue_remove(struct platform_device *pdev)
 {
-	/* TODO: Free resources */
+	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);
 }
Signature · 1 line
2.51.1
maintainer
#1 lore raw
Quoted 6 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 cleanup performed in the probe error path.

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

Missing Signed-off-by -> please run checkpatch --strict.

ERROR: Missing Signed-off-by: line by nominal patch author 'Md Shofiqul Islam <[email protected]>'

Quoted 9 lines
---
 drivers/soc/ti/knav_qmss_queue.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/soc/ti/knav_qmss_queue.c +0 -0
index 86d7a9c9a..8d8245352 100644

drivers/soc/ti/knav_qmss_queue.c static int knav_queue_probe(struct platform_device *pdev) · line 1877

Quoted 6 lines
drivers/soc/ti/knav_qmss_queue.c +2 -1
@@ -1873,7 +1873,11 @@ static int knav_queue_probe(struct platform_device *pdev)
 
 static void knav_queue_remove(struct platform_device *pdev)
 {
-	/* TODO: Free resources */
+	struct knav_device *kdev = platform_get_drvdata(pdev);
+

I suggest adding:

	device_ready = false;
Quoted 9 lines
drivers/soc/ti/knav_qmss_queue.c +3 -0
+	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);
 }
Signature · 1 line
2.51.1
Signature · 4 lines
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D
https://ti.com/opensource