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

Commit 08f2d58d authored by Wey-Yi Guy's avatar Wey-Yi Guy Committed by John W. Linville
Browse files

iwlwifi: do not allow set tx power over channel power limit



When setting tx power in sysfs, check against max channel tx power
limit instead of IWL_TX_POWER_TARGET_POWER_MAX.

Different devices have different max tx power limit; using
IWL_TX_POWER_TARGET_POWER_MAX can excess the limitaion and give wrong
information.

Signed-off-by: default avatarWey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 02eec9c5
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1708,10 +1708,10 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
		return -EINVAL;
	}

	if (tx_power > IWL_TX_POWER_TARGET_POWER_MAX) {
		IWL_WARN(priv, "Requested user TXPOWER %d above upper limit %d.\n",
			 tx_power,
			 IWL_TX_POWER_TARGET_POWER_MAX);
	if (tx_power > priv->tx_power_channel_lmt) {
		IWL_WARN(priv,
			"Requested user TXPOWER %d above upper limit %d.\n",
			 tx_power, priv->tx_power_channel_lmt);
		return -EINVAL;
	}