diff options
Diffstat (limited to 'net/mac80211/rc80211_minstrel_debugfs.c')
-rw-r--r-- | net/mac80211/rc80211_minstrel_debugfs.c | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/net/mac80211/rc80211_minstrel_debugfs.c b/net/mac80211/rc80211_minstrel_debugfs.c index 0e1f12b1b6d..241e76f3fdf 100644 --- a/net/mac80211/rc80211_minstrel_debugfs.c +++ b/net/mac80211/rc80211_minstrel_debugfs.c | |||
@@ -53,21 +53,15 @@ | |||
53 | #include <net/mac80211.h> | 53 | #include <net/mac80211.h> |
54 | #include "rc80211_minstrel.h" | 54 | #include "rc80211_minstrel.h" |
55 | 55 | ||
56 | struct minstrel_stats_info { | 56 | int |
57 | struct minstrel_sta_info *mi; | ||
58 | char buf[4096]; | ||
59 | size_t len; | ||
60 | }; | ||
61 | |||
62 | static int | ||
63 | minstrel_stats_open(struct inode *inode, struct file *file) | 57 | minstrel_stats_open(struct inode *inode, struct file *file) |
64 | { | 58 | { |
65 | struct minstrel_sta_info *mi = inode->i_private; | 59 | struct minstrel_sta_info *mi = inode->i_private; |
66 | struct minstrel_stats_info *ms; | 60 | struct minstrel_debugfs_info *ms; |
67 | unsigned int i, tp, prob, eprob; | 61 | unsigned int i, tp, prob, eprob; |
68 | char *p; | 62 | char *p; |
69 | 63 | ||
70 | ms = kmalloc(sizeof(*ms), GFP_KERNEL); | 64 | ms = kmalloc(sizeof(*ms) + 4096, GFP_KERNEL); |
71 | if (!ms) | 65 | if (!ms) |
72 | return -ENOMEM; | 66 | return -ENOMEM; |
73 | 67 | ||
@@ -107,36 +101,19 @@ minstrel_stats_open(struct inode *inode, struct file *file) | |||
107 | return 0; | 101 | return 0; |
108 | } | 102 | } |
109 | 103 | ||
110 | static ssize_t | 104 | ssize_t |
111 | minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *o) | 105 | minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos) |
112 | { | 106 | { |
113 | struct minstrel_stats_info *ms; | 107 | struct minstrel_debugfs_info *ms; |
114 | char *src; | ||
115 | 108 | ||
116 | ms = file->private_data; | 109 | ms = file->private_data; |
117 | src = ms->buf; | 110 | return simple_read_from_buffer(buf, len, ppos, ms->buf, ms->len); |
118 | |||
119 | len = min(len, ms->len); | ||
120 | if (len <= *o) | ||
121 | return 0; | ||
122 | |||
123 | src += *o; | ||
124 | len -= *o; | ||
125 | *o += len; | ||
126 | |||
127 | if (copy_to_user(buf, src, len)) | ||
128 | return -EFAULT; | ||
129 | |||
130 | return len; | ||
131 | } | 111 | } |
132 | 112 | ||
133 | static int | 113 | int |
134 | minstrel_stats_release(struct inode *inode, struct file *file) | 114 | minstrel_stats_release(struct inode *inode, struct file *file) |
135 | { | 115 | { |
136 | struct minstrel_stats_info *ms = file->private_data; | 116 | kfree(file->private_data); |
137 | |||
138 | kfree(ms); | ||
139 | |||
140 | return 0; | 117 | return 0; |
141 | } | 118 | } |
142 | 119 | ||