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

Commit 86357f79 authored by Sergio Paracuellos's avatar Sergio Paracuellos Committed by Greg Kroah-Hartman
Browse files

staging: ks7010: refactor ks_wlan_set_tx_gain function



This commit refactors ks_wlan_set_rx_gain function to
improve readability:
    - error condition is handling the error to avoid an 'else'
    - ternary operator is used to clean if-else block assignment.

Signed-off-by: default avatarSergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6cb3e606
Loading
Loading
Loading
Loading
+3 −8
Original line number Original line Diff line number Diff line
@@ -2290,16 +2290,11 @@ static int ks_wlan_set_tx_gain(struct net_device *dev,
	if (priv->sleep_mode == SLP_SLEEP)
	if (priv->sleep_mode == SLP_SLEEP)
		return -EPERM;
		return -EPERM;
	/* for SLEEP MODE */
	/* for SLEEP MODE */
	if (*uwrq >= 0 && *uwrq <= 0xFF)	/* 0-255 */
	if (*uwrq < 0 || *uwrq > 0xFF)
		priv->gain.tx_gain = (uint8_t)*uwrq;
	else
		return -EINVAL;
		return -EINVAL;


	if (priv->gain.tx_gain < 0xFF)
	priv->gain.tx_gain = (uint8_t)*uwrq;
		priv->gain.tx_mode = 1;
	priv->gain.tx_mode = (priv->gain.tx_gain < 0xFF) ? 1 : 0;
	else
		priv->gain.tx_mode = 0;

	hostif_sme_enqueue(priv, SME_SET_GAIN);
	hostif_sme_enqueue(priv, SME_SET_GAIN);
	return 0;
	return 0;
}
}