@@ -31,7 +31,6 @@ static struct dentry *rootdir;
31
31
struct b43legacy_debugfs_fops {
32
32
ssize_t (* read )(struct b43legacy_wldev * dev , char * buf , size_t bufsize );
33
33
int (* write )(struct b43legacy_wldev * dev , const char * buf , size_t count );
34
- struct file_operations fops ;
35
34
/* Offset of struct b43legacy_dfs_file in struct b43legacy_dfsentry */
36
35
size_t file_struct_offset ;
37
36
/* Take wl->irq_lock before calling read/write? */
@@ -188,7 +187,7 @@ static ssize_t b43legacy_debugfs_read(struct file *file, char __user *userbuf,
188
187
size_t count , loff_t * ppos )
189
188
{
190
189
struct b43legacy_wldev * dev ;
191
- struct b43legacy_debugfs_fops * dfops ;
190
+ const struct b43legacy_debugfs_fops * dfops ;
192
191
struct b43legacy_dfs_file * dfile ;
193
192
ssize_t ret ;
194
193
char * buf ;
@@ -208,8 +207,7 @@ static ssize_t b43legacy_debugfs_read(struct file *file, char __user *userbuf,
208
207
goto out_unlock ;
209
208
}
210
209
211
- dfops = container_of (debugfs_real_fops (file ),
212
- struct b43legacy_debugfs_fops , fops );
210
+ dfops = debugfs_get_aux (file );
213
211
if (!dfops -> read ) {
214
212
err = - ENOSYS ;
215
213
goto out_unlock ;
@@ -257,7 +255,7 @@ static ssize_t b43legacy_debugfs_write(struct file *file,
257
255
size_t count , loff_t * ppos )
258
256
{
259
257
struct b43legacy_wldev * dev ;
260
- struct b43legacy_debugfs_fops * dfops ;
258
+ const struct b43legacy_debugfs_fops * dfops ;
261
259
char * buf ;
262
260
int err = 0 ;
263
261
@@ -275,8 +273,7 @@ static ssize_t b43legacy_debugfs_write(struct file *file,
275
273
goto out_unlock ;
276
274
}
277
275
278
- dfops = container_of (debugfs_real_fops (file ),
279
- struct b43legacy_debugfs_fops , fops );
276
+ dfops = debugfs_get_aux (file );
280
277
if (!dfops -> write ) {
281
278
err = - ENOSYS ;
282
279
goto out_unlock ;
@@ -308,17 +305,16 @@ static ssize_t b43legacy_debugfs_write(struct file *file,
308
305
return err ? err : count ;
309
306
}
310
307
308
+ static struct debugfs_short_fops debugfs_ops = {
309
+ .read = b43legacy_debugfs_read ,
310
+ .write = b43legacy_debugfs_write ,
311
+ .llseek = generic_file_llseek
312
+ };
311
313
312
314
#define B43legacy_DEBUGFS_FOPS (name , _read , _write , _take_irqlock ) \
313
315
static struct b43legacy_debugfs_fops fops_##name = { \
314
316
.read = _read, \
315
317
.write = _write, \
316
- .fops = { \
317
- .open = simple_open, \
318
- .read = b43legacy_debugfs_read, \
319
- .write = b43legacy_debugfs_write, \
320
- .llseek = generic_file_llseek, \
321
- }, \
322
318
.file_struct_offset = offsetof(struct b43legacy_dfsentry, \
323
319
file_##name), \
324
320
.take_irqlock = _take_irqlock, \
@@ -386,9 +382,9 @@ void b43legacy_debugfs_add_device(struct b43legacy_wldev *dev)
386
382
387
383
#define ADD_FILE (name , mode ) \
388
384
do { \
389
- debugfs_create_file (__stringify(name), mode, \
385
+ debugfs_create_file_aux (__stringify(name), mode, \
390
386
e->subdir, dev, \
391
- &fops_##name.fops); \
387
+ &fops_##name, &debugfs_ops); \
392
388
} while (0)
393
389
394
390
0 commit comments