mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-09 12:33:18 -04:00
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: Sergio Paracuellos <sergio.paracuellos@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
81255d867c
commit
2d1de1e318
@@ -1787,23 +1787,20 @@ static int ks_wlan_set_mlme(struct net_device *dev,
|
||||
{
|
||||
struct ks_wlan_private *priv = netdev_priv(dev);
|
||||
struct iw_mlme *mlme = (struct iw_mlme *)extra;
|
||||
__u32 mode;
|
||||
__u32 mode = 1;
|
||||
|
||||
if (priv->sleep_mode == SLP_SLEEP)
|
||||
return -EPERM;
|
||||
|
||||
/* for SLEEP MODE */
|
||||
switch (mlme->cmd) {
|
||||
case IW_MLME_DEAUTH:
|
||||
if (mlme->reason_code == WLAN_REASON_MIC_FAILURE)
|
||||
return 0;
|
||||
/* fall through */
|
||||
case IW_MLME_DISASSOC:
|
||||
mode = 1;
|
||||
return ks_wlan_set_stop_request(dev, NULL, &mode, NULL);
|
||||
default:
|
||||
return -EOPNOTSUPP; /* Not Support */
|
||||
}
|
||||
if (mlme->cmd != IW_MLME_DEAUTH &&
|
||||
mlme->cmd != IW_MLME_DISASSOC)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (mlme->cmd == IW_MLME_DEAUTH &&
|
||||
mlme->reason_code == WLAN_REASON_MIC_FAILURE)
|
||||
return 0;
|
||||
|
||||
return ks_wlan_set_stop_request(dev, NULL, &mode, NULL);
|
||||
}
|
||||
|
||||
static int ks_wlan_get_firmware_version(struct net_device *dev,
|
||||
|
||||
Reference in New Issue
Block a user