aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorMing Lei <tom.leiming@gmail.com>2010-07-28 10:33:28 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-10 17:35:44 -0400
commit185c9bcfde628f1d71aefd34517252cce4c4a57a (patch)
treefeeda7617f406baca34fedb74ddbc29d062ea296 /drivers/usb
parentf2402f21caba2aceebbf637458b777300669020f (diff)
USB: ehci: fix remove of ehci debugfs dir
The patch below on gregkh tree only creates 'lpm' file under ehci->debug_dir, but not removes it when unloading module, USB: EHCI: EHCI 1.1 addendum: preparation which can make loading of ehci-hcd module failed after unloading it. This patch replaces debugfs_remove with debugfs_remove_recursive to remove ehci debugfs dir and files. It does fix the bug above, and may simplify the removing procedure. Also, remove the debug_registers, debug_async and debug_periodic field from ehci_hcd struct since they are useless now. Signed-off-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/ehci-dbg.c58
-rw-r--r--drivers/usb/host/ehci.h4
2 files changed, 21 insertions, 41 deletions
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index 4498efb49b95..76b7fd2d838a 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -1049,49 +1049,33 @@ static inline void create_debug_files (struct ehci_hcd *ehci)
1049 1049
1050 ehci->debug_dir = debugfs_create_dir(bus->bus_name, ehci_debug_root); 1050 ehci->debug_dir = debugfs_create_dir(bus->bus_name, ehci_debug_root);
1051 if (!ehci->debug_dir) 1051 if (!ehci->debug_dir)
1052 goto dir_error; 1052 return;
1053 1053
1054 ehci->debug_async = debugfs_create_file("async", S_IRUGO, 1054 if (!debugfs_create_file("async", S_IRUGO, ehci->debug_dir, bus,
1055 ehci->debug_dir, bus, 1055 &debug_async_fops))
1056 &debug_async_fops); 1056 goto file_error;
1057 if (!ehci->debug_async) 1057
1058 goto async_error; 1058 if (!debugfs_create_file("periodic", S_IRUGO, ehci->debug_dir, bus,
1059 1059 &debug_periodic_fops))
1060 ehci->debug_periodic = debugfs_create_file("periodic", S_IRUGO, 1060 goto file_error;
1061 ehci->debug_dir, bus, 1061
1062 &debug_periodic_fops); 1062 if (!debugfs_create_file("registers", S_IRUGO, ehci->debug_dir, bus,
1063 if (!ehci->debug_periodic) 1063 &debug_registers_fops))
1064 goto periodic_error; 1064 goto file_error;
1065 1065
1066 ehci->debug_registers = debugfs_create_file("registers", S_IRUGO, 1066 if (!debugfs_create_file("lpm", S_IRUGO|S_IWUGO, ehci->debug_dir, bus,
1067 ehci->debug_dir, bus, 1067 &debug_lpm_fops))
1068 &debug_registers_fops); 1068 goto file_error;
1069 1069
1070 ehci->debug_registers = debugfs_create_file("lpm", S_IRUGO|S_IWUGO,
1071 ehci->debug_dir, bus,
1072 &debug_lpm_fops);
1073 if (!ehci->debug_registers)
1074 goto registers_error;
1075 return; 1070 return;
1076 1071
1077registers_error: 1072file_error:
1078 debugfs_remove(ehci->debug_periodic); 1073 debugfs_remove_recursive(ehci->debug_dir);
1079periodic_error:
1080 debugfs_remove(ehci->debug_async);
1081async_error:
1082 debugfs_remove(ehci->debug_dir);
1083dir_error:
1084 ehci->debug_periodic = NULL;
1085 ehci->debug_async = NULL;
1086 ehci->debug_dir = NULL;
1087} 1074}
1088 1075
1089static inline void remove_debug_files (struct ehci_hcd *ehci) 1076static inline void remove_debug_files (struct ehci_hcd *ehci)
1090{ 1077{
1091 debugfs_remove(ehci->debug_registers); 1078 debugfs_remove_recursive(ehci->debug_dir);
1092 debugfs_remove(ehci->debug_periodic);
1093 debugfs_remove(ehci->debug_async);
1094 debugfs_remove(ehci->debug_dir);
1095} 1079}
1096 1080
1097#endif /* STUB_DEBUG_FILES */ 1081#endif /* STUB_DEBUG_FILES */
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index e5b9ece8a077..bde823f704e9 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -156,10 +156,6 @@ struct ehci_hcd { /* one per controller */
156 /* debug files */ 156 /* debug files */
157#ifdef DEBUG 157#ifdef DEBUG
158 struct dentry *debug_dir; 158 struct dentry *debug_dir;
159 struct dentry *debug_async;
160 struct dentry *debug_periodic;
161 struct dentry *debug_registers;
162 struct dentry *debug_lpm;
163#endif 159#endif
164}; 160};
165 161