]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
soc: ti: knav_qmss_queue: Implement resource cleanup in remove()
authorMd Shofiqul Islam <shofiqtest@gmail.com>
Wed, 6 May 2026 15:41:14 +0000 (18:41 +0300)
committerNishanth Menon <nm@ti.com>
Fri, 15 May 2026 13:19:55 +0000 (08:19 -0500)
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.

Set device_ready to false before cleanup to prevent any further
use of the device during teardown.

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

Suggested-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Md Shofiqul Islam <shofiqtest@gmail.com>
Link: https://lore.kernel.org/linux-arm-kernel/20260506154114.2288-1-shofiqtest@gmail.com/
Signed-off-by: Nishanth Menon <nm@ti.com>
drivers/soc/ti/knav_qmss_queue.c

index 86d7a9c9ae011afc02bbefc62afe0b7bfb4a1801..a0644578789f5ace03742304dc8428c471028740 100644 (file)
@@ -1873,7 +1873,12 @@ err:
 
 static void knav_queue_remove(struct platform_device *pdev)
 {
-       /* TODO: Free resources */
+       struct knav_device *kdev = platform_get_drvdata(pdev);
+
+       device_ready = false;
+       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);
 }