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

Commit 4beeba7d authored by Stanislaw Gruszka's avatar Stanislaw Gruszka Committed by John W. Linville
Browse files

iwlwifi: warn when send tx power settings during scan



Add WARN_ONCE when scanning is pending. Use STATUS_SCAN_HW bit since we
can have scan canceled or completed but STATUS_SCANNING bit still set.

v1 -> v2: replace EIO to EAGAIN

Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
Acked-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent c7317e41
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -1451,6 +1451,10 @@ static int iwl3945_send_tx_power(struct iwl_priv *priv)
	};
	};
	u16 chan;
	u16 chan;


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

	chan = le16_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.channel);
	chan = le16_to_cpu(priv->contexts[IWL_RXON_CTX_BSS].active.channel);


	txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1;
	txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1;
+2 −6
Original line number Original line Diff line number Diff line
@@ -1377,13 +1377,9 @@ static int iwl4965_send_tx_power(struct iwl_priv *priv)
	u8 ctrl_chan_high = 0;
	u8 ctrl_chan_high = 0;
	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_SCANNING, &priv->status)) {
	if (WARN_ONCE(test_bit(STATUS_SCAN_HW, &priv->status),
		/* If this gets hit a lot, switch it to a BUG() and catch
		      "TX Power requested while scanning!\n"))
		 * the stack trace to find out who is calling this during
		 * a scan. */
		IWL_WARN(priv, "TX Power requested while scanning!\n");
		return -EAGAIN;
		return -EAGAIN;
	}


	band = priv->band == IEEE80211_BAND_2GHZ;
	band = priv->band == IEEE80211_BAND_2GHZ;


+4 −0
Original line number Original line Diff line number Diff line
@@ -496,6 +496,10 @@ 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),
		      "TX Power requested while scanning!\n"))
		return -EAGAIN;

	/* half dBm need to multiply */
	/* half dBm need to multiply */
	tx_power_cmd.global_lmt = (s8)(2 * priv->tx_power_user_lmt);
	tx_power_cmd.global_lmt = (s8)(2 * priv->tx_power_user_lmt);