diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-06-04 12:26:06 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-06-10 13:27:49 -0400 |
commit | a60e77e5a41330334fd0ca428f18919d1ea6ed62 (patch) | |
tree | 74ab8959c0bb0dece119c52db41c55df0926f6ea /drivers/net/wireless/iwlwifi/iwl-core.c | |
parent | 1506e30b5f25f6c3357167a18f0e4ae6f5662a28 (diff) |
iwlwifi: port to cfg80211 rfkill
This ports the iwlwifi rfkill code to the new API offered by
cfg80211 and thus removes a lot of useless stuff. The soft-
rfkill is completely removed since that is now handled by
setting the interfaces down.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Tested-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-core.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 138 |
1 files changed, 0 insertions, 138 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 51cae4ec26a..f9d16ca5b3d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include "iwl-debug.h" | 36 | #include "iwl-debug.h" |
37 | #include "iwl-core.h" | 37 | #include "iwl-core.h" |
38 | #include "iwl-io.h" | 38 | #include "iwl-io.h" |
39 | #include "iwl-rfkill.h" | ||
40 | #include "iwl-power.h" | 39 | #include "iwl-power.h" |
41 | #include "iwl-sta.h" | 40 | #include "iwl-sta.h" |
42 | #include "iwl-helpers.h" | 41 | #include "iwl-helpers.h" |
@@ -2211,126 +2210,6 @@ int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag) | |||
2211 | } | 2210 | } |
2212 | EXPORT_SYMBOL(iwl_send_card_state); | 2211 | EXPORT_SYMBOL(iwl_send_card_state); |
2213 | 2212 | ||
2214 | void iwl_radio_kill_sw_disable_radio(struct iwl_priv *priv) | ||
2215 | { | ||
2216 | unsigned long flags; | ||
2217 | |||
2218 | if (test_bit(STATUS_RF_KILL_SW, &priv->status)) | ||
2219 | return; | ||
2220 | |||
2221 | IWL_DEBUG_RF_KILL(priv, "Manual SW RF KILL set to: RADIO OFF\n"); | ||
2222 | |||
2223 | iwl_scan_cancel(priv); | ||
2224 | /* FIXME: This is a workaround for AP */ | ||
2225 | if (priv->iw_mode != NL80211_IFTYPE_AP) { | ||
2226 | spin_lock_irqsave(&priv->lock, flags); | ||
2227 | iwl_write32(priv, CSR_UCODE_DRV_GP1_SET, | ||
2228 | CSR_UCODE_SW_BIT_RFKILL); | ||
2229 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2230 | /* call the host command only if no hw rf-kill set */ | ||
2231 | if (!test_bit(STATUS_RF_KILL_HW, &priv->status) && | ||
2232 | iwl_is_ready(priv)) | ||
2233 | iwl_send_card_state(priv, | ||
2234 | CARD_STATE_CMD_DISABLE, 0); | ||
2235 | set_bit(STATUS_RF_KILL_SW, &priv->status); | ||
2236 | /* make sure mac80211 stop sending Tx frame */ | ||
2237 | if (priv->mac80211_registered) | ||
2238 | ieee80211_stop_queues(priv->hw); | ||
2239 | } | ||
2240 | } | ||
2241 | EXPORT_SYMBOL(iwl_radio_kill_sw_disable_radio); | ||
2242 | |||
2243 | int iwl_radio_kill_sw_enable_radio(struct iwl_priv *priv) | ||
2244 | { | ||
2245 | unsigned long flags; | ||
2246 | |||
2247 | if (!test_bit(STATUS_RF_KILL_SW, &priv->status)) | ||
2248 | return 0; | ||
2249 | |||
2250 | IWL_DEBUG_RF_KILL(priv, "Manual SW RF KILL set to: RADIO ON\n"); | ||
2251 | |||
2252 | spin_lock_irqsave(&priv->lock, flags); | ||
2253 | iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL); | ||
2254 | |||
2255 | /* If the driver is up it will receive CARD_STATE_NOTIFICATION | ||
2256 | * notification where it will clear SW rfkill status. | ||
2257 | * Setting it here would break the handler. Only if the | ||
2258 | * interface is down we can set here since we don't | ||
2259 | * receive any further notification. | ||
2260 | */ | ||
2261 | if (!priv->is_open) | ||
2262 | clear_bit(STATUS_RF_KILL_SW, &priv->status); | ||
2263 | spin_unlock_irqrestore(&priv->lock, flags); | ||
2264 | |||
2265 | /* wake up ucode */ | ||
2266 | msleep(10); | ||
2267 | |||
2268 | iwl_read32(priv, CSR_UCODE_DRV_GP1); | ||
2269 | spin_lock_irqsave(&priv->reg_lock, flags); | ||
2270 | if (!iwl_grab_nic_access(priv)) | ||
2271 | iwl_release_nic_access(priv); | ||
2272 | spin_unlock_irqrestore(&priv->reg_lock, flags); | ||
2273 | |||
2274 | if (test_bit(STATUS_RF_KILL_HW, &priv->status)) { | ||
2275 | IWL_DEBUG_RF_KILL(priv, "Can not turn radio back on - " | ||
2276 | "disabled by HW switch\n"); | ||
2277 | return 0; | ||
2278 | } | ||
2279 | |||
2280 | /* when driver is up while rfkill is on, it wont receive | ||
2281 | * any CARD_STATE_NOTIFICATION notifications so we have to | ||
2282 | * restart it in here | ||
2283 | */ | ||
2284 | if (priv->is_open && !test_bit(STATUS_ALIVE, &priv->status)) { | ||
2285 | clear_bit(STATUS_RF_KILL_SW, &priv->status); | ||
2286 | if (!iwl_is_rfkill(priv)) | ||
2287 | queue_work(priv->workqueue, &priv->up); | ||
2288 | } | ||
2289 | |||
2290 | /* If the driver is already loaded, it will receive | ||
2291 | * CARD_STATE_NOTIFICATION notifications and the handler will | ||
2292 | * call restart to reload the driver. | ||
2293 | */ | ||
2294 | return 1; | ||
2295 | } | ||
2296 | EXPORT_SYMBOL(iwl_radio_kill_sw_enable_radio); | ||
2297 | |||
2298 | void iwl_bg_rf_kill(struct work_struct *work) | ||
2299 | { | ||
2300 | struct iwl_priv *priv = container_of(work, struct iwl_priv, rf_kill); | ||
2301 | |||
2302 | wake_up_interruptible(&priv->wait_command_queue); | ||
2303 | |||
2304 | if (test_bit(STATUS_EXIT_PENDING, &priv->status)) | ||
2305 | return; | ||
2306 | |||
2307 | mutex_lock(&priv->mutex); | ||
2308 | |||
2309 | if (!iwl_is_rfkill(priv)) { | ||
2310 | IWL_DEBUG_RF_KILL(priv, | ||
2311 | "HW and/or SW RF Kill no longer active, restarting " | ||
2312 | "device\n"); | ||
2313 | if (!test_bit(STATUS_EXIT_PENDING, &priv->status) && | ||
2314 | priv->is_open) | ||
2315 | queue_work(priv->workqueue, &priv->restart); | ||
2316 | } else { | ||
2317 | /* make sure mac80211 stop sending Tx frame */ | ||
2318 | if (priv->mac80211_registered) | ||
2319 | ieee80211_stop_queues(priv->hw); | ||
2320 | |||
2321 | if (!test_bit(STATUS_RF_KILL_HW, &priv->status)) | ||
2322 | IWL_DEBUG_RF_KILL(priv, "Can not turn radio back on - " | ||
2323 | "disabled by SW switch\n"); | ||
2324 | else | ||
2325 | IWL_WARN(priv, "Radio Frequency Kill Switch is On:\n" | ||
2326 | "Kill switch must be turned off for " | ||
2327 | "wireless networking to work.\n"); | ||
2328 | } | ||
2329 | mutex_unlock(&priv->mutex); | ||
2330 | iwl_rfkill_set_hw_state(priv); | ||
2331 | } | ||
2332 | EXPORT_SYMBOL(iwl_bg_rf_kill); | ||
2333 | |||
2334 | void iwl_rx_pm_sleep_notif(struct iwl_priv *priv, | 2213 | void iwl_rx_pm_sleep_notif(struct iwl_priv *priv, |
2335 | struct iwl_rx_mem_buffer *rxb) | 2214 | struct iwl_rx_mem_buffer *rxb) |
2336 | { | 2215 | { |
@@ -2849,23 +2728,6 @@ int iwl_mac_config(struct ieee80211_hw *hw, u32 changed) | |||
2849 | if (priv->cfg->ops->hcmd->set_rxon_chain) | 2728 | if (priv->cfg->ops->hcmd->set_rxon_chain) |
2850 | priv->cfg->ops->hcmd->set_rxon_chain(priv); | 2729 | priv->cfg->ops->hcmd->set_rxon_chain(priv); |
2851 | 2730 | ||
2852 | if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED) { | ||
2853 | if (conf->radio_enabled && | ||
2854 | iwl_radio_kill_sw_enable_radio(priv)) { | ||
2855 | IWL_DEBUG_MAC80211(priv, "leave - RF-KILL - " | ||
2856 | "waiting for uCode\n"); | ||
2857 | goto out; | ||
2858 | } | ||
2859 | |||
2860 | if (!conf->radio_enabled) | ||
2861 | iwl_radio_kill_sw_disable_radio(priv); | ||
2862 | } | ||
2863 | |||
2864 | if (!conf->radio_enabled) { | ||
2865 | IWL_DEBUG_MAC80211(priv, "leave - radio disabled\n"); | ||
2866 | goto out; | ||
2867 | } | ||
2868 | |||
2869 | if (!iwl_is_ready(priv)) { | 2731 | if (!iwl_is_ready(priv)) { |
2870 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); | 2732 | IWL_DEBUG_MAC80211(priv, "leave - not ready\n"); |
2871 | goto out; | 2733 | goto out; |