@@ -54,15 +54,14 @@ struct carl9170_debugfs_fops {
54
54
char * (* read )(struct ar9170 * ar , char * buf , size_t bufsize ,
55
55
ssize_t * len );
56
56
ssize_t (* write )(struct ar9170 * aru , const char * buf , size_t size );
57
- const struct file_operations fops ;
58
57
59
58
enum carl9170_device_state req_dev_state ;
60
59
};
61
60
62
61
static ssize_t carl9170_debugfs_read (struct file * file , char __user * userbuf ,
63
62
size_t count , loff_t * ppos )
64
63
{
65
- struct carl9170_debugfs_fops * dfops ;
64
+ const struct carl9170_debugfs_fops * dfops ;
66
65
struct ar9170 * ar ;
67
66
char * buf = NULL , * res_buf = NULL ;
68
67
ssize_t ret = 0 ;
@@ -75,8 +74,7 @@ static ssize_t carl9170_debugfs_read(struct file *file, char __user *userbuf,
75
74
76
75
if (!ar )
77
76
return - ENODEV ;
78
- dfops = container_of (debugfs_real_fops (file ),
79
- struct carl9170_debugfs_fops , fops );
77
+ dfops = debugfs_get_aux (file );
80
78
81
79
if (!dfops -> read )
82
80
return - ENOSYS ;
@@ -113,7 +111,7 @@ static ssize_t carl9170_debugfs_read(struct file *file, char __user *userbuf,
113
111
static ssize_t carl9170_debugfs_write (struct file * file ,
114
112
const char __user * userbuf , size_t count , loff_t * ppos )
115
113
{
116
- struct carl9170_debugfs_fops * dfops ;
114
+ const struct carl9170_debugfs_fops * dfops ;
117
115
struct ar9170 * ar ;
118
116
char * buf = NULL ;
119
117
int err = 0 ;
@@ -128,8 +126,7 @@ static ssize_t carl9170_debugfs_write(struct file *file,
128
126
129
127
if (!ar )
130
128
return - ENODEV ;
131
- dfops = container_of (debugfs_real_fops (file ),
132
- struct carl9170_debugfs_fops , fops );
129
+ dfops = debugfs_get_aux (file );
133
130
134
131
if (!dfops -> write )
135
132
return - ENOSYS ;
@@ -165,6 +162,11 @@ static ssize_t carl9170_debugfs_write(struct file *file,
165
162
return err ;
166
163
}
167
164
165
+ static struct debugfs_short_fops debugfs_fops = {
166
+ .read = carl9170_debugfs_read ,
167
+ .write = carl9170_debugfs_write ,
168
+ };
169
+
168
170
#define __DEBUGFS_DECLARE_FILE (name , _read , _write , _read_bufsize , \
169
171
_attr , _dstate ) \
170
172
static const struct carl9170_debugfs_fops carl_debugfs_##name ##_ops = {\
@@ -173,12 +175,6 @@ static const struct carl9170_debugfs_fops carl_debugfs_##name ##_ops = {\
173
175
.write = _write, \
174
176
.attr = _attr, \
175
177
.req_dev_state = _dstate, \
176
- .fops = { \
177
- .open = simple_open, \
178
- .read = carl9170_debugfs_read, \
179
- .write = carl9170_debugfs_write, \
180
- .owner = THIS_MODULE \
181
- }, \
182
178
}
183
179
184
180
#define DEBUGFS_DECLARE_FILE (name , _read , _write , _read_bufsize , _attr ) \
@@ -816,9 +812,9 @@ void carl9170_debugfs_register(struct ar9170 *ar)
816
812
ar -> hw -> wiphy -> debugfsdir );
817
813
818
814
#define DEBUGFS_ADD (name ) \
819
- debugfs_create_file (#name, carl_debugfs_##name ##_ops.attr, \
820
- ar->debug_dir, ar, \
821
- &carl_debugfs_##name ## _ops.fops )
815
+ debugfs_create_file_aux (#name, carl_debugfs_##name ##_ops.attr, \
816
+ ar->debug_dir, ar, &carl_debugfs_##name ## _ops, \
817
+ &debugfs_fops )
822
818
823
819
DEBUGFS_ADD (usb_tx_anch_urbs );
824
820
DEBUGFS_ADD (usb_rx_pool_urbs );
0 commit comments