aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/orinoco
diff options
context:
space:
mode:
authorDavid Kilroy <kilroyd@googlemail.com>2009-06-18 18:21:26 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 15:01:44 -0400
commitea60a6aaf55984a13a7150568cc103d006e86ab2 (patch)
tree1c6b80d7d6a2129fe33591508ac125b65100fa09 /drivers/net/wireless/orinoco
parent98e5f404485d5d11b15e8351535a0e064a37647c (diff)
orinoco: initiate cfg80211 conversion
Initialise and register a wiphy. Store the orinoco_private structure in the new wiphy, and use the net_device private area to store the wireless_dev. This results in a change to the way we navigate from a net_device to the driver private orinoco_private, which we encapsulate in the inline function ndev_priv. Most of the remaining calls to netdev_priv are thus replaced by ndev_priv. We can immediately rely on cfg80211 to handle SIOCGIWNAME, so orinoco_ioctl_getname is removed. Signed-off-by: David Kilroy <kilroyd@googlemail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/orinoco')
-rw-r--r--drivers/net/wireless/orinoco/Kconfig1
-rw-r--r--drivers/net/wireless/orinoco/Makefile2
-rw-r--r--drivers/net/wireless/orinoco/cfg.c98
-rw-r--r--drivers/net/wireless/orinoco/cfg.h15
-rw-r--r--drivers/net/wireless/orinoco/main.c108
-rw-r--r--drivers/net/wireless/orinoco/orinoco.h11
-rw-r--r--drivers/net/wireless/orinoco/wext.c110
7 files changed, 256 insertions, 89 deletions
diff --git a/drivers/net/wireless/orinoco/Kconfig b/drivers/net/wireless/orinoco/Kconfig
index 44411eb4e91b..83b635fd7784 100644
--- a/drivers/net/wireless/orinoco/Kconfig
+++ b/drivers/net/wireless/orinoco/Kconfig
@@ -1,6 +1,7 @@
1config HERMES 1config HERMES
2 tristate "Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)" 2 tristate "Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)"
3 depends on (PPC_PMAC || PCI || PCMCIA) && WLAN_80211 3 depends on (PPC_PMAC || PCI || PCMCIA) && WLAN_80211
4 depends on CFG80211
4 select WIRELESS_EXT 5 select WIRELESS_EXT
5 select FW_LOADER 6 select FW_LOADER
6 select CRYPTO 7 select CRYPTO
diff --git a/drivers/net/wireless/orinoco/Makefile b/drivers/net/wireless/orinoco/Makefile
index 1fc7409d6699..9abd6329bcbd 100644
--- a/drivers/net/wireless/orinoco/Makefile
+++ b/drivers/net/wireless/orinoco/Makefile
@@ -1,7 +1,7 @@
1# 1#
2# Makefile for the orinoco wireless device drivers. 2# Makefile for the orinoco wireless device drivers.
3# 3#
4orinoco-objs := main.o fw.o hw.o mic.o scan.o wext.o hermes_dld.o hermes.o 4orinoco-objs := main.o fw.o hw.o mic.o scan.o wext.o hermes_dld.o hermes.o cfg.o
5 5
6obj-$(CONFIG_HERMES) += orinoco.o 6obj-$(CONFIG_HERMES) += orinoco.o
7obj-$(CONFIG_PCMCIA_HERMES) += orinoco_cs.o 7obj-$(CONFIG_PCMCIA_HERMES) += orinoco_cs.o
diff --git a/drivers/net/wireless/orinoco/cfg.c b/drivers/net/wireless/orinoco/cfg.c
new file mode 100644
index 000000000000..9a616ddac091
--- /dev/null
+++ b/drivers/net/wireless/orinoco/cfg.c
@@ -0,0 +1,98 @@
1/* cfg80211 support
2 *
3 * See copyright notice in main.c
4 */
5#include <linux/ieee80211.h>
6#include <net/cfg80211.h>
7#include "hw.h"
8#include "main.h"
9#include "orinoco.h"
10
11#include "cfg.h"
12
13/* Supported bitrates. Must agree with hw.c */
14static struct ieee80211_rate orinoco_rates[] = {
15 { .bitrate = 10 },
16 { .bitrate = 20 },
17 { .bitrate = 55 },
18 { .bitrate = 110 },
19};
20
21static const void * const orinoco_wiphy_privid = &orinoco_wiphy_privid;
22
23/* Called after orinoco_private is allocated. */
24void orinoco_wiphy_init(struct wiphy *wiphy)
25{
26 struct orinoco_private *priv = wiphy_priv(wiphy);
27
28 wiphy->privid = orinoco_wiphy_privid;
29
30 set_wiphy_dev(wiphy, priv->dev);
31}
32
33/* Called after firmware is initialised */
34int orinoco_wiphy_register(struct wiphy *wiphy)
35{
36 struct orinoco_private *priv = wiphy_priv(wiphy);
37 int i, channels = 0;
38
39 if (priv->firmware_type == FIRMWARE_TYPE_AGERE)
40 wiphy->max_scan_ssids = 1;
41 else
42 wiphy->max_scan_ssids = 0;
43
44 wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
45
46 /* TODO: should we set if we only have demo ad-hoc?
47 * (priv->has_port3)
48 */
49 if (priv->has_ibss)
50 wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC);
51
52 if (!priv->broken_monitor || force_monitor)
53 wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);
54
55 priv->band.bitrates = orinoco_rates;
56 priv->band.n_bitrates = ARRAY_SIZE(orinoco_rates);
57
58 /* Only support channels allowed by the card EEPROM */
59 for (i = 0; i < NUM_CHANNELS; i++) {
60 if (priv->channel_mask & (1 << i)) {
61 priv->channels[i].center_freq =
62 ieee80211_dsss_chan_to_freq(i+1);
63 channels++;
64 }
65 }
66 priv->band.channels = priv->channels;
67 priv->band.n_channels = channels;
68
69 wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
70 wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
71
72 i = 0;
73 if (priv->has_wep) {
74 priv->cipher_suites[i] = WLAN_CIPHER_SUITE_WEP40;
75 i++;
76
77 if (priv->has_big_wep) {
78 priv->cipher_suites[i] = WLAN_CIPHER_SUITE_WEP104;
79 i++;
80 }
81 }
82 if (priv->has_wpa) {
83 priv->cipher_suites[i] = WLAN_CIPHER_SUITE_TKIP;
84 i++;
85 }
86 wiphy->cipher_suites = priv->cipher_suites;
87 wiphy->n_cipher_suites = i;
88
89 wiphy->rts_threshold = priv->rts_thresh;
90 if (!priv->has_mwo)
91 wiphy->frag_threshold = priv->frag_thresh;
92
93 return wiphy_register(wiphy);
94}
95
96const struct cfg80211_ops orinoco_cfg_ops = {
97
98};
diff --git a/drivers/net/wireless/orinoco/cfg.h b/drivers/net/wireless/orinoco/cfg.h
new file mode 100644
index 000000000000..3ddc96a06cd7
--- /dev/null
+++ b/drivers/net/wireless/orinoco/cfg.h
@@ -0,0 +1,15 @@
1/* cfg80211 support.
2 *
3 * See copyright notice in main.c
4 */
5#ifndef ORINOCO_CFG_H
6#define ORINOCO_CFG_H
7
8#include <net/cfg80211.h>
9
10extern const struct cfg80211_ops orinoco_cfg_ops;
11
12void orinoco_wiphy_init(struct wiphy *wiphy);
13int orinoco_wiphy_register(struct wiphy *wiphy);
14
15#endif /* ORINOCO_CFG_H */
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c
index ff869a25024d..5c1cf648002a 100644
--- a/drivers/net/wireless/orinoco/main.c
+++ b/drivers/net/wireless/orinoco/main.c
@@ -89,6 +89,7 @@
89#include <linux/wireless.h> 89#include <linux/wireless.h>
90#include <linux/ieee80211.h> 90#include <linux/ieee80211.h>
91#include <net/iw_handler.h> 91#include <net/iw_handler.h>
92#include <net/cfg80211.h>
92 93
93#include "hermes_rid.h" 94#include "hermes_rid.h"
94#include "hermes_dld.h" 95#include "hermes_dld.h"
@@ -97,6 +98,7 @@
97#include "mic.h" 98#include "mic.h"
98#include "fw.h" 99#include "fw.h"
99#include "wext.h" 100#include "wext.h"
101#include "cfg.h"
100#include "main.h" 102#include "main.h"
101 103
102#include "orinoco.h" 104#include "orinoco.h"
@@ -246,7 +248,7 @@ void set_port_type(struct orinoco_private *priv)
246 248
247static int orinoco_open(struct net_device *dev) 249static int orinoco_open(struct net_device *dev)
248{ 250{
249 struct orinoco_private *priv = netdev_priv(dev); 251 struct orinoco_private *priv = ndev_priv(dev);
250 unsigned long flags; 252 unsigned long flags;
251 int err; 253 int err;
252 254
@@ -265,7 +267,7 @@ static int orinoco_open(struct net_device *dev)
265 267
266static int orinoco_stop(struct net_device *dev) 268static int orinoco_stop(struct net_device *dev)
267{ 269{
268 struct orinoco_private *priv = netdev_priv(dev); 270 struct orinoco_private *priv = ndev_priv(dev);
269 int err = 0; 271 int err = 0;
270 272
271 /* We mustn't use orinoco_lock() here, because we need to be 273 /* We mustn't use orinoco_lock() here, because we need to be
@@ -284,14 +286,14 @@ static int orinoco_stop(struct net_device *dev)
284 286
285static struct net_device_stats *orinoco_get_stats(struct net_device *dev) 287static struct net_device_stats *orinoco_get_stats(struct net_device *dev)
286{ 288{
287 struct orinoco_private *priv = netdev_priv(dev); 289 struct orinoco_private *priv = ndev_priv(dev);
288 290
289 return &priv->stats; 291 return &priv->stats;
290} 292}
291 293
292static void orinoco_set_multicast_list(struct net_device *dev) 294static void orinoco_set_multicast_list(struct net_device *dev)
293{ 295{
294 struct orinoco_private *priv = netdev_priv(dev); 296 struct orinoco_private *priv = ndev_priv(dev);
295 unsigned long flags; 297 unsigned long flags;
296 298
297 if (orinoco_lock(priv, &flags) != 0) { 299 if (orinoco_lock(priv, &flags) != 0) {
@@ -306,7 +308,7 @@ static void orinoco_set_multicast_list(struct net_device *dev)
306 308
307static int orinoco_change_mtu(struct net_device *dev, int new_mtu) 309static int orinoco_change_mtu(struct net_device *dev, int new_mtu)
308{ 310{
309 struct orinoco_private *priv = netdev_priv(dev); 311 struct orinoco_private *priv = ndev_priv(dev);
310 312
311 if ((new_mtu < ORINOCO_MIN_MTU) || (new_mtu > ORINOCO_MAX_MTU)) 313 if ((new_mtu < ORINOCO_MIN_MTU) || (new_mtu > ORINOCO_MAX_MTU))
312 return -EINVAL; 314 return -EINVAL;
@@ -327,7 +329,7 @@ static int orinoco_change_mtu(struct net_device *dev, int new_mtu)
327 329
328static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev) 330static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
329{ 331{
330 struct orinoco_private *priv = netdev_priv(dev); 332 struct orinoco_private *priv = ndev_priv(dev);
331 struct net_device_stats *stats = &priv->stats; 333 struct net_device_stats *stats = &priv->stats;
332 hermes_t *hw = &priv->hw; 334 hermes_t *hw = &priv->hw;
333 int err = 0; 335 int err = 0;
@@ -517,7 +519,7 @@ static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
517 519
518static void __orinoco_ev_alloc(struct net_device *dev, hermes_t *hw) 520static void __orinoco_ev_alloc(struct net_device *dev, hermes_t *hw)
519{ 521{
520 struct orinoco_private *priv = netdev_priv(dev); 522 struct orinoco_private *priv = ndev_priv(dev);
521 u16 fid = hermes_read_regn(hw, ALLOCFID); 523 u16 fid = hermes_read_regn(hw, ALLOCFID);
522 524
523 if (fid != priv->txfid) { 525 if (fid != priv->txfid) {
@@ -532,7 +534,7 @@ static void __orinoco_ev_alloc(struct net_device *dev, hermes_t *hw)
532 534
533static void __orinoco_ev_tx(struct net_device *dev, hermes_t *hw) 535static void __orinoco_ev_tx(struct net_device *dev, hermes_t *hw)
534{ 536{
535 struct orinoco_private *priv = netdev_priv(dev); 537 struct orinoco_private *priv = ndev_priv(dev);
536 struct net_device_stats *stats = &priv->stats; 538 struct net_device_stats *stats = &priv->stats;
537 539
538 stats->tx_packets++; 540 stats->tx_packets++;
@@ -544,7 +546,7 @@ static void __orinoco_ev_tx(struct net_device *dev, hermes_t *hw)
544 546
545static void __orinoco_ev_txexc(struct net_device *dev, hermes_t *hw) 547static void __orinoco_ev_txexc(struct net_device *dev, hermes_t *hw)
546{ 548{
547 struct orinoco_private *priv = netdev_priv(dev); 549 struct orinoco_private *priv = ndev_priv(dev);
548 struct net_device_stats *stats = &priv->stats; 550 struct net_device_stats *stats = &priv->stats;
549 u16 fid = hermes_read_regn(hw, TXCOMPLFID); 551 u16 fid = hermes_read_regn(hw, TXCOMPLFID);
550 u16 status; 552 u16 status;
@@ -600,7 +602,7 @@ static void __orinoco_ev_txexc(struct net_device *dev, hermes_t *hw)
600 602
601static void orinoco_tx_timeout(struct net_device *dev) 603static void orinoco_tx_timeout(struct net_device *dev)
602{ 604{
603 struct orinoco_private *priv = netdev_priv(dev); 605 struct orinoco_private *priv = ndev_priv(dev);
604 struct net_device_stats *stats = &priv->stats; 606 struct net_device_stats *stats = &priv->stats;
605 struct hermes *hw = &priv->hw; 607 struct hermes *hw = &priv->hw;
606 608
@@ -649,7 +651,7 @@ static void orinoco_stat_gather(struct net_device *dev,
649 struct sk_buff *skb, 651 struct sk_buff *skb,
650 struct hermes_rx_descriptor *desc) 652 struct hermes_rx_descriptor *desc)
651{ 653{
652 struct orinoco_private *priv = netdev_priv(dev); 654 struct orinoco_private *priv = ndev_priv(dev);
653 655
654 /* Using spy support with lots of Rx packets, like in an 656 /* Using spy support with lots of Rx packets, like in an
655 * infrastructure (AP), will really slow down everything, because 657 * infrastructure (AP), will really slow down everything, because
@@ -686,7 +688,7 @@ static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid,
686 int err; 688 int err;
687 int len; 689 int len;
688 struct sk_buff *skb; 690 struct sk_buff *skb;
689 struct orinoco_private *priv = netdev_priv(dev); 691 struct orinoco_private *priv = ndev_priv(dev);
690 struct net_device_stats *stats = &priv->stats; 692 struct net_device_stats *stats = &priv->stats;
691 hermes_t *hw = &priv->hw; 693 hermes_t *hw = &priv->hw;
692 694
@@ -777,7 +779,7 @@ static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid,
777 779
778static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw) 780static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw)
779{ 781{
780 struct orinoco_private *priv = netdev_priv(dev); 782 struct orinoco_private *priv = ndev_priv(dev);
781 struct net_device_stats *stats = &priv->stats; 783 struct net_device_stats *stats = &priv->stats;
782 struct iw_statistics *wstats = &priv->wstats; 784 struct iw_statistics *wstats = &priv->wstats;
783 struct sk_buff *skb = NULL; 785 struct sk_buff *skb = NULL;
@@ -901,7 +903,7 @@ static void orinoco_rx(struct net_device *dev,
901 struct hermes_rx_descriptor *desc, 903 struct hermes_rx_descriptor *desc,
902 struct sk_buff *skb) 904 struct sk_buff *skb)
903{ 905{
904 struct orinoco_private *priv = netdev_priv(dev); 906 struct orinoco_private *priv = ndev_priv(dev);
905 struct net_device_stats *stats = &priv->stats; 907 struct net_device_stats *stats = &priv->stats;
906 u16 status, fc; 908 u16 status, fc;
907 int length; 909 int length;
@@ -1016,7 +1018,7 @@ static void orinoco_rx(struct net_device *dev,
1016static void orinoco_rx_isr_tasklet(unsigned long data) 1018static void orinoco_rx_isr_tasklet(unsigned long data)
1017{ 1019{
1018 struct net_device *dev = (struct net_device *) data; 1020 struct net_device *dev = (struct net_device *) data;
1019 struct orinoco_private *priv = netdev_priv(dev); 1021 struct orinoco_private *priv = ndev_priv(dev);
1020 struct orinoco_rx_data *rx_data, *temp; 1022 struct orinoco_rx_data *rx_data, *temp;
1021 struct hermes_rx_descriptor *desc; 1023 struct hermes_rx_descriptor *desc;
1022 struct sk_buff *skb; 1024 struct sk_buff *skb;
@@ -1261,7 +1263,7 @@ static void orinoco_send_wevents(struct work_struct *work)
1261 1263
1262static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) 1264static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw)
1263{ 1265{
1264 struct orinoco_private *priv = netdev_priv(dev); 1266 struct orinoco_private *priv = ndev_priv(dev);
1265 u16 infofid; 1267 u16 infofid;
1266 struct { 1268 struct {
1267 __le16 len; 1269 __le16 len;
@@ -1594,7 +1596,7 @@ EXPORT_SYMBOL(orinoco_reinit_firmware);
1594 1596
1595int __orinoco_program_rids(struct net_device *dev) 1597int __orinoco_program_rids(struct net_device *dev)
1596{ 1598{
1597 struct orinoco_private *priv = netdev_priv(dev); 1599 struct orinoco_private *priv = ndev_priv(dev);
1598 hermes_t *hw = &priv->hw; 1600 hermes_t *hw = &priv->hw;
1599 int err; 1601 int err;
1600 struct hermes_idstring idbuf; 1602 struct hermes_idstring idbuf;
@@ -1825,7 +1827,7 @@ int __orinoco_program_rids(struct net_device *dev)
1825static void 1827static void
1826__orinoco_set_multicast_list(struct net_device *dev) 1828__orinoco_set_multicast_list(struct net_device *dev)
1827{ 1829{
1828 struct orinoco_private *priv = netdev_priv(dev); 1830 struct orinoco_private *priv = ndev_priv(dev);
1829 int err = 0; 1831 int err = 0;
1830 int promisc, mc_count; 1832 int promisc, mc_count;
1831 1833
@@ -2077,6 +2079,7 @@ static void orinoco_unregister_pm_notifier(struct orinoco_private *priv)
2077int orinoco_init(struct orinoco_private *priv) 2079int orinoco_init(struct orinoco_private *priv)
2078{ 2080{
2079 struct device *dev = priv->dev; 2081 struct device *dev = priv->dev;
2082 struct wiphy *wiphy = priv_to_wiphy(priv);
2080 hermes_t *hw = &priv->hw; 2083 hermes_t *hw = &priv->hw;
2081 int err = 0; 2084 int err = 0;
2082 2085
@@ -2137,10 +2140,10 @@ int orinoco_init(struct orinoco_private *priv)
2137 goto out; 2140 goto out;
2138 orinoco_bss_data_init(priv); 2141 orinoco_bss_data_init(priv);
2139 2142
2140 /* Netdev has not initialised, but we have allocated the buffer. */ 2143 err = orinoco_hw_read_card_settings(priv, wiphy->perm_addr);
2141 err = orinoco_hw_read_card_settings(priv, priv->ndev->dev_addr);
2142 if (err) 2144 if (err)
2143 goto out; 2145 goto out;
2146 memcpy(priv->ndev->dev_addr, wiphy->perm_addr, ETH_ALEN);
2144 2147
2145 err = orinoco_hw_allocate_fid(priv); 2148 err = orinoco_hw_allocate_fid(priv);
2146 if (err) { 2149 if (err) {
@@ -2164,6 +2167,11 @@ int orinoco_init(struct orinoco_private *priv)
2164 priv->wpa_ie_len = 0; 2167 priv->wpa_ie_len = 0;
2165 priv->wpa_ie = NULL; 2168 priv->wpa_ie = NULL;
2166 2169
2170 if (orinoco_wiphy_register(wiphy)) {
2171 err = -ENODEV;
2172 goto out;
2173 }
2174
2167 /* Make the hardware available, as long as it hasn't been 2175 /* Make the hardware available, as long as it hasn't been
2168 * removed elsewhere (e.g. by PCMCIA hot unplug) */ 2176 * removed elsewhere (e.g. by PCMCIA hot unplug) */
2169 spin_lock_irq(&priv->lock); 2177 spin_lock_irq(&priv->lock);
@@ -2187,6 +2195,31 @@ static const struct net_device_ops orinoco_netdev_ops = {
2187 .ndo_get_stats = orinoco_get_stats, 2195 .ndo_get_stats = orinoco_get_stats,
2188}; 2196};
2189 2197
2198/* Allocate private data.
2199 *
2200 * This driver has a number of structures associated with it
2201 * netdev - Net device structure for each network interface
2202 * wiphy - structure associated with wireless phy
2203 * wireless_dev (wdev) - structure for each wireless interface
2204 * hw - structure for hermes chip info
2205 * card - card specific structure for use by the card driver
2206 * (airport, orinoco_cs)
2207 * priv - orinoco private data
2208 * device - generic linux device structure
2209 *
2210 * +---------+ +---------+
2211 * | wiphy | | netdev |
2212 * | +-------+ | +-------+
2213 * | | priv | | | wdev |
2214 * | | +-----+ +-+-------+
2215 * | | | hw |
2216 * | +-+-----+
2217 * | | card |
2218 * +-+-------+
2219 *
2220 * priv has a link to netdev and device
2221 * wdev has a link to wiphy
2222 */
2190struct orinoco_private 2223struct orinoco_private
2191*alloc_orinocodev(int sizeof_card, 2224*alloc_orinocodev(int sizeof_card,
2192 struct device *device, 2225 struct device *device,
@@ -2195,12 +2228,27 @@ struct orinoco_private
2195{ 2228{
2196 struct net_device *dev; 2229 struct net_device *dev;
2197 struct orinoco_private *priv; 2230 struct orinoco_private *priv;
2231 struct wireless_dev *wdev;
2232 struct wiphy *wiphy;
2233
2234 /* allocate wiphy
2235 * NOTE: We only support a single virtual interface
2236 * but this may change when monitor mode is added
2237 */
2238 wiphy = wiphy_new(&orinoco_cfg_ops,
2239 sizeof(struct orinoco_private) + sizeof_card);
2240 if (!wiphy)
2241 return NULL;
2198 2242
2199 dev = alloc_etherdev(sizeof(struct orinoco_private) + sizeof_card); 2243 dev = alloc_etherdev(sizeof(struct wireless_dev));
2200 if (!dev) 2244 if (!dev) {
2245 wiphy_free(wiphy);
2201 return NULL; 2246 return NULL;
2202 priv = netdev_priv(dev); 2247 }
2248
2249 priv = wiphy_priv(wiphy);
2203 priv->ndev = dev; 2250 priv->ndev = dev;
2251
2204 if (sizeof_card) 2252 if (sizeof_card)
2205 priv->card = (void *)((unsigned long)priv 2253 priv->card = (void *)((unsigned long)priv
2206 + sizeof(struct orinoco_private)); 2254 + sizeof(struct orinoco_private));
@@ -2208,7 +2256,15 @@ struct orinoco_private
2208 priv->card = NULL; 2256 priv->card = NULL;
2209 priv->dev = device; 2257 priv->dev = device;
2210 2258
2259 orinoco_wiphy_init(wiphy);
2260
2261 /* Initialise wireless_dev */
2262 wdev = netdev_priv(dev);
2263 wdev->wiphy = wiphy;
2264 wdev->iftype = NL80211_IFTYPE_STATION;
2265
2211 /* Setup / override net_device fields */ 2266 /* Setup / override net_device fields */
2267 dev->ieee80211_ptr = wdev;
2212 dev->netdev_ops = &orinoco_netdev_ops; 2268 dev->netdev_ops = &orinoco_netdev_ops;
2213 dev->watchdog_timeo = HZ; /* 1 second timeout */ 2269 dev->watchdog_timeo = HZ; /* 1 second timeout */
2214 dev->ethtool_ops = &orinoco_ethtool_ops; 2270 dev->ethtool_ops = &orinoco_ethtool_ops;
@@ -2257,8 +2313,11 @@ EXPORT_SYMBOL(alloc_orinocodev);
2257void free_orinocodev(struct orinoco_private *priv) 2313void free_orinocodev(struct orinoco_private *priv)
2258{ 2314{
2259 struct net_device *dev = priv->ndev; 2315 struct net_device *dev = priv->ndev;
2316 struct wiphy *wiphy = priv_to_wiphy(priv);
2260 struct orinoco_rx_data *rx_data, *temp; 2317 struct orinoco_rx_data *rx_data, *temp;
2261 2318
2319 wiphy_unregister(wiphy);
2320
2262 /* If the tasklet is scheduled when we call tasklet_kill it 2321 /* If the tasklet is scheduled when we call tasklet_kill it
2263 * will run one final time. However the tasklet will only 2322 * will run one final time. However the tasklet will only
2264 * drain priv->rx_list if the hw is still available. */ 2323 * drain priv->rx_list if the hw is still available. */
@@ -2281,13 +2340,14 @@ void free_orinocodev(struct orinoco_private *priv)
2281 orinoco_mic_free(priv); 2340 orinoco_mic_free(priv);
2282 orinoco_bss_data_free(priv); 2341 orinoco_bss_data_free(priv);
2283 free_netdev(dev); 2342 free_netdev(dev);
2343 wiphy_free(wiphy);
2284} 2344}
2285EXPORT_SYMBOL(free_orinocodev); 2345EXPORT_SYMBOL(free_orinocodev);
2286 2346
2287static void orinoco_get_drvinfo(struct net_device *dev, 2347static void orinoco_get_drvinfo(struct net_device *dev,
2288 struct ethtool_drvinfo *info) 2348 struct ethtool_drvinfo *info)
2289{ 2349{
2290 struct orinoco_private *priv = netdev_priv(dev); 2350 struct orinoco_private *priv = ndev_priv(dev);
2291 2351
2292 strncpy(info->driver, DRIVER_NAME, sizeof(info->driver) - 1); 2352 strncpy(info->driver, DRIVER_NAME, sizeof(info->driver) - 1);
2293 strncpy(info->version, DRIVER_VERSION, sizeof(info->version) - 1); 2353 strncpy(info->version, DRIVER_VERSION, sizeof(info->version) - 1);
diff --git a/drivers/net/wireless/orinoco/orinoco.h b/drivers/net/wireless/orinoco/orinoco.h
index 2e9d33fc6b18..608cc5e1bd9a 100644
--- a/drivers/net/wireless/orinoco/orinoco.h
+++ b/drivers/net/wireless/orinoco/orinoco.h
@@ -14,6 +14,7 @@
14#include <linux/netdevice.h> 14#include <linux/netdevice.h>
15#include <linux/wireless.h> 15#include <linux/wireless.h>
16#include <net/iw_handler.h> 16#include <net/iw_handler.h>
17#include <net/cfg80211.h>
17 18
18#include "hermes.h" 19#include "hermes.h"
19 20
@@ -67,6 +68,10 @@ struct orinoco_private {
67 int (*hard_reset)(struct orinoco_private *); 68 int (*hard_reset)(struct orinoco_private *);
68 int (*stop_fw)(struct orinoco_private *, int); 69 int (*stop_fw)(struct orinoco_private *, int);
69 70
71 struct ieee80211_supported_band band;
72 struct ieee80211_channel channels[14];
73 u32 cipher_suites[3];
74
70 /* Synchronisation stuff */ 75 /* Synchronisation stuff */
71 spinlock_t lock; 76 spinlock_t lock;
72 int hw_unavailable; 77 int hw_unavailable;
@@ -216,4 +221,10 @@ static inline void orinoco_unlock(struct orinoco_private *priv,
216 spin_unlock_irqrestore(&priv->lock, *flags); 221 spin_unlock_irqrestore(&priv->lock, *flags);
217} 222}
218 223
224/*** Navigate from net_device to orinoco_private ***/
225static inline struct orinoco_private *ndev_priv(struct net_device *dev)
226{
227 struct wireless_dev *wdev = netdev_priv(dev);
228 return wdev_priv(wdev);
229}
219#endif /* _ORINOCO_H */ 230#endif /* _ORINOCO_H */
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c
index 74fdfcec9b2c..74892e1d34ae 100644
--- a/drivers/net/wireless/orinoco/wext.c
+++ b/drivers/net/wireless/orinoco/wext.c
@@ -7,6 +7,7 @@
7#include <linux/wireless.h> 7#include <linux/wireless.h>
8#include <linux/ieee80211.h> 8#include <linux/ieee80211.h>
9#include <net/iw_handler.h> 9#include <net/iw_handler.h>
10#include <net/cfg80211.h>
10 11
11#include "hermes.h" 12#include "hermes.h"
12#include "hermes_rid.h" 13#include "hermes_rid.h"
@@ -23,7 +24,7 @@
23 24
24static struct iw_statistics *orinoco_get_wireless_stats(struct net_device *dev) 25static struct iw_statistics *orinoco_get_wireless_stats(struct net_device *dev)
25{ 26{
26 struct orinoco_private *priv = netdev_priv(dev); 27 struct orinoco_private *priv = ndev_priv(dev);
27 hermes_t *hw = &priv->hw; 28 hermes_t *hw = &priv->hw;
28 struct iw_statistics *wstats = &priv->wstats; 29 struct iw_statistics *wstats = &priv->wstats;
29 int err; 30 int err;
@@ -87,31 +88,12 @@ static struct iw_statistics *orinoco_get_wireless_stats(struct net_device *dev)
87/* Wireless extensions */ 88/* Wireless extensions */
88/********************************************************************/ 89/********************************************************************/
89 90
90static int orinoco_ioctl_getname(struct net_device *dev,
91 struct iw_request_info *info,
92 char *name,
93 char *extra)
94{
95 struct orinoco_private *priv = netdev_priv(dev);
96 int numrates;
97 int err;
98
99 err = orinoco_hw_get_bitratelist(priv, &numrates, NULL, 0);
100
101 if (!err && (numrates > 2))
102 strcpy(name, "IEEE 802.11b");
103 else
104 strcpy(name, "IEEE 802.11-DS");
105
106 return 0;
107}
108
109static int orinoco_ioctl_setwap(struct net_device *dev, 91static int orinoco_ioctl_setwap(struct net_device *dev,
110 struct iw_request_info *info, 92 struct iw_request_info *info,
111 struct sockaddr *ap_addr, 93 struct sockaddr *ap_addr,
112 char *extra) 94 char *extra)
113{ 95{
114 struct orinoco_private *priv = netdev_priv(dev); 96 struct orinoco_private *priv = ndev_priv(dev);
115 int err = -EINPROGRESS; /* Call commit handler */ 97 int err = -EINPROGRESS; /* Call commit handler */
116 unsigned long flags; 98 unsigned long flags;
117 static const u8 off_addr[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; 99 static const u8 off_addr[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
@@ -172,7 +154,7 @@ static int orinoco_ioctl_getwap(struct net_device *dev,
172 struct sockaddr *ap_addr, 154 struct sockaddr *ap_addr,
173 char *extra) 155 char *extra)
174{ 156{
175 struct orinoco_private *priv = netdev_priv(dev); 157 struct orinoco_private *priv = ndev_priv(dev);
176 158
177 hermes_t *hw = &priv->hw; 159 hermes_t *hw = &priv->hw;
178 int err = 0; 160 int err = 0;
@@ -195,7 +177,7 @@ static int orinoco_ioctl_setmode(struct net_device *dev,
195 u32 *mode, 177 u32 *mode,
196 char *extra) 178 char *extra)
197{ 179{
198 struct orinoco_private *priv = netdev_priv(dev); 180 struct orinoco_private *priv = ndev_priv(dev);
199 int err = -EINPROGRESS; /* Call commit handler */ 181 int err = -EINPROGRESS; /* Call commit handler */
200 unsigned long flags; 182 unsigned long flags;
201 183
@@ -243,7 +225,7 @@ static int orinoco_ioctl_getmode(struct net_device *dev,
243 u32 *mode, 225 u32 *mode,
244 char *extra) 226 char *extra)
245{ 227{
246 struct orinoco_private *priv = netdev_priv(dev); 228 struct orinoco_private *priv = ndev_priv(dev);
247 229
248 *mode = priv->iw_mode; 230 *mode = priv->iw_mode;
249 return 0; 231 return 0;
@@ -254,7 +236,7 @@ static int orinoco_ioctl_getiwrange(struct net_device *dev,
254 struct iw_point *rrq, 236 struct iw_point *rrq,
255 char *extra) 237 char *extra)
256{ 238{
257 struct orinoco_private *priv = netdev_priv(dev); 239 struct orinoco_private *priv = ndev_priv(dev);
258 int err = 0; 240 int err = 0;
259 struct iw_range *range = (struct iw_range *) extra; 241 struct iw_range *range = (struct iw_range *) extra;
260 int numrates; 242 int numrates;
@@ -367,7 +349,7 @@ static int orinoco_ioctl_setiwencode(struct net_device *dev,
367 struct iw_point *erq, 349 struct iw_point *erq,
368 char *keybuf) 350 char *keybuf)
369{ 351{
370 struct orinoco_private *priv = netdev_priv(dev); 352 struct orinoco_private *priv = ndev_priv(dev);
371 int index = (erq->flags & IW_ENCODE_INDEX) - 1; 353 int index = (erq->flags & IW_ENCODE_INDEX) - 1;
372 int setindex = priv->tx_key; 354 int setindex = priv->tx_key;
373 int encode_alg = priv->encode_alg; 355 int encode_alg = priv->encode_alg;
@@ -469,7 +451,7 @@ static int orinoco_ioctl_getiwencode(struct net_device *dev,
469 struct iw_point *erq, 451 struct iw_point *erq,
470 char *keybuf) 452 char *keybuf)
471{ 453{
472 struct orinoco_private *priv = netdev_priv(dev); 454 struct orinoco_private *priv = ndev_priv(dev);
473 int index = (erq->flags & IW_ENCODE_INDEX) - 1; 455 int index = (erq->flags & IW_ENCODE_INDEX) - 1;
474 u16 xlen = 0; 456 u16 xlen = 0;
475 unsigned long flags; 457 unsigned long flags;
@@ -508,7 +490,7 @@ static int orinoco_ioctl_setessid(struct net_device *dev,
508 struct iw_point *erq, 490 struct iw_point *erq,
509 char *essidbuf) 491 char *essidbuf)
510{ 492{
511 struct orinoco_private *priv = netdev_priv(dev); 493 struct orinoco_private *priv = ndev_priv(dev);
512 unsigned long flags; 494 unsigned long flags;
513 495
514 /* Note : ESSID is ignored in Ad-Hoc demo mode, but we can set it 496 /* Note : ESSID is ignored in Ad-Hoc demo mode, but we can set it
@@ -539,7 +521,7 @@ static int orinoco_ioctl_getessid(struct net_device *dev,
539 struct iw_point *erq, 521 struct iw_point *erq,
540 char *essidbuf) 522 char *essidbuf)
541{ 523{
542 struct orinoco_private *priv = netdev_priv(dev); 524 struct orinoco_private *priv = ndev_priv(dev);
543 int active; 525 int active;
544 int err = 0; 526 int err = 0;
545 unsigned long flags; 527 unsigned long flags;
@@ -567,7 +549,7 @@ static int orinoco_ioctl_setnick(struct net_device *dev,
567 struct iw_point *nrq, 549 struct iw_point *nrq,
568 char *nickbuf) 550 char *nickbuf)
569{ 551{
570 struct orinoco_private *priv = netdev_priv(dev); 552 struct orinoco_private *priv = ndev_priv(dev);
571 unsigned long flags; 553 unsigned long flags;
572 554
573 if (nrq->length > IW_ESSID_MAX_SIZE) 555 if (nrq->length > IW_ESSID_MAX_SIZE)
@@ -589,7 +571,7 @@ static int orinoco_ioctl_getnick(struct net_device *dev,
589 struct iw_point *nrq, 571 struct iw_point *nrq,
590 char *nickbuf) 572 char *nickbuf)
591{ 573{
592 struct orinoco_private *priv = netdev_priv(dev); 574 struct orinoco_private *priv = ndev_priv(dev);
593 unsigned long flags; 575 unsigned long flags;
594 576
595 if (orinoco_lock(priv, &flags) != 0) 577 if (orinoco_lock(priv, &flags) != 0)
@@ -608,7 +590,7 @@ static int orinoco_ioctl_setfreq(struct net_device *dev,
608 struct iw_freq *frq, 590 struct iw_freq *frq,
609 char *extra) 591 char *extra)
610{ 592{
611 struct orinoco_private *priv = netdev_priv(dev); 593 struct orinoco_private *priv = ndev_priv(dev);
612 int chan = -1; 594 int chan = -1;
613 unsigned long flags; 595 unsigned long flags;
614 int err = -EINPROGRESS; /* Call commit handler */ 596 int err = -EINPROGRESS; /* Call commit handler */
@@ -657,7 +639,7 @@ static int orinoco_ioctl_getfreq(struct net_device *dev,
657 struct iw_freq *frq, 639 struct iw_freq *frq,
658 char *extra) 640 char *extra)
659{ 641{
660 struct orinoco_private *priv = netdev_priv(dev); 642 struct orinoco_private *priv = ndev_priv(dev);
661 int tmp; 643 int tmp;
662 644
663 /* Locking done in there */ 645 /* Locking done in there */
@@ -676,7 +658,7 @@ static int orinoco_ioctl_getsens(struct net_device *dev,
676 struct iw_param *srq, 658 struct iw_param *srq,
677 char *extra) 659 char *extra)
678{ 660{
679 struct orinoco_private *priv = netdev_priv(dev); 661 struct orinoco_private *priv = ndev_priv(dev);
680 hermes_t *hw = &priv->hw; 662 hermes_t *hw = &priv->hw;
681 u16 val; 663 u16 val;
682 int err; 664 int err;
@@ -705,7 +687,7 @@ static int orinoco_ioctl_setsens(struct net_device *dev,
705 struct iw_param *srq, 687 struct iw_param *srq,
706 char *extra) 688 char *extra)
707{ 689{
708 struct orinoco_private *priv = netdev_priv(dev); 690 struct orinoco_private *priv = ndev_priv(dev);
709 int val = srq->value; 691 int val = srq->value;
710 unsigned long flags; 692 unsigned long flags;
711 693
@@ -728,7 +710,7 @@ static int orinoco_ioctl_setrts(struct net_device *dev,
728 struct iw_param *rrq, 710 struct iw_param *rrq,
729 char *extra) 711 char *extra)
730{ 712{
731 struct orinoco_private *priv = netdev_priv(dev); 713 struct orinoco_private *priv = ndev_priv(dev);
732 int val = rrq->value; 714 int val = rrq->value;
733 unsigned long flags; 715 unsigned long flags;
734 716
@@ -752,7 +734,7 @@ static int orinoco_ioctl_getrts(struct net_device *dev,
752 struct iw_param *rrq, 734 struct iw_param *rrq,
753 char *extra) 735 char *extra)
754{ 736{
755 struct orinoco_private *priv = netdev_priv(dev); 737 struct orinoco_private *priv = ndev_priv(dev);
756 738
757 rrq->value = priv->rts_thresh; 739 rrq->value = priv->rts_thresh;
758 rrq->disabled = (rrq->value == 2347); 740 rrq->disabled = (rrq->value == 2347);
@@ -766,7 +748,7 @@ static int orinoco_ioctl_setfrag(struct net_device *dev,
766 struct iw_param *frq, 748 struct iw_param *frq,
767 char *extra) 749 char *extra)
768{ 750{
769 struct orinoco_private *priv = netdev_priv(dev); 751 struct orinoco_private *priv = ndev_priv(dev);
770 int err = -EINPROGRESS; /* Call commit handler */ 752 int err = -EINPROGRESS; /* Call commit handler */
771 unsigned long flags; 753 unsigned long flags;
772 754
@@ -806,7 +788,7 @@ static int orinoco_ioctl_getfrag(struct net_device *dev,
806 struct iw_param *frq, 788 struct iw_param *frq,
807 char *extra) 789 char *extra)
808{ 790{
809 struct orinoco_private *priv = netdev_priv(dev); 791 struct orinoco_private *priv = ndev_priv(dev);
810 hermes_t *hw = &priv->hw; 792 hermes_t *hw = &priv->hw;
811 int err; 793 int err;
812 u16 val; 794 u16 val;
@@ -847,7 +829,7 @@ static int orinoco_ioctl_setrate(struct net_device *dev,
847 struct iw_param *rrq, 829 struct iw_param *rrq,
848 char *extra) 830 char *extra)
849{ 831{
850 struct orinoco_private *priv = netdev_priv(dev); 832 struct orinoco_private *priv = ndev_priv(dev);
851 int ratemode; 833 int ratemode;
852 int bitrate; /* 100s of kilobits */ 834 int bitrate; /* 100s of kilobits */
853 unsigned long flags; 835 unsigned long flags;
@@ -881,7 +863,7 @@ static int orinoco_ioctl_getrate(struct net_device *dev,
881 struct iw_param *rrq, 863 struct iw_param *rrq,
882 char *extra) 864 char *extra)
883{ 865{
884 struct orinoco_private *priv = netdev_priv(dev); 866 struct orinoco_private *priv = ndev_priv(dev);
885 int err = 0; 867 int err = 0;
886 int bitrate, automatic; 868 int bitrate, automatic;
887 unsigned long flags; 869 unsigned long flags;
@@ -910,7 +892,7 @@ static int orinoco_ioctl_setpower(struct net_device *dev,
910 struct iw_param *prq, 892 struct iw_param *prq,
911 char *extra) 893 char *extra)
912{ 894{
913 struct orinoco_private *priv = netdev_priv(dev); 895 struct orinoco_private *priv = ndev_priv(dev);
914 int err = -EINPROGRESS; /* Call commit handler */ 896 int err = -EINPROGRESS; /* Call commit handler */
915 unsigned long flags; 897 unsigned long flags;
916 898
@@ -964,7 +946,7 @@ static int orinoco_ioctl_getpower(struct net_device *dev,
964 struct iw_param *prq, 946 struct iw_param *prq,
965 char *extra) 947 char *extra)
966{ 948{
967 struct orinoco_private *priv = netdev_priv(dev); 949 struct orinoco_private *priv = ndev_priv(dev);
968 hermes_t *hw = &priv->hw; 950 hermes_t *hw = &priv->hw;
969 int err = 0; 951 int err = 0;
970 u16 enable, period, timeout, mcast; 952 u16 enable, period, timeout, mcast;
@@ -1018,7 +1000,7 @@ static int orinoco_ioctl_set_encodeext(struct net_device *dev,
1018 union iwreq_data *wrqu, 1000 union iwreq_data *wrqu,
1019 char *extra) 1001 char *extra)
1020{ 1002{
1021 struct orinoco_private *priv = netdev_priv(dev); 1003 struct orinoco_private *priv = ndev_priv(dev);
1022 struct iw_point *encoding = &wrqu->encoding; 1004 struct iw_point *encoding = &wrqu->encoding;
1023 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 1005 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
1024 int idx, alg = ext->alg, set_key = 1; 1006 int idx, alg = ext->alg, set_key = 1;
@@ -1119,7 +1101,7 @@ static int orinoco_ioctl_get_encodeext(struct net_device *dev,
1119 union iwreq_data *wrqu, 1101 union iwreq_data *wrqu,
1120 char *extra) 1102 char *extra)
1121{ 1103{
1122 struct orinoco_private *priv = netdev_priv(dev); 1104 struct orinoco_private *priv = ndev_priv(dev);
1123 struct iw_point *encoding = &wrqu->encoding; 1105 struct iw_point *encoding = &wrqu->encoding;
1124 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 1106 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
1125 int idx, max_key_len; 1107 int idx, max_key_len;
@@ -1176,7 +1158,7 @@ static int orinoco_ioctl_set_auth(struct net_device *dev,
1176 struct iw_request_info *info, 1158 struct iw_request_info *info,
1177 union iwreq_data *wrqu, char *extra) 1159 union iwreq_data *wrqu, char *extra)
1178{ 1160{
1179 struct orinoco_private *priv = netdev_priv(dev); 1161 struct orinoco_private *priv = ndev_priv(dev);
1180 hermes_t *hw = &priv->hw; 1162 hermes_t *hw = &priv->hw;
1181 struct iw_param *param = &wrqu->param; 1163 struct iw_param *param = &wrqu->param;
1182 unsigned long flags; 1164 unsigned long flags;
@@ -1254,7 +1236,7 @@ static int orinoco_ioctl_get_auth(struct net_device *dev,
1254 struct iw_request_info *info, 1236 struct iw_request_info *info,
1255 union iwreq_data *wrqu, char *extra) 1237 union iwreq_data *wrqu, char *extra)
1256{ 1238{
1257 struct orinoco_private *priv = netdev_priv(dev); 1239 struct orinoco_private *priv = ndev_priv(dev);
1258 struct iw_param *param = &wrqu->param; 1240 struct iw_param *param = &wrqu->param;
1259 unsigned long flags; 1241 unsigned long flags;
1260 int ret = 0; 1242 int ret = 0;
@@ -1294,7 +1276,7 @@ static int orinoco_ioctl_set_genie(struct net_device *dev,
1294 struct iw_request_info *info, 1276 struct iw_request_info *info,
1295 union iwreq_data *wrqu, char *extra) 1277 union iwreq_data *wrqu, char *extra)
1296{ 1278{
1297 struct orinoco_private *priv = netdev_priv(dev); 1279 struct orinoco_private *priv = ndev_priv(dev);
1298 u8 *buf; 1280 u8 *buf;
1299 unsigned long flags; 1281 unsigned long flags;
1300 1282
@@ -1337,7 +1319,7 @@ static int orinoco_ioctl_get_genie(struct net_device *dev,
1337 struct iw_request_info *info, 1319 struct iw_request_info *info,
1338 union iwreq_data *wrqu, char *extra) 1320 union iwreq_data *wrqu, char *extra)
1339{ 1321{
1340 struct orinoco_private *priv = netdev_priv(dev); 1322 struct orinoco_private *priv = ndev_priv(dev);
1341 unsigned long flags; 1323 unsigned long flags;
1342 int err = 0; 1324 int err = 0;
1343 1325
@@ -1366,7 +1348,7 @@ static int orinoco_ioctl_set_mlme(struct net_device *dev,
1366 struct iw_request_info *info, 1348 struct iw_request_info *info,
1367 union iwreq_data *wrqu, char *extra) 1349 union iwreq_data *wrqu, char *extra)
1368{ 1350{
1369 struct orinoco_private *priv = netdev_priv(dev); 1351 struct orinoco_private *priv = ndev_priv(dev);
1370 hermes_t *hw = &priv->hw; 1352 hermes_t *hw = &priv->hw;
1371 struct iw_mlme *mlme = (struct iw_mlme *)extra; 1353 struct iw_mlme *mlme = (struct iw_mlme *)extra;
1372 unsigned long flags; 1354 unsigned long flags;
@@ -1407,7 +1389,7 @@ static int orinoco_ioctl_getretry(struct net_device *dev,
1407 struct iw_param *rrq, 1389 struct iw_param *rrq,
1408 char *extra) 1390 char *extra)
1409{ 1391{
1410 struct orinoco_private *priv = netdev_priv(dev); 1392 struct orinoco_private *priv = ndev_priv(dev);
1411 hermes_t *hw = &priv->hw; 1393 hermes_t *hw = &priv->hw;
1412 int err = 0; 1394 int err = 0;
1413 u16 short_limit, long_limit, lifetime; 1395 u16 short_limit, long_limit, lifetime;
@@ -1461,7 +1443,7 @@ static int orinoco_ioctl_reset(struct net_device *dev,
1461 void *wrqu, 1443 void *wrqu,
1462 char *extra) 1444 char *extra)
1463{ 1445{
1464 struct orinoco_private *priv = netdev_priv(dev); 1446 struct orinoco_private *priv = ndev_priv(dev);
1465 1447
1466 if (!capable(CAP_NET_ADMIN)) 1448 if (!capable(CAP_NET_ADMIN))
1467 return -EPERM; 1449 return -EPERM;
@@ -1486,7 +1468,7 @@ static int orinoco_ioctl_setibssport(struct net_device *dev,
1486 char *extra) 1468 char *extra)
1487 1469
1488{ 1470{
1489 struct orinoco_private *priv = netdev_priv(dev); 1471 struct orinoco_private *priv = ndev_priv(dev);
1490 int val = *((int *) extra); 1472 int val = *((int *) extra);
1491 unsigned long flags; 1473 unsigned long flags;
1492 1474
@@ -1507,7 +1489,7 @@ static int orinoco_ioctl_getibssport(struct net_device *dev,
1507 void *wrqu, 1489 void *wrqu,
1508 char *extra) 1490 char *extra)
1509{ 1491{
1510 struct orinoco_private *priv = netdev_priv(dev); 1492 struct orinoco_private *priv = ndev_priv(dev);
1511 int *val = (int *) extra; 1493 int *val = (int *) extra;
1512 1494
1513 *val = priv->ibss_port; 1495 *val = priv->ibss_port;
@@ -1519,7 +1501,7 @@ static int orinoco_ioctl_setport3(struct net_device *dev,
1519 void *wrqu, 1501 void *wrqu,
1520 char *extra) 1502 char *extra)
1521{ 1503{
1522 struct orinoco_private *priv = netdev_priv(dev); 1504 struct orinoco_private *priv = ndev_priv(dev);
1523 int val = *((int *) extra); 1505 int val = *((int *) extra);
1524 int err = 0; 1506 int err = 0;
1525 unsigned long flags; 1507 unsigned long flags;
@@ -1565,7 +1547,7 @@ static int orinoco_ioctl_getport3(struct net_device *dev,
1565 void *wrqu, 1547 void *wrqu,
1566 char *extra) 1548 char *extra)
1567{ 1549{
1568 struct orinoco_private *priv = netdev_priv(dev); 1550 struct orinoco_private *priv = ndev_priv(dev);
1569 int *val = (int *) extra; 1551 int *val = (int *) extra;
1570 1552
1571 *val = priv->prefer_port3; 1553 *val = priv->prefer_port3;
@@ -1577,7 +1559,7 @@ static int orinoco_ioctl_setpreamble(struct net_device *dev,
1577 void *wrqu, 1559 void *wrqu,
1578 char *extra) 1560 char *extra)
1579{ 1561{
1580 struct orinoco_private *priv = netdev_priv(dev); 1562 struct orinoco_private *priv = ndev_priv(dev);
1581 unsigned long flags; 1563 unsigned long flags;
1582 int val; 1564 int val;
1583 1565
@@ -1609,7 +1591,7 @@ static int orinoco_ioctl_getpreamble(struct net_device *dev,
1609 void *wrqu, 1591 void *wrqu,
1610 char *extra) 1592 char *extra)
1611{ 1593{
1612 struct orinoco_private *priv = netdev_priv(dev); 1594 struct orinoco_private *priv = ndev_priv(dev);
1613 int *val = (int *) extra; 1595 int *val = (int *) extra;
1614 1596
1615 if (!priv->has_preamble) 1597 if (!priv->has_preamble)
@@ -1629,7 +1611,7 @@ static int orinoco_ioctl_getrid(struct net_device *dev,
1629 struct iw_point *data, 1611 struct iw_point *data,
1630 char *extra) 1612 char *extra)
1631{ 1613{
1632 struct orinoco_private *priv = netdev_priv(dev); 1614 struct orinoco_private *priv = ndev_priv(dev);
1633 hermes_t *hw = &priv->hw; 1615 hermes_t *hw = &priv->hw;
1634 int rid = data->flags; 1616 int rid = data->flags;
1635 u16 length; 1617 u16 length;
@@ -1666,7 +1648,7 @@ static int orinoco_ioctl_setscan(struct net_device *dev,
1666 struct iw_point *srq, 1648 struct iw_point *srq,
1667 char *extra) 1649 char *extra)
1668{ 1650{
1669 struct orinoco_private *priv = netdev_priv(dev); 1651 struct orinoco_private *priv = ndev_priv(dev);
1670 hermes_t *hw = &priv->hw; 1652 hermes_t *hw = &priv->hw;
1671 struct iw_scan_req *si = (struct iw_scan_req *) extra; 1653 struct iw_scan_req *si = (struct iw_scan_req *) extra;
1672 int err = 0; 1654 int err = 0;
@@ -1791,7 +1773,7 @@ static inline char *orinoco_translate_scan(struct net_device *dev,
1791 union hermes_scan_info *bss, 1773 union hermes_scan_info *bss,
1792 unsigned long last_scanned) 1774 unsigned long last_scanned)
1793{ 1775{
1794 struct orinoco_private *priv = netdev_priv(dev); 1776 struct orinoco_private *priv = ndev_priv(dev);
1795 u16 capabilities; 1777 u16 capabilities;
1796 u16 channel; 1778 u16 channel;
1797 struct iw_event iwe; /* Temporary buffer */ 1779 struct iw_event iwe; /* Temporary buffer */
@@ -2102,7 +2084,7 @@ static int orinoco_ioctl_getscan(struct net_device *dev,
2102 struct iw_point *srq, 2084 struct iw_point *srq,
2103 char *extra) 2085 char *extra)
2104{ 2086{
2105 struct orinoco_private *priv = netdev_priv(dev); 2087 struct orinoco_private *priv = ndev_priv(dev);
2106 int err = 0; 2088 int err = 0;
2107 unsigned long flags; 2089 unsigned long flags;
2108 char *current_ev = extra; 2090 char *current_ev = extra;
@@ -2180,7 +2162,7 @@ static int orinoco_ioctl_commit(struct net_device *dev,
2180 void *wrqu, 2162 void *wrqu,
2181 char *extra) 2163 char *extra)
2182{ 2164{
2183 struct orinoco_private *priv = netdev_priv(dev); 2165 struct orinoco_private *priv = ndev_priv(dev);
2184 struct hermes *hw = &priv->hw; 2166 struct hermes *hw = &priv->hw;
2185 unsigned long flags; 2167 unsigned long flags;
2186 int err = 0; 2168 int err = 0;
@@ -2257,7 +2239,7 @@ static const struct iw_priv_args orinoco_privtab[] = {
2257 [IW_IOCTL_IDX(id)] = (iw_handler) func 2239 [IW_IOCTL_IDX(id)] = (iw_handler) func
2258static const iw_handler orinoco_handler[] = { 2240static const iw_handler orinoco_handler[] = {
2259 STD_IW_HANDLER(SIOCSIWCOMMIT, orinoco_ioctl_commit), 2241 STD_IW_HANDLER(SIOCSIWCOMMIT, orinoco_ioctl_commit),
2260 STD_IW_HANDLER(SIOCGIWNAME, orinoco_ioctl_getname), 2242 STD_IW_HANDLER(SIOCGIWNAME, cfg80211_wext_giwname),
2261 STD_IW_HANDLER(SIOCSIWFREQ, orinoco_ioctl_setfreq), 2243 STD_IW_HANDLER(SIOCSIWFREQ, orinoco_ioctl_setfreq),
2262 STD_IW_HANDLER(SIOCGIWFREQ, orinoco_ioctl_getfreq), 2244 STD_IW_HANDLER(SIOCGIWFREQ, orinoco_ioctl_getfreq),
2263 STD_IW_HANDLER(SIOCSIWMODE, orinoco_ioctl_setmode), 2245 STD_IW_HANDLER(SIOCSIWMODE, orinoco_ioctl_setmode),