aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2011-12-21 02:47:20 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-12-21 15:06:13 -0500
commit43906cdb916a9059c34d02831d293fbd4105ed8f (patch)
treec1c9f29a7e582eaa9922ef2b0a5c96abfa8dff2a
parentcf9bc5bae7fee420cebcfdbd7f59bb72b5f8ed1b (diff)
mwifiex: remove redundant band config code
struct mwifiex_ds_band_cfg and mwifiex_set_radio_band_cfg() routine are unnecessary. It can be done with simple equivalant code. Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c49
-rw-r--r--drivers/net/wireless/mwifiex/ioctl.h7
-rw-r--r--drivers/net/wireless/mwifiex/main.h2
-rw-r--r--drivers/net/wireless/mwifiex/sta_ioctl.c61
4 files changed, 24 insertions, 95 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 787dbe2aa408..64bf64051aa9 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -331,37 +331,38 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
331 enum nl80211_channel_type channel_type) 331 enum nl80211_channel_type channel_type)
332{ 332{
333 struct mwifiex_chan_freq_power cfp; 333 struct mwifiex_chan_freq_power cfp;
334 struct mwifiex_ds_band_cfg band_cfg;
335 u32 config_bands = 0; 334 u32 config_bands = 0;
336 struct wiphy *wiphy = priv->wdev->wiphy; 335 struct wiphy *wiphy = priv->wdev->wiphy;
336 struct mwifiex_adapter *adapter = priv->adapter;
337 337
338 if (chan) { 338 if (chan) {
339 memset(&band_cfg, 0, sizeof(band_cfg));
340 /* Set appropriate bands */ 339 /* Set appropriate bands */
341 if (chan->band == IEEE80211_BAND_2GHZ) 340 if (chan->band == IEEE80211_BAND_2GHZ)
342 config_bands = BAND_B | BAND_G | BAND_GN; 341 config_bands = BAND_B | BAND_G | BAND_GN;
343 else 342 else
344 config_bands = BAND_AN | BAND_A; 343 config_bands = BAND_AN | BAND_A;
345 if (priv->bss_mode == NL80211_IFTYPE_STATION
346 || priv->bss_mode == NL80211_IFTYPE_UNSPECIFIED) {
347 band_cfg.config_bands = config_bands;
348 } else if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
349 band_cfg.config_bands = config_bands;
350 band_cfg.adhoc_start_band = config_bands;
351 }
352 344
353 band_cfg.sec_chan_offset = 345 if (!((config_bands | adapter->fw_bands) &
346 ~adapter->fw_bands)) {
347 adapter->config_bands = config_bands;
348 if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
349 adapter->adhoc_start_band = config_bands;
350 if ((config_bands & BAND_GN) ||
351 (config_bands & BAND_AN))
352 adapter->adhoc_11n_enabled = true;
353 else
354 adapter->adhoc_11n_enabled = false;
355 }
356 }
357 adapter->chan_offset =
354 mwifiex_cfg80211_channel_type_to_mwifiex_channels 358 mwifiex_cfg80211_channel_type_to_mwifiex_channels
355 (channel_type); 359 (channel_type);
356 360
357 if (mwifiex_set_radio_band_cfg(priv, &band_cfg))
358 return -EFAULT;
359
360 mwifiex_send_domain_info_cmd_fw(wiphy); 361 mwifiex_send_domain_info_cmd_fw(wiphy);
361 } 362 }
362 363
363 wiphy_dbg(wiphy, "info: setting band %d, channel offset %d and " 364 wiphy_dbg(wiphy, "info: setting band %d, channel offset %d and "
364 "mode %d\n", config_bands, band_cfg.sec_chan_offset, 365 "mode %d\n", config_bands, adapter->chan_offset,
365 priv->bss_mode); 366 priv->bss_mode);
366 if (!chan) 367 if (!chan)
367 return 0; 368 return 0;
@@ -697,9 +698,9 @@ static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy,
697 const u8 *peer, 698 const u8 *peer,
698 const struct cfg80211_bitrate_mask *mask) 699 const struct cfg80211_bitrate_mask *mask)
699{ 700{
700 struct mwifiex_ds_band_cfg band_cfg;
701 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 701 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
702 int index = 0, mode = 0, i; 702 int index = 0, mode = 0, i;
703 struct mwifiex_adapter *adapter = priv->adapter;
703 704
704 /* Currently only 2.4GHz is supported */ 705 /* Currently only 2.4GHz is supported */
705 for (i = 0; i < mwifiex_band_2ghz.n_bitrates; i++) { 706 for (i = 0; i < mwifiex_band_2ghz.n_bitrates; i++) {
@@ -721,16 +722,14 @@ static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy,
721 mode |= BAND_B; 722 mode |= BAND_B;
722 } 723 }
723 724
724 memset(&band_cfg, 0, sizeof(band_cfg)); 725 if (!((mode | adapter->fw_bands) & ~adapter->fw_bands)) {
725 band_cfg.config_bands = mode; 726 adapter->config_bands = mode;
726 727 if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
727 if (priv->bss_mode == NL80211_IFTYPE_ADHOC) 728 adapter->adhoc_start_band = mode;
728 band_cfg.adhoc_start_band = mode; 729 adapter->adhoc_11n_enabled = false;
729 730 }
730 band_cfg.sec_chan_offset = NO_SEC_CHANNEL; 731 }
731 732 adapter->chan_offset = NO_SEC_CHANNEL;
732 if (mwifiex_set_radio_band_cfg(priv, &band_cfg))
733 return -EFAULT;
734 733
735 wiphy_debug(wiphy, "info: device configured in 802.11%s%s mode\n", 734 wiphy_debug(wiphy, "info: device configured in 802.11%s%s mode\n",
736 (mode & BAND_B) ? "b" : "", 735 (mode & BAND_B) ? "b" : "",
diff --git a/drivers/net/wireless/mwifiex/ioctl.h b/drivers/net/wireless/mwifiex/ioctl.h
index e0b68e7c8ca2..eb76b7b749ad 100644
--- a/drivers/net/wireless/mwifiex/ioctl.h
+++ b/drivers/net/wireless/mwifiex/ioctl.h
@@ -66,13 +66,6 @@ enum {
66#define SEC_CHANNEL_ABOVE 1 66#define SEC_CHANNEL_ABOVE 1
67#define SEC_CHANNEL_BELOW 3 67#define SEC_CHANNEL_BELOW 3
68 68
69struct mwifiex_ds_band_cfg {
70 u32 config_bands;
71 u32 adhoc_start_band;
72 u32 adhoc_channel;
73 u32 sec_chan_offset;
74};
75
76enum { 69enum {
77 ADHOC_IDLE, 70 ADHOC_IDLE,
78 ADHOC_STARTED, 71 ADHOC_STARTED,
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index 9207fc64641e..d659650a1379 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -954,8 +954,6 @@ int mwifiex_main_process(struct mwifiex_adapter *);
954 954
955int mwifiex_bss_set_channel(struct mwifiex_private *, 955int mwifiex_bss_set_channel(struct mwifiex_private *,
956 struct mwifiex_chan_freq_power *cfp); 956 struct mwifiex_chan_freq_power *cfp);
957int mwifiex_set_radio_band_cfg(struct mwifiex_private *,
958 struct mwifiex_ds_band_cfg *);
959int mwifiex_get_bss_info(struct mwifiex_private *, 957int mwifiex_get_bss_info(struct mwifiex_private *,
960 struct mwifiex_bss_info *); 958 struct mwifiex_bss_info *);
961int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv, 959int mwifiex_fill_new_bss_desc(struct mwifiex_private *priv,
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index 6d990c798a20..e40196dfdea0 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -472,67 +472,6 @@ int mwifiex_get_bss_info(struct mwifiex_private *priv,
472} 472}
473 473
474/* 474/*
475 * The function sets band configurations.
476 *
477 * it performs extra checks to make sure the Ad-Hoc
478 * band and channel are compatible. Otherwise it returns an error.
479 *
480 */
481int mwifiex_set_radio_band_cfg(struct mwifiex_private *priv,
482 struct mwifiex_ds_band_cfg *radio_cfg)
483{
484 struct mwifiex_adapter *adapter = priv->adapter;
485 u8 infra_band, adhoc_band;
486 u32 adhoc_channel;
487
488 infra_band = (u8) radio_cfg->config_bands;
489 adhoc_band = (u8) radio_cfg->adhoc_start_band;
490 adhoc_channel = radio_cfg->adhoc_channel;
491
492 /* SET Infra band */
493 if ((infra_band | adapter->fw_bands) & ~adapter->fw_bands)
494 return -1;
495
496 adapter->config_bands = infra_band;
497
498 /* SET Ad-hoc Band */
499 if ((adhoc_band | adapter->fw_bands) & ~adapter->fw_bands)
500 return -1;
501
502 if (adhoc_band)
503 adapter->adhoc_start_band = adhoc_band;
504 adapter->chan_offset = (u8) radio_cfg->sec_chan_offset;
505 /*
506 * If no adhoc_channel is supplied verify if the existing adhoc
507 * channel compiles with new adhoc_band
508 */
509 if (!adhoc_channel) {
510 if (!mwifiex_get_cfp_by_band_and_channel_from_cfg80211
511 (priv, adapter->adhoc_start_band,
512 priv->adhoc_channel)) {
513 /* Pass back the default channel */
514 radio_cfg->adhoc_channel = DEFAULT_AD_HOC_CHANNEL;
515 if ((adapter->adhoc_start_band & BAND_A)
516 || (adapter->adhoc_start_band & BAND_AN))
517 radio_cfg->adhoc_channel =
518 DEFAULT_AD_HOC_CHANNEL_A;
519 }
520 } else { /* Retrurn error if adhoc_band and
521 adhoc_channel combination is invalid */
522 if (!mwifiex_get_cfp_by_band_and_channel_from_cfg80211
523 (priv, adapter->adhoc_start_band, (u16) adhoc_channel))
524 return -1;
525 priv->adhoc_channel = (u8) adhoc_channel;
526 }
527 if ((adhoc_band & BAND_GN) || (adhoc_band & BAND_AN))
528 adapter->adhoc_11n_enabled = true;
529 else
530 adapter->adhoc_11n_enabled = false;
531
532 return 0;
533}
534
535/*
536 * The function disables auto deep sleep mode. 475 * The function disables auto deep sleep mode.
537 */ 476 */
538int mwifiex_disable_auto_ds(struct mwifiex_private *priv) 477int mwifiex_disable_auto_ds(struct mwifiex_private *priv)