aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43/sysfs.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-01-24 13:38:38 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-02-29 15:19:32 -0500
commit8318d78a44d49ac1edf2bdec7299de3617c4232e (patch)
treed434634418edd7399737801615d247be06616fdd /drivers/net/wireless/b43/sysfs.c
parent10b6b80145cc93887dd8aab99bfffa375e9add31 (diff)
cfg80211 API for channels/bitrates, mac80211 and driver conversion
This patch creates new cfg80211 wiphy API for channel and bitrate registration and converts mac80211 and drivers to the new API. The old mac80211 API is completely ripped out. All drivers (except ath5k) are updated to the new API, in many cases I expect that optimisations can be done. Along with the regulatory code I've also ripped out the IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED flag, I believe it to be unnecessary if the hardware simply gives us whatever channels it wants to support and we then enable/disable them as required, which is pretty much required for travelling. Additionally, the patch adds proper "basic" rate handling for STA mode interface, AP mode interface will have to have new API added to allow userspace to set the basic rate set, currently it'll be empty... However, the basic rate handling will need to be moved to the BSS conf stuff. I do expect there to be bugs in this, especially wrt. transmit power handling where I'm basically clueless about how it should work. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43/sysfs.c')
-rw-r--r--drivers/net/wireless/b43/sysfs.c89
1 files changed, 1 insertions, 88 deletions
diff --git a/drivers/net/wireless/b43/sysfs.c b/drivers/net/wireless/b43/sysfs.c
index f4faff6a7d6c..275095b8cbe7 100644
--- a/drivers/net/wireless/b43/sysfs.c
+++ b/drivers/net/wireless/b43/sysfs.c
@@ -47,29 +47,6 @@ static int get_integer(const char *buf, size_t count)
47 return ret; 47 return ret;
48} 48}
49 49
50static int get_boolean(const char *buf, size_t count)
51{
52 if (count != 0) {
53 if (buf[0] == '1')
54 return 1;
55 if (buf[0] == '0')
56 return 0;
57 if (count >= 4 && memcmp(buf, "true", 4) == 0)
58 return 1;
59 if (count >= 5 && memcmp(buf, "false", 5) == 0)
60 return 0;
61 if (count >= 3 && memcmp(buf, "yes", 3) == 0)
62 return 1;
63 if (count >= 2 && memcmp(buf, "no", 2) == 0)
64 return 0;
65 if (count >= 2 && memcmp(buf, "on", 2) == 0)
66 return 1;
67 if (count >= 3 && memcmp(buf, "off", 3) == 0)
68 return 0;
69 }
70 return -EINVAL;
71}
72
73static ssize_t b43_attr_interfmode_show(struct device *dev, 50static ssize_t b43_attr_interfmode_show(struct device *dev,
74 struct device_attribute *attr, 51 struct device_attribute *attr,
75 char *buf) 52 char *buf)
@@ -155,82 +132,18 @@ static ssize_t b43_attr_interfmode_store(struct device *dev,
155static DEVICE_ATTR(interference, 0644, 132static DEVICE_ATTR(interference, 0644,
156 b43_attr_interfmode_show, b43_attr_interfmode_store); 133 b43_attr_interfmode_show, b43_attr_interfmode_store);
157 134
158static ssize_t b43_attr_preamble_show(struct device *dev,
159 struct device_attribute *attr, char *buf)
160{
161 struct b43_wldev *wldev = dev_to_b43_wldev(dev);
162 ssize_t count;
163
164 if (!capable(CAP_NET_ADMIN))
165 return -EPERM;
166
167 mutex_lock(&wldev->wl->mutex);
168
169 if (wldev->short_preamble)
170 count =
171 snprintf(buf, PAGE_SIZE, "1 (Short Preamble enabled)\n");
172 else
173 count =
174 snprintf(buf, PAGE_SIZE, "0 (Short Preamble disabled)\n");
175
176 mutex_unlock(&wldev->wl->mutex);
177
178 return count;
179}
180
181static ssize_t b43_attr_preamble_store(struct device *dev,
182 struct device_attribute *attr,
183 const char *buf, size_t count)
184{
185 struct b43_wldev *wldev = dev_to_b43_wldev(dev);
186 unsigned long flags;
187 int value;
188
189 if (!capable(CAP_NET_ADMIN))
190 return -EPERM;
191
192 value = get_boolean(buf, count);
193 if (value < 0)
194 return value;
195 mutex_lock(&wldev->wl->mutex);
196 spin_lock_irqsave(&wldev->wl->irq_lock, flags);
197
198 wldev->short_preamble = !!value;
199
200 spin_unlock_irqrestore(&wldev->wl->irq_lock, flags);
201 mutex_unlock(&wldev->wl->mutex);
202
203 return count;
204}
205
206static DEVICE_ATTR(shortpreamble, 0644,
207 b43_attr_preamble_show, b43_attr_preamble_store);
208
209int b43_sysfs_register(struct b43_wldev *wldev) 135int b43_sysfs_register(struct b43_wldev *wldev)
210{ 136{
211 struct device *dev = wldev->dev->dev; 137 struct device *dev = wldev->dev->dev;
212 int err;
213 138
214 B43_WARN_ON(b43_status(wldev) != B43_STAT_INITIALIZED); 139 B43_WARN_ON(b43_status(wldev) != B43_STAT_INITIALIZED);
215 140
216 err = device_create_file(dev, &dev_attr_interference); 141 return device_create_file(dev, &dev_attr_interference);
217 if (err)
218 goto out;
219 err = device_create_file(dev, &dev_attr_shortpreamble);
220 if (err)
221 goto err_remove_interfmode;
222
223 out:
224 return err;
225 err_remove_interfmode:
226 device_remove_file(dev, &dev_attr_interference);
227 goto out;
228} 142}
229 143
230void b43_sysfs_unregister(struct b43_wldev *wldev) 144void b43_sysfs_unregister(struct b43_wldev *wldev)
231{ 145{
232 struct device *dev = wldev->dev->dev; 146 struct device *dev = wldev->dev->dev;
233 147
234 device_remove_file(dev, &dev_attr_shortpreamble);
235 device_remove_file(dev, &dev_attr_interference); 148 device_remove_file(dev, &dev_attr_interference);
236} 149}