aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/wext.c
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2009-10-06 22:20:28 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-07 16:39:53 -0400
commit63f275df64dc69a46bbc21e6a68d5506d2da9c51 (patch)
tree4d21f47420f0ef155e9e461512d3c6354019c31c /drivers/net/wireless/libertas/wext.c
parent536b3a7a10c8fd39576a0602bfeca9bbd04658a6 (diff)
libertas: Use lbs_is_cmd_allowed() check in command handling routines.
lbs_is_cmd_allowed() check is added in __lbs_cmd_async() and lbs_prepare_and_send_command(). The check is removed from other places. Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Acked-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.c133
1 files changed, 0 insertions, 133 deletions
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 38a451edb703..69dd19bf9558 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -46,32 +46,6 @@ static inline void lbs_cancel_association_work(struct lbs_private *priv)
46} 46}
47 47
48/** 48/**
49 * @brief This function checks if the command is allowed.
50 *
51 * @param priv A pointer to lbs_private structure
52 * @return allowed or not allowed.
53 */
54
55int lbs_is_cmd_allowed(struct lbs_private *priv)
56{
57 int ret = 1;
58
59 lbs_deb_enter(LBS_DEB_WEXT);
60
61 if (!priv->is_auto_deep_sleep_enabled) {
62 if (priv->is_deep_sleep) {
63 lbs_deb_wext("IOCTLS called when station"
64 "is in deep sleep\n");
65 ret = 0;
66 }
67 }
68
69 lbs_deb_leave(LBS_DEB_WEXT);
70 return ret;
71}
72
73
74/**
75 * @brief Find the channel frequency power info with specific channel 49 * @brief Find the channel frequency power info with specific channel
76 * 50 *
77 * @param priv A pointer to struct lbs_private structure 51 * @param priv A pointer to struct lbs_private structure
@@ -193,11 +167,6 @@ static int lbs_get_freq(struct net_device *dev, struct iw_request_info *info,
193 167
194 lbs_deb_enter(LBS_DEB_WEXT); 168 lbs_deb_enter(LBS_DEB_WEXT);
195 169
196 if (!lbs_is_cmd_allowed(priv)) {
197 lbs_deb_leave(LBS_DEB_WEXT);
198 return -EBUSY;
199 }
200
201 cfp = lbs_find_cfp_by_band_and_channel(priv, 0, 170 cfp = lbs_find_cfp_by_band_and_channel(priv, 0,
202 priv->curbssparams.channel); 171 priv->curbssparams.channel);
203 172
@@ -308,12 +277,6 @@ static int lbs_set_rts(struct net_device *dev, struct iw_request_info *info,
308 277
309 lbs_deb_enter(LBS_DEB_WEXT); 278 lbs_deb_enter(LBS_DEB_WEXT);
310 279
311 if (!lbs_is_cmd_allowed(priv)) {
312 ret = -EBUSY;
313 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
314 return ret;
315 }
316
317 if (vwrq->disabled) 280 if (vwrq->disabled)
318 val = MRVDRV_RTS_MAX_VALUE; 281 val = MRVDRV_RTS_MAX_VALUE;
319 282
@@ -335,11 +298,6 @@ static int lbs_get_rts(struct net_device *dev, struct iw_request_info *info,
335 298
336 lbs_deb_enter(LBS_DEB_WEXT); 299 lbs_deb_enter(LBS_DEB_WEXT);
337 300
338 if (!lbs_is_cmd_allowed(priv)) {
339 ret = -EBUSY;
340 goto out;
341 }
342
343 ret = lbs_get_snmp_mib(priv, SNMP_MIB_OID_RTS_THRESHOLD, &val); 301 ret = lbs_get_snmp_mib(priv, SNMP_MIB_OID_RTS_THRESHOLD, &val);
344 if (ret) 302 if (ret)
345 goto out; 303 goto out;
@@ -362,12 +320,6 @@ static int lbs_set_frag(struct net_device *dev, struct iw_request_info *info,
362 320
363 lbs_deb_enter(LBS_DEB_WEXT); 321 lbs_deb_enter(LBS_DEB_WEXT);
364 322
365 if (!lbs_is_cmd_allowed(priv)) {
366 ret = -EBUSY;
367 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
368 return ret;
369 }
370
371 if (vwrq->disabled) 323 if (vwrq->disabled)
372 val = MRVDRV_FRAG_MAX_VALUE; 324 val = MRVDRV_FRAG_MAX_VALUE;
373 325
@@ -389,11 +341,6 @@ static int lbs_get_frag(struct net_device *dev, struct iw_request_info *info,
389 341
390 lbs_deb_enter(LBS_DEB_WEXT); 342 lbs_deb_enter(LBS_DEB_WEXT);
391 343
392 if (!lbs_is_cmd_allowed(priv)) {
393 ret = -EBUSY;
394 goto out;
395 }
396
397 ret = lbs_get_snmp_mib(priv, SNMP_MIB_OID_FRAG_THRESHOLD, &val); 344 ret = lbs_get_snmp_mib(priv, SNMP_MIB_OID_FRAG_THRESHOLD, &val);
398 if (ret) 345 if (ret)
399 goto out; 346 goto out;
@@ -443,11 +390,6 @@ static int lbs_get_txpow(struct net_device *dev,
443 390
444 lbs_deb_enter(LBS_DEB_WEXT); 391 lbs_deb_enter(LBS_DEB_WEXT);
445 392
446 if (!lbs_is_cmd_allowed(priv)) {
447 ret = -EBUSY;
448 goto out;
449 }
450
451 if (!priv->radio_on) { 393 if (!priv->radio_on) {
452 lbs_deb_wext("tx power off\n"); 394 lbs_deb_wext("tx power off\n");
453 vwrq->value = 0; 395 vwrq->value = 0;
@@ -481,11 +423,6 @@ static int lbs_set_retry(struct net_device *dev, struct iw_request_info *info,
481 423
482 lbs_deb_enter(LBS_DEB_WEXT); 424 lbs_deb_enter(LBS_DEB_WEXT);
483 425
484 if (!lbs_is_cmd_allowed(priv)) {
485 ret = -EBUSY;
486 goto out;
487 }
488
489 if ((vwrq->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT) 426 if ((vwrq->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT)
490 return -EOPNOTSUPP; 427 return -EOPNOTSUPP;
491 428
@@ -534,11 +471,6 @@ static int lbs_get_retry(struct net_device *dev, struct iw_request_info *info,
534 471
535 lbs_deb_enter(LBS_DEB_WEXT); 472 lbs_deb_enter(LBS_DEB_WEXT);
536 473
537 if (!lbs_is_cmd_allowed(priv)) {
538 ret = -EBUSY;
539 goto out;
540 }
541
542 vwrq->disabled = 0; 474 vwrq->disabled = 0;
543 475
544 if (vwrq->flags & IW_RETRY_LONG) { 476 if (vwrq->flags & IW_RETRY_LONG) {
@@ -907,9 +839,6 @@ static struct iw_statistics *lbs_get_wireless_stats(struct net_device *dev)
907 839
908 lbs_deb_enter(LBS_DEB_WEXT); 840 lbs_deb_enter(LBS_DEB_WEXT);
909 841
910 if (!lbs_is_cmd_allowed(priv))
911 return NULL;
912
913 priv->wstats.status = priv->mode; 842 priv->wstats.status = priv->mode;
914 843
915 /* If we're not associated, all quality values are meaningless */ 844 /* If we're not associated, all quality values are meaningless */
@@ -1010,12 +939,6 @@ static int lbs_set_freq(struct net_device *dev, struct iw_request_info *info,
1010 939
1011 lbs_deb_enter(LBS_DEB_WEXT); 940 lbs_deb_enter(LBS_DEB_WEXT);
1012 941
1013 if (!lbs_is_cmd_allowed(priv)) {
1014 ret = -EBUSY;
1015 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1016 return ret;
1017 }
1018
1019 mutex_lock(&priv->lock); 942 mutex_lock(&priv->lock);
1020 assoc_req = lbs_get_association_request(priv); 943 assoc_req = lbs_get_association_request(priv);
1021 if (!assoc_req) { 944 if (!assoc_req) {
@@ -1125,11 +1048,6 @@ static int lbs_set_rate(struct net_device *dev, struct iw_request_info *info,
1125 1048
1126 lbs_deb_enter(LBS_DEB_WEXT); 1049 lbs_deb_enter(LBS_DEB_WEXT);
1127 1050
1128 if (!lbs_is_cmd_allowed(priv)) {
1129 ret = -EBUSY;
1130 goto out;
1131 }
1132
1133 lbs_deb_wext("vwrq->value %d\n", vwrq->value); 1051 lbs_deb_wext("vwrq->value %d\n", vwrq->value);
1134 lbs_deb_wext("vwrq->fixed %d\n", vwrq->fixed); 1052 lbs_deb_wext("vwrq->fixed %d\n", vwrq->fixed);
1135 1053
@@ -1188,11 +1106,6 @@ static int lbs_get_rate(struct net_device *dev, struct iw_request_info *info,
1188 1106
1189 lbs_deb_enter(LBS_DEB_WEXT); 1107 lbs_deb_enter(LBS_DEB_WEXT);
1190 1108
1191 if (!lbs_is_cmd_allowed(priv)) {
1192 lbs_deb_leave(LBS_DEB_WEXT);
1193 return -EBUSY;
1194 }
1195
1196 if (priv->connect_status == LBS_CONNECTED) { 1109 if (priv->connect_status == LBS_CONNECTED) {
1197 vwrq->value = priv->cur_rate * 500000; 1110 vwrq->value = priv->cur_rate * 500000;
1198 1111
@@ -1219,11 +1132,6 @@ static int lbs_set_mode(struct net_device *dev,
1219 1132
1220 lbs_deb_enter(LBS_DEB_WEXT); 1133 lbs_deb_enter(LBS_DEB_WEXT);
1221 1134
1222 if (!lbs_is_cmd_allowed(priv)) {
1223 ret = -EBUSY;
1224 goto out;
1225 }
1226
1227 if ( (*uwrq != IW_MODE_ADHOC) 1135 if ( (*uwrq != IW_MODE_ADHOC)
1228 && (*uwrq != IW_MODE_INFRA) 1136 && (*uwrq != IW_MODE_INFRA)
1229 && (*uwrq != IW_MODE_AUTO)) { 1137 && (*uwrq != IW_MODE_AUTO)) {
@@ -1465,12 +1373,6 @@ static int lbs_set_encode(struct net_device *dev,
1465 1373
1466 lbs_deb_enter(LBS_DEB_WEXT); 1374 lbs_deb_enter(LBS_DEB_WEXT);
1467 1375
1468 if (!lbs_is_cmd_allowed(priv)) {
1469 ret = -EBUSY;
1470 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1471 return ret;
1472 }
1473
1474 mutex_lock(&priv->lock); 1376 mutex_lock(&priv->lock);
1475 assoc_req = lbs_get_association_request(priv); 1377 assoc_req = lbs_get_association_request(priv);
1476 if (!assoc_req) { 1378 if (!assoc_req) {
@@ -1654,12 +1556,6 @@ static int lbs_set_encodeext(struct net_device *dev,
1654 1556
1655 lbs_deb_enter(LBS_DEB_WEXT); 1557 lbs_deb_enter(LBS_DEB_WEXT);
1656 1558
1657 if (!lbs_is_cmd_allowed(priv)) {
1658 ret = -EBUSY;
1659 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1660 return ret;
1661 }
1662
1663 mutex_lock(&priv->lock); 1559 mutex_lock(&priv->lock);
1664 assoc_req = lbs_get_association_request(priv); 1560 assoc_req = lbs_get_association_request(priv);
1665 if (!assoc_req) { 1561 if (!assoc_req) {
@@ -1872,12 +1768,6 @@ static int lbs_set_auth(struct net_device *dev,
1872 1768
1873 lbs_deb_enter(LBS_DEB_WEXT); 1769 lbs_deb_enter(LBS_DEB_WEXT);
1874 1770
1875 if (!lbs_is_cmd_allowed(priv)) {
1876 ret = -EBUSY;
1877 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1878 return ret;
1879 }
1880
1881 mutex_lock(&priv->lock); 1771 mutex_lock(&priv->lock);
1882 assoc_req = lbs_get_association_request(priv); 1772 assoc_req = lbs_get_association_request(priv);
1883 if (!assoc_req) { 1773 if (!assoc_req) {
@@ -1980,12 +1870,6 @@ static int lbs_get_auth(struct net_device *dev,
1980 1870
1981 lbs_deb_enter(LBS_DEB_WEXT); 1871 lbs_deb_enter(LBS_DEB_WEXT);
1982 1872
1983 if (!lbs_is_cmd_allowed(priv)) {
1984 ret = -EBUSY;
1985 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1986 return ret;
1987 }
1988
1989 switch (dwrq->flags & IW_AUTH_INDEX) { 1873 switch (dwrq->flags & IW_AUTH_INDEX) {
1990 case IW_AUTH_KEY_MGMT: 1874 case IW_AUTH_KEY_MGMT:
1991 dwrq->value = priv->secinfo.key_mgmt; 1875 dwrq->value = priv->secinfo.key_mgmt;
@@ -2028,11 +1912,6 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info,
2028 1912
2029 lbs_deb_enter(LBS_DEB_WEXT); 1913 lbs_deb_enter(LBS_DEB_WEXT);
2030 1914
2031 if (!lbs_is_cmd_allowed(priv)) {
2032 ret = -EBUSY;
2033 goto out;
2034 }
2035
2036 if (vwrq->disabled) { 1915 if (vwrq->disabled) {
2037 lbs_set_radio(priv, RADIO_PREAMBLE_AUTO, 0); 1916 lbs_set_radio(priv, RADIO_PREAMBLE_AUTO, 0);
2038 goto out; 1917 goto out;
@@ -2152,12 +2031,6 @@ static int lbs_set_essid(struct net_device *dev, struct iw_request_info *info,
2152 2031
2153 lbs_deb_enter(LBS_DEB_WEXT); 2032 lbs_deb_enter(LBS_DEB_WEXT);
2154 2033
2155 if (!lbs_is_cmd_allowed(priv)) {
2156 ret = -EBUSY;
2157 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
2158 return ret;
2159 }
2160
2161 if (!priv->radio_on) { 2034 if (!priv->radio_on) {
2162 ret = -EINVAL; 2035 ret = -EINVAL;
2163 goto out; 2036 goto out;
@@ -2285,12 +2158,6 @@ static int lbs_set_wap(struct net_device *dev, struct iw_request_info *info,
2285 2158
2286 lbs_deb_enter(LBS_DEB_WEXT); 2159 lbs_deb_enter(LBS_DEB_WEXT);
2287 2160
2288 if (!lbs_is_cmd_allowed(priv)) {
2289 ret = -EBUSY;
2290 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
2291 return ret;
2292 }
2293
2294 if (!priv->radio_on) 2161 if (!priv->radio_on)
2295 return -EINVAL; 2162 return -EINVAL;
2296 2163