aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/wext.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-05-10 22:58:02 -0400
committerJohn W. Linville <linville@tuxdriver.com>2007-05-11 14:54:54 -0400
commit0dc5a29044d56912bf0d4e5cd19127f82b90c29c (patch)
tree6b9432572a96232da24314b3fa6924d63042028e /drivers/net/wireless/libertas/wext.c
parent889c05bdf3056b029b9fa95096eac4f0dfd3fb6f (diff)
[PATCH] libertas: remove WLAN_802_11_NETWORK_INFRASTRUCTURE enum
Use standard IW_MODE_* constants instead. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/wext.c')
-rw-r--r--drivers/net/wireless/libertas/wext.c65
1 files changed, 16 insertions, 49 deletions
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 62d92ff9fc1c..18629af33282 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -233,7 +233,7 @@ static int changeadhocchannel(wlan_private * priv, int channel)
233 233
234 // find out the BSSID that matches the current SSID 234 // find out the BSSID that matches the current SSID
235 i = libertas_find_SSID_in_list(adapter, &curadhocssid, NULL, 235 i = libertas_find_SSID_in_list(adapter, &curadhocssid, NULL,
236 wlan802_11ibss); 236 IW_MODE_ADHOC);
237 237
238 if (i >= 0) { 238 if (i >= 0) {
239 lbs_pr_debug(1, "SSID found at %d in List," 239 lbs_pr_debug(1, "SSID found at %d in List,"
@@ -316,13 +316,11 @@ static int get_active_data_rates(wlan_adapter * adapter,
316 ENTER(); 316 ENTER();
317 317
318 if (adapter->connect_status != libertas_connected) { 318 if (adapter->connect_status != libertas_connected) {
319 if (adapter->inframode == wlan802_11infrastructure) { 319 if (adapter->mode == IW_MODE_INFRA) {
320 //Infra. mode
321 lbs_pr_debug(1, "Infra\n"); 320 lbs_pr_debug(1, "Infra\n");
322 k = copyrates(rates, k, libertas_supported_rates, 321 k = copyrates(rates, k, libertas_supported_rates,
323 sizeof(libertas_supported_rates)); 322 sizeof(libertas_supported_rates));
324 } else { 323 } else {
325 //ad-hoc mode
326 lbs_pr_debug(1, "Adhoc G\n"); 324 lbs_pr_debug(1, "Adhoc G\n");
327 k = copyrates(rates, k, libertas_adhoc_rates_g, 325 k = copyrates(rates, k, libertas_adhoc_rates_g,
328 sizeof(libertas_adhoc_rates_g)); 326 sizeof(libertas_adhoc_rates_g));
@@ -586,20 +584,7 @@ static int wlan_get_mode(struct net_device *dev,
586 584
587 ENTER(); 585 ENTER();
588 586
589 switch (adapter->inframode) { 587 *uwrq = adapter->mode;
590 case wlan802_11ibss:
591 *uwrq = IW_MODE_ADHOC;
592 break;
593
594 case wlan802_11infrastructure:
595 *uwrq = IW_MODE_INFRA;
596 break;
597
598 default:
599 case wlan802_11autounknown:
600 *uwrq = IW_MODE_AUTO;
601 break;
602 }
603 588
604 LEAVE(); 589 LEAVE();
605 return 0; 590 return 0;
@@ -1417,7 +1402,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
1417 1402
1418 ENTER(); 1403 ENTER();
1419 1404
1420 priv->wstats.status = adapter->inframode; 1405 priv->wstats.status = adapter->mode;
1421 1406
1422 /* If we're not associated, all quality values are meaningless */ 1407 /* If we're not associated, all quality values are meaningless */
1423 if (adapter->connect_status != libertas_connected) 1408 if (adapter->connect_status != libertas_connected)
@@ -1551,7 +1536,7 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
1551 if (!cfp) { 1536 if (!cfp) {
1552 rc = -EINVAL; 1537 rc = -EINVAL;
1553 } else { 1538 } else {
1554 if (adapter->inframode == wlan802_11ibss) { 1539 if (adapter->mode == IW_MODE_ADHOC) {
1555 rc = changeadhocchannel(priv, channel); 1540 rc = changeadhocchannel(priv, channel);
1556 /* If station is WEP enabled, send the 1541 /* If station is WEP enabled, send the
1557 * command to set WEP in firmware 1542 * command to set WEP in firmware
@@ -1698,49 +1683,31 @@ static int wlan_set_mode(struct net_device *dev,
1698 wlan_private *priv = dev->priv; 1683 wlan_private *priv = dev->priv;
1699 wlan_adapter *adapter = priv->adapter; 1684 wlan_adapter *adapter = priv->adapter;
1700 struct assoc_request * assoc_req; 1685 struct assoc_request * assoc_req;
1701 enum WLAN_802_11_NETWORK_INFRASTRUCTURE new_mode;
1702 1686
1703 ENTER(); 1687 ENTER();
1704 1688
1705 switch (*uwrq) { 1689 if ( (*uwrq != IW_MODE_ADHOC)
1706 case IW_MODE_ADHOC: 1690 && (*uwrq != IW_MODE_INFRA)
1707 lbs_pr_debug(1, "Wanted mode is ad-hoc: current datarate=%#x\n", 1691 && (*uwrq != IW_MODE_AUTO)) {
1708 adapter->datarate); 1692 lbs_pr_debug(1, "Invalid mode: 0x%x\n", *uwrq);
1709 new_mode = wlan802_11ibss; 1693 ret = -EINVAL;
1710 adapter->adhocchannel = DEFAULT_AD_HOC_CHANNEL; 1694 goto out;
1711 break;
1712
1713 case IW_MODE_INFRA:
1714 lbs_pr_debug(1, "Wanted mode is Infrastructure\n");
1715 new_mode = wlan802_11infrastructure;
1716 break;
1717
1718 case IW_MODE_AUTO:
1719 lbs_pr_debug(1, "Wanted mode is Auto\n");
1720 new_mode = wlan802_11autounknown;
1721 break;
1722
1723 default:
1724 lbs_pr_debug(1, "Wanted mode is Unknown: 0x%x\n", *uwrq);
1725 return -EINVAL;
1726 } 1695 }
1727 1696
1728 mutex_lock(&adapter->lock); 1697 mutex_lock(&adapter->lock);
1729 assoc_req = wlan_get_association_request(adapter); 1698 assoc_req = wlan_get_association_request(adapter);
1730 if (!assoc_req) { 1699 if (!assoc_req) {
1731 ret = -ENOMEM; 1700 ret = -ENOMEM;
1701 wlan_cancel_association_work(priv);
1732 } else { 1702 } else {
1733 assoc_req->mode = new_mode; 1703 assoc_req->mode = *uwrq;
1734 }
1735
1736 if (ret == 0) {
1737 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); 1704 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags);
1738 wlan_postpone_association_work(priv); 1705 wlan_postpone_association_work(priv);
1739 } else { 1706 lbs_pr_debug(1, "Switching to mode: 0x%x\n", *uwrq);
1740 wlan_cancel_association_work(priv);
1741 } 1707 }
1742 mutex_unlock(&adapter->lock); 1708 mutex_unlock(&adapter->lock);
1743 1709
1710out:
1744 LEAVE(); 1711 LEAVE();
1745 return ret; 1712 return ret;
1746} 1713}
@@ -2037,7 +2004,7 @@ static int wlan_get_encodeext(struct net_device *dev,
2037 2004
2038 if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY && 2005 if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY &&
2039 ext->alg != IW_ENCODE_ALG_WEP) { 2006 ext->alg != IW_ENCODE_ALG_WEP) {
2040 if (index != 0 || adapter->inframode != wlan802_11infrastructure) 2007 if (index != 0 || adapter->mode != IW_MODE_INFRA)
2041 goto out; 2008 goto out;
2042 } 2009 }
2043 2010