diff options
Diffstat (limited to 'drivers/net/wireless/brcm80211/brcmfmac/debug.c')
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/debug.c | 50 |
1 files changed, 4 insertions, 46 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/debug.c b/drivers/net/wireless/brcm80211/brcmfmac/debug.c index 9b473d50b005..2d6d00553858 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/debug.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/debug.c | |||
@@ -41,15 +41,6 @@ void brcmf_debugfs_exit(void) | |||
41 | root_folder = NULL; | 41 | root_folder = NULL; |
42 | } | 42 | } |
43 | 43 | ||
44 | static int brcmf_debugfs_chipinfo_read(struct seq_file *seq, void *data) | ||
45 | { | ||
46 | struct brcmf_bus *bus = dev_get_drvdata(seq->private); | ||
47 | |||
48 | seq_printf(seq, "chip: %x(%u) rev %u\n", | ||
49 | bus->chip, bus->chip, bus->chiprev); | ||
50 | return 0; | ||
51 | } | ||
52 | |||
53 | int brcmf_debugfs_attach(struct brcmf_pub *drvr) | 44 | int brcmf_debugfs_attach(struct brcmf_pub *drvr) |
54 | { | 45 | { |
55 | struct device *dev = drvr->bus_if->dev; | 46 | struct device *dev = drvr->bus_if->dev; |
@@ -58,7 +49,6 @@ int brcmf_debugfs_attach(struct brcmf_pub *drvr) | |||
58 | return -ENODEV; | 49 | return -ENODEV; |
59 | 50 | ||
60 | drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder); | 51 | drvr->dbgfs_dir = debugfs_create_dir(dev_name(dev), root_folder); |
61 | brcmf_debugfs_add_entry(drvr, "chipinfo", brcmf_debugfs_chipinfo_read); | ||
62 | 52 | ||
63 | return PTR_ERR_OR_ZERO(drvr->dbgfs_dir); | 53 | return PTR_ERR_OR_ZERO(drvr->dbgfs_dir); |
64 | } | 54 | } |
@@ -74,44 +64,12 @@ struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr) | |||
74 | return drvr->dbgfs_dir; | 64 | return drvr->dbgfs_dir; |
75 | } | 65 | } |
76 | 66 | ||
77 | struct brcmf_debugfs_entry { | ||
78 | int (*read)(struct seq_file *seq, void *data); | ||
79 | struct brcmf_pub *drvr; | ||
80 | }; | ||
81 | |||
82 | static int brcmf_debugfs_entry_open(struct inode *inode, struct file *f) | ||
83 | { | ||
84 | struct brcmf_debugfs_entry *entry = inode->i_private; | ||
85 | |||
86 | return single_open(f, entry->read, entry->drvr->bus_if->dev); | ||
87 | } | ||
88 | |||
89 | static const struct file_operations brcmf_debugfs_def_ops = { | ||
90 | .owner = THIS_MODULE, | ||
91 | .open = brcmf_debugfs_entry_open, | ||
92 | .release = single_release, | ||
93 | .read = seq_read, | ||
94 | .llseek = seq_lseek | ||
95 | }; | ||
96 | |||
97 | int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, | 67 | int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, |
98 | int (*read_fn)(struct seq_file *seq, void *data)) | 68 | int (*read_fn)(struct seq_file *seq, void *data)) |
99 | { | 69 | { |
100 | struct dentry *dentry = drvr->dbgfs_dir; | 70 | struct dentry *e; |
101 | struct brcmf_debugfs_entry *entry; | ||
102 | |||
103 | if (IS_ERR_OR_NULL(dentry)) | ||
104 | return -ENOENT; | ||
105 | |||
106 | entry = devm_kzalloc(drvr->bus_if->dev, sizeof(*entry), GFP_KERNEL); | ||
107 | if (!entry) | ||
108 | return -ENOMEM; | ||
109 | |||
110 | entry->read = read_fn; | ||
111 | entry->drvr = drvr; | ||
112 | |||
113 | dentry = debugfs_create_file(fn, S_IRUGO, dentry, entry, | ||
114 | &brcmf_debugfs_def_ops); | ||
115 | 71 | ||
116 | return PTR_ERR_OR_ZERO(dentry); | 72 | e = debugfs_create_devm_seqfile(drvr->bus_if->dev, fn, |
73 | drvr->dbgfs_dir, read_fn); | ||
74 | return PTR_ERR_OR_ZERO(e); | ||
117 | } | 75 | } |