Re: [PATCH 06/10] thunderbolt: Create debugfs directory automatically for services

From
Greg KH <gregkh@linuxfoundation.org>
Date
2020-11-04 14:19:52
Also in
linux-usb
Reply to
Mika Westerberg, 2020-11-04
On Wed, Nov 04, 2020 at 05:00:26PM +0300, Mika Westerberg wrote:
quoted hunk ↗ jump to hunk
This allows service drivers to use it as parent directory if they need
to add their own debugfs entries.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/thunderbolt/debugfs.c | 24 ++++++++++++++++++++++++
 drivers/thunderbolt/tb.h      |  4 ++++
 drivers/thunderbolt/xdomain.c |  3 +++
 include/linux/thunderbolt.h   |  4 ++++
 4 files changed, 35 insertions(+)
diff --git a/drivers/thunderbolt/debugfs.c b/drivers/thunderbolt/debugfs.c
index ed65d2b13964..a80278fc50af 100644
--- a/drivers/thunderbolt/debugfs.c
+++ b/drivers/thunderbolt/debugfs.c
@@ -691,6 +691,30 @@ void tb_switch_debugfs_remove(struct tb_switch *sw)
 	debugfs_remove_recursive(sw->debugfs_dir);
 }
 
+/**
+ * tb_service_debugfs_init() - Add debugfs directory for service
+ * @svc: Thunderbolt service pointer
+ *
+ * Adds debugfs directory for service.
+ */
+void tb_service_debugfs_init(struct tb_service *svc)
+{
+	svc->debugfs_dir = debugfs_create_dir(dev_name(&svc->dev),
+					      tb_debugfs_root);
+}
+
+/**
+ * tb_service_debugfs_remove() - Remove service debugfs directory
+ * @svc: Thunderbolt service pointer
+ *
+ * Removes the previously created debugfs directory for @svc.
+ */
+void tb_service_debugfs_remove(struct tb_service *svc)
+{
+	debugfs_remove(svc->debugfs_dir);
debugfs_remove_recursive() just to be safe that you really did clean
everything up?  As you aren't "owning" this directory here, you don't
know what will get added by some other patch :)

Other than that tiny nit, this series looks good to me, nice work.

thanks,

greg k-h
Thread (17 messages) 17 messages, 3 authors, last reply 2020-11-05
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help