Skip to content

Commit 231e9f0

Browse files
Al Virogregkh
authored andcommitted
b43legacy: make use of debugfs_get_aux()
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 86d4ef6 commit 231e9f0

File tree

1 file changed

+11
-15
lines changed
  • drivers/net/wireless/broadcom/b43legacy

1 file changed

+11
-15
lines changed

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

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ static struct dentry *rootdir;
3131
struct b43legacy_debugfs_fops {
3232
ssize_t (*read)(struct b43legacy_wldev *dev, char *buf, size_t bufsize);
3333
int (*write)(struct b43legacy_wldev *dev, const char *buf, size_t count);
34-
struct file_operations fops;
3534
/* Offset of struct b43legacy_dfs_file in struct b43legacy_dfsentry */
3635
size_t file_struct_offset;
3736
/* Take wl->irq_lock before calling read/write? */
@@ -188,7 +187,7 @@ static ssize_t b43legacy_debugfs_read(struct file *file, char __user *userbuf,
188187
size_t count, loff_t *ppos)
189188
{
190189
struct b43legacy_wldev *dev;
191-
struct b43legacy_debugfs_fops *dfops;
190+
const struct b43legacy_debugfs_fops *dfops;
192191
struct b43legacy_dfs_file *dfile;
193192
ssize_t ret;
194193
char *buf;
@@ -208,8 +207,7 @@ static ssize_t b43legacy_debugfs_read(struct file *file, char __user *userbuf,
208207
goto out_unlock;
209208
}
210209

211-
dfops = container_of(debugfs_real_fops(file),
212-
struct b43legacy_debugfs_fops, fops);
210+
dfops = debugfs_get_aux(file);
213211
if (!dfops->read) {
214212
err = -ENOSYS;
215213
goto out_unlock;
@@ -257,7 +255,7 @@ static ssize_t b43legacy_debugfs_write(struct file *file,
257255
size_t count, loff_t *ppos)
258256
{
259257
struct b43legacy_wldev *dev;
260-
struct b43legacy_debugfs_fops *dfops;
258+
const struct b43legacy_debugfs_fops *dfops;
261259
char *buf;
262260
int err = 0;
263261

@@ -275,8 +273,7 @@ static ssize_t b43legacy_debugfs_write(struct file *file,
275273
goto out_unlock;
276274
}
277275

278-
dfops = container_of(debugfs_real_fops(file),
279-
struct b43legacy_debugfs_fops, fops);
276+
dfops = debugfs_get_aux(file);
280277
if (!dfops->write) {
281278
err = -ENOSYS;
282279
goto out_unlock;
@@ -308,17 +305,16 @@ static ssize_t b43legacy_debugfs_write(struct file *file,
308305
return err ? err : count;
309306
}
310307

308+
static struct debugfs_short_fops debugfs_ops = {
309+
.read = b43legacy_debugfs_read,
310+
.write = b43legacy_debugfs_write,
311+
.llseek = generic_file_llseek
312+
};
311313

312314
#define B43legacy_DEBUGFS_FOPS(name, _read, _write, _take_irqlock) \
313315
static struct b43legacy_debugfs_fops fops_##name = { \
314316
.read = _read, \
315317
.write = _write, \
316-
.fops = { \
317-
.open = simple_open, \
318-
.read = b43legacy_debugfs_read, \
319-
.write = b43legacy_debugfs_write, \
320-
.llseek = generic_file_llseek, \
321-
}, \
322318
.file_struct_offset = offsetof(struct b43legacy_dfsentry, \
323319
file_##name), \
324320
.take_irqlock = _take_irqlock, \
@@ -386,9 +382,9 @@ void b43legacy_debugfs_add_device(struct b43legacy_wldev *dev)
386382

387383
#define ADD_FILE(name, mode) \
388384
do { \
389-
debugfs_create_file(__stringify(name), mode, \
385+
debugfs_create_file_aux(__stringify(name), mode, \
390386
e->subdir, dev, \
391-
&fops_##name.fops); \
387+
&fops_##name, &debugfs_ops); \
392388
} while (0)
393389

394390

0 commit comments

Comments
 (0)