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>
This commit is contained in:
parent
f2402f21ca
commit
185c9bcfde
2 changed files with 17 additions and 37 deletions
|
@ -1049,49 +1049,33 @@ static inline void create_debug_files (struct ehci_hcd *ehci)
|
||||||
|
|
||||||
ehci->debug_dir = debugfs_create_dir(bus->bus_name, ehci_debug_root);
|
ehci->debug_dir = debugfs_create_dir(bus->bus_name, ehci_debug_root);
|
||||||
if (!ehci->debug_dir)
|
if (!ehci->debug_dir)
|
||||||
goto dir_error;
|
|
||||||
|
|
||||||
ehci->debug_async = debugfs_create_file("async", S_IRUGO,
|
|
||||||
ehci->debug_dir, bus,
|
|
||||||
&debug_async_fops);
|
|
||||||
if (!ehci->debug_async)
|
|
||||||
goto async_error;
|
|
||||||
|
|
||||||
ehci->debug_periodic = debugfs_create_file("periodic", S_IRUGO,
|
|
||||||
ehci->debug_dir, bus,
|
|
||||||
&debug_periodic_fops);
|
|
||||||
if (!ehci->debug_periodic)
|
|
||||||
goto periodic_error;
|
|
||||||
|
|
||||||
ehci->debug_registers = debugfs_create_file("registers", S_IRUGO,
|
|
||||||
ehci->debug_dir, bus,
|
|
||||||
&debug_registers_fops);
|
|
||||||
|
|
||||||
ehci->debug_registers = debugfs_create_file("lpm", S_IRUGO|S_IWUGO,
|
|
||||||
ehci->debug_dir, bus,
|
|
||||||
&debug_lpm_fops);
|
|
||||||
if (!ehci->debug_registers)
|
|
||||||
goto registers_error;
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
registers_error:
|
if (!debugfs_create_file("async", S_IRUGO, ehci->debug_dir, bus,
|
||||||
debugfs_remove(ehci->debug_periodic);
|
&debug_async_fops))
|
||||||
periodic_error:
|
goto file_error;
|
||||||
debugfs_remove(ehci->debug_async);
|
|
||||||
async_error:
|
if (!debugfs_create_file("periodic", S_IRUGO, ehci->debug_dir, bus,
|
||||||
debugfs_remove(ehci->debug_dir);
|
&debug_periodic_fops))
|
||||||
dir_error:
|
goto file_error;
|
||||||
ehci->debug_periodic = NULL;
|
|
||||||
ehci->debug_async = NULL;
|
if (!debugfs_create_file("registers", S_IRUGO, ehci->debug_dir, bus,
|
||||||
ehci->debug_dir = NULL;
|
&debug_registers_fops))
|
||||||
|
goto file_error;
|
||||||
|
|
||||||
|
if (!debugfs_create_file("lpm", S_IRUGO|S_IWUGO, ehci->debug_dir, bus,
|
||||||
|
&debug_lpm_fops))
|
||||||
|
goto file_error;
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
file_error:
|
||||||
|
debugfs_remove_recursive(ehci->debug_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void remove_debug_files (struct ehci_hcd *ehci)
|
static inline void remove_debug_files (struct ehci_hcd *ehci)
|
||||||
{
|
{
|
||||||
debugfs_remove(ehci->debug_registers);
|
debugfs_remove_recursive(ehci->debug_dir);
|
||||||
debugfs_remove(ehci->debug_periodic);
|
|
||||||
debugfs_remove(ehci->debug_async);
|
|
||||||
debugfs_remove(ehci->debug_dir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* STUB_DEBUG_FILES */
|
#endif /* STUB_DEBUG_FILES */
|
||||||
|
|
|
@ -156,10 +156,6 @@ struct ehci_hcd { /* one per controller */
|
||||||
/* debug files */
|
/* debug files */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
struct dentry *debug_dir;
|
struct dentry *debug_dir;
|
||||||
struct dentry *debug_async;
|
|
||||||
struct dentry *debug_periodic;
|
|
||||||
struct dentry *debug_registers;
|
|
||||||
struct dentry *debug_lpm;
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue