Commit 5b18ffb2 authored by Arend van Spriel's avatar Arend van Spriel Committed by Kalle Valo

brcmfmac: use debugfs_create_devm_seqfile() helper function

Some time ago the function debugfs_create_devm_seqfile() was
introduced in debugfs. The caller simply needs to provide a
device pointer and read function. The function brcmf_debugfs_add_entry()
is now simply a wrapper only doing the work for CONFIG_BRCMDBG.
Reviewed-by: default avatarHante Meuleman <meuleman@broadcom.com>
Reviewed-by: default avatarFranky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: default avatarDaniel (Deognyoun) Kim <dekim@broadcom.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent c161f29b
...@@ -64,44 +64,12 @@ struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr) ...@@ -64,44 +64,12 @@ struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr)
return drvr->dbgfs_dir; return drvr->dbgfs_dir;
} }
struct brcmf_debugfs_entry {
int (*read)(struct seq_file *seq, void *data);
struct brcmf_pub *drvr;
};
static int brcmf_debugfs_entry_open(struct inode *inode, struct file *f)
{
struct brcmf_debugfs_entry *entry = inode->i_private;
return single_open(f, entry->read, entry->drvr->bus_if->dev);
}
static const struct file_operations brcmf_debugfs_def_ops = {
.owner = THIS_MODULE,
.open = brcmf_debugfs_entry_open,
.release = single_release,
.read = seq_read,
.llseek = seq_lseek
};
int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn,
int (*read_fn)(struct seq_file *seq, void *data)) int (*read_fn)(struct seq_file *seq, void *data))
{ {
struct dentry *dentry = drvr->dbgfs_dir; struct dentry *e;
struct brcmf_debugfs_entry *entry;
if (IS_ERR_OR_NULL(dentry))
return -ENOENT;
entry = devm_kzalloc(drvr->bus_if->dev, sizeof(*entry), GFP_KERNEL);
if (!entry)
return -ENOMEM;
entry->read = read_fn;
entry->drvr = drvr;
dentry = debugfs_create_file(fn, S_IRUGO, dentry, entry,
&brcmf_debugfs_def_ops);
return PTR_ERR_OR_ZERO(dentry); e = debugfs_create_devm_seqfile(drvr->bus_if->dev, fn,
drvr->dbgfs_dir, read_fn);
return PTR_ERR_OR_ZERO(e);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment