aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2010-02-17 07:54:08 -0500
committerReinette Chatre <reinette.chatre@intel.com>2010-03-09 19:06:06 -0500
commitb55e75ed926ded110293b0d1e24eb6a878883115 (patch)
tree8d8d8661b7e8044e89677d4c7c2f6d92451239c5 /drivers/net
parent76c9cc18fd2c8cfa5a7f66d5496d469db00eaf54 (diff)
iwlwifi: remove STATUS_MODE_PENDING
Since rfkill integration, mac80211 can no longer add an interface while the hardware is not ready, so STATUS_MODE_PENDING can never be set. Also, remove another superfluous channel sanity check and return the commit_rxon return value in case it failed. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c53
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c3
5 files changed, 19 insertions, 44 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index b07c013e273..6c816d9b524 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -2144,9 +2144,6 @@ static void iwl_alive_start(struct iwl_priv *priv)
2144 2144
2145 iwl_power_update_mode(priv, true); 2145 iwl_power_update_mode(priv, true);
2146 2146
2147 if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status))
2148 iwl_set_mode(priv, priv->iw_mode);
2149
2150 return; 2147 return;
2151 2148
2152 restart: 2149 restart:
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 5fa1da1f59c..a962fb3cb35 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -2275,23 +2275,9 @@ int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
2275} 2275}
2276EXPORT_SYMBOL(iwl_mac_beacon_update); 2276EXPORT_SYMBOL(iwl_mac_beacon_update);
2277 2277
2278int iwl_set_mode(struct iwl_priv *priv, int mode) 2278static int iwl_set_mode(struct iwl_priv *priv, struct ieee80211_vif *vif)
2279{ 2279{
2280 if (mode == NL80211_IFTYPE_ADHOC) { 2280 iwl_connection_init_rx_config(priv, vif->type);
2281 const struct iwl_channel_info *ch_info;
2282
2283 ch_info = iwl_get_channel_info(priv,
2284 priv->band,
2285 le16_to_cpu(priv->staging_rxon.channel));
2286
2287 if (!ch_info || !is_channel_ibss(ch_info)) {
2288 IWL_ERR(priv, "channel %d not IBSS channel\n",
2289 le16_to_cpu(priv->staging_rxon.channel));
2290 return -EINVAL;
2291 }
2292 }
2293
2294 iwl_connection_init_rx_config(priv, mode);
2295 2281
2296 if (priv->cfg->ops->hcmd->set_rxon_chain) 2282 if (priv->cfg->ops->hcmd->set_rxon_chain)
2297 priv->cfg->ops->hcmd->set_rxon_chain(priv); 2283 priv->cfg->ops->hcmd->set_rxon_chain(priv);
@@ -2300,18 +2286,10 @@ int iwl_set_mode(struct iwl_priv *priv, int mode)
2300 2286
2301 iwl_clear_stations_table(priv); 2287 iwl_clear_stations_table(priv);
2302 2288
2303 /* dont commit rxon if rf-kill is on*/ 2289 return iwlcore_commit_rxon(priv);
2304 if (!iwl_is_ready_rf(priv))
2305 return -EAGAIN;
2306
2307 iwlcore_commit_rxon(priv);
2308
2309 return 0;
2310} 2290}
2311EXPORT_SYMBOL(iwl_set_mode);
2312 2291
2313int iwl_mac_add_interface(struct ieee80211_hw *hw, 2292int iwl_mac_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
2314 struct ieee80211_vif *vif)
2315{ 2293{
2316 struct iwl_priv *priv = hw->priv; 2294 struct iwl_priv *priv = hw->priv;
2317 int err = 0; 2295 int err = 0;
@@ -2320,6 +2298,11 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw,
2320 2298
2321 mutex_lock(&priv->mutex); 2299 mutex_lock(&priv->mutex);
2322 2300
2301 if (WARN_ON(!iwl_is_ready_rf(priv))) {
2302 err = -EINVAL;
2303 goto out;
2304 }
2305
2323 if (priv->vif) { 2306 if (priv->vif) {
2324 IWL_DEBUG_MAC80211(priv, "leave - vif != NULL\n"); 2307 IWL_DEBUG_MAC80211(priv, "leave - vif != NULL\n");
2325 err = -EOPNOTSUPP; 2308 err = -EOPNOTSUPP;
@@ -2329,15 +2312,17 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw,
2329 priv->vif = vif; 2312 priv->vif = vif;
2330 priv->iw_mode = vif->type; 2313 priv->iw_mode = vif->type;
2331 2314
2332 if (vif->addr) { 2315 IWL_DEBUG_MAC80211(priv, "Set %pM\n", vif->addr);
2333 IWL_DEBUG_MAC80211(priv, "Set %pM\n", vif->addr); 2316 memcpy(priv->mac_addr, vif->addr, ETH_ALEN);
2334 memcpy(priv->mac_addr, vif->addr, ETH_ALEN);
2335 }
2336 2317
2337 if (iwl_set_mode(priv, vif->type) == -EAGAIN) 2318 err = iwl_set_mode(priv, vif);
2338 /* we are not ready, will run again when ready */ 2319 if (err)
2339 set_bit(STATUS_MODE_PENDING, &priv->status); 2320 goto out_err;
2321 goto out;
2340 2322
2323 out_err:
2324 priv->vif = NULL;
2325 priv->iw_mode = NL80211_IFTYPE_STATION;
2341 out: 2326 out:
2342 mutex_unlock(&priv->mutex); 2327 mutex_unlock(&priv->mutex);
2343 2328
@@ -2347,7 +2332,7 @@ int iwl_mac_add_interface(struct ieee80211_hw *hw,
2347EXPORT_SYMBOL(iwl_mac_add_interface); 2332EXPORT_SYMBOL(iwl_mac_add_interface);
2348 2333
2349void iwl_mac_remove_interface(struct ieee80211_hw *hw, 2334void iwl_mac_remove_interface(struct ieee80211_hw *hw,
2350 struct ieee80211_vif *vif) 2335 struct ieee80211_vif *vif)
2351{ 2336{
2352 struct iwl_priv *priv = hw->priv; 2337 struct iwl_priv *priv = hw->priv;
2353 2338
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index f493248d472..bec00c79059 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -336,7 +336,6 @@ void iwl_bss_info_changed(struct ieee80211_hw *hw,
336 u32 changes); 336 u32 changes);
337int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb); 337int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb);
338int iwl_commit_rxon(struct iwl_priv *priv); 338int iwl_commit_rxon(struct iwl_priv *priv);
339int iwl_set_mode(struct iwl_priv *priv, int mode);
340int iwl_mac_add_interface(struct ieee80211_hw *hw, 339int iwl_mac_add_interface(struct ieee80211_hw *hw,
341 struct ieee80211_vif *vif); 340 struct ieee80211_vif *vif);
342void iwl_mac_remove_interface(struct ieee80211_hw *hw, 341void iwl_mac_remove_interface(struct ieee80211_hw *hw,
@@ -617,7 +616,6 @@ void iwlcore_free_geos(struct iwl_priv *priv);
617#define STATUS_SCAN_HW 15 616#define STATUS_SCAN_HW 15
618#define STATUS_POWER_PMI 16 617#define STATUS_POWER_PMI 16
619#define STATUS_FW_ERROR 17 618#define STATUS_FW_ERROR 17
620#define STATUS_MODE_PENDING 18
621 619
622 620
623static inline int iwl_is_ready(struct iwl_priv *priv) 621static inline int iwl_is_ready(struct iwl_priv *priv)
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index 7bf44f14679..fc084dd2d14 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -560,8 +560,6 @@ static ssize_t iwl_dbgfs_status_read(struct file *file,
560 test_bit(STATUS_POWER_PMI, &priv->status)); 560 test_bit(STATUS_POWER_PMI, &priv->status));
561 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_FW_ERROR:\t %d\n", 561 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_FW_ERROR:\t %d\n",
562 test_bit(STATUS_FW_ERROR, &priv->status)); 562 test_bit(STATUS_FW_ERROR, &priv->status));
563 pos += scnprintf(buf + pos, bufsz - pos, "STATUS_MODE_PENDING:\t %d\n",
564 test_bit(STATUS_MODE_PENDING, &priv->status));
565 return simple_read_from_buffer(user_buf, count, ppos, buf, pos); 563 return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
566} 564}
567 565
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index bdd5fc74bce..2fd1b3d4949 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2537,9 +2537,6 @@ static void iwl3945_alive_start(struct iwl_priv *priv)
2537 set_bit(STATUS_READY, &priv->status); 2537 set_bit(STATUS_READY, &priv->status);
2538 wake_up_interruptible(&priv->wait_command_queue); 2538 wake_up_interruptible(&priv->wait_command_queue);
2539 2539
2540 if (test_and_clear_bit(STATUS_MODE_PENDING, &priv->status))
2541 iwl_set_mode(priv, priv->iw_mode);
2542
2543 return; 2540 return;
2544 2541
2545 restart: 2542 restart: