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

staging: ks7010: refactor ks_wlan_set_cts_mode function

This commit refactors ks_wlan_set_cts_mode function to
handle invalid values first and then assign the good
one changing a bit logic to use a ternary operator.
Signed-off-by: default avatarSergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8521b4e6
...@@ -2030,18 +2030,13 @@ static int ks_wlan_set_cts_mode(struct net_device *dev, ...@@ -2030,18 +2030,13 @@ static int ks_wlan_set_cts_mode(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 == CTS_MODE_FALSE) { /* 0 */ if (*uwrq != CTS_MODE_FALSE && *uwrq != CTS_MODE_TRUE)
priv->reg.cts_mode = CTS_MODE_FALSE;
} else if (*uwrq == CTS_MODE_TRUE) { /* 1 */
if (priv->reg.phy_type == D_11G_ONLY_MODE ||
priv->reg.phy_type == D_11BG_COMPATIBLE_MODE) {
priv->reg.cts_mode = CTS_MODE_TRUE;
} else {
priv->reg.cts_mode = CTS_MODE_FALSE;
}
} else {
return -EINVAL; return -EINVAL;
}
priv->reg.cts_mode = (*uwrq == CTS_MODE_FALSE) ? *uwrq :
(priv->reg.phy_type == D_11G_ONLY_MODE ||
priv->reg.phy_type == D_11BG_COMPATIBLE_MODE) ?
*uwrq : !*uwrq;
priv->need_commit |= SME_MODE_SET; priv->need_commit |= SME_MODE_SET;
return -EINPROGRESS; /* Call commit handler */ return -EINPROGRESS; /* Call commit handler */
......
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