diff options
author | Eliad Peller <eliad@wizery.com> | 2011-10-10 04:12:52 -0400 |
---|---|---|
committer | Luciano Coelho <coelho@ti.com> | 2011-10-11 08:04:22 -0400 |
commit | baf6277ae964b1d3830aa74b13e87ff9ba29145c (patch) | |
tree | ecd4e5d47f78fb921f1b701b2ccaa7ab6dcdce87 | |
parent | d6a3cc2ef962ad4392a2401cae513a18a6d35099 (diff) |
wl12xx: move some functions from remove_interface() to stop()
Leave only vif-specific deinit stuff in remove_interface().
Move the global deinit (including power_off) to stop().
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
-rw-r--r-- | drivers/net/wireless/wl12xx/main.c | 157 |
1 files changed, 83 insertions, 74 deletions
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c index abe5ef8807ba..e53829aab92e 100644 --- a/drivers/net/wireless/wl12xx/main.c +++ b/drivers/net/wireless/wl12xx/main.c | |||
@@ -1803,7 +1803,83 @@ static int wl1271_op_start(struct ieee80211_hw *hw) | |||
1803 | 1803 | ||
1804 | static void wl1271_op_stop(struct ieee80211_hw *hw) | 1804 | static void wl1271_op_stop(struct ieee80211_hw *hw) |
1805 | { | 1805 | { |
1806 | struct wl1271 *wl = hw->priv; | ||
1807 | int i; | ||
1808 | |||
1806 | wl1271_debug(DEBUG_MAC80211, "mac80211 stop"); | 1809 | wl1271_debug(DEBUG_MAC80211, "mac80211 stop"); |
1810 | |||
1811 | mutex_lock(&wl_list_mutex); | ||
1812 | list_del(&wl->list); | ||
1813 | |||
1814 | /* | ||
1815 | * this must be before the cancel_work calls below, so that the work | ||
1816 | * functions don't perform further work. | ||
1817 | */ | ||
1818 | wl->state = WL1271_STATE_OFF; | ||
1819 | mutex_unlock(&wl_list_mutex); | ||
1820 | |||
1821 | wl1271_disable_interrupts(wl); | ||
1822 | wl1271_flush_deferred_work(wl); | ||
1823 | cancel_delayed_work_sync(&wl->scan_complete_work); | ||
1824 | cancel_work_sync(&wl->netstack_work); | ||
1825 | cancel_work_sync(&wl->tx_work); | ||
1826 | del_timer_sync(&wl->rx_streaming_timer); | ||
1827 | cancel_work_sync(&wl->rx_streaming_enable_work); | ||
1828 | cancel_work_sync(&wl->rx_streaming_disable_work); | ||
1829 | cancel_delayed_work_sync(&wl->elp_work); | ||
1830 | |||
1831 | /* let's notify MAC80211 about the remaining pending TX frames */ | ||
1832 | wl12xx_tx_reset(wl, true); | ||
1833 | mutex_lock(&wl->mutex); | ||
1834 | |||
1835 | wl1271_power_off(wl); | ||
1836 | |||
1837 | wl->band = IEEE80211_BAND_2GHZ; | ||
1838 | |||
1839 | wl->rx_counter = 0; | ||
1840 | wl->power_level = WL1271_DEFAULT_POWER_LEVEL; | ||
1841 | wl->tx_blocks_available = 0; | ||
1842 | wl->tx_allocated_blocks = 0; | ||
1843 | wl->tx_results_count = 0; | ||
1844 | wl->tx_packets_count = 0; | ||
1845 | wl->time_offset = 0; | ||
1846 | wl->vif = NULL; | ||
1847 | wl->tx_spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT; | ||
1848 | wl->ap_fw_ps_map = 0; | ||
1849 | wl->ap_ps_map = 0; | ||
1850 | wl->sched_scanning = false; | ||
1851 | memset(wl->roles_map, 0, sizeof(wl->roles_map)); | ||
1852 | memset(wl->links_map, 0, sizeof(wl->links_map)); | ||
1853 | memset(wl->roc_map, 0, sizeof(wl->roc_map)); | ||
1854 | wl->active_sta_count = 0; | ||
1855 | |||
1856 | /* The system link is always allocated */ | ||
1857 | __set_bit(WL12XX_SYSTEM_HLID, wl->links_map); | ||
1858 | |||
1859 | /* | ||
1860 | * this is performed after the cancel_work calls and the associated | ||
1861 | * mutex_lock, so that wl1271_op_add_interface does not accidentally | ||
1862 | * get executed before all these vars have been reset. | ||
1863 | */ | ||
1864 | wl->flags = 0; | ||
1865 | |||
1866 | wl->tx_blocks_freed = 0; | ||
1867 | |||
1868 | for (i = 0; i < NUM_TX_QUEUES; i++) { | ||
1869 | wl->tx_pkts_freed[i] = 0; | ||
1870 | wl->tx_allocated_pkts[i] = 0; | ||
1871 | } | ||
1872 | |||
1873 | wl1271_debugfs_reset(wl); | ||
1874 | |||
1875 | kfree(wl->fw_status); | ||
1876 | wl->fw_status = NULL; | ||
1877 | kfree(wl->tx_res_if); | ||
1878 | wl->tx_res_if = NULL; | ||
1879 | kfree(wl->target_mem_map); | ||
1880 | wl->target_mem_map = NULL; | ||
1881 | |||
1882 | mutex_unlock(&wl->mutex); | ||
1807 | } | 1883 | } |
1808 | 1884 | ||
1809 | static u8 wl12xx_get_role_type(struct wl1271 *wl, struct wl12xx_vif *wlvif) | 1885 | static u8 wl12xx_get_role_type(struct wl1271 *wl, struct wl12xx_vif *wlvif) |
@@ -2053,7 +2129,7 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl, | |||
2053 | bool reset_tx_queues) | 2129 | bool reset_tx_queues) |
2054 | { | 2130 | { |
2055 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | 2131 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); |
2056 | int ret, i; | 2132 | int ret; |
2057 | 2133 | ||
2058 | wl1271_debug(DEBUG_MAC80211, "mac80211 remove interface"); | 2134 | wl1271_debug(DEBUG_MAC80211, "mac80211 remove interface"); |
2059 | 2135 | ||
@@ -2063,15 +2139,12 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl, | |||
2063 | 2139 | ||
2064 | wl1271_info("down"); | 2140 | wl1271_info("down"); |
2065 | 2141 | ||
2066 | mutex_lock(&wl_list_mutex); | ||
2067 | list_del(&wl->list); | ||
2068 | mutex_unlock(&wl_list_mutex); | ||
2069 | |||
2070 | /* enable dyn ps just in case (if left on due to fw crash etc) */ | 2142 | /* enable dyn ps just in case (if left on due to fw crash etc) */ |
2071 | if (wlvif->bss_type == BSS_TYPE_STA_BSS) | 2143 | if (wlvif->bss_type == BSS_TYPE_STA_BSS) |
2072 | ieee80211_enable_dyn_ps(wl->vif); | 2144 | ieee80211_enable_dyn_ps(vif); |
2073 | 2145 | ||
2074 | if (wl->scan.state != WL1271_SCAN_STATE_IDLE) { | 2146 | if (wl->scan.state != WL1271_SCAN_STATE_IDLE && |
2147 | wl->scan_vif == vif) { | ||
2075 | wl->scan.state = WL1271_SCAN_STATE_IDLE; | 2148 | wl->scan.state = WL1271_SCAN_STATE_IDLE; |
2076 | memset(wl->scan.scanned_ch, 0, sizeof(wl->scan.scanned_ch)); | 2149 | memset(wl->scan.scanned_ch, 0, sizeof(wl->scan.scanned_ch)); |
2077 | wl->scan_vif = NULL; | 2150 | wl->scan_vif = NULL; |
@@ -2104,82 +2177,18 @@ deinit: | |||
2104 | wlvif->ap.bcast_hlid = WL12XX_INVALID_LINK_ID; | 2177 | wlvif->ap.bcast_hlid = WL12XX_INVALID_LINK_ID; |
2105 | wlvif->ap.global_hlid = WL12XX_INVALID_LINK_ID; | 2178 | wlvif->ap.global_hlid = WL12XX_INVALID_LINK_ID; |
2106 | 2179 | ||
2107 | /* | ||
2108 | * this must be before the cancel_work calls below, so that the work | ||
2109 | * functions don't perform further work. | ||
2110 | */ | ||
2111 | wl->state = WL1271_STATE_OFF; | ||
2112 | |||
2113 | mutex_unlock(&wl->mutex); | ||
2114 | |||
2115 | wl1271_disable_interrupts(wl); | ||
2116 | wl1271_flush_deferred_work(wl); | ||
2117 | cancel_delayed_work_sync(&wl->scan_complete_work); | ||
2118 | cancel_work_sync(&wl->netstack_work); | ||
2119 | cancel_work_sync(&wl->tx_work); | ||
2120 | del_timer_sync(&wl->rx_streaming_timer); | ||
2121 | cancel_work_sync(&wl->rx_streaming_enable_work); | ||
2122 | cancel_work_sync(&wl->rx_streaming_disable_work); | ||
2123 | cancel_delayed_work_sync(&wlvif->pspoll_work); | ||
2124 | cancel_delayed_work_sync(&wl->elp_work); | ||
2125 | |||
2126 | mutex_lock(&wl->mutex); | ||
2127 | |||
2128 | /* let's notify MAC80211 about the remaining pending TX frames */ | ||
2129 | wl12xx_tx_reset_wlvif(wl, wlvif); | 2180 | wl12xx_tx_reset_wlvif(wl, wlvif); |
2130 | wl12xx_tx_reset(wl, reset_tx_queues); | ||
2131 | wl1271_power_off(wl); | ||
2132 | |||
2133 | wl->band = IEEE80211_BAND_2GHZ; | ||
2134 | |||
2135 | wl->rx_counter = 0; | ||
2136 | wl->power_level = WL1271_DEFAULT_POWER_LEVEL; | ||
2137 | wl->tx_blocks_available = 0; | ||
2138 | wl->tx_allocated_blocks = 0; | ||
2139 | wl->tx_results_count = 0; | ||
2140 | wl->tx_packets_count = 0; | ||
2141 | wl->time_offset = 0; | ||
2142 | wl->bitrate_masks[IEEE80211_BAND_2GHZ] = wl->conf.tx.basic_rate; | 2181 | wl->bitrate_masks[IEEE80211_BAND_2GHZ] = wl->conf.tx.basic_rate; |
2143 | wl->bitrate_masks[IEEE80211_BAND_5GHZ] = wl->conf.tx.basic_rate_5; | 2182 | wl->bitrate_masks[IEEE80211_BAND_5GHZ] = wl->conf.tx.basic_rate_5; |
2144 | wl->vif = NULL; | ||
2145 | wl->tx_spare_blocks = TX_HW_BLOCK_SPARE_DEFAULT; | ||
2146 | wl1271_free_ap_keys(wl, wlvif); | 2183 | wl1271_free_ap_keys(wl, wlvif); |
2147 | memset(wlvif->ap.sta_hlid_map, 0, sizeof(wlvif->ap.sta_hlid_map)); | 2184 | memset(wlvif->ap.sta_hlid_map, 0, sizeof(wlvif->ap.sta_hlid_map)); |
2148 | wl->ap_fw_ps_map = 0; | ||
2149 | wl->ap_ps_map = 0; | ||
2150 | wl->sched_scanning = false; | ||
2151 | wlvif->role_id = WL12XX_INVALID_ROLE_ID; | 2185 | wlvif->role_id = WL12XX_INVALID_ROLE_ID; |
2152 | wlvif->dev_role_id = WL12XX_INVALID_ROLE_ID; | 2186 | wlvif->dev_role_id = WL12XX_INVALID_ROLE_ID; |
2153 | memset(wl->roles_map, 0, sizeof(wl->roles_map)); | ||
2154 | memset(wl->links_map, 0, sizeof(wl->links_map)); | ||
2155 | memset(wl->roc_map, 0, sizeof(wl->roc_map)); | ||
2156 | wl->active_sta_count = 0; | ||
2157 | 2187 | ||
2158 | /* The system link is always allocated */ | 2188 | mutex_unlock(&wl->mutex); |
2159 | __set_bit(WL12XX_SYSTEM_HLID, wl->links_map); | 2189 | cancel_delayed_work_sync(&wlvif->pspoll_work); |
2160 | |||
2161 | /* | ||
2162 | * this is performed after the cancel_work calls and the associated | ||
2163 | * mutex_lock, so that wl1271_op_add_interface does not accidentally | ||
2164 | * get executed before all these vars have been reset. | ||
2165 | */ | ||
2166 | wl->flags = 0; | ||
2167 | |||
2168 | wl->tx_blocks_freed = 0; | ||
2169 | |||
2170 | for (i = 0; i < NUM_TX_QUEUES; i++) { | ||
2171 | wl->tx_pkts_freed[i] = 0; | ||
2172 | wl->tx_allocated_pkts[i] = 0; | ||
2173 | } | ||
2174 | |||
2175 | wl1271_debugfs_reset(wl); | ||
2176 | 2190 | ||
2177 | kfree(wl->fw_status); | 2191 | mutex_lock(&wl->mutex); |
2178 | wl->fw_status = NULL; | ||
2179 | kfree(wl->tx_res_if); | ||
2180 | wl->tx_res_if = NULL; | ||
2181 | kfree(wl->target_mem_map); | ||
2182 | wl->target_mem_map = NULL; | ||
2183 | } | 2192 | } |
2184 | 2193 | ||
2185 | static void wl1271_op_remove_interface(struct ieee80211_hw *hw, | 2194 | static void wl1271_op_remove_interface(struct ieee80211_hw *hw, |