aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/core/usb.c22
-rw-r--r--include/linux/usb.h3
2 files changed, 25 insertions, 0 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 7eee400d3e32..5f6873f5f268 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -34,6 +34,7 @@
34#include <linux/usb.h> 34#include <linux/usb.h>
35#include <linux/mutex.h> 35#include <linux/mutex.h>
36#include <linux/workqueue.h> 36#include <linux/workqueue.h>
37#include <linux/debugfs.h>
37 38
38#include <asm/io.h> 39#include <asm/io.h>
39#include <linux/scatterlist.h> 40#include <linux/scatterlist.h>
@@ -1001,6 +1002,22 @@ static struct notifier_block usb_bus_nb = {
1001 .notifier_call = usb_bus_notify, 1002 .notifier_call = usb_bus_notify,
1002}; 1003};
1003 1004
1005struct dentry *usb_debug_root;
1006EXPORT_SYMBOL_GPL(usb_debug_root);
1007
1008static int usb_debugfs_init(void)
1009{
1010 usb_debug_root = debugfs_create_dir("usb", NULL);
1011 if (!usb_debug_root)
1012 return -ENOENT;
1013 return 0;
1014}
1015
1016static void usb_debugfs_cleanup(void)
1017{
1018 debugfs_remove(usb_debug_root);
1019}
1020
1004/* 1021/*
1005 * Init 1022 * Init
1006 */ 1023 */
@@ -1012,6 +1029,10 @@ static int __init usb_init(void)
1012 return 0; 1029 return 0;
1013 } 1030 }
1014 1031
1032 retval = usb_debugfs_init();
1033 if (retval)
1034 goto out;
1035
1015 retval = ksuspend_usb_init(); 1036 retval = ksuspend_usb_init();
1016 if (retval) 1037 if (retval)
1017 goto out; 1038 goto out;
@@ -1083,6 +1104,7 @@ static void __exit usb_exit(void)
1083 bus_unregister_notifier(&usb_bus_type, &usb_bus_nb); 1104 bus_unregister_notifier(&usb_bus_type, &usb_bus_nb);
1084 bus_unregister(&usb_bus_type); 1105 bus_unregister(&usb_bus_type);
1085 ksuspend_usb_cleanup(); 1106 ksuspend_usb_cleanup();
1107 usb_debugfs_cleanup();
1086} 1108}
1087 1109
1088subsys_initcall(usb_init); 1110subsys_initcall(usb_init);
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 3aa2cd1f8d08..29060dad81e6 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -1558,6 +1558,9 @@ extern void usb_unregister_notify(struct notifier_block *nb);
1558#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \ 1558#define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \
1559 format "\n" , ## arg) 1559 format "\n" , ## arg)
1560 1560
1561/* debugfs stuff */
1562extern struct dentry *usb_debug_root;
1563
1561#endif /* __KERNEL__ */ 1564#endif /* __KERNEL__ */
1562 1565
1563#endif 1566#endif