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-agn.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-agn.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn.c | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c index b77208de92ad..a5637c4aa85d 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn.c | |||
@@ -737,19 +737,13 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv, | |||
737 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 737 | clear_bit(STATUS_RF_KILL_HW, &priv->status); |
738 | 738 | ||
739 | 739 | ||
740 | if (flags & SW_CARD_DISABLED) | ||
741 | set_bit(STATUS_RF_KILL_SW, &priv->status); | ||
742 | else | ||
743 | clear_bit(STATUS_RF_KILL_SW, &priv->status); | ||
744 | |||
745 | if (!(flags & RXON_CARD_DISABLED)) | 740 | if (!(flags & RXON_CARD_DISABLED)) |
746 | iwl_scan_cancel(priv); | 741 | iwl_scan_cancel(priv); |
747 | 742 | ||
748 | if ((test_bit(STATUS_RF_KILL_HW, &status) != | 743 | if ((test_bit(STATUS_RF_KILL_HW, &status) != |
749 | test_bit(STATUS_RF_KILL_HW, &priv->status)) || | 744 | test_bit(STATUS_RF_KILL_HW, &priv->status))) |
750 | (test_bit(STATUS_RF_KILL_SW, &status) != | 745 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, |
751 | test_bit(STATUS_RF_KILL_SW, &priv->status))) | 746 | test_bit(STATUS_RF_KILL_HW, &priv->status)); |
752 | queue_work(priv->workqueue, &priv->rf_kill); | ||
753 | else | 747 | else |
754 | wake_up_interruptible(&priv->wait_command_queue); | 748 | wake_up_interruptible(&priv->wait_command_queue); |
755 | } | 749 | } |
@@ -1045,7 +1039,7 @@ static void iwl_irq_tasklet_legacy(struct iwl_priv *priv) | |||
1045 | set_bit(STATUS_RF_KILL_HW, &priv->status); | 1039 | set_bit(STATUS_RF_KILL_HW, &priv->status); |
1046 | else | 1040 | else |
1047 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 1041 | clear_bit(STATUS_RF_KILL_HW, &priv->status); |
1048 | queue_work(priv->workqueue, &priv->rf_kill); | 1042 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, hw_rf_kill); |
1049 | } | 1043 | } |
1050 | 1044 | ||
1051 | handled |= CSR_INT_BIT_RF_KILL; | 1045 | handled |= CSR_INT_BIT_RF_KILL; |
@@ -1218,7 +1212,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) | |||
1218 | set_bit(STATUS_RF_KILL_HW, &priv->status); | 1212 | set_bit(STATUS_RF_KILL_HW, &priv->status); |
1219 | else | 1213 | else |
1220 | clear_bit(STATUS_RF_KILL_HW, &priv->status); | 1214 | clear_bit(STATUS_RF_KILL_HW, &priv->status); |
1221 | queue_work(priv->workqueue, &priv->rf_kill); | 1215 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, hw_rf_kill); |
1222 | } | 1216 | } |
1223 | 1217 | ||
1224 | handled |= CSR_INT_BIT_RF_KILL; | 1218 | handled |= CSR_INT_BIT_RF_KILL; |
@@ -1726,12 +1720,10 @@ static void __iwl_down(struct iwl_priv *priv) | |||
1726 | ieee80211_stop_queues(priv->hw); | 1720 | ieee80211_stop_queues(priv->hw); |
1727 | 1721 | ||
1728 | /* If we have not previously called iwl_init() then | 1722 | /* If we have not previously called iwl_init() then |
1729 | * clear all bits but the RF Kill bits and return */ | 1723 | * clear all bits but the RF Kill bit and return */ |
1730 | if (!iwl_is_init(priv)) { | 1724 | if (!iwl_is_init(priv)) { |
1731 | priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << | 1725 | priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) << |
1732 | STATUS_RF_KILL_HW | | 1726 | STATUS_RF_KILL_HW | |
1733 | test_bit(STATUS_RF_KILL_SW, &priv->status) << | ||
1734 | STATUS_RF_KILL_SW | | ||
1735 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << | 1727 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << |
1736 | STATUS_GEO_CONFIGURED | | 1728 | STATUS_GEO_CONFIGURED | |
1737 | test_bit(STATUS_EXIT_PENDING, &priv->status) << | 1729 | test_bit(STATUS_EXIT_PENDING, &priv->status) << |
@@ -1740,11 +1732,9 @@ static void __iwl_down(struct iwl_priv *priv) | |||
1740 | } | 1732 | } |
1741 | 1733 | ||
1742 | /* ...otherwise clear out all the status bits but the RF Kill | 1734 | /* ...otherwise clear out all the status bits but the RF Kill |
1743 | * bits and continue taking the NIC down. */ | 1735 | * bit and continue taking the NIC down. */ |
1744 | priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << | 1736 | priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) << |
1745 | STATUS_RF_KILL_HW | | 1737 | STATUS_RF_KILL_HW | |
1746 | test_bit(STATUS_RF_KILL_SW, &priv->status) << | ||
1747 | STATUS_RF_KILL_SW | | ||
1748 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << | 1738 | test_bit(STATUS_GEO_CONFIGURED, &priv->status) << |
1749 | STATUS_GEO_CONFIGURED | | 1739 | STATUS_GEO_CONFIGURED | |
1750 | test_bit(STATUS_FW_ERROR, &priv->status) << | 1740 | test_bit(STATUS_FW_ERROR, &priv->status) << |
@@ -1866,9 +1856,10 @@ static int __iwl_up(struct iwl_priv *priv) | |||
1866 | set_bit(STATUS_RF_KILL_HW, &priv->status); | 1856 | set_bit(STATUS_RF_KILL_HW, &priv->status); |
1867 | 1857 | ||
1868 | if (iwl_is_rfkill(priv)) { | 1858 | if (iwl_is_rfkill(priv)) { |
1859 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, true); | ||
1860 | |||
1869 | iwl_enable_interrupts(priv); | 1861 | iwl_enable_interrupts(priv); |
1870 | IWL_WARN(priv, "Radio disabled by %s RF Kill switch\n", | 1862 | IWL_WARN(priv, "Radio disabled by HW RF Kill switch\n"); |
1871 | test_bit(STATUS_RF_KILL_HW, &priv->status) ? "HW" : "SW"); | ||
1872 | return 0; | 1863 | return 0; |
1873 | } | 1864 | } |
1874 | 1865 | ||
@@ -2001,7 +1992,6 @@ static void iwl_bg_up(struct work_struct *data) | |||
2001 | mutex_lock(&priv->mutex); | 1992 | mutex_lock(&priv->mutex); |
2002 | __iwl_up(priv); | 1993 | __iwl_up(priv); |
2003 | mutex_unlock(&priv->mutex); | 1994 | mutex_unlock(&priv->mutex); |
2004 | iwl_rfkill_set_hw_state(priv); | ||
2005 | } | 1995 | } |
2006 | 1996 | ||
2007 | static void iwl_bg_restart(struct work_struct *data) | 1997 | static void iwl_bg_restart(struct work_struct *data) |
@@ -2179,8 +2169,6 @@ static int iwl_mac_start(struct ieee80211_hw *hw) | |||
2179 | 2169 | ||
2180 | mutex_unlock(&priv->mutex); | 2170 | mutex_unlock(&priv->mutex); |
2181 | 2171 | ||
2182 | iwl_rfkill_set_hw_state(priv); | ||
2183 | |||
2184 | if (ret) | 2172 | if (ret) |
2185 | return ret; | 2173 | return ret; |
2186 | 2174 | ||
@@ -2775,7 +2763,6 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv) | |||
2775 | INIT_WORK(&priv->up, iwl_bg_up); | 2763 | INIT_WORK(&priv->up, iwl_bg_up); |
2776 | INIT_WORK(&priv->restart, iwl_bg_restart); | 2764 | INIT_WORK(&priv->restart, iwl_bg_restart); |
2777 | INIT_WORK(&priv->rx_replenish, iwl_bg_rx_replenish); | 2765 | INIT_WORK(&priv->rx_replenish, iwl_bg_rx_replenish); |
2778 | INIT_WORK(&priv->rf_kill, iwl_bg_rf_kill); | ||
2779 | INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update); | 2766 | INIT_WORK(&priv->beacon_update, iwl_bg_beacon_update); |
2780 | INIT_WORK(&priv->run_time_calib_work, iwl_bg_run_time_calib_work); | 2767 | INIT_WORK(&priv->run_time_calib_work, iwl_bg_run_time_calib_work); |
2781 | INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); | 2768 | INIT_DELAYED_WORK(&priv->init_alive_start, iwl_bg_init_alive_start); |
@@ -3046,12 +3033,8 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3046 | else | 3033 | else |
3047 | set_bit(STATUS_RF_KILL_HW, &priv->status); | 3034 | set_bit(STATUS_RF_KILL_HW, &priv->status); |
3048 | 3035 | ||
3049 | err = iwl_rfkill_init(priv); | 3036 | wiphy_rfkill_set_hw_state(priv->hw->wiphy, |
3050 | if (err) | 3037 | test_bit(STATUS_RF_KILL_HW, &priv->status)); |
3051 | IWL_ERR(priv, "Unable to initialize RFKILL system. " | ||
3052 | "Ignoring error: %d\n", err); | ||
3053 | else | ||
3054 | iwl_rfkill_set_hw_state(priv); | ||
3055 | 3038 | ||
3056 | iwl_power_initialize(priv); | 3039 | iwl_power_initialize(priv); |
3057 | return 0; | 3040 | return 0; |
@@ -3115,7 +3098,6 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev) | |||
3115 | 3098 | ||
3116 | iwl_synchronize_irq(priv); | 3099 | iwl_synchronize_irq(priv); |
3117 | 3100 | ||
3118 | iwl_rfkill_unregister(priv); | ||
3119 | iwl_dealloc_ucode_pci(priv); | 3101 | iwl_dealloc_ucode_pci(priv); |
3120 | 3102 | ||
3121 | if (priv->rxq.bd) | 3103 | if (priv->rxq.bd) |