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

staging: ks7010: refactor ks_wlan_set_phy_type function

Handle invalid values first and assign good ones at the
end if it is the case. This makes code simplier.
Signed-off-by: default avatarSergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7f3c8bb5
...@@ -1960,17 +1960,14 @@ static int ks_wlan_set_phy_type(struct net_device *dev, ...@@ -1960,17 +1960,14 @@ static int ks_wlan_set_phy_type(struct net_device *dev,
if (priv->sleep_mode == SLP_SLEEP) if (priv->sleep_mode == SLP_SLEEP)
return -EPERM; return -EPERM;
/* for SLEEP MODE */
if (*uwrq == D_11B_ONLY_MODE) { /* 0 */ if (*uwrq != D_11B_ONLY_MODE &&
priv->reg.phy_type = D_11B_ONLY_MODE; *uwrq != D_11G_ONLY_MODE &&
} else if (*uwrq == D_11G_ONLY_MODE) { /* 1 */ *uwrq != D_11BG_COMPATIBLE_MODE)
priv->reg.phy_type = D_11G_ONLY_MODE;
} else if (*uwrq == D_11BG_COMPATIBLE_MODE) { /* 2 */
priv->reg.phy_type = D_11BG_COMPATIBLE_MODE;
} else {
return -EINVAL; return -EINVAL;
}
/* for SLEEP MODE */
priv->reg.phy_type = *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