Skip to content

Commit a61af96

Browse files
Al Virogregkh
authored andcommitted
carl9170: stop embedding file_operations into their objects
use debugfs_get_aux() instead; switch to debugfs_short_ops as well. 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 d1433c7 commit a61af96

File tree

1 file changed

+12
-16
lines changed
  • drivers/net/wireless/ath/carl9170

1 file changed

+12
-16
lines changed

drivers/net/wireless/ath/carl9170/debug.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,14 @@ struct carl9170_debugfs_fops {
5454
char *(*read)(struct ar9170 *ar, char *buf, size_t bufsize,
5555
ssize_t *len);
5656
ssize_t (*write)(struct ar9170 *aru, const char *buf, size_t size);
57-
const struct file_operations fops;
5857

5958
enum carl9170_device_state req_dev_state;
6059
};
6160

6261
static ssize_t carl9170_debugfs_read(struct file *file, char __user *userbuf,
6362
size_t count, loff_t *ppos)
6463
{
65-
struct carl9170_debugfs_fops *dfops;
64+
const struct carl9170_debugfs_fops *dfops;
6665
struct ar9170 *ar;
6766
char *buf = NULL, *res_buf = NULL;
6867
ssize_t ret = 0;
@@ -75,8 +74,7 @@ static ssize_t carl9170_debugfs_read(struct file *file, char __user *userbuf,
7574

7675
if (!ar)
7776
return -ENODEV;
78-
dfops = container_of(debugfs_real_fops(file),
79-
struct carl9170_debugfs_fops, fops);
77+
dfops = debugfs_get_aux(file);
8078

8179
if (!dfops->read)
8280
return -ENOSYS;
@@ -113,7 +111,7 @@ static ssize_t carl9170_debugfs_read(struct file *file, char __user *userbuf,
113111
static ssize_t carl9170_debugfs_write(struct file *file,
114112
const char __user *userbuf, size_t count, loff_t *ppos)
115113
{
116-
struct carl9170_debugfs_fops *dfops;
114+
const struct carl9170_debugfs_fops *dfops;
117115
struct ar9170 *ar;
118116
char *buf = NULL;
119117
int err = 0;
@@ -128,8 +126,7 @@ static ssize_t carl9170_debugfs_write(struct file *file,
128126

129127
if (!ar)
130128
return -ENODEV;
131-
dfops = container_of(debugfs_real_fops(file),
132-
struct carl9170_debugfs_fops, fops);
129+
dfops = debugfs_get_aux(file);
133130

134131
if (!dfops->write)
135132
return -ENOSYS;
@@ -165,6 +162,11 @@ static ssize_t carl9170_debugfs_write(struct file *file,
165162
return err;
166163
}
167164

165+
static struct debugfs_short_fops debugfs_fops = {
166+
.read = carl9170_debugfs_read,
167+
.write = carl9170_debugfs_write,
168+
};
169+
168170
#define __DEBUGFS_DECLARE_FILE(name, _read, _write, _read_bufsize, \
169171
_attr, _dstate) \
170172
static const struct carl9170_debugfs_fops carl_debugfs_##name ##_ops = {\
@@ -173,12 +175,6 @@ static const struct carl9170_debugfs_fops carl_debugfs_##name ##_ops = {\
173175
.write = _write, \
174176
.attr = _attr, \
175177
.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-
}, \
182178
}
183179

184180
#define DEBUGFS_DECLARE_FILE(name, _read, _write, _read_bufsize, _attr) \
@@ -816,9 +812,9 @@ void carl9170_debugfs_register(struct ar9170 *ar)
816812
ar->hw->wiphy->debugfsdir);
817813

818814
#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)
822818

823819
DEBUGFS_ADD(usb_tx_anch_urbs);
824820
DEBUGFS_ADD(usb_rx_pool_urbs);

0 commit comments

Comments
 (0)