[PATCH] soc: ti: knav_qmss: remove debugfs file on teardown
Pengpeng Hou
pengpeng at iscas.ac.cn
Mon Jun 15 02:12:51 PDT 2026
knav_queue_probe() creates the global qmss debugfs file whose show
callback reads the global kdev state. knav_queue_remove() disables
runtime PM but leaves the debugfs file and ready state published.
Save the debugfs dentry, remove it during teardown, and clear the global
ready pointer state.
Signed-off-by: Pengpeng Hou <pengpeng at iscas.ac.cn>
---
drivers/soc/ti/knav_qmss_queue.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/ti/knav_qmss_queue.c b/drivers/soc/ti/knav_qmss_queue.c
index 86d7a9c9ae01..1cc2e4a90c0d 100644
--- a/drivers/soc/ti/knav_qmss_queue.c
+++ b/drivers/soc/ti/knav_qmss_queue.c
@@ -26,6 +26,7 @@
#include "knav_qmss.h"
static struct knav_device *kdev;
+static struct dentry *knav_queue_debugfs;
static DEFINE_MUTEX(knav_dev_lock);
#define knav_dev_lock_held() \
lockdep_is_held(&knav_dev_lock)
@@ -1857,8 +1858,9 @@ static int knav_queue_probe(struct platform_device *pdev)
goto err;
}
- debugfs_create_file("qmss", S_IFREG | S_IRUGO, NULL, NULL,
- &knav_queue_debug_fops);
+ knav_queue_debugfs = debugfs_create_file("qmss", 0444,
+ NULL, NULL,
+ &knav_queue_debug_fops);
device_ready = true;
return 0;
@@ -1873,9 +1875,14 @@ static int knav_queue_probe(struct platform_device *pdev)
static void knav_queue_remove(struct platform_device *pdev)
{
+ device_ready = false;
+ debugfs_remove(knav_queue_debugfs);
+ knav_queue_debugfs = NULL;
+
/* TODO: Free resources */
pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
+ kdev = NULL;
}
static struct platform_driver keystone_qmss_driver = {
--
2.50.1 (Apple Git-155)
More information about the linux-arm-kernel
mailing list