brcm47xx: fix commit r18413 "128MB ram problem"
[openwrt.git] / package / mac80211 / patches / 540-minstrel_debugfs_cleanup.patch
1 --- a/net/mac80211/rc80211_minstrel.h
2 +++ b/net/mac80211/rc80211_minstrel.h
3 @@ -80,6 +80,11 @@ struct minstrel_priv {
4 unsigned int lookaround_rate_mrr;
5 };
6
7 +struct minstrel_debugfs_info {
8 + size_t len;
9 + char buf[];
10 +};
11 +
12 void minstrel_add_sta_debugfs(void *priv, void *priv_sta, struct dentry *dir);
13 void minstrel_remove_sta_debugfs(void *priv, void *priv_sta);
14
15 --- a/net/mac80211/rc80211_minstrel_debugfs.c
16 +++ b/net/mac80211/rc80211_minstrel_debugfs.c
17 @@ -52,21 +52,15 @@
18 #include <net/mac80211.h>
19 #include "rc80211_minstrel.h"
20
21 -struct minstrel_stats_info {
22 - struct minstrel_sta_info *mi;
23 - char buf[4096];
24 - size_t len;
25 -};
26 -
27 static int
28 minstrel_stats_open(struct inode *inode, struct file *file)
29 {
30 struct minstrel_sta_info *mi = inode->i_private;
31 - struct minstrel_stats_info *ms;
32 + struct minstrel_debugfs_info *ms;
33 unsigned int i, tp, prob, eprob;
34 char *p;
35
36 - ms = kmalloc(sizeof(*ms), GFP_KERNEL);
37 + ms = kmalloc(sizeof(*ms) + 4096, GFP_KERNEL);
38 if (!ms)
39 return -ENOMEM;
40
41 @@ -107,35 +101,18 @@ minstrel_stats_open(struct inode *inode,
42 }
43
44 static ssize_t
45 -minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *o)
46 +minstrel_stats_read(struct file *file, char __user *buf, size_t len, loff_t *ppos)
47 {
48 - struct minstrel_stats_info *ms;
49 - char *src;
50 + struct minstrel_debugfs_info *ms;
51
52 ms = file->private_data;
53 - src = ms->buf;
54 -
55 - len = min(len, ms->len);
56 - if (len <= *o)
57 - return 0;
58 -
59 - src += *o;
60 - len -= *o;
61 - *o += len;
62 -
63 - if (copy_to_user(buf, src, len))
64 - return -EFAULT;
65 -
66 - return len;
67 + return simple_read_from_buffer(buf, len, ppos, ms->buf, ms->len);
68 }
69
70 static int
71 minstrel_stats_release(struct inode *inode, struct file *file)
72 {
73 - struct minstrel_stats_info *ms = file->private_data;
74 -
75 - kfree(ms);
76 -
77 + kfree(file->private_data);
78 return 0;
79 }
80
This page took 0.046637 seconds and 5 git commands to generate.