Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soc: ti: knav_qmss: remove debugfs file on teardown
@ 2026-06-15  9:12 Pengpeng Hou
  2026-06-29 13:12 ` Nishanth Menon
  0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-06-15  9:12 UTC (permalink / raw)
  To: Nishanth Menon, Santosh Shilimkar, linux-kernel, linux-arm-kernel
  Cc: Pengpeng Hou

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@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)



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] soc: ti: knav_qmss: remove debugfs file on teardown
  2026-06-15  9:12 [PATCH] soc: ti: knav_qmss: remove debugfs file on teardown Pengpeng Hou
@ 2026-06-29 13:12 ` Nishanth Menon
  0 siblings, 0 replies; 2+ messages in thread
From: Nishanth Menon @ 2026-06-29 13:12 UTC (permalink / raw)
  To: Pengpeng Hou; +Cc: Santosh Shilimkar, linux-kernel, linux-arm-kernel

On 17:12-20260615, Pengpeng Hou wrote:
> 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.

Please update the commit message once you have rebased.
> 
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
>  drivers/soc/ti/knav_qmss_queue.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)

Please rebase to v7.2-rc1 or the latest linux-next please. The patch no
longer applies.

> 
> 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;

Does this belong to knav_device?

>  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,

I think the 0444 change was triggered by checkpatch.pl? Lets document
the change in commit message?


> +						 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;

This should already be present.

> +	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;

I think we renamed this in recent patches. knav_qdev = NULL and should
get the memory released once the remove function returns back?

>  }
>  
>  static struct platform_driver keystone_qmss_driver = {
> -- 
> 2.50.1 (Apple Git-155)
> 
> 

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-29 13:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-15  9:12 [PATCH] soc: ti: knav_qmss: remove debugfs file on teardown Pengpeng Hou
2026-06-29 13:12 ` Nishanth Menon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox