| .. | .. |
|---|
| 37 | 37 | void brcms_debugfs_init(void) |
|---|
| 38 | 38 | { |
|---|
| 39 | 39 | root_folder = debugfs_create_dir(KBUILD_MODNAME, NULL); |
|---|
| 40 | | - if (IS_ERR(root_folder)) |
|---|
| 41 | | - root_folder = NULL; |
|---|
| 42 | 40 | } |
|---|
| 43 | 41 | |
|---|
| 44 | 42 | void brcms_debugfs_exit(void) |
|---|
| 45 | 43 | { |
|---|
| 46 | | - if (!root_folder) |
|---|
| 47 | | - return; |
|---|
| 48 | | - |
|---|
| 49 | 44 | debugfs_remove_recursive(root_folder); |
|---|
| 50 | 45 | root_folder = NULL; |
|---|
| 51 | 46 | } |
|---|
| 52 | 47 | |
|---|
| 53 | | -int brcms_debugfs_attach(struct brcms_pub *drvr) |
|---|
| 48 | +void brcms_debugfs_attach(struct brcms_pub *drvr) |
|---|
| 54 | 49 | { |
|---|
| 55 | | - if (!root_folder) |
|---|
| 56 | | - return -ENODEV; |
|---|
| 57 | | - |
|---|
| 58 | 50 | drvr->dbgfs_dir = debugfs_create_dir( |
|---|
| 59 | 51 | dev_name(&drvr->wlc->hw->d11core->dev), root_folder); |
|---|
| 60 | | - return PTR_ERR_OR_ZERO(drvr->dbgfs_dir); |
|---|
| 61 | 52 | } |
|---|
| 62 | 53 | |
|---|
| 63 | 54 | void brcms_debugfs_detach(struct brcms_pub *drvr) |
|---|
| 64 | 55 | { |
|---|
| 65 | | - if (!IS_ERR_OR_NULL(drvr->dbgfs_dir)) |
|---|
| 66 | | - debugfs_remove_recursive(drvr->dbgfs_dir); |
|---|
| 56 | + debugfs_remove_recursive(drvr->dbgfs_dir); |
|---|
| 67 | 57 | } |
|---|
| 68 | 58 | |
|---|
| 69 | 59 | struct dentry *brcms_debugfs_get_devdir(struct brcms_pub *drvr) |
|---|
| .. | .. |
|---|
| 196 | 186 | .llseek = seq_lseek |
|---|
| 197 | 187 | }; |
|---|
| 198 | 188 | |
|---|
| 199 | | -static int |
|---|
| 189 | +static void |
|---|
| 200 | 190 | brcms_debugfs_add_entry(struct brcms_pub *drvr, const char *fn, |
|---|
| 201 | 191 | int (*read_fn)(struct seq_file *seq, void *data)) |
|---|
| 202 | 192 | { |
|---|
| .. | .. |
|---|
| 204 | 194 | struct dentry *dentry = drvr->dbgfs_dir; |
|---|
| 205 | 195 | struct brcms_debugfs_entry *entry; |
|---|
| 206 | 196 | |
|---|
| 207 | | - if (IS_ERR_OR_NULL(dentry)) |
|---|
| 208 | | - return -ENOENT; |
|---|
| 209 | | - |
|---|
| 210 | 197 | entry = devm_kzalloc(dev, sizeof(*entry), GFP_KERNEL); |
|---|
| 211 | 198 | if (!entry) |
|---|
| 212 | | - return -ENOMEM; |
|---|
| 199 | + return; |
|---|
| 213 | 200 | |
|---|
| 214 | 201 | entry->read = read_fn; |
|---|
| 215 | 202 | entry->drvr = drvr; |
|---|
| 216 | 203 | |
|---|
| 217 | | - dentry = debugfs_create_file(fn, 0444, dentry, entry, |
|---|
| 218 | | - &brcms_debugfs_def_ops); |
|---|
| 219 | | - |
|---|
| 220 | | - return PTR_ERR_OR_ZERO(dentry); |
|---|
| 204 | + debugfs_create_file(fn, 0444, dentry, entry, &brcms_debugfs_def_ops); |
|---|
| 221 | 205 | } |
|---|
| 222 | 206 | |
|---|
| 223 | 207 | void brcms_debugfs_create_files(struct brcms_pub *drvr) |
|---|
| 224 | 208 | { |
|---|
| 225 | | - if (IS_ERR_OR_NULL(drvr->dbgfs_dir)) |
|---|
| 226 | | - return; |
|---|
| 227 | | - |
|---|
| 228 | 209 | brcms_debugfs_add_entry(drvr, "hardware", brcms_debugfs_hardware_read); |
|---|
| 229 | 210 | brcms_debugfs_add_entry(drvr, "macstat", brcms_debugfs_macstat_read); |
|---|
| 230 | 211 | } |
|---|