| .. | .. |
|---|
| 45 | 45 | |
|---|
| 46 | 46 | return 0; |
|---|
| 47 | 47 | } |
|---|
| 48 | | - |
|---|
| 49 | | -static int bond_debug_rlb_hash_open(struct inode *inode, struct file *file) |
|---|
| 50 | | -{ |
|---|
| 51 | | - return single_open(file, bond_debug_rlb_hash_show, inode->i_private); |
|---|
| 52 | | -} |
|---|
| 53 | | - |
|---|
| 54 | | -static const struct file_operations bond_debug_rlb_hash_fops = { |
|---|
| 55 | | - .owner = THIS_MODULE, |
|---|
| 56 | | - .open = bond_debug_rlb_hash_open, |
|---|
| 57 | | - .read = seq_read, |
|---|
| 58 | | - .llseek = seq_lseek, |
|---|
| 59 | | - .release = single_release, |
|---|
| 60 | | -}; |
|---|
| 48 | +DEFINE_SHOW_ATTRIBUTE(bond_debug_rlb_hash); |
|---|
| 61 | 49 | |
|---|
| 62 | 50 | void bond_debug_register(struct bonding *bond) |
|---|
| 63 | 51 | { |
|---|
| .. | .. |
|---|
| 66 | 54 | |
|---|
| 67 | 55 | bond->debug_dir = |
|---|
| 68 | 56 | debugfs_create_dir(bond->dev->name, bonding_debug_root); |
|---|
| 69 | | - |
|---|
| 70 | | - if (!bond->debug_dir) { |
|---|
| 71 | | - netdev_warn(bond->dev, "failed to register to debugfs\n"); |
|---|
| 72 | | - return; |
|---|
| 73 | | - } |
|---|
| 74 | 57 | |
|---|
| 75 | 58 | debugfs_create_file("rlb_hash_table", 0400, bond->debug_dir, |
|---|
| 76 | 59 | bond, &bond_debug_rlb_hash_fops); |
|---|
| .. | .. |
|---|
| 93 | 76 | |
|---|
| 94 | 77 | d = debugfs_rename(bonding_debug_root, bond->debug_dir, |
|---|
| 95 | 78 | bonding_debug_root, bond->dev->name); |
|---|
| 96 | | - if (d) { |
|---|
| 79 | + if (!IS_ERR(d)) { |
|---|
| 97 | 80 | bond->debug_dir = d; |
|---|
| 98 | 81 | } else { |
|---|
| 99 | 82 | netdev_warn(bond->dev, "failed to reregister, so just unregister old one\n"); |
|---|