mmc: host: sh_mobile_sdhi: move card_busy from tmio to sdhi
[linux/fpc-iii.git] / drivers / staging / wlan-ng / cfg80211.c
blobf46dfe6b24e813c2ec43740dd18b9e1901c68b99
1 /* cfg80211 Interface for prism2_usb module */
2 #include "hfa384x.h"
3 #include "prism2mgmt.h"
5 /* Prism2 channel/frequency/bitrate declarations */
6 static const struct ieee80211_channel prism2_channels[] = {
7 { .center_freq = 2412 },
8 { .center_freq = 2417 },
9 { .center_freq = 2422 },
10 { .center_freq = 2427 },
11 { .center_freq = 2432 },
12 { .center_freq = 2437 },
13 { .center_freq = 2442 },
14 { .center_freq = 2447 },
15 { .center_freq = 2452 },
16 { .center_freq = 2457 },
17 { .center_freq = 2462 },
18 { .center_freq = 2467 },
19 { .center_freq = 2472 },
20 { .center_freq = 2484 },
23 static const struct ieee80211_rate prism2_rates[] = {
24 { .bitrate = 10 },
25 { .bitrate = 20 },
26 { .bitrate = 55 },
27 { .bitrate = 110 }
30 #define PRISM2_NUM_CIPHER_SUITES 2
31 static const u32 prism2_cipher_suites[PRISM2_NUM_CIPHER_SUITES] = {
32 WLAN_CIPHER_SUITE_WEP40,
33 WLAN_CIPHER_SUITE_WEP104
36 /* prism2 device private data */
37 struct prism2_wiphy_private {
38 wlandevice_t *wlandev;
40 struct ieee80211_supported_band band;
41 struct ieee80211_channel channels[ARRAY_SIZE(prism2_channels)];
42 struct ieee80211_rate rates[ARRAY_SIZE(prism2_rates)];
44 struct cfg80211_scan_request *scan_request;
47 static const void * const prism2_wiphy_privid = &prism2_wiphy_privid;
49 /* Helper Functions */
50 static int prism2_result2err(int prism2_result)
52 int err = 0;
54 switch (prism2_result) {
55 case P80211ENUM_resultcode_invalid_parameters:
56 err = -EINVAL;
57 break;
58 case P80211ENUM_resultcode_implementation_failure:
59 err = -EIO;
60 break;
61 case P80211ENUM_resultcode_not_supported:
62 err = -EOPNOTSUPP;
63 break;
64 default:
65 err = 0;
66 break;
69 return err;
72 static int prism2_domibset_uint32(wlandevice_t *wlandev, u32 did, u32 data)
74 struct p80211msg_dot11req_mibset msg;
75 p80211item_uint32_t *mibitem =
76 (p80211item_uint32_t *)&msg.mibattribute.data;
78 msg.msgcode = DIDmsg_dot11req_mibset;
79 mibitem->did = did;
80 mibitem->data = data;
82 return p80211req_dorequest(wlandev, (u8 *)&msg);
85 static int prism2_domibset_pstr32(wlandevice_t *wlandev,
86 u32 did, u8 len, const u8 *data)
88 struct p80211msg_dot11req_mibset msg;
89 p80211item_pstr32_t *mibitem =
90 (p80211item_pstr32_t *)&msg.mibattribute.data;
92 msg.msgcode = DIDmsg_dot11req_mibset;
93 mibitem->did = did;
94 mibitem->data.len = len;
95 memcpy(mibitem->data.data, data, len);
97 return p80211req_dorequest(wlandev, (u8 *)&msg);
100 /* The interface functions, called by the cfg80211 layer */
101 static int prism2_change_virtual_intf(struct wiphy *wiphy,
102 struct net_device *dev,
103 enum nl80211_iftype type, u32 *flags,
104 struct vif_params *params)
106 wlandevice_t *wlandev = dev->ml_priv;
107 u32 data;
108 int result;
109 int err = 0;
111 switch (type) {
112 case NL80211_IFTYPE_ADHOC:
113 if (wlandev->macmode == WLAN_MACMODE_IBSS_STA)
114 goto exit;
115 wlandev->macmode = WLAN_MACMODE_IBSS_STA;
116 data = 0;
117 break;
118 case NL80211_IFTYPE_STATION:
119 if (wlandev->macmode == WLAN_MACMODE_ESS_STA)
120 goto exit;
121 wlandev->macmode = WLAN_MACMODE_ESS_STA;
122 data = 1;
123 break;
124 default:
125 netdev_warn(dev, "Operation mode: %d not support\n", type);
126 return -EOPNOTSUPP;
129 /* Set Operation mode to the PORT TYPE RID */
130 result = prism2_domibset_uint32(wlandev,
131 DIDmib_p2_p2Static_p2CnfPortType,
132 data);
134 if (result)
135 err = -EFAULT;
137 dev->ieee80211_ptr->iftype = type;
139 exit:
140 return err;
143 static int prism2_add_key(struct wiphy *wiphy, struct net_device *dev,
144 u8 key_index, bool pairwise, const u8 *mac_addr,
145 struct key_params *params)
147 wlandevice_t *wlandev = dev->ml_priv;
148 u32 did;
150 int err = 0;
151 int result = 0;
153 switch (params->cipher) {
154 case WLAN_CIPHER_SUITE_WEP40:
155 case WLAN_CIPHER_SUITE_WEP104:
156 result = prism2_domibset_uint32(wlandev,
157 DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID,
158 key_index);
159 if (result)
160 goto exit;
162 /* send key to driver */
163 switch (key_index) {
164 case 0:
165 did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0;
166 break;
168 case 1:
169 did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1;
170 break;
172 case 2:
173 did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2;
174 break;
176 case 3:
177 did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3;
178 break;
180 default:
181 err = -EINVAL;
182 goto exit;
185 result = prism2_domibset_pstr32(wlandev, did,
186 params->key_len, params->key);
187 if (result)
188 goto exit;
189 break;
191 default:
192 pr_debug("Unsupported cipher suite\n");
193 result = 1;
196 exit:
197 if (result)
198 err = -EFAULT;
200 return err;
203 static int prism2_get_key(struct wiphy *wiphy, struct net_device *dev,
204 u8 key_index, bool pairwise,
205 const u8 *mac_addr, void *cookie,
206 void (*callback)(void *cookie, struct key_params*))
208 wlandevice_t *wlandev = dev->ml_priv;
209 struct key_params params;
210 int len;
212 if (key_index >= NUM_WEPKEYS)
213 return -EINVAL;
215 len = wlandev->wep_keylens[key_index];
216 memset(&params, 0, sizeof(params));
218 if (len == 13)
219 params.cipher = WLAN_CIPHER_SUITE_WEP104;
220 else if (len == 5)
221 params.cipher = WLAN_CIPHER_SUITE_WEP104;
222 else
223 return -ENOENT;
224 params.key_len = len;
225 params.key = wlandev->wep_keys[key_index];
226 params.seq_len = 0;
228 callback(cookie, &params);
230 return 0;
233 static int prism2_del_key(struct wiphy *wiphy, struct net_device *dev,
234 u8 key_index, bool pairwise, const u8 *mac_addr)
236 wlandevice_t *wlandev = dev->ml_priv;
237 u32 did;
238 int err = 0;
239 int result = 0;
241 /* There is no direct way in the hardware (AFAIK) of removing
242 * a key, so we will cheat by setting the key to a bogus value
245 /* send key to driver */
246 switch (key_index) {
247 case 0:
248 did =
249 DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0;
250 break;
252 case 1:
253 did =
254 DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1;
255 break;
257 case 2:
258 did =
259 DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2;
260 break;
262 case 3:
263 did =
264 DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3;
265 break;
267 default:
268 err = -EINVAL;
269 goto exit;
272 result = prism2_domibset_pstr32(wlandev, did, 13, "0000000000000");
274 exit:
275 if (result)
276 err = -EFAULT;
278 return err;
281 static int prism2_set_default_key(struct wiphy *wiphy, struct net_device *dev,
282 u8 key_index, bool unicast, bool multicast)
284 wlandevice_t *wlandev = dev->ml_priv;
286 int err = 0;
287 int result = 0;
289 result = prism2_domibset_uint32(wlandev,
290 DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID,
291 key_index);
293 if (result)
294 err = -EFAULT;
296 return err;
299 static int prism2_get_station(struct wiphy *wiphy, struct net_device *dev,
300 const u8 *mac, struct station_info *sinfo)
302 wlandevice_t *wlandev = dev->ml_priv;
303 struct p80211msg_lnxreq_commsquality quality;
304 int result;
306 memset(sinfo, 0, sizeof(*sinfo));
308 if ((wlandev == NULL) || (wlandev->msdstate != WLAN_MSD_RUNNING))
309 return -EOPNOTSUPP;
311 /* build request message */
312 quality.msgcode = DIDmsg_lnxreq_commsquality;
313 quality.dbm.data = P80211ENUM_truth_true;
314 quality.dbm.status = P80211ENUM_msgitem_status_data_ok;
316 /* send message to nsd */
317 if (wlandev->mlmerequest == NULL)
318 return -EOPNOTSUPP;
320 result = wlandev->mlmerequest(wlandev, (struct p80211msg *)&quality);
322 if (result == 0) {
323 sinfo->txrate.legacy = quality.txrate.data;
324 sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
325 sinfo->signal = quality.level.data;
326 sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
329 return result;
332 static int prism2_scan(struct wiphy *wiphy,
333 struct cfg80211_scan_request *request)
335 struct net_device *dev;
336 struct prism2_wiphy_private *priv = wiphy_priv(wiphy);
337 wlandevice_t *wlandev;
338 struct p80211msg_dot11req_scan msg1;
339 struct p80211msg_dot11req_scan_results msg2;
340 struct cfg80211_bss *bss;
341 struct cfg80211_scan_info info = {};
343 int result;
344 int err = 0;
345 int numbss = 0;
346 int i = 0;
347 u8 ie_buf[46];
348 int ie_len;
350 if (!request)
351 return -EINVAL;
353 dev = request->wdev->netdev;
354 wlandev = dev->ml_priv;
356 if (priv->scan_request && priv->scan_request != request)
357 return -EBUSY;
359 if (wlandev->macmode == WLAN_MACMODE_ESS_AP) {
360 netdev_err(dev, "Can't scan in AP mode\n");
361 return -EOPNOTSUPP;
364 priv->scan_request = request;
366 memset(&msg1, 0x00, sizeof(struct p80211msg_dot11req_scan));
367 msg1.msgcode = DIDmsg_dot11req_scan;
368 msg1.bsstype.data = P80211ENUM_bsstype_any;
370 memset(&msg1.bssid.data.data, 0xFF, sizeof(msg1.bssid.data.data));
371 msg1.bssid.data.len = 6;
373 if (request->n_ssids > 0) {
374 msg1.scantype.data = P80211ENUM_scantype_active;
375 msg1.ssid.data.len = request->ssids->ssid_len;
376 memcpy(msg1.ssid.data.data,
377 request->ssids->ssid, request->ssids->ssid_len);
378 } else {
379 msg1.scantype.data = 0;
381 msg1.probedelay.data = 0;
383 for (i = 0;
384 (i < request->n_channels) && i < ARRAY_SIZE(prism2_channels);
385 i++)
386 msg1.channellist.data.data[i] =
387 ieee80211_frequency_to_channel(
388 request->channels[i]->center_freq);
389 msg1.channellist.data.len = request->n_channels;
391 msg1.maxchanneltime.data = 250;
392 msg1.minchanneltime.data = 200;
394 result = p80211req_dorequest(wlandev, (u8 *)&msg1);
395 if (result) {
396 err = prism2_result2err(msg1.resultcode.data);
397 goto exit;
399 /* Now retrieve scan results */
400 numbss = msg1.numbss.data;
402 for (i = 0; i < numbss; i++) {
403 int freq;
405 memset(&msg2, 0, sizeof(msg2));
406 msg2.msgcode = DIDmsg_dot11req_scan_results;
407 msg2.bssindex.data = i;
409 result = p80211req_dorequest(wlandev, (u8 *)&msg2);
410 if ((result != 0) ||
411 (msg2.resultcode.data != P80211ENUM_resultcode_success)) {
412 break;
415 ie_buf[0] = WLAN_EID_SSID;
416 ie_buf[1] = msg2.ssid.data.len;
417 ie_len = ie_buf[1] + 2;
418 memcpy(&ie_buf[2], &(msg2.ssid.data.data), msg2.ssid.data.len);
419 freq = ieee80211_channel_to_frequency(msg2.dschannel.data,
420 NL80211_BAND_2GHZ);
421 bss = cfg80211_inform_bss(wiphy,
422 ieee80211_get_channel(wiphy, freq),
423 CFG80211_BSS_FTYPE_UNKNOWN,
424 (const u8 *)&(msg2.bssid.data.data),
425 msg2.timestamp.data, msg2.capinfo.data,
426 msg2.beaconperiod.data,
427 ie_buf,
428 ie_len,
429 (msg2.signal.data - 65536) * 100, /* Conversion to signed type */
430 GFP_KERNEL
433 if (!bss) {
434 err = -ENOMEM;
435 goto exit;
438 cfg80211_put_bss(wiphy, bss);
441 if (result)
442 err = prism2_result2err(msg2.resultcode.data);
444 exit:
445 info.aborted = !!(err);
446 cfg80211_scan_done(request, &info);
447 priv->scan_request = NULL;
448 return err;
451 static int prism2_set_wiphy_params(struct wiphy *wiphy, u32 changed)
453 struct prism2_wiphy_private *priv = wiphy_priv(wiphy);
454 wlandevice_t *wlandev = priv->wlandev;
455 u32 data;
456 int result;
457 int err = 0;
459 if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
460 if (wiphy->rts_threshold == -1)
461 data = 2347;
462 else
463 data = wiphy->rts_threshold;
465 result = prism2_domibset_uint32(wlandev,
466 DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold,
467 data);
468 if (result) {
469 err = -EFAULT;
470 goto exit;
474 if (changed & WIPHY_PARAM_FRAG_THRESHOLD) {
475 if (wiphy->frag_threshold == -1)
476 data = 2346;
477 else
478 data = wiphy->frag_threshold;
480 result = prism2_domibset_uint32(wlandev,
481 DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold,
482 data);
483 if (result) {
484 err = -EFAULT;
485 goto exit;
489 exit:
490 return err;
493 static int prism2_connect(struct wiphy *wiphy, struct net_device *dev,
494 struct cfg80211_connect_params *sme)
496 wlandevice_t *wlandev = dev->ml_priv;
497 struct ieee80211_channel *channel = sme->channel;
498 struct p80211msg_lnxreq_autojoin msg_join;
499 u32 did;
500 int length = sme->ssid_len;
501 int chan = -1;
502 int is_wep = (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP40) ||
503 (sme->crypto.cipher_group == WLAN_CIPHER_SUITE_WEP104);
504 int result;
505 int err = 0;
507 /* Set the channel */
508 if (channel) {
509 chan = ieee80211_frequency_to_channel(channel->center_freq);
510 result = prism2_domibset_uint32(wlandev,
511 DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel,
512 chan);
513 if (result)
514 goto exit;
517 /* Set the authorization */
518 if ((sme->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) ||
519 ((sme->auth_type == NL80211_AUTHTYPE_AUTOMATIC) && !is_wep))
520 msg_join.authtype.data = P80211ENUM_authalg_opensystem;
521 else if ((sme->auth_type == NL80211_AUTHTYPE_SHARED_KEY) ||
522 ((sme->auth_type == NL80211_AUTHTYPE_AUTOMATIC) && is_wep))
523 msg_join.authtype.data = P80211ENUM_authalg_sharedkey;
524 else
525 netdev_warn(dev,
526 "Unhandled authorisation type for connect (%d)\n",
527 sme->auth_type);
529 /* Set the encryption - we only support wep */
530 if (is_wep) {
531 if (sme->key) {
532 result = prism2_domibset_uint32(wlandev,
533 DIDmib_dot11smt_dot11PrivacyTable_dot11WEPDefaultKeyID,
534 sme->key_idx);
535 if (result)
536 goto exit;
538 /* send key to driver */
539 switch (sme->key_idx) {
540 case 0:
541 did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey0;
542 break;
544 case 1:
545 did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey1;
546 break;
548 case 2:
549 did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey2;
550 break;
552 case 3:
553 did = DIDmib_dot11smt_dot11WEPDefaultKeysTable_dot11WEPDefaultKey3;
554 break;
556 default:
557 err = -EINVAL;
558 goto exit;
561 result = prism2_domibset_pstr32(wlandev,
562 did, sme->key_len,
563 (u8 *)sme->key);
564 if (result)
565 goto exit;
568 /* Assume we should set privacy invoked and exclude unencrypted
569 * We could possible use sme->privacy here, but the assumption
570 * seems reasonable anyways
572 result = prism2_domibset_uint32(wlandev,
573 DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked,
574 P80211ENUM_truth_true);
575 if (result)
576 goto exit;
578 result = prism2_domibset_uint32(wlandev,
579 DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted,
580 P80211ENUM_truth_true);
581 if (result)
582 goto exit;
584 } else {
585 /* Assume we should unset privacy invoked
586 * and exclude unencrypted
588 result = prism2_domibset_uint32(wlandev,
589 DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked,
590 P80211ENUM_truth_false);
591 if (result)
592 goto exit;
594 result = prism2_domibset_uint32(wlandev,
595 DIDmib_dot11smt_dot11PrivacyTable_dot11ExcludeUnencrypted,
596 P80211ENUM_truth_false);
597 if (result)
598 goto exit;
601 /* Now do the actual join. Note there is no way that I can
602 * see to request a specific bssid
604 msg_join.msgcode = DIDmsg_lnxreq_autojoin;
606 memcpy(msg_join.ssid.data.data, sme->ssid, length);
607 msg_join.ssid.data.len = length;
609 result = p80211req_dorequest(wlandev, (u8 *)&msg_join);
611 exit:
612 if (result)
613 err = -EFAULT;
615 return err;
618 static int prism2_disconnect(struct wiphy *wiphy, struct net_device *dev,
619 u16 reason_code)
621 wlandevice_t *wlandev = dev->ml_priv;
622 struct p80211msg_lnxreq_autojoin msg_join;
623 int result;
624 int err = 0;
626 /* Do a join, with a bogus ssid. Thats the only way I can think of */
627 msg_join.msgcode = DIDmsg_lnxreq_autojoin;
629 memcpy(msg_join.ssid.data.data, "---", 3);
630 msg_join.ssid.data.len = 3;
632 result = p80211req_dorequest(wlandev, (u8 *)&msg_join);
634 if (result)
635 err = -EFAULT;
637 return err;
640 static int prism2_join_ibss(struct wiphy *wiphy, struct net_device *dev,
641 struct cfg80211_ibss_params *params)
643 return -EOPNOTSUPP;
646 static int prism2_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
648 return -EOPNOTSUPP;
651 static int prism2_set_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
652 enum nl80211_tx_power_setting type, int mbm)
654 struct prism2_wiphy_private *priv = wiphy_priv(wiphy);
655 wlandevice_t *wlandev = priv->wlandev;
656 u32 data;
657 int result;
658 int err = 0;
660 if (type == NL80211_TX_POWER_AUTOMATIC)
661 data = 30;
662 else
663 data = MBM_TO_DBM(mbm);
665 result = prism2_domibset_uint32(wlandev,
666 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel,
667 data);
669 if (result) {
670 err = -EFAULT;
671 goto exit;
674 exit:
675 return err;
678 static int prism2_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
679 int *dbm)
681 struct prism2_wiphy_private *priv = wiphy_priv(wiphy);
682 wlandevice_t *wlandev = priv->wlandev;
683 struct p80211msg_dot11req_mibget msg;
684 p80211item_uint32_t *mibitem;
685 int result;
686 int err = 0;
688 mibitem = (p80211item_uint32_t *)&msg.mibattribute.data;
689 msg.msgcode = DIDmsg_dot11req_mibget;
690 mibitem->did =
691 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel;
693 result = p80211req_dorequest(wlandev, (u8 *)&msg);
695 if (result) {
696 err = -EFAULT;
697 goto exit;
700 *dbm = mibitem->data;
702 exit:
703 return err;
706 /* Interface callback functions, passing data back up to the cfg80211 layer */
707 void prism2_connect_result(wlandevice_t *wlandev, u8 failed)
709 u16 status = failed ?
710 WLAN_STATUS_UNSPECIFIED_FAILURE : WLAN_STATUS_SUCCESS;
712 cfg80211_connect_result(wlandev->netdev, wlandev->bssid,
713 NULL, 0, NULL, 0, status, GFP_KERNEL);
716 void prism2_disconnected(wlandevice_t *wlandev)
718 cfg80211_disconnected(wlandev->netdev, 0, NULL,
719 0, false, GFP_KERNEL);
722 void prism2_roamed(wlandevice_t *wlandev)
724 cfg80211_roamed(wlandev->netdev, NULL, wlandev->bssid,
725 NULL, 0, NULL, 0, GFP_KERNEL);
728 /* Structures for declaring wiphy interface */
729 static const struct cfg80211_ops prism2_usb_cfg_ops = {
730 .change_virtual_intf = prism2_change_virtual_intf,
731 .add_key = prism2_add_key,
732 .get_key = prism2_get_key,
733 .del_key = prism2_del_key,
734 .set_default_key = prism2_set_default_key,
735 .get_station = prism2_get_station,
736 .scan = prism2_scan,
737 .set_wiphy_params = prism2_set_wiphy_params,
738 .connect = prism2_connect,
739 .disconnect = prism2_disconnect,
740 .join_ibss = prism2_join_ibss,
741 .leave_ibss = prism2_leave_ibss,
742 .set_tx_power = prism2_set_tx_power,
743 .get_tx_power = prism2_get_tx_power,
746 /* Functions to create/free wiphy interface */
747 static struct wiphy *wlan_create_wiphy(struct device *dev, wlandevice_t *wlandev)
749 struct wiphy *wiphy;
750 struct prism2_wiphy_private *priv;
752 wiphy = wiphy_new(&prism2_usb_cfg_ops, sizeof(*priv));
753 if (!wiphy)
754 return NULL;
756 priv = wiphy_priv(wiphy);
757 priv->wlandev = wlandev;
758 memcpy(priv->channels, prism2_channels, sizeof(prism2_channels));
759 memcpy(priv->rates, prism2_rates, sizeof(prism2_rates));
760 priv->band.channels = priv->channels;
761 priv->band.n_channels = ARRAY_SIZE(prism2_channels);
762 priv->band.bitrates = priv->rates;
763 priv->band.n_bitrates = ARRAY_SIZE(prism2_rates);
764 priv->band.band = NL80211_BAND_2GHZ;
765 priv->band.ht_cap.ht_supported = false;
766 wiphy->bands[NL80211_BAND_2GHZ] = &priv->band;
768 set_wiphy_dev(wiphy, dev);
769 wiphy->privid = prism2_wiphy_privid;
770 wiphy->max_scan_ssids = 1;
771 wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION)
772 | BIT(NL80211_IFTYPE_ADHOC);
773 wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
774 wiphy->n_cipher_suites = PRISM2_NUM_CIPHER_SUITES;
775 wiphy->cipher_suites = prism2_cipher_suites;
777 if (wiphy_register(wiphy) < 0) {
778 wiphy_free(wiphy);
779 return NULL;
782 return wiphy;
785 static void wlan_free_wiphy(struct wiphy *wiphy)
787 wiphy_unregister(wiphy);
788 wiphy_free(wiphy);