static void wl1251_op_stop(struct ieee80211_hw *hw) { struct wl1251 *wl = hw->priv; wl1251_info("down"); wl1251_debug(DEBUG_MAC80211, "mac80211 stop"); mutex_lock(&wl->mutex); WARN_ON(wl->state != WL1251_STATE_ON); if (wl->scanning) { ieee80211_scan_completed(wl->hw, true); wl->scanning = false; } wl->state = WL1251_STATE_OFF; wl1251_disable_interrupts(wl); mutex_unlock(&wl->mutex); cancel_work_sync(&wl->irq_work); cancel_work_sync(&wl->tx_work); cancel_delayed_work_sync(&wl->ps_work); cancel_delayed_work_sync(&wl->elp_work); mutex_lock(&wl->mutex); /* let's notify MAC80211 about the remaining pending TX frames */ wl1251_tx_flush(wl); wl1251_power_off(wl); memset(wl->bssid, 0, ETH_ALEN); wl->listen_int = 1; wl->bss_type = MAX_BSS_TYPE; wl->data_in_count = 0; wl->rx_counter = 0; wl->rx_handled = 0; wl->rx_current_buffer = 0; wl->rx_last_id = 0; wl->next_tx_complete = 0; wl->elp = false; wl->station_mode = STATION_ACTIVE_MODE; wl->tx_queue_stopped = false; wl->power_level = WL1251_DEFAULT_POWER_LEVEL; wl->rssi_thold = 0; wl->channel = WL1251_DEFAULT_CHANNEL; wl->monitor_present = false; wl->joined = false; wl->long_doze_mode_set = false; wl1251_debugfs_reset(wl); mutex_unlock(&wl->mutex); }
static int wl1251_op_start(struct ieee80211_hw *hw) { struct wl1251 *wl = hw->priv; struct wiphy *wiphy = hw->wiphy; int ret = 0; wl1251_debug(DEBUG_MAC80211, "mac80211 start"); mutex_lock(&wl->mutex); if (wl->state != WL1251_STATE_OFF) { wl1251_error("cannot start because not in off state: %d", wl->state); ret = -EBUSY; goto out; } ret = wl1251_chip_wakeup(wl); if (ret < 0) goto out; ret = wl1251_boot(wl); if (ret < 0) goto out; ret = wl1251_hw_init(wl); if (ret < 0) goto out; ret = wl1251_acx_station_id(wl); if (ret < 0) goto out; wl->state = WL1251_STATE_ON; wl1251_info("firmware booted (%s)", wl->fw_ver); /* update hw/fw version info in wiphy struct */ wiphy->hw_version = wl->chip_id; strncpy(wiphy->fw_version, wl->fw_ver, sizeof(wiphy->fw_version)); out: if (ret < 0) wl1251_power_off(wl); mutex_unlock(&wl->mutex); return ret; }