Commit 6cb3e606 authored by Sergio Paracuellos's avatar Sergio Paracuellos Committed by Greg Kroah-Hartman

staging: ks7010: refactor ks_wlan_set_rx_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 9dbeb16a
...@@ -2327,16 +2327,11 @@ static int ks_wlan_set_rx_gain(struct net_device *dev, ...@@ -2327,16 +2327,11 @@ static int ks_wlan_set_rx_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.rx_gain = (uint8_t)*uwrq;
else
return -EINVAL; return -EINVAL;
if (priv->gain.rx_gain < 0xFF) priv->gain.rx_gain = (uint8_t)*uwrq;
priv->gain.rx_mode = 1; priv->gain.rx_mode = (priv->gain.rx_gain < 0xFF) ? 1 : 0;
else
priv->gain.rx_mode = 0;
hostif_sme_enqueue(priv, SME_SET_GAIN); hostif_sme_enqueue(priv, SME_SET_GAIN);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment