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

staging: ks7010: refactor hostif_sme_power_mgmt_set function

This commit refactor hostif_sme_power_mgmt_set avoiding to
use switch-case statement and simplifying data paths. This
improves readability.
Signed-off-by: default avatarSergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0d8be306
...@@ -1880,36 +1880,23 @@ void hostif_sme_multicast_set(struct ks_wlan_private *priv) ...@@ -1880,36 +1880,23 @@ void hostif_sme_multicast_set(struct ks_wlan_private *priv)
spin_unlock(&priv->multicast_spin); spin_unlock(&priv->multicast_spin);
} }
static static void hostif_sme_power_mgmt_set(struct ks_wlan_private *priv)
void hostif_sme_power_mgmt_set(struct ks_wlan_private *priv)
{ {
u32 mode, wake_up, receive_dtims; u32 mode, wake_up, receive_dtims;
switch (priv->reg.power_mgmt) { if (priv->reg.power_mgmt != POWER_MGMT_SAVE1 &&
case POWER_MGMT_SAVE1: priv->reg.power_mgmt != POWER_MGMT_SAVE2) {
mode = (priv->reg.operation_mode == MODE_INFRASTRUCTURE) ?
POWER_SAVE : POWER_ACTIVE;
wake_up = 0;
receive_dtims = 0;
break;
case POWER_MGMT_SAVE2:
if (priv->reg.operation_mode == MODE_INFRASTRUCTURE) {
mode = POWER_SAVE;
wake_up = 0;
receive_dtims = 1;
} else {
mode = POWER_ACTIVE; mode = POWER_ACTIVE;
wake_up = 0; wake_up = 0;
receive_dtims = 0; receive_dtims = 0;
} } else {
break; mode = (priv->reg.operation_mode == MODE_INFRASTRUCTURE) ?
case POWER_MGMT_ACTIVE: POWER_SAVE : POWER_ACTIVE;
default:
mode = POWER_ACTIVE;
wake_up = 0; wake_up = 0;
receive_dtims = 0; receive_dtims = (priv->reg.operation_mode == MODE_INFRASTRUCTURE &&
break; priv->reg.power_mgmt == POWER_MGMT_SAVE2);
} }
hostif_power_mgmt_request(priv, mode, wake_up, receive_dtims); hostif_power_mgmt_request(priv, mode, wake_up, receive_dtims);
} }
......
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