aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/debugfs.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-04-23 12:52:52 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-05-06 15:14:37 -0400
commit2448798133d747ad339e57099e32a1d1e68aca1c (patch)
treeee09385f5dca9e243c38f5f888baa02605423bd7 /net/mac80211/debugfs.c
parent2d0ddec5b2b859f06116f631fc0ffe94fbceb556 (diff)
mac80211: add driver ops wrappers
In order to later add tracing or verifications to the driver calls mac80211 makes, this patch adds static inline wrappers for all operations. All calls are now written as drv_<op>(local, ...); instead of local->ops-><op>(&local->hw, ...); Where necessary, the wrappers also do existence checking and return default values as appropriate. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/debugfs.c')
-rw-r--r--net/mac80211/debugfs.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 5001328be46..ac793201b70 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -10,6 +10,7 @@
10#include <linux/debugfs.h> 10#include <linux/debugfs.h>
11#include <linux/rtnetlink.h> 11#include <linux/rtnetlink.h>
12#include "ieee80211_i.h" 12#include "ieee80211_i.h"
13#include "driver-ops.h"
13#include "rate.h" 14#include "rate.h"
14#include "debugfs.h" 15#include "debugfs.h"
15 16
@@ -70,11 +71,10 @@ static ssize_t tsf_read(struct file *file, char __user *user_buf,
70 size_t count, loff_t *ppos) 71 size_t count, loff_t *ppos)
71{ 72{
72 struct ieee80211_local *local = file->private_data; 73 struct ieee80211_local *local = file->private_data;
73 u64 tsf = 0; 74 u64 tsf;
74 char buf[100]; 75 char buf[100];
75 76
76 if (local->ops->get_tsf) 77 tsf = drv_get_tsf(local);
77 tsf = local->ops->get_tsf(local_to_hw(local));
78 78
79 snprintf(buf, sizeof(buf), "0x%016llx\n", (unsigned long long) tsf); 79 snprintf(buf, sizeof(buf), "0x%016llx\n", (unsigned long long) tsf);
80 80
@@ -97,13 +97,13 @@ static ssize_t tsf_write(struct file *file,
97 97
98 if (strncmp(buf, "reset", 5) == 0) { 98 if (strncmp(buf, "reset", 5) == 0) {
99 if (local->ops->reset_tsf) { 99 if (local->ops->reset_tsf) {
100 local->ops->reset_tsf(local_to_hw(local)); 100 drv_reset_tsf(local);
101 printk(KERN_INFO "%s: debugfs reset TSF\n", wiphy_name(local->hw.wiphy)); 101 printk(KERN_INFO "%s: debugfs reset TSF\n", wiphy_name(local->hw.wiphy));
102 } 102 }
103 } else { 103 } else {
104 tsf = simple_strtoul(buf, NULL, 0); 104 tsf = simple_strtoul(buf, NULL, 0);
105 if (local->ops->set_tsf) { 105 if (local->ops->set_tsf) {
106 local->ops->set_tsf(local_to_hw(local), tsf); 106 drv_set_tsf(local, tsf);
107 printk(KERN_INFO "%s: debugfs set TSF to %#018llx\n", wiphy_name(local->hw.wiphy), tsf); 107 printk(KERN_INFO "%s: debugfs set TSF to %#018llx\n", wiphy_name(local->hw.wiphy), tsf);
108 } 108 }
109 } 109 }
@@ -150,14 +150,12 @@ static ssize_t format_devstat_counter(struct ieee80211_local *local,
150 char buf[20]; 150 char buf[20];
151 int res; 151 int res;
152 152
153 if (!local->ops->get_stats)
154 return -EOPNOTSUPP;
155
156 rtnl_lock(); 153 rtnl_lock();
157 res = local->ops->get_stats(local_to_hw(local), &stats); 154 res = drv_get_stats(local, &stats);
158 rtnl_unlock(); 155 rtnl_unlock();
159 if (!res) 156 if (res)
160 res = printvalue(&stats, buf, sizeof(buf)); 157 return res;
158 res = printvalue(&stats, buf, sizeof(buf));
161 return simple_read_from_buffer(userbuf, count, ppos, buf, res); 159 return simple_read_from_buffer(userbuf, count, ppos, buf, res);
162} 160}
163 161