summaryrefslogtreecommitdiffstats
path: root/drivers/staging/ks7010/ks_wlan_net.c
diff options
context:
space:
mode:
authorSergio Paracuellos <sergio.paracuellos@gmail.com>2018-04-19 07:08:01 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-04-23 14:32:05 +0200
commit86357f794b9692e8754718183801ce5d6f163392 (patch)
treedca02069a6c3a46cfc5ac7243168ac5b681c369e /drivers/staging/ks7010/ks_wlan_net.c
parent6cb3e6062bcae0d841188d59091c6720ff8981c3 (diff)
downloadlinux-86357f794b9692e8754718183801ce5d6f163392.tar.bz2
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: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/ks7010/ks_wlan_net.c')
-rw-r--r--drivers/staging/ks7010/ks_wlan_net.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 2fbacc56abdd..81889a5b2251 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -2290,16 +2290,11 @@ static int ks_wlan_set_tx_gain(struct net_device *dev,
if (priv->sleep_mode == SLP_SLEEP)
return -EPERM;
/* for SLEEP MODE */
- if (*uwrq >= 0 && *uwrq <= 0xFF) /* 0-255 */
- priv->gain.tx_gain = (uint8_t)*uwrq;
- else
+ if (*uwrq < 0 || *uwrq > 0xFF)
return -EINVAL;
- if (priv->gain.tx_gain < 0xFF)
- priv->gain.tx_mode = 1;
- else
- priv->gain.tx_mode = 0;
-
+ priv->gain.tx_gain = (uint8_t)*uwrq;
+ priv->gain.tx_mode = (priv->gain.tx_gain < 0xFF) ? 1 : 0;
hostif_sme_enqueue(priv, SME_SET_GAIN);
return 0;
}