mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-13 19:59:34 -04:00
staging: ks7010: refactor ks_wlan_set_mode function
Most cases which are being handled in the switch-case of ks_wlan_set_mode function are just returning EINVAL. Avoid the use of switch-case stament and just use a simple if to handle those. This decrease LOC as well as improves 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
b58e1ddaa2
commit
1e4c7fb3a5
@@ -745,24 +745,13 @@ static int ks_wlan_set_mode(struct net_device *dev,
|
||||
if (priv->sleep_mode == SLP_SLEEP)
|
||||
return -EPERM;
|
||||
|
||||
/* for SLEEP MODE */
|
||||
switch (uwrq->mode) {
|
||||
case IW_MODE_ADHOC:
|
||||
priv->reg.operation_mode = MODE_ADHOC;
|
||||
priv->need_commit |= SME_MODE_SET;
|
||||
break;
|
||||
case IW_MODE_INFRA:
|
||||
priv->reg.operation_mode = MODE_INFRASTRUCTURE;
|
||||
priv->need_commit |= SME_MODE_SET;
|
||||
break;
|
||||
case IW_MODE_AUTO:
|
||||
case IW_MODE_MASTER:
|
||||
case IW_MODE_REPEAT:
|
||||
case IW_MODE_SECOND:
|
||||
case IW_MODE_MONITOR:
|
||||
default:
|
||||
if (uwrq->mode != IW_MODE_ADHOC &&
|
||||
uwrq->mode != IW_MODE_INFRA)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
priv->reg.operation_mode = (uwrq->mode == IW_MODE_ADHOC) ?
|
||||
MODE_ADHOC : MODE_INFRASTRUCTURE;
|
||||
priv->need_commit |= SME_MODE_SET;
|
||||
|
||||
return -EINPROGRESS; /* Call commit handler */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user