Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63013ae3 authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by John W. Linville
Browse files

iwlagn: priv->status moves to iwl_shared



Since it is used by all the layers, it needs to move to iwl_shared.

Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 74e28e44
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -387,7 +387,7 @@ void iwl_check_abort_status(struct iwl_priv *priv,
{
{
	if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) {
	if (frame_count == 1 && status == TX_STATUS_FAIL_RFKILL_FLUSH) {
		IWL_ERR(priv, "Tx flush command to flush out all frames\n");
		IWL_ERR(priv, "Tx flush command to flush out all frames\n");
		if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
		if (!test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
			queue_work(priv->shrd->workqueue, &priv->tx_flush);
			queue_work(priv->shrd->workqueue, &priv->tx_flush);
	}
	}
}
}
@@ -496,7 +496,7 @@ int iwlagn_send_tx_power(struct iwl_priv *priv)
	struct iwlagn_tx_power_dbm_cmd tx_power_cmd;
	struct iwlagn_tx_power_dbm_cmd tx_power_cmd;
	u8 tx_ant_cfg_cmd;
	u8 tx_ant_cfg_cmd;


	if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->status),
	if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->shrd->status),
		      "TX Power requested while scanning!\n"))
		      "TX Power requested while scanning!\n"))
		return -EAGAIN;
		return -EAGAIN;


@@ -945,7 +945,7 @@ int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
	scan->tx_cmd.rate_n_flags = iwl_hw_set_rate_n_flags(rate, rate_flags);
	scan->tx_cmd.rate_n_flags = iwl_hw_set_rate_n_flags(rate, rate_flags);


	/* In power save mode use one chain, otherwise use all chains */
	/* In power save mode use one chain, otherwise use all chains */
	if (test_bit(STATUS_POWER_PMI, &priv->status)) {
	if (test_bit(STATUS_POWER_PMI, &priv->shrd->status)) {
		/* rx_ant has been set to all valid chains previously */
		/* rx_ant has been set to all valid chains previously */
		active_chains = rx_ant &
		active_chains = rx_ant &
				((u8)(priv->chain_noise_data.active_chains));
				((u8)(priv->chain_noise_data.active_chains));
@@ -1048,7 +1048,7 @@ int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)
	scan->len = cpu_to_le16(cmd.len[0]);
	scan->len = cpu_to_le16(cmd.len[0]);


	/* set scan bit here for PAN params */
	/* set scan bit here for PAN params */
	set_bit(STATUS_SCAN_HW, &priv->status);
	set_bit(STATUS_SCAN_HW, &priv->shrd->status);


	ret = iwlagn_set_pan_params(priv);
	ret = iwlagn_set_pan_params(priv);
	if (ret)
	if (ret)
@@ -1056,7 +1056,7 @@ int iwlagn_request_scan(struct iwl_priv *priv, struct ieee80211_vif *vif)


	ret = trans_send_cmd(&priv->trans, &cmd);
	ret = trans_send_cmd(&priv->trans, &cmd);
	if (ret) {
	if (ret) {
		clear_bit(STATUS_SCAN_HW, &priv->status);
		clear_bit(STATUS_SCAN_HW, &priv->shrd->status);
		iwlagn_set_pan_params(priv);
		iwlagn_set_pan_params(priv);
	}
	}


@@ -1494,7 +1494,7 @@ static void iwlagn_bt_traffic_change_work(struct work_struct *work)
	 * STATUS_SCANNING to avoid race when queue_work two times from
	 * STATUS_SCANNING to avoid race when queue_work two times from
	 * different notifications, but quit and not perform any work at all.
	 * different notifications, but quit and not perform any work at all.
	 */
	 */
	if (test_bit(STATUS_SCAN_HW, &priv->status))
	if (test_bit(STATUS_SCAN_HW, &priv->shrd->status))
		goto out;
		goto out;


	iwl_update_chain_flags(priv);
	iwl_update_chain_flags(priv);
@@ -1775,7 +1775,7 @@ static u8 iwl_count_chain_bitmap(u32 chain_bitmap)
void iwlagn_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
void iwlagn_set_rxon_chain(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
{
{
	bool is_single = is_single_rx_stream(priv);
	bool is_single = is_single_rx_stream(priv);
	bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->status);
	bool is_cam = !test_bit(STATUS_POWER_PMI, &priv->shrd->status);
	u8 idle_rx_cnt, active_rx_cnt, valid_rx_cnt;
	u8 idle_rx_cnt, active_rx_cnt, valid_rx_cnt;
	u32 active_chains;
	u32 active_chains;
	u16 rx_chain;
	u16 rx_chain;
+5 −5
Original line number Original line Diff line number Diff line
@@ -363,7 +363,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv)
		slot0 = bcnint / 2;
		slot0 = bcnint / 2;
		slot1 = bcnint - slot0;
		slot1 = bcnint - slot0;


		if (test_bit(STATUS_SCAN_HW, &priv->status) ||
		if (test_bit(STATUS_SCAN_HW, &priv->shrd->status) ||
		    (!ctx_bss->vif->bss_conf.idle &&
		    (!ctx_bss->vif->bss_conf.idle &&
		     !ctx_bss->vif->bss_conf.assoc)) {
		     !ctx_bss->vif->bss_conf.assoc)) {
			slot0 = dtim * bcnint * 3 - IWL_MIN_SLOT_TIME;
			slot0 = dtim * bcnint * 3 - IWL_MIN_SLOT_TIME;
@@ -379,7 +379,7 @@ int iwlagn_set_pan_params(struct iwl_priv *priv)
					ctx_pan->beacon_int;
					ctx_pan->beacon_int;
		slot1 = max_t(int, DEFAULT_BEACON_INTERVAL, slot1);
		slot1 = max_t(int, DEFAULT_BEACON_INTERVAL, slot1);


		if (test_bit(STATUS_SCAN_HW, &priv->status)) {
		if (test_bit(STATUS_SCAN_HW, &priv->shrd->status)) {
			slot0 = slot1 * 3 - IWL_MIN_SLOT_TIME;
			slot0 = slot1 * 3 - IWL_MIN_SLOT_TIME;
			slot1 = IWL_MIN_SLOT_TIME;
			slot1 = IWL_MIN_SLOT_TIME;
		}
		}
@@ -423,7 +423,7 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)


	lockdep_assert_held(&priv->mutex);
	lockdep_assert_held(&priv->mutex);


	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		return -EINVAL;
		return -EINVAL;


	if (!iwl_is_alive(priv))
	if (!iwl_is_alive(priv))
@@ -463,7 +463,7 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
	 * receive commit_rxon request
	 * receive commit_rxon request
	 * abort any previous channel switch if still in process
	 * abort any previous channel switch if still in process
	 */
	 */
	if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status) &&
	if (test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status) &&
	    (priv->switch_channel != ctx->staging.channel)) {
	    (priv->switch_channel != ctx->staging.channel)) {
		IWL_DEBUG_11H(priv, "abort channel switch on %d\n",
		IWL_DEBUG_11H(priv, "abort channel switch on %d\n",
			      le16_to_cpu(priv->switch_channel));
			      le16_to_cpu(priv->switch_channel));
@@ -539,7 +539,7 @@ int iwlagn_mac_config(struct ieee80211_hw *hw, u32 changed)


	mutex_lock(&priv->mutex);
	mutex_lock(&priv->mutex);


	if (unlikely(test_bit(STATUS_SCANNING, &priv->status))) {
	if (unlikely(test_bit(STATUS_SCANNING, &priv->shrd->status))) {
		IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
		IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
		goto out;
		goto out;
	}
	}
+17 −15
Original line number Original line Diff line number Diff line
@@ -176,7 +176,7 @@ static void iwl_tt_check_exit_ct_kill(unsigned long data)
	struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
	struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
	unsigned long flags;
	unsigned long flags;


	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		return;
		return;


	if (tt->state == IWL_TI_CT_KILL) {
	if (tt->state == IWL_TI_CT_KILL) {
@@ -227,7 +227,7 @@ static void iwl_tt_ready_for_ct_kill(unsigned long data)
	struct iwl_priv *priv = (struct iwl_priv *)data;
	struct iwl_priv *priv = (struct iwl_priv *)data;
	struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
	struct iwl_tt_mgmt *tt = &priv->thermal_throttle;


	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		return;
		return;


	/* temperature timer expired, ready to go into CT_KILL state */
	/* temperature timer expired, ready to go into CT_KILL state */
@@ -235,7 +235,7 @@ static void iwl_tt_ready_for_ct_kill(unsigned long data)
		IWL_DEBUG_TEMP(priv, "entering CT_KILL state when "
		IWL_DEBUG_TEMP(priv, "entering CT_KILL state when "
				"temperature timer expired\n");
				"temperature timer expired\n");
		tt->state = IWL_TI_CT_KILL;
		tt->state = IWL_TI_CT_KILL;
		set_bit(STATUS_CT_KILL, &priv->status);
		set_bit(STATUS_CT_KILL, &priv->shrd->status);
		iwl_perform_ct_kill_task(priv, true);
		iwl_perform_ct_kill_task(priv, true);
	}
	}
}
}
@@ -315,21 +315,22 @@ static void iwl_legacy_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
		}
		}
		mutex_lock(&priv->mutex);
		mutex_lock(&priv->mutex);
		if (old_state == IWL_TI_CT_KILL)
		if (old_state == IWL_TI_CT_KILL)
			clear_bit(STATUS_CT_KILL, &priv->status);
			clear_bit(STATUS_CT_KILL, &priv->shrd->status);
		if (tt->state != IWL_TI_CT_KILL &&
		if (tt->state != IWL_TI_CT_KILL &&
		    iwl_power_update_mode(priv, true)) {
		    iwl_power_update_mode(priv, true)) {
			/* TT state not updated
			/* TT state not updated
			 * try again during next temperature read
			 * try again during next temperature read
			 */
			 */
			if (old_state == IWL_TI_CT_KILL)
			if (old_state == IWL_TI_CT_KILL)
				set_bit(STATUS_CT_KILL, &priv->status);
				set_bit(STATUS_CT_KILL, &priv->shrd->status);
			tt->state = old_state;
			tt->state = old_state;
			IWL_ERR(priv, "Cannot update power mode, "
			IWL_ERR(priv, "Cannot update power mode, "
					"TT state not updated\n");
					"TT state not updated\n");
		} else {
		} else {
			if (tt->state == IWL_TI_CT_KILL) {
			if (tt->state == IWL_TI_CT_KILL) {
				if (force) {
				if (force) {
					set_bit(STATUS_CT_KILL, &priv->status);
					set_bit(STATUS_CT_KILL,
						&priv->shrd->status);
					iwl_perform_ct_kill_task(priv, true);
					iwl_perform_ct_kill_task(priv, true);
				} else {
				} else {
					iwl_prepare_ct_kill_task(priv);
					iwl_prepare_ct_kill_task(priv);
@@ -455,7 +456,7 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
		}
		}
		mutex_lock(&priv->mutex);
		mutex_lock(&priv->mutex);
		if (old_state == IWL_TI_CT_KILL)
		if (old_state == IWL_TI_CT_KILL)
			clear_bit(STATUS_CT_KILL, &priv->status);
			clear_bit(STATUS_CT_KILL, &priv->shrd->status);
		if (tt->state != IWL_TI_CT_KILL &&
		if (tt->state != IWL_TI_CT_KILL &&
		    iwl_power_update_mode(priv, true)) {
		    iwl_power_update_mode(priv, true)) {
			/* TT state not updated
			/* TT state not updated
@@ -464,7 +465,7 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
			IWL_ERR(priv, "Cannot update power mode, "
			IWL_ERR(priv, "Cannot update power mode, "
					"TT state not updated\n");
					"TT state not updated\n");
			if (old_state == IWL_TI_CT_KILL)
			if (old_state == IWL_TI_CT_KILL)
				set_bit(STATUS_CT_KILL, &priv->status);
				set_bit(STATUS_CT_KILL, &priv->shrd->status);
			tt->state = old_state;
			tt->state = old_state;
		} else {
		} else {
			IWL_DEBUG_TEMP(priv,
			IWL_DEBUG_TEMP(priv,
@@ -475,7 +476,8 @@ static void iwl_advance_tt_handler(struct iwl_priv *priv, s32 temp, bool force)
				if (force) {
				if (force) {
					IWL_DEBUG_TEMP(priv,
					IWL_DEBUG_TEMP(priv,
						"Enter IWL_TI_CT_KILL\n");
						"Enter IWL_TI_CT_KILL\n");
					set_bit(STATUS_CT_KILL, &priv->status);
					set_bit(STATUS_CT_KILL,
						&priv->shrd->status);
					iwl_perform_ct_kill_task(priv, true);
					iwl_perform_ct_kill_task(priv, true);
				} else {
				} else {
					iwl_prepare_ct_kill_task(priv);
					iwl_prepare_ct_kill_task(priv);
@@ -506,7 +508,7 @@ static void iwl_bg_ct_enter(struct work_struct *work)
	struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_enter);
	struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_enter);
	struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
	struct iwl_tt_mgmt *tt = &priv->thermal_throttle;


	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		return;
		return;


	if (!iwl_is_ready(priv))
	if (!iwl_is_ready(priv))
@@ -535,7 +537,7 @@ static void iwl_bg_ct_exit(struct work_struct *work)
	struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_exit);
	struct iwl_priv *priv = container_of(work, struct iwl_priv, ct_exit);
	struct iwl_tt_mgmt *tt = &priv->thermal_throttle;
	struct iwl_tt_mgmt *tt = &priv->thermal_throttle;


	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		return;
		return;


	if (!iwl_is_ready(priv))
	if (!iwl_is_ready(priv))
@@ -565,7 +567,7 @@ static void iwl_bg_ct_exit(struct work_struct *work)


void iwl_tt_enter_ct_kill(struct iwl_priv *priv)
void iwl_tt_enter_ct_kill(struct iwl_priv *priv)
{
{
	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		return;
		return;


	IWL_DEBUG_TEMP(priv, "Queueing critical temperature enter.\n");
	IWL_DEBUG_TEMP(priv, "Queueing critical temperature enter.\n");
@@ -574,7 +576,7 @@ void iwl_tt_enter_ct_kill(struct iwl_priv *priv)


void iwl_tt_exit_ct_kill(struct iwl_priv *priv)
void iwl_tt_exit_ct_kill(struct iwl_priv *priv)
{
{
	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		return;
		return;


	IWL_DEBUG_TEMP(priv, "Queueing critical temperature exit.\n");
	IWL_DEBUG_TEMP(priv, "Queueing critical temperature exit.\n");
@@ -586,7 +588,7 @@ static void iwl_bg_tt_work(struct work_struct *work)
	struct iwl_priv *priv = container_of(work, struct iwl_priv, tt_work);
	struct iwl_priv *priv = container_of(work, struct iwl_priv, tt_work);
	s32 temp = priv->temperature; /* degrees CELSIUS except specified */
	s32 temp = priv->temperature; /* degrees CELSIUS except specified */


	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		return;
		return;


	if (priv->cfg->base_params->temperature_kelvin)
	if (priv->cfg->base_params->temperature_kelvin)
@@ -600,7 +602,7 @@ static void iwl_bg_tt_work(struct work_struct *work)


void iwl_tt_handler(struct iwl_priv *priv)
void iwl_tt_handler(struct iwl_priv *priv)
{
{
	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		return;
		return;


	IWL_DEBUG_TEMP(priv, "Queueing thermal throttling work.\n");
	IWL_DEBUG_TEMP(priv, "Queueing thermal throttling work.\n");
+37 −35
Original line number Original line Diff line number Diff line
@@ -247,7 +247,7 @@ static void iwl_bg_bt_runtime_config(struct work_struct *work)
	struct iwl_priv *priv =
	struct iwl_priv *priv =
		container_of(work, struct iwl_priv, bt_runtime_config);
		container_of(work, struct iwl_priv, bt_runtime_config);


	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		return;
		return;


	/* dont send host command if rf-kill is on */
	/* dont send host command if rf-kill is on */
@@ -264,7 +264,7 @@ static void iwl_bg_bt_full_concurrency(struct work_struct *work)


	mutex_lock(&priv->mutex);
	mutex_lock(&priv->mutex);


	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		goto out;
		goto out;


	/* dont send host command if rf-kill is on */
	/* dont send host command if rf-kill is on */
@@ -303,7 +303,7 @@ static void iwl_bg_statistics_periodic(unsigned long data)
{
{
	struct iwl_priv *priv = (struct iwl_priv *)data;
	struct iwl_priv *priv = (struct iwl_priv *)data;


	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		return;
		return;


	/* dont send host command if rf-kill is on */
	/* dont send host command if rf-kill is on */
@@ -424,7 +424,7 @@ static void iwl_bg_ucode_trace(unsigned long data)
{
{
	struct iwl_priv *priv = (struct iwl_priv *)data;
	struct iwl_priv *priv = (struct iwl_priv *)data;


	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		return;
		return;


	if (priv->event_log.ucode_trace) {
	if (priv->event_log.ucode_trace) {
@@ -440,7 +440,7 @@ static void iwl_bg_tx_flush(struct work_struct *work)
	struct iwl_priv *priv =
	struct iwl_priv *priv =
		container_of(work, struct iwl_priv, tx_flush);
		container_of(work, struct iwl_priv, tx_flush);


	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		return;
		return;


	/* do nothing if rf-kill is on */
	/* do nothing if rf-kill is on */
@@ -1405,7 +1405,7 @@ void iwl_dump_nic_error_log(struct iwl_priv *priv)
	if (ERROR_START_OFFSET <= table.valid * ERROR_ELEM_SIZE) {
	if (ERROR_START_OFFSET <= table.valid * ERROR_ELEM_SIZE) {
		IWL_ERR(priv, "Start IWL Error Log Dump:\n");
		IWL_ERR(priv, "Start IWL Error Log Dump:\n");
		IWL_ERR(priv, "Status: 0x%08lX, count: %d\n",
		IWL_ERR(priv, "Status: 0x%08lX, count: %d\n",
			priv->status, table.valid);
			priv->shrd->status, table.valid);
	}
	}


	priv->isr_stats.err_code = table.error_id;
	priv->isr_stats.err_code = table.error_id;
@@ -1765,7 +1765,7 @@ int iwl_alive_start(struct iwl_priv *priv)
	IWL_DEBUG_INFO(priv, "Runtime Alive received.\n");
	IWL_DEBUG_INFO(priv, "Runtime Alive received.\n");


	/* After the ALIVE response, we can send host commands to the uCode */
	/* After the ALIVE response, we can send host commands to the uCode */
	set_bit(STATUS_ALIVE, &priv->status);
	set_bit(STATUS_ALIVE, &priv->shrd->status);


	/* Enable watchdog to monitor the driver tx queues */
	/* Enable watchdog to monitor the driver tx queues */
	iwl_setup_watchdog(priv);
	iwl_setup_watchdog(priv);
@@ -1838,7 +1838,7 @@ int iwl_alive_start(struct iwl_priv *priv)
		iwl_reset_run_time_calib(priv);
		iwl_reset_run_time_calib(priv);
	}
	}


	set_bit(STATUS_READY, &priv->status);
	set_bit(STATUS_READY, &priv->shrd->status);


	/* Configure the adapter for unassociated operation */
	/* Configure the adapter for unassociated operation */
	ret = iwlagn_commit_rxon(priv, ctx);
	ret = iwlagn_commit_rxon(priv, ctx);
@@ -1870,7 +1870,8 @@ static void __iwl_down(struct iwl_priv *priv)
	 */
	 */
	ieee80211_remain_on_channel_expired(priv->hw);
	ieee80211_remain_on_channel_expired(priv->hw);


	exit_pending = test_and_set_bit(STATUS_EXIT_PENDING, &priv->status);
	exit_pending =
		test_and_set_bit(STATUS_EXIT_PENDING, &priv->shrd->status);


	/* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set
	/* Stop TX queues watchdog. We need to have STATUS_EXIT_PENDING bit set
	 * to prevent rearm timer */
	 * to prevent rearm timer */
@@ -1895,19 +1896,20 @@ static void __iwl_down(struct iwl_priv *priv)
	/* Wipe out the EXIT_PENDING status bit if we are not actually
	/* Wipe out the EXIT_PENDING status bit if we are not actually
	 * exiting the module */
	 * exiting the module */
	if (!exit_pending)
	if (!exit_pending)
		clear_bit(STATUS_EXIT_PENDING, &priv->status);
		clear_bit(STATUS_EXIT_PENDING, &priv->shrd->status);


	if (priv->mac80211_registered)
	if (priv->mac80211_registered)
		ieee80211_stop_queues(priv->hw);
		ieee80211_stop_queues(priv->hw);


	/* Clear out all status bits but a few that are stable across reset */
	/* Clear out all status bits but a few that are stable across reset */
	priv->status &= test_bit(STATUS_RF_KILL_HW, &priv->status) <<
	priv->shrd->status &=
			test_bit(STATUS_RF_KILL_HW, &priv->shrd->status) <<
				STATUS_RF_KILL_HW |
				STATUS_RF_KILL_HW |
			test_bit(STATUS_GEO_CONFIGURED, &priv->status) <<
			test_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status) <<
				STATUS_GEO_CONFIGURED |
				STATUS_GEO_CONFIGURED |
			test_bit(STATUS_FW_ERROR, &priv->status) <<
			test_bit(STATUS_FW_ERROR, &priv->shrd->status) <<
				STATUS_FW_ERROR |
				STATUS_FW_ERROR |
		       test_bit(STATUS_EXIT_PENDING, &priv->status) <<
			test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) <<
				STATUS_EXIT_PENDING;
				STATUS_EXIT_PENDING;


	trans_stop_device(&priv->trans);
	trans_stop_device(&priv->trans);
@@ -1934,7 +1936,7 @@ static int __iwl_up(struct iwl_priv *priv)


	lockdep_assert_held(&priv->mutex);
	lockdep_assert_held(&priv->mutex);


	if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) {
		IWL_WARN(priv, "Exit pending; will not bring the NIC up\n");
		IWL_WARN(priv, "Exit pending; will not bring the NIC up\n");
		return -EIO;
		return -EIO;
	}
	}
@@ -1967,9 +1969,9 @@ static int __iwl_up(struct iwl_priv *priv)
	return 0;
	return 0;


 error:
 error:
	set_bit(STATUS_EXIT_PENDING, &priv->status);
	set_bit(STATUS_EXIT_PENDING, &priv->shrd->status);
	__iwl_down(priv);
	__iwl_down(priv);
	clear_bit(STATUS_EXIT_PENDING, &priv->status);
	clear_bit(STATUS_EXIT_PENDING, &priv->shrd->status);


	IWL_ERR(priv, "Unable to initialize device.\n");
	IWL_ERR(priv, "Unable to initialize device.\n");
	return ret;
	return ret;
@@ -1989,8 +1991,8 @@ static void iwl_bg_run_time_calib_work(struct work_struct *work)


	mutex_lock(&priv->mutex);
	mutex_lock(&priv->mutex);


	if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) ||
	    test_bit(STATUS_SCANNING, &priv->status)) {
	    test_bit(STATUS_SCANNING, &priv->shrd->status)) {
		mutex_unlock(&priv->mutex);
		mutex_unlock(&priv->mutex);
		return;
		return;
	}
	}
@@ -2046,10 +2048,10 @@ static void iwl_bg_restart(struct work_struct *data)
{
{
	struct iwl_priv *priv = container_of(data, struct iwl_priv, restart);
	struct iwl_priv *priv = container_of(data, struct iwl_priv, restart);


	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		return;
		return;


	if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) {
	if (test_and_clear_bit(STATUS_FW_ERROR, &priv->shrd->status)) {
		mutex_lock(&priv->mutex);
		mutex_lock(&priv->mutex);
		iwlagn_prepare_restart(priv);
		iwlagn_prepare_restart(priv);
		mutex_unlock(&priv->mutex);
		mutex_unlock(&priv->mutex);
@@ -2263,7 +2265,7 @@ static int iwlagn_mac_start(struct ieee80211_hw *hw)
	IWL_DEBUG_INFO(priv, "Start UP work done.\n");
	IWL_DEBUG_INFO(priv, "Start UP work done.\n");


	/* Now we should be done, and the READY bit should be set. */
	/* Now we should be done, and the READY bit should be set. */
	if (WARN_ON(!test_bit(STATUS_READY, &priv->status)))
	if (WARN_ON(!test_bit(STATUS_READY, &priv->shrd->status)))
		ret = -EIO;
		ret = -EIO;


	iwlagn_led_enable(priv);
	iwlagn_led_enable(priv);
@@ -2905,7 +2907,7 @@ static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw,
	case IEEE80211_AMPDU_RX_STOP:
	case IEEE80211_AMPDU_RX_STOP:
		IWL_DEBUG_HT(priv, "stop Rx\n");
		IWL_DEBUG_HT(priv, "stop Rx\n");
		ret = iwl_sta_rx_agg_stop(priv, sta, tid);
		ret = iwl_sta_rx_agg_stop(priv, sta, tid);
		if (test_bit(STATUS_EXIT_PENDING, &priv->status))
		if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
			ret = 0;
			ret = 0;
		break;
		break;
	case IEEE80211_AMPDU_TX_START:
	case IEEE80211_AMPDU_TX_START:
@@ -2925,7 +2927,7 @@ static int iwlagn_mac_ampdu_action(struct ieee80211_hw *hw,
			IWL_DEBUG_HT(priv, "priv->agg_tids_count = %u\n",
			IWL_DEBUG_HT(priv, "priv->agg_tids_count = %u\n",
				     priv->agg_tids_count);
				     priv->agg_tids_count);
		}
		}
		if (test_bit(STATUS_EXIT_PENDING, &priv->status))
		if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
			ret = 0;
			ret = 0;
		if (priv->cfg->ht_params &&
		if (priv->cfg->ht_params &&
		    priv->cfg->ht_params->use_rts_for_aggregation) {
		    priv->cfg->ht_params->use_rts_for_aggregation) {
@@ -3060,9 +3062,9 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
	if (iwl_is_rfkill(priv))
	if (iwl_is_rfkill(priv))
		goto out;
		goto out;


	if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status) ||
	    test_bit(STATUS_SCANNING, &priv->status) ||
	    test_bit(STATUS_SCANNING, &priv->shrd->status) ||
	    test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
	    test_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status))
		goto out;
		goto out;


	if (!iwl_is_associated_ctx(ctx))
	if (!iwl_is_associated_ctx(ctx))
@@ -3118,10 +3120,10 @@ static void iwlagn_mac_channel_switch(struct ieee80211_hw *hw,
	 * at this point, staging_rxon has the
	 * at this point, staging_rxon has the
	 * configuration for channel switch
	 * configuration for channel switch
	 */
	 */
	set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
	set_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status);
	priv->switch_channel = cpu_to_le16(ch);
	priv->switch_channel = cpu_to_le16(ch);
	if (priv->cfg->lib->set_channel_switch(priv, ch_switch)) {
	if (priv->cfg->lib->set_channel_switch(priv, ch_switch)) {
		clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status);
		clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->shrd->status);
		priv->switch_channel = 0;
		priv->switch_channel = 0;
		ieee80211_chswitch_done(ctx->vif, false);
		ieee80211_chswitch_done(ctx->vif, false);
	}
	}
@@ -3188,7 +3190,7 @@ static void iwlagn_mac_flush(struct ieee80211_hw *hw, bool drop)
	mutex_lock(&priv->mutex);
	mutex_lock(&priv->mutex);
	IWL_DEBUG_MAC80211(priv, "enter\n");
	IWL_DEBUG_MAC80211(priv, "enter\n");


	if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) {
		IWL_DEBUG_TX(priv, "Aborting flush due to device shutdown\n");
		IWL_DEBUG_TX(priv, "Aborting flush due to device shutdown\n");
		goto done;
		goto done;
	}
	}
@@ -3273,7 +3275,7 @@ static int iwl_mac_remain_on_channel(struct ieee80211_hw *hw,
	if (iwl_is_associated(priv, IWL_RXON_CTX_BSS) && duration > 80)
	if (iwl_is_associated(priv, IWL_RXON_CTX_BSS) && duration > 80)
		duration = 80;
		duration = 80;


	if (test_bit(STATUS_SCAN_HW, &priv->status)) {
	if (test_bit(STATUS_SCAN_HW, &priv->shrd->status)) {
		err = -EBUSY;
		err = -EBUSY;
		goto out;
		goto out;
	}
	}
@@ -3727,12 +3729,12 @@ int iwl_probe(struct iwl_bus *bus, struct iwl_cfg *cfg)


	/* If platform's RF_KILL switch is NOT set to KILL */
	/* If platform's RF_KILL switch is NOT set to KILL */
	if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
	if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
		clear_bit(STATUS_RF_KILL_HW, &priv->status);
		clear_bit(STATUS_RF_KILL_HW, &priv->shrd->status);
	else
	else
		set_bit(STATUS_RF_KILL_HW, &priv->status);
		set_bit(STATUS_RF_KILL_HW, &priv->shrd->status);


	wiphy_rfkill_set_hw_state(priv->hw->wiphy,
	wiphy_rfkill_set_hw_state(priv->hw->wiphy,
		test_bit(STATUS_RF_KILL_HW, &priv->status));
		test_bit(STATUS_RF_KILL_HW, &priv->shrd->status));


	iwl_power_initialize(priv);
	iwl_power_initialize(priv);
	iwl_tt_initialize(priv);
	iwl_tt_initialize(priv);
@@ -3776,7 +3778,7 @@ void __devexit iwl_remove(struct iwl_priv * priv)
	 * to be called and iwl_down since we are removing the device
	 * to be called and iwl_down since we are removing the device
	 * we need to set STATUS_EXIT_PENDING bit.
	 * we need to set STATUS_EXIT_PENDING bit.
	 */
	 */
	set_bit(STATUS_EXIT_PENDING, &priv->status);
	set_bit(STATUS_EXIT_PENDING, &priv->shrd->status);


	iwl_testmode_cleanup(priv);
	iwl_testmode_cleanup(priv);
	iwl_leds_exit(priv);
	iwl_leds_exit(priv);
+20 −19
Original line number Original line Diff line number Diff line
@@ -121,7 +121,7 @@ int iwl_init_geos(struct iwl_priv *priv)
	if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates ||
	if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates ||
	    priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) {
	    priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) {
		IWL_DEBUG_INFO(priv, "Geography modes already initialized.\n");
		IWL_DEBUG_INFO(priv, "Geography modes already initialized.\n");
		set_bit(STATUS_GEO_CONFIGURED, &priv->status);
		set_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status);
		return 0;
		return 0;
	}
	}


@@ -221,7 +221,7 @@ int iwl_init_geos(struct iwl_priv *priv)
		   priv->bands[IEEE80211_BAND_2GHZ].n_channels,
		   priv->bands[IEEE80211_BAND_2GHZ].n_channels,
		   priv->bands[IEEE80211_BAND_5GHZ].n_channels);
		   priv->bands[IEEE80211_BAND_5GHZ].n_channels);


	set_bit(STATUS_GEO_CONFIGURED, &priv->status);
	set_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status);


	return 0;
	return 0;
}
}
@@ -233,7 +233,7 @@ void iwl_free_geos(struct iwl_priv *priv)
{
{
	kfree(priv->ieee_channels);
	kfree(priv->ieee_channels);
	kfree(priv->ieee_rates);
	kfree(priv->ieee_rates);
	clear_bit(STATUS_GEO_CONFIGURED, &priv->status);
	clear_bit(STATUS_GEO_CONFIGURED, &priv->shrd->status);
}
}


static bool iwl_is_channel_extension(struct iwl_priv *priv,
static bool iwl_is_channel_extension(struct iwl_priv *priv,
@@ -808,10 +808,11 @@ void iwl_chswitch_done(struct iwl_priv *priv, bool is_success)
	 */
	 */
	struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
	struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];


	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		return;
		return;


	if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING, &priv->status))
	if (test_and_clear_bit(STATUS_CHANNEL_SWITCH_PENDING,
				&priv->shrd->status))
		ieee80211_chswitch_done(ctx->vif, is_success);
		ieee80211_chswitch_done(ctx->vif, is_success);
}
}


@@ -856,16 +857,16 @@ void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
	unsigned long reload_jiffies;
	unsigned long reload_jiffies;


	/* Set the FW error flag -- cleared on iwl_down */
	/* Set the FW error flag -- cleared on iwl_down */
	set_bit(STATUS_FW_ERROR, &priv->status);
	set_bit(STATUS_FW_ERROR, &priv->shrd->status);


	/* Cancel currently queued command. */
	/* Cancel currently queued command. */
	clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
	clear_bit(STATUS_HCMD_ACTIVE, &priv->shrd->status);


	iwlagn_abort_notification_waits(priv);
	iwlagn_abort_notification_waits(priv);


	/* Keep the restart process from trying to send host
	/* Keep the restart process from trying to send host
	 * commands by clearing the ready bit */
	 * commands by clearing the ready bit */
	clear_bit(STATUS_READY, &priv->status);
	clear_bit(STATUS_READY, &priv->shrd->status);


	wake_up_interruptible(&priv->wait_command_queue);
	wake_up_interruptible(&priv->wait_command_queue);


@@ -890,7 +891,7 @@ void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand)
			priv->reload_count = 0;
			priv->reload_count = 0;
	}
	}


	if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) {
	if (!test_bit(STATUS_EXIT_PENDING, &priv->shrd->status)) {
		if (iwlagn_mod_params.restart_fw) {
		if (iwlagn_mod_params.restart_fw) {
			IWL_DEBUG(priv, IWL_DL_FW_ERRORS,
			IWL_DEBUG(priv, IWL_DL_FW_ERRORS,
				  "Restarting adapter due to uCode error.\n");
				  "Restarting adapter due to uCode error.\n");
@@ -916,8 +917,8 @@ void iwl_irq_handle_error(struct iwl_priv *priv)
		 * Keep the restart process from trying to send host
		 * Keep the restart process from trying to send host
		 * commands by clearing the ready bit.
		 * commands by clearing the ready bit.
		 */
		 */
		clear_bit(STATUS_READY, &priv->status);
		clear_bit(STATUS_READY, &priv->shrd->status);
		clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
		clear_bit(STATUS_HCMD_ACTIVE, &priv->shrd->status);
		wake_up_interruptible(&priv->wait_command_queue);
		wake_up_interruptible(&priv->wait_command_queue);
		IWL_ERR(priv, "RF is used by WiMAX\n");
		IWL_ERR(priv, "RF is used by WiMAX\n");
		return;
		return;
@@ -960,7 +961,7 @@ void iwl_apm_stop(struct iwl_priv *priv)
{
{
	IWL_DEBUG_INFO(priv, "Stop card, put in low power state\n");
	IWL_DEBUG_INFO(priv, "Stop card, put in low power state\n");


	clear_bit(STATUS_DEVICE_ENABLED, &priv->status);
	clear_bit(STATUS_DEVICE_ENABLED, &priv->shrd->status);


	/* Stop device's DMA activity */
	/* Stop device's DMA activity */
	iwl_apm_stop_master(priv);
	iwl_apm_stop_master(priv);
@@ -1054,7 +1055,7 @@ int iwl_apm_init(struct iwl_priv *priv)
	iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
	iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
			  APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
			  APMG_PCIDEV_STT_VAL_L1_ACT_DIS);


	set_bit(STATUS_DEVICE_ENABLED, &priv->status);
	set_bit(STATUS_DEVICE_ENABLED, &priv->shrd->status);


out:
out:
	return ret;
	return ret;
@@ -1096,7 +1097,7 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
	priv->tx_power_next = tx_power;
	priv->tx_power_next = tx_power;


	/* do not set tx power when scanning or channel changing */
	/* do not set tx power when scanning or channel changing */
	defer = test_bit(STATUS_SCANNING, &priv->status) ||
	defer = test_bit(STATUS_SCANNING, &priv->shrd->status) ||
		memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging));
		memcmp(&ctx->active, &ctx->staging, sizeof(ctx->staging));
	if (defer && !force) {
	if (defer && !force) {
		IWL_DEBUG_INFO(priv, "Deferring tx power set\n");
		IWL_DEBUG_INFO(priv, "Deferring tx power set\n");
@@ -1613,7 +1614,7 @@ void iwl_update_stats(struct iwl_priv *priv, bool is_tx, __le16 fc, u16 len)


static void iwl_force_rf_reset(struct iwl_priv *priv)
static void iwl_force_rf_reset(struct iwl_priv *priv)
{
{
	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		return;
		return;


	if (!iwl_is_any_associated(priv)) {
	if (!iwl_is_any_associated(priv)) {
@@ -1638,7 +1639,7 @@ int iwl_force_reset(struct iwl_priv *priv, int mode, bool external)
{
{
	struct iwl_force_reset *force_reset;
	struct iwl_force_reset *force_reset;


	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		return -EINVAL;
		return -EINVAL;


	if (mode >= IWL_MAX_FORCE_RESET) {
	if (mode >= IWL_MAX_FORCE_RESET) {
@@ -1810,7 +1811,7 @@ void iwl_bg_watchdog(unsigned long data)
	int cnt;
	int cnt;
	unsigned long timeout;
	unsigned long timeout;


	if (test_bit(STATUS_EXIT_PENDING, &priv->status))
	if (test_bit(STATUS_EXIT_PENDING, &priv->shrd->status))
		return;
		return;


	timeout = priv->cfg->base_params->wd_timeout;
	timeout = priv->cfg->base_params->wd_timeout;
@@ -1930,9 +1931,9 @@ int iwl_resume(struct iwl_priv *priv)
		hw_rfkill = true;
		hw_rfkill = true;


	if (hw_rfkill)
	if (hw_rfkill)
		set_bit(STATUS_RF_KILL_HW, &priv->status);
		set_bit(STATUS_RF_KILL_HW, &priv->shrd->status);
	else
	else
		clear_bit(STATUS_RF_KILL_HW, &priv->status);
		clear_bit(STATUS_RF_KILL_HW, &priv->shrd->status);


	wiphy_rfkill_set_hw_state(priv->hw->wiphy, hw_rfkill);
	wiphy_rfkill_set_hw_state(priv->hw->wiphy, hw_rfkill);


Loading