Skip to content

Commit 86d4ef6

Browse files
Al Virogregkh
authored andcommitted
b43: stop embedding struct file_operations into their objects
Use debugfs_get_aux() instead. And switch to debugfs_short_fops, while we are at it... Signed-off-by: Al Viro <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a61af96 commit 86d4ef6

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

drivers/net/wireless/broadcom/b43/debugfs.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ static struct dentry *rootdir;
3030
struct b43_debugfs_fops {
3131
ssize_t (*read)(struct b43_wldev *dev, char *buf, size_t bufsize);
3232
int (*write)(struct b43_wldev *dev, const char *buf, size_t count);
33-
struct file_operations fops;
3433
/* Offset of struct b43_dfs_file in struct b43_dfsentry */
3534
size_t file_struct_offset;
3635
};
@@ -491,7 +490,7 @@ static ssize_t b43_debugfs_read(struct file *file, char __user *userbuf,
491490
size_t count, loff_t *ppos)
492491
{
493492
struct b43_wldev *dev;
494-
struct b43_debugfs_fops *dfops;
493+
const struct b43_debugfs_fops *dfops;
495494
struct b43_dfs_file *dfile;
496495
ssize_t ret;
497496
char *buf;
@@ -511,8 +510,7 @@ static ssize_t b43_debugfs_read(struct file *file, char __user *userbuf,
511510
goto out_unlock;
512511
}
513512

514-
dfops = container_of(debugfs_real_fops(file),
515-
struct b43_debugfs_fops, fops);
513+
dfops = debugfs_get_aux(file);
516514
if (!dfops->read) {
517515
err = -ENOSYS;
518516
goto out_unlock;
@@ -555,7 +553,7 @@ static ssize_t b43_debugfs_write(struct file *file,
555553
size_t count, loff_t *ppos)
556554
{
557555
struct b43_wldev *dev;
558-
struct b43_debugfs_fops *dfops;
556+
const struct b43_debugfs_fops *dfops;
559557
char *buf;
560558
int err = 0;
561559

@@ -573,8 +571,7 @@ static ssize_t b43_debugfs_write(struct file *file,
573571
goto out_unlock;
574572
}
575573

576-
dfops = container_of(debugfs_real_fops(file),
577-
struct b43_debugfs_fops, fops);
574+
dfops = debugfs_get_aux(file);
578575
if (!dfops->write) {
579576
err = -ENOSYS;
580577
goto out_unlock;
@@ -602,16 +599,16 @@ static ssize_t b43_debugfs_write(struct file *file,
602599
}
603600

604601

602+
static struct debugfs_short_fops debugfs_ops = {
603+
.read = b43_debugfs_read,
604+
.write = b43_debugfs_write,
605+
.llseek = generic_file_llseek,
606+
};
607+
605608
#define B43_DEBUGFS_FOPS(name, _read, _write) \
606609
static struct b43_debugfs_fops fops_##name = { \
607610
.read = _read, \
608611
.write = _write, \
609-
.fops = { \
610-
.open = simple_open, \
611-
.read = b43_debugfs_read, \
612-
.write = b43_debugfs_write, \
613-
.llseek = generic_file_llseek, \
614-
}, \
615612
.file_struct_offset = offsetof(struct b43_dfsentry, \
616613
file_##name), \
617614
}
@@ -703,9 +700,9 @@ void b43_debugfs_add_device(struct b43_wldev *dev)
703700

704701
#define ADD_FILE(name, mode) \
705702
do { \
706-
debugfs_create_file(__stringify(name), \
703+
debugfs_create_file_aux(__stringify(name), \
707704
mode, e->subdir, dev, \
708-
&fops_##name.fops); \
705+
&fops_##name, &debugfs_ops); \
709706
} while (0)
710707

711708

0 commit comments

Comments
 (0)