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

staging: ks7010: refactor ks_wlan_set_mlme function

This commit refactors ks_wlan_set_mlme function changing
switch-case block for more simple if paths improving
readability.
Signed-off-by: default avatarSergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 81255d86
...@@ -1787,23 +1787,20 @@ static int ks_wlan_set_mlme(struct net_device *dev, ...@@ -1787,23 +1787,20 @@ static int ks_wlan_set_mlme(struct net_device *dev,
{ {
struct ks_wlan_private *priv = netdev_priv(dev); struct ks_wlan_private *priv = netdev_priv(dev);
struct iw_mlme *mlme = (struct iw_mlme *)extra; struct iw_mlme *mlme = (struct iw_mlme *)extra;
__u32 mode; __u32 mode = 1;
if (priv->sleep_mode == SLP_SLEEP) if (priv->sleep_mode == SLP_SLEEP)
return -EPERM; return -EPERM;
/* for SLEEP MODE */ if (mlme->cmd != IW_MLME_DEAUTH &&
switch (mlme->cmd) { mlme->cmd != IW_MLME_DISASSOC)
case IW_MLME_DEAUTH: return -EOPNOTSUPP;
if (mlme->reason_code == WLAN_REASON_MIC_FAILURE)
if (mlme->cmd == IW_MLME_DEAUTH &&
mlme->reason_code == WLAN_REASON_MIC_FAILURE)
return 0; return 0;
/* fall through */
case IW_MLME_DISASSOC:
mode = 1;
return ks_wlan_set_stop_request(dev, NULL, &mode, NULL); return ks_wlan_set_stop_request(dev, NULL, &mode, NULL);
default:
return -EOPNOTSUPP; /* Not Support */
}
} }
static int ks_wlan_get_firmware_version(struct net_device *dev, static int ks_wlan_get_firmware_version(struct net_device *dev,
......
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