summaryrefslogtreecommitdiffstats
path: root/drivers/uwb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/uwb')
-rw-r--r--drivers/uwb/pal.c5
-rw-r--r--drivers/uwb/uwb-debug.c13
-rw-r--r--drivers/uwb/uwb-internal.h3
3 files changed, 19 insertions, 2 deletions
diff --git a/drivers/uwb/pal.c b/drivers/uwb/pal.c
index 6057651..99a19c1 100644
--- a/drivers/uwb/pal.c
+++ b/drivers/uwb/pal.c
@@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <linux/kernel.h>
+#include <linux/debugfs.h>
#include <linux/uwb.h>
#include "uwb-internal.h"
@@ -54,6 +55,8 @@ int uwb_pal_register(struct uwb_pal *pal)
}
}
+ pal->debugfs_dir = uwb_dbg_create_pal_dir(pal);
+
mutex_lock(&rc->uwb_dev.mutex);
list_add(&pal->node, &rc->pals);
mutex_unlock(&rc->uwb_dev.mutex);
@@ -76,6 +79,8 @@ void uwb_pal_unregister(struct uwb_pal *pal)
list_del(&pal->node);
mutex_unlock(&rc->uwb_dev.mutex);
+ debugfs_remove(pal->debugfs_dir);
+
if (pal->device) {
sysfs_remove_link(&rc->uwb_dev.dev.kobj, pal->name);
sysfs_remove_link(&pal->device->kobj, "uwb_rc");
diff --git a/drivers/uwb/uwb-debug.c b/drivers/uwb/uwb-debug.c
index ec1b7a4..a6debb9 100644
--- a/drivers/uwb/uwb-debug.c
+++ b/drivers/uwb/uwb-debug.c
@@ -407,3 +407,16 @@ void uwb_dbg_exit(void)
{
debugfs_remove(root_dir);
}
+
+/**
+ * uwb_dbg_create_pal_dir - create a debugfs directory for a PAL
+ * @pal: The PAL.
+ */
+struct dentry *uwb_dbg_create_pal_dir(struct uwb_pal *pal)
+{
+ struct uwb_rc *rc = pal->rc;
+
+ if (root_dir && rc->dbg && rc->dbg->root_d && pal->name)
+ return debugfs_create_dir(pal->name, rc->dbg->root_d);
+ return NULL;
+}
diff --git a/drivers/uwb/uwb-internal.h b/drivers/uwb/uwb-internal.h
index 9c0cdb4..f0f21f4 100644
--- a/drivers/uwb/uwb-internal.h
+++ b/drivers/uwb/uwb-internal.h
@@ -284,8 +284,7 @@ void uwb_dbg_init(void);
void uwb_dbg_exit(void);
void uwb_dbg_add_rc(struct uwb_rc *rc);
void uwb_dbg_del_rc(struct uwb_rc *rc);
-
-/* Workarounds for version specific stuff */
+struct dentry *uwb_dbg_create_pal_dir(struct uwb_pal *pal);
static inline void uwb_dev_lock(struct uwb_dev *uwb_dev)
{
OpenPOWER on IntegriCloud