@@ -49,9 +49,6 @@ DEFINE_SHOW_ATTRIBUTE(bond_debug_rlb_hash);
4949
5050void bond_debug_register (struct bonding * bond )
5151{
52- if (!bonding_debug_root )
53- return ;
54-
5552 bond -> debug_dir =
5653 debugfs_create_dir (bond -> dev -> name , bonding_debug_root );
5754
@@ -61,24 +58,13 @@ void bond_debug_register(struct bonding *bond)
6158
6259void bond_debug_unregister (struct bonding * bond )
6360{
64- if (!bonding_debug_root )
65- return ;
66-
6761 debugfs_remove_recursive (bond -> debug_dir );
6862}
6963
7064void bond_debug_reregister (struct bonding * bond )
7165{
72- struct dentry * d ;
73-
74- if (!bonding_debug_root )
75- return ;
76-
77- d = debugfs_rename (bonding_debug_root , bond -> debug_dir ,
78- bonding_debug_root , bond -> dev -> name );
79- if (d ) {
80- bond -> debug_dir = d ;
81- } else {
66+ int err = debugfs_change_name (bond -> debug_dir , "%s" , bond -> dev -> name );
67+ if (err ) {
8268 netdev_warn (bond -> dev , "failed to reregister, so just unregister old one\n" );
8369 bond_debug_unregister (bond );
8470 }
@@ -88,7 +74,7 @@ void __init bond_create_debugfs(void)
8874{
8975 bonding_debug_root = debugfs_create_dir ("bonding" , NULL );
9076
91- if (! bonding_debug_root )
77+ if (IS_ERR ( bonding_debug_root ) )
9278 pr_warn ("Warning: Cannot create bonding directory in debugfs\n" );
9379}
9480
0 commit comments