Commit c0cfe01f authored by Ana Rey's avatar Ana Rey Committed by Peter P Waskiewicz Jr

staging: rtl8187se: Convert _RT_RF_POWER_STATE typedef into an enum

The Documentation/CodingStyle doesn't recommend the use of typedef,
convert this to an enum.

While at it, I have also renamed the variable names that were used in
this typedef not to use Hungarian notation.
Signed-off-by: default avatarAna Rey <anarey@gmail.com>
Signed-off-by: default avatarPeter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
parent 8a8ec806
...@@ -250,11 +250,11 @@ typedef enum _LED_CTL_MODE { ...@@ -250,11 +250,11 @@ typedef enum _LED_CTL_MODE {
LED_CTL_POWER_OFF = 7 LED_CTL_POWER_OFF = 7
} LED_CTL_MODE; } LED_CTL_MODE;
typedef enum _RT_RF_POWER_STATE { enum rt_rf_power_state {
eRfOn, RF_ON,
eRfSleep, RF_SLEEP,
eRfOff RF_OFF
} RT_RF_POWER_STATE; };
enum _ReasonCode { enum _ReasonCode {
unspec_reason = 0x1, unspec_reason = 0x1,
...@@ -467,8 +467,8 @@ struct r8180_priv { ...@@ -467,8 +467,8 @@ struct r8180_priv {
struct timer_list watch_dog_timer; struct timer_list watch_dog_timer;
bool bInactivePs; bool bInactivePs;
bool bSwRfProcessing; bool bSwRfProcessing;
RT_RF_POWER_STATE eInactivePowerState; enum rt_rf_power_state eInactivePowerState;
RT_RF_POWER_STATE eRFPowerState; enum rt_rf_power_state eRFPowerState;
u32 RfOffReason; u32 RfOffReason;
bool RFChangeInProgress; bool RFChangeInProgress;
bool SetRFPowerStateInProgress; bool SetRFPowerStateInProgress;
...@@ -694,7 +694,7 @@ void fix_tx_fifo(struct net_device *dev); ...@@ -694,7 +694,7 @@ void fix_tx_fifo(struct net_device *dev);
void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch); void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch);
void rtl8180_rate_adapter(struct work_struct *work); void rtl8180_rate_adapter(struct work_struct *work);
/* #endif */ /* #endif */
bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet, bool MgntActSet_RF_State(struct net_device *dev, enum rt_rf_power_state StateToSet,
u32 ChangeSource); u32 ChangeSource);
#endif #endif
......
...@@ -2439,7 +2439,7 @@ static short rtl8180_init(struct net_device *dev) ...@@ -2439,7 +2439,7 @@ static short rtl8180_init(struct net_device *dev)
priv->bInactivePs = true; /* false; */ priv->bInactivePs = true; /* false; */
priv->ieee80211->bInactivePs = priv->bInactivePs; priv->ieee80211->bInactivePs = priv->bInactivePs;
priv->bSwRfProcessing = false; priv->bSwRfProcessing = false;
priv->eRFPowerState = eRfOff; priv->eRFPowerState = RF_OFF;
priv->RfOffReason = 0; priv->RfOffReason = 0;
priv->led_strategy = SW_LED_MODE0; priv->led_strategy = SW_LED_MODE0;
priv->TxPollingTimes = 0; /* lzm add 080826 */ priv->TxPollingTimes = 0; /* lzm add 080826 */
...@@ -2967,7 +2967,7 @@ void rtl8180_watch_dog(struct net_device *dev) ...@@ -2967,7 +2967,7 @@ void rtl8180_watch_dog(struct net_device *dev)
if ((priv->ieee80211->iw_mode != IW_MODE_ADHOC) && if ((priv->ieee80211->iw_mode != IW_MODE_ADHOC) &&
(priv->ieee80211->state == IEEE80211_NOLINK) && (priv->ieee80211->state == IEEE80211_NOLINK) &&
(priv->ieee80211->beinretry == false) && (priv->ieee80211->beinretry == false) &&
(priv->eRFPowerState == eRfOn)) (priv->eRFPowerState == RF_ON))
IPSEnter(dev); IPSEnter(dev);
} }
/* YJ,add,080828,for link state check */ /* YJ,add,080828,for link state check */
...@@ -3101,7 +3101,7 @@ int rtl8180_down(struct net_device *dev) ...@@ -3101,7 +3101,7 @@ int rtl8180_down(struct net_device *dev)
cancel_delayed_work(&priv->ieee80211->hw_dig_wq); cancel_delayed_work(&priv->ieee80211->hw_dig_wq);
cancel_delayed_work(&priv->ieee80211->tx_pw_wq); cancel_delayed_work(&priv->ieee80211->tx_pw_wq);
del_timer_sync(&priv->SwAntennaDiversityTimer); del_timer_sync(&priv->SwAntennaDiversityTimer);
SetZebraRFPowerState8185(dev, eRfOff); SetZebraRFPowerState8185(dev, RF_OFF);
memset(&priv->ieee80211->current_network, memset(&priv->ieee80211->current_network,
0, sizeof(struct ieee80211_network)); 0, sizeof(struct ieee80211_network));
priv->ieee80211->state = IEEE80211_NOLINK; priv->ieee80211->state = IEEE80211_NOLINK;
...@@ -3752,7 +3752,7 @@ void GPIOChangeRFWorkItemCallBack(struct work_struct *work) ...@@ -3752,7 +3752,7 @@ void GPIOChangeRFWorkItemCallBack(struct work_struct *work)
struct r8180_priv *priv = ieee80211_priv(dev); struct r8180_priv *priv = ieee80211_priv(dev);
u8 btPSR; u8 btPSR;
u8 btConfig0; u8 btConfig0;
RT_RF_POWER_STATE eRfPowerStateToSet; enum rt_rf_power_state eRfPowerStateToSet;
bool bActuallySet = false; bool bActuallySet = false;
char *argv[3]; char *argv[3];
...@@ -3774,18 +3774,18 @@ void GPIOChangeRFWorkItemCallBack(struct work_struct *work) ...@@ -3774,18 +3774,18 @@ void GPIOChangeRFWorkItemCallBack(struct work_struct *work)
/* HW radio On/Off according to the value of FF51[4](config0) */ /* HW radio On/Off according to the value of FF51[4](config0) */
btConfig0 = btPSR = read_nic_byte(dev, CONFIG0); btConfig0 = btPSR = read_nic_byte(dev, CONFIG0);
eRfPowerStateToSet = (btConfig0 & BIT4) ? eRfOn : eRfOff; eRfPowerStateToSet = (btConfig0 & BIT4) ? RF_ON : RF_OFF;
/* Turn LED back on when radio enabled */ /* Turn LED back on when radio enabled */
if (eRfPowerStateToSet == eRfOn) if (eRfPowerStateToSet == RF_ON)
write_nic_byte(dev, PSR, btPSR | BIT3); write_nic_byte(dev, PSR, btPSR | BIT3);
if ((priv->ieee80211->bHwRadioOff == true) && if ((priv->ieee80211->bHwRadioOff == true) &&
(eRfPowerStateToSet == eRfOn)) { (eRfPowerStateToSet == RF_ON)) {
priv->ieee80211->bHwRadioOff = false; priv->ieee80211->bHwRadioOff = false;
bActuallySet = true; bActuallySet = true;
} else if ((priv->ieee80211->bHwRadioOff == false) && } else if ((priv->ieee80211->bHwRadioOff == false) &&
(eRfPowerStateToSet == eRfOff)) { (eRfPowerStateToSet == RF_OFF)) {
priv->ieee80211->bHwRadioOff = true; priv->ieee80211->bHwRadioOff = true;
bActuallySet = true; bActuallySet = true;
} }
......
...@@ -1116,14 +1116,14 @@ bool CheckTxPwrTracking(struct net_device *dev) ...@@ -1116,14 +1116,14 @@ bool CheckTxPwrTracking(struct net_device *dev)
void SwAntennaDiversityTimerCallback(struct net_device *dev) void SwAntennaDiversityTimerCallback(struct net_device *dev)
{ {
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
RT_RF_POWER_STATE rtState; enum rt_rf_power_state rtState;
/* We do NOT need to switch antenna while RF is off. */ /* We do NOT need to switch antenna while RF is off. */
rtState = priv->eRFPowerState; rtState = priv->eRFPowerState;
do { do {
if (rtState == eRfOff) { if (rtState == RF_OFF) {
break; break;
} else if (rtState == eRfSleep) { } else if (rtState == RF_SLEEP) {
/* Don't access BB/RF under Disable PLL situation. */ /* Don't access BB/RF under Disable PLL situation. */
break; break;
} }
......
...@@ -29,7 +29,7 @@ u16 RF_ReadReg(struct net_device *dev, u8 offset); ...@@ -29,7 +29,7 @@ u16 RF_ReadReg(struct net_device *dev, u8 offset);
void rtl8180_set_mode(struct net_device *dev, int mode); void rtl8180_set_mode(struct net_device *dev, int mode);
void rtl8180_set_mode(struct net_device *dev, int mode); void rtl8180_set_mode(struct net_device *dev, int mode);
bool SetZebraRFPowerState8185(struct net_device *dev, bool SetZebraRFPowerState8185(struct net_device *dev,
RT_RF_POWER_STATE eRFPowerState); enum rt_rf_power_state eRFPowerState);
void rtl8225z4_rf_sleep(struct net_device *dev); void rtl8225z4_rf_sleep(struct net_device *dev);
void rtl8225z4_rf_wakeup(struct net_device *dev); void rtl8225z4_rf_wakeup(struct net_device *dev);
...@@ -650,7 +650,7 @@ void rtl8225z2_rf_set_mode(struct net_device *dev) ...@@ -650,7 +650,7 @@ void rtl8225z2_rf_set_mode(struct net_device *dev)
#define LPS_MAX_SLEEP_WAITING_TIMES_87SE 5 #define LPS_MAX_SLEEP_WAITING_TIMES_87SE 5
bool SetZebraRFPowerState8185(struct net_device *dev, bool SetZebraRFPowerState8185(struct net_device *dev,
RT_RF_POWER_STATE eRFPowerState) enum rt_rf_power_state eRFPowerState)
{ {
struct r8180_priv *priv = ieee80211_priv(dev); struct r8180_priv *priv = ieee80211_priv(dev);
u8 btCR9346, btConfig3; u8 btCR9346, btConfig3;
...@@ -672,7 +672,7 @@ bool SetZebraRFPowerState8185(struct net_device *dev, ...@@ -672,7 +672,7 @@ bool SetZebraRFPowerState8185(struct net_device *dev,
write_nic_byte(dev, CONFIG3, (btConfig3 | CONFIG3_PARM_En)); write_nic_byte(dev, CONFIG3, (btConfig3 | CONFIG3_PARM_En));
switch (eRFPowerState) { switch (eRFPowerState) {
case eRfOn: case RF_ON:
write_nic_word(dev, 0x37C, 0x00EC); write_nic_word(dev, 0x37C, 0x00EC);
/* turn on AFE */ /* turn on AFE */
...@@ -697,7 +697,7 @@ bool SetZebraRFPowerState8185(struct net_device *dev, ...@@ -697,7 +697,7 @@ bool SetZebraRFPowerState8185(struct net_device *dev,
u1bTmp = read_nic_byte(dev, 0x24E); u1bTmp = read_nic_byte(dev, 0x24E);
write_nic_byte(dev, 0x24E, (u1bTmp & (~(BIT5 | BIT6)))); write_nic_byte(dev, 0x24E, (u1bTmp & (~(BIT5 | BIT6))));
break; break;
case eRfSleep: case RF_SLEEP:
for (QueueID = 0, i = 0; QueueID < 6;) { for (QueueID = 0, i = 0; QueueID < 6;) {
if (get_curr_tx_free_desc(dev, QueueID) == if (get_curr_tx_free_desc(dev, QueueID) ==
priv->txringcount) { priv->txringcount) {
...@@ -764,7 +764,7 @@ bool SetZebraRFPowerState8185(struct net_device *dev, ...@@ -764,7 +764,7 @@ bool SetZebraRFPowerState8185(struct net_device *dev,
} }
} }
break; break;
case eRfOff: case RF_OFF:
for (QueueID = 0, i = 0; QueueID < 6;) { for (QueueID = 0, i = 0; QueueID < 6;) {
if (get_curr_tx_free_desc(dev, QueueID) == if (get_curr_tx_free_desc(dev, QueueID) ==
priv->txringcount) { priv->txringcount) {
...@@ -841,10 +841,10 @@ bool SetZebraRFPowerState8185(struct net_device *dev, ...@@ -841,10 +841,10 @@ bool SetZebraRFPowerState8185(struct net_device *dev,
void rtl8225z4_rf_sleep(struct net_device *dev) void rtl8225z4_rf_sleep(struct net_device *dev)
{ {
MgntActSet_RF_State(dev, eRfSleep, RF_CHANGE_BY_PS); MgntActSet_RF_State(dev, RF_SLEEP, RF_CHANGE_BY_PS);
} }
void rtl8225z4_rf_wakeup(struct net_device *dev) void rtl8225z4_rf_wakeup(struct net_device *dev)
{ {
MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_PS); MgntActSet_RF_State(dev, RF_ON, RF_CHANGE_BY_PS);
} }
...@@ -619,10 +619,10 @@ void UpdateInitialGain(struct net_device *dev) ...@@ -619,10 +619,10 @@ void UpdateInitialGain(struct net_device *dev)
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
/* lzm add 080826 */ /* lzm add 080826 */
if (priv->eRFPowerState != eRfOn) { if (priv->eRFPowerState != RF_ON) {
/* Don't access BB/RF under disable PLL situation. /* Don't access BB/RF under disable PLL situation.
* RT_TRACE(COMP_DIG, DBG_LOUD, ("UpdateInitialGain - * RT_TRACE(COMP_DIG, DBG_LOUD, ("UpdateInitialGain -
* pHalData->eRFPowerState!=eRfOn\n")); * pHalData->eRFPowerState!=RF_ON\n"));
* Back to the original state * Back to the original state
*/ */
priv->InitialGain = priv->InitialGainBackUp; priv->InitialGain = priv->InitialGainBackUp;
...@@ -1085,7 +1085,7 @@ static bool MgntDisconnect(struct net_device *dev, u8 asRsn) ...@@ -1085,7 +1085,7 @@ static bool MgntDisconnect(struct net_device *dev, u8 asRsn)
* PASSIVE LEVEL. * PASSIVE LEVEL.
*/ */
static bool SetRFPowerState(struct net_device *dev, static bool SetRFPowerState(struct net_device *dev,
RT_RF_POWER_STATE eRFPowerState) enum rt_rf_power_state eRFPowerState)
{ {
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
bool bResult = false; bool bResult = false;
...@@ -1098,13 +1098,13 @@ static bool SetRFPowerState(struct net_device *dev, ...@@ -1098,13 +1098,13 @@ static bool SetRFPowerState(struct net_device *dev,
return bResult; return bResult;
} }
bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet, bool MgntActSet_RF_State(struct net_device *dev, enum rt_rf_power_state StateToSet,
u32 ChangeSource) u32 ChangeSource)
{ {
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
bool bActionAllowed = false; bool bActionAllowed = false;
bool bConnectBySSID = false; bool bConnectBySSID = false;
RT_RF_POWER_STATE rtState; enum rt_rf_power_state rtState;
u16 RFWaitCounter = 0; u16 RFWaitCounter = 0;
unsigned long flag; unsigned long flag;
/* /*
...@@ -1140,7 +1140,7 @@ bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet, ...@@ -1140,7 +1140,7 @@ bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet,
rtState = priv->eRFPowerState; rtState = priv->eRFPowerState;
switch (StateToSet) { switch (StateToSet) {
case eRfOn: case RF_ON:
/* /*
* Turn On RF no matter the IPS setting because we need to * Turn On RF no matter the IPS setting because we need to
* update the RF state to Ndis under Vista, or the Windows * update the RF state to Ndis under Vista, or the Windows
...@@ -1153,13 +1153,13 @@ bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet, ...@@ -1153,13 +1153,13 @@ bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet,
priv->RfOffReason = 0; priv->RfOffReason = 0;
bActionAllowed = true; bActionAllowed = true;
if (rtState == eRfOff && if (rtState == RF_OFF &&
ChangeSource >= RF_CHANGE_BY_HW) ChangeSource >= RF_CHANGE_BY_HW)
bConnectBySSID = true; bConnectBySSID = true;
} }
break; break;
case eRfOff: case RF_OFF:
/* 070125, rcnjko: we always keep connected in AP mode. */ /* 070125, rcnjko: we always keep connected in AP mode. */
if (priv->RfOffReason > RF_CHANGE_BY_IPS) { if (priv->RfOffReason > RF_CHANGE_BY_IPS) {
...@@ -1182,7 +1182,7 @@ bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet, ...@@ -1182,7 +1182,7 @@ bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet,
priv->RfOffReason |= ChangeSource; priv->RfOffReason |= ChangeSource;
bActionAllowed = true; bActionAllowed = true;
break; break;
case eRfSleep: case RF_SLEEP:
priv->RfOffReason |= ChangeSource; priv->RfOffReason |= ChangeSource;
bActionAllowed = true; bActionAllowed = true;
break; break;
...@@ -1233,7 +1233,7 @@ static void InactivePowerSave(struct net_device *dev) ...@@ -1233,7 +1233,7 @@ static void InactivePowerSave(struct net_device *dev)
void IPSEnter(struct net_device *dev) void IPSEnter(struct net_device *dev)
{ {
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
RT_RF_POWER_STATE rtState; enum rt_rf_power_state rtState;
if (priv->bInactivePs) { if (priv->bInactivePs) {
rtState = priv->eRFPowerState; rtState = priv->eRFPowerState;
...@@ -1245,9 +1245,9 @@ void IPSEnter(struct net_device *dev) ...@@ -1245,9 +1245,9 @@ void IPSEnter(struct net_device *dev)
* trigger IPS)(4) IBSS (send Beacon) * trigger IPS)(4) IBSS (send Beacon)
* (5) AP mode (send Beacon) * (5) AP mode (send Beacon)
*/ */
if (rtState == eRfOn && !priv->bSwRfProcessing if (rtState == RF_ON && !priv->bSwRfProcessing
&& (priv->ieee80211->state != IEEE80211_LINKED)) { && (priv->ieee80211->state != IEEE80211_LINKED)) {
priv->eInactivePowerState = eRfOff; priv->eInactivePowerState = RF_OFF;
InactivePowerSave(dev); InactivePowerSave(dev);
} }
} }
...@@ -1255,13 +1255,13 @@ void IPSEnter(struct net_device *dev) ...@@ -1255,13 +1255,13 @@ void IPSEnter(struct net_device *dev)
void IPSLeave(struct net_device *dev) void IPSLeave(struct net_device *dev)
{ {
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
RT_RF_POWER_STATE rtState; enum rt_rf_power_state rtState;
if (priv->bInactivePs) { if (priv->bInactivePs) {
rtState = priv->eRFPowerState; rtState = priv->eRFPowerState;
if ((rtState == eRfOff || rtState == eRfSleep) && if ((rtState == RF_OFF || rtState == RF_SLEEP) &&
!priv->bSwRfProcessing !priv->bSwRfProcessing
&& priv->RfOffReason <= RF_CHANGE_BY_IPS) { && priv->RfOffReason <= RF_CHANGE_BY_IPS) {
priv->eInactivePowerState = eRfOn; priv->eInactivePowerState = RF_ON;
InactivePowerSave(dev); InactivePowerSave(dev);
} }
} }
...@@ -1391,17 +1391,17 @@ void rtl8185b_adapter_start(struct net_device *dev) ...@@ -1391,17 +1391,17 @@ void rtl8185b_adapter_start(struct net_device *dev)
/* One of B, G, A. */ /* One of B, G, A. */
InitWirelessMode = ieee->mode; InitWirelessMode = ieee->mode;
} }
priv->eRFPowerState = eRfOff; priv->eRFPowerState = RF_OFF;
priv->RfOffReason = 0; priv->RfOffReason = 0;
{ {
MgntActSet_RF_State(dev, eRfOn, 0); MgntActSet_RF_State(dev, RF_ON, 0);
} }
/* /*
* If inactive power mode is enabled, disable rf while in * If inactive power mode is enabled, disable rf while in
* disconnected state. * disconnected state.
*/ */
if (priv->bInactivePs) if (priv->bInactivePs)
MgntActSet_RF_State(dev , eRfOff, RF_CHANGE_BY_IPS); MgntActSet_RF_State(dev , RF_OFF, RF_CHANGE_BY_IPS);
ActSetWirelessMode8185(dev, (u8)(InitWirelessMode)); ActSetWirelessMode8185(dev, (u8)(InitWirelessMode));
......
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