From: Sergio Paracuellos Date: Tue, 24 Apr 2018 13:49:53 +0000 (+0200) Subject: staging: ks7010: refactor hostif_sme_power_mgmt_set function X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=9cfd8837ae501cef01205f6dd955fa9dedb5e2d4;p=openwrt%2Fstaging%2Fblogic.git staging: ks7010: refactor hostif_sme_power_mgmt_set function Some minor changes have been done in this function to clean it a bit: - POWER_MGMT_ACTIVE and default case are the same so just handle that with the same block of code, - POWER_MGMT_SAVE1 replaces if-else with a ternary operator. Signed-off-by: Sergio Paracuellos Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/ks7010/ks_hostif.c b/drivers/staging/ks7010/ks_hostif.c index 19c8887200f5..fe19243e192b 100644 --- a/drivers/staging/ks7010/ks_hostif.c +++ b/drivers/staging/ks7010/ks_hostif.c @@ -1962,22 +1962,12 @@ void hostif_sme_power_mgmt_set(struct ks_wlan_private *priv) unsigned long mode, wake_up, receive_dtims; switch (priv->reg.power_mgmt) { - case POWER_MGMT_ACTIVE: - mode = POWER_ACTIVE; + case POWER_MGMT_SAVE1: + mode = (priv->reg.operation_mode == MODE_INFRASTRUCTURE) ? + POWER_SAVE : POWER_ACTIVE; wake_up = 0; receive_dtims = 0; break; - case POWER_MGMT_SAVE1: - if (priv->reg.operation_mode == MODE_INFRASTRUCTURE) { - mode = POWER_SAVE; - wake_up = 0; - receive_dtims = 0; - } else { - mode = POWER_ACTIVE; - wake_up = 0; - receive_dtims = 0; - } - break; case POWER_MGMT_SAVE2: if (priv->reg.operation_mode == MODE_INFRASTRUCTURE) { mode = POWER_SAVE; @@ -1989,6 +1979,7 @@ void hostif_sme_power_mgmt_set(struct ks_wlan_private *priv) receive_dtims = 0; } break; + case POWER_MGMT_ACTIVE: default: mode = POWER_ACTIVE; wake_up = 0;