From 1ca96884b12dd2d57e0339d9f4a29e4888edc0e2 Mon Sep 17 00:00:00 2001 From: Luis de Bethencourt Date: Mon, 19 Oct 2015 18:14:29 +0100 Subject: staging: rtl8712: Remove boolean comparisons Boolean tests do not need explicit comparison to true or false. Signed-off-by: Luis de Bethencourt Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8712/rtl8712_led.c | 164 +++++++++++++++++----------------- 1 file changed, 80 insertions(+), 84 deletions(-) (limited to 'drivers/staging/rtl8712/rtl8712_led.c') diff --git a/drivers/staging/rtl8712/rtl8712_led.c b/drivers/staging/rtl8712/rtl8712_led.c index ada8d5dafd49..48d744df47df 100644 --- a/drivers/staging/rtl8712/rtl8712_led.c +++ b/drivers/staging/rtl8712/rtl8712_led.c @@ -122,8 +122,7 @@ static void SwLedOn(struct _adapter *padapter, struct LED_871x *pLed) { u8 LedCfg; - if ((padapter->bSurpriseRemoved == true) || - (padapter->bDriverStopped == true)) + if (padapter->bSurpriseRemoved || padapter->bDriverStopped) return; LedCfg = r8712_read8(padapter, LEDCFG); switch (pLed->LedPin) { @@ -151,8 +150,7 @@ static void SwLedOff(struct _adapter *padapter, struct LED_871x *pLed) { u8 LedCfg; - if ((padapter->bSurpriseRemoved == true) || - (padapter->bDriverStopped == true)) + if (padapter->bSurpriseRemoved || padapter->bDriverStopped) return; LedCfg = r8712_read8(padapter, LEDCFG); switch (pLed->LedPin) { @@ -222,11 +220,11 @@ static void SwLedBlink(struct LED_871x *pLed) bStopBlinking = true; break; case LED_BLINK_StartToBlink: - if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) && + if (check_fwstate(pmlmepriv, _FW_LINKED) && (pmlmepriv->fw_state & WIFI_STATION_STATE)) bStopBlinking = true; - if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) && - ((pmlmepriv->fw_state & WIFI_ADHOC_STATE) || + if (check_fwstate(pmlmepriv, _FW_LINKED) && + ((pmlmepriv->fw_state & WIFI_ADHOC_STATE) || (pmlmepriv->fw_state & WIFI_ADHOC_MASTER_STATE))) bStopBlinking = true; else if (pLed->BlinkTimes == 0) @@ -241,11 +239,10 @@ static void SwLedBlink(struct LED_871x *pLed) break; } if (bStopBlinking) { - if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) && - (pLed->bLedOn == false)) + if (check_fwstate(pmlmepriv, _FW_LINKED) && + !pLed->bLedOn) SwLedOn(padapter, pLed); - else if ((check_fwstate(pmlmepriv, _FW_LINKED) == - true) && pLed->bLedOn == true) + else if (check_fwstate(pmlmepriv, _FW_LINKED) && pLed->bLedOn) SwLedOff(padapter, pLed); pLed->BlinkTimes = 0; pLed->bLedBlinkInProgress = false; @@ -296,7 +293,7 @@ static void SwLedBlink1(struct LED_871x *pLed) else SwLedOff(padapter, pLed); if (peeprompriv->CustomerID == RT_CID_DEFAULT) { - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { if (!pLed1->bSWLedCtrl) { SwLedOn(padapter, pLed1); pLed1->bSWLedCtrl = true; @@ -332,7 +329,7 @@ static void SwLedBlink1(struct LED_871x *pLed) if (pLed->BlinkTimes == 0) bStopBlinking = true; if (bStopBlinking) { - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { pLed->bLedLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_NORMAL; if (pLed->bLedOn) @@ -366,7 +363,7 @@ static void SwLedBlink1(struct LED_871x *pLed) if (pLed->BlinkTimes == 0) bStopBlinking = true; if (bStopBlinking) { - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { pLed->bLedLinkBlinkInProgress = true; pLed->CurrLedState = LED_BLINK_NORMAL; if (pLed->bLedOn) @@ -446,7 +443,7 @@ static void SwLedBlink2(struct LED_871x *pLed) if (pLed->BlinkTimes == 0) bStopBlinking = true; if (bStopBlinking) { - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { pLed->CurrLedState = LED_ON; pLed->BlinkingLedState = LED_ON; SwLedOn(padapter, pLed); @@ -470,7 +467,7 @@ static void SwLedBlink2(struct LED_871x *pLed) if (pLed->BlinkTimes == 0) bStopBlinking = true; if (bStopBlinking) { - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { pLed->CurrLedState = LED_ON; pLed->BlinkingLedState = LED_ON; SwLedOn(padapter, pLed); @@ -512,7 +509,7 @@ static void SwLedBlink3(struct LED_871x *pLed) if (pLed->BlinkTimes == 0) bStopBlinking = true; if (bStopBlinking) { - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { pLed->CurrLedState = LED_ON; pLed->BlinkingLedState = LED_ON; if (!pLed->bLedOn) @@ -538,7 +535,7 @@ static void SwLedBlink3(struct LED_871x *pLed) if (pLed->BlinkTimes == 0) bStopBlinking = true; if (bStopBlinking) { - if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { + if (check_fwstate(pmlmepriv, _FW_LINKED)) { pLed->CurrLedState = LED_ON; pLed->BlinkingLedState = LED_ON; if (!pLed->bLedOn) @@ -827,8 +824,7 @@ static void BlinkTimerCallback(unsigned long data) /* This fixed the crash problem on Fedora 12 when trying to do the * insmod;ifconfig up;rmmod commands. */ - if ((pLed->padapter->bSurpriseRemoved == true) || - (pLed->padapter->bDriverStopped == true)) + if (pLed->padapter->bSurpriseRemoved || pLed->padapter->bDriverStopped) return; schedule_work(&pLed->BlinkWorkItem); } @@ -893,15 +889,15 @@ static void SwLedControlMode1(struct _adapter *padapter, switch (LedAction) { case LED_CTL_START_TO_LINK: case LED_CTL_NO_LINK: - if (pLed->bLedNoLinkBlinkInProgress == false) { + if (!pLed->bLedNoLinkBlinkInProgress) { if (pLed->CurrLedState == LED_SCAN_BLINK || IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedLinkBlinkInProgress == true) { + if (pLed->bLedLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedLinkBlinkInProgress = false; } - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } @@ -916,15 +912,15 @@ static void SwLedControlMode1(struct _adapter *padapter, } break; case LED_CTL_LINK: - if (pLed->bLedLinkBlinkInProgress == false) { + if (!pLed->bLedLinkBlinkInProgress) { if (pLed->CurrLedState == LED_SCAN_BLINK || IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedNoLinkBlinkInProgress == true) { + if (pLed->bLedNoLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } @@ -939,21 +935,21 @@ static void SwLedControlMode1(struct _adapter *padapter, } break; case LED_CTL_SITE_SURVEY: - if ((psitesurveyctrl->traffic_busy) && - (check_fwstate(pmlmepriv, _FW_LINKED) == true)) + if (psitesurveyctrl->traffic_busy && + check_fwstate(pmlmepriv, _FW_LINKED)) ; /* dummy branch */ - else if (pLed->bLedScanBlinkInProgress == false) { + else if (!pLed->bLedScanBlinkInProgress) { if (IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedNoLinkBlinkInProgress == true) { + if (pLed->bLedNoLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } - if (pLed->bLedLinkBlinkInProgress == true) { + if (pLed->bLedLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedLinkBlinkInProgress = false; } - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } @@ -970,15 +966,15 @@ static void SwLedControlMode1(struct _adapter *padapter, break; case LED_CTL_TX: case LED_CTL_RX: - if (pLed->bLedBlinkInProgress == false) { + if (!pLed->bLedBlinkInProgress) { if (pLed->CurrLedState == LED_SCAN_BLINK || IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedNoLinkBlinkInProgress == true) { + if (pLed->bLedNoLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } - if (pLed->bLedLinkBlinkInProgress == true) { + if (pLed->bLedLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedLinkBlinkInProgress = false; } @@ -996,20 +992,20 @@ static void SwLedControlMode1(struct _adapter *padapter, case LED_CTL_START_WPS: /*wait until xinpin finish */ case LED_CTL_START_WPS_BOTTON: - if (pLed->bLedWPSBlinkInProgress == false) { - if (pLed->bLedNoLinkBlinkInProgress == true) { + if (!pLed->bLedWPSBlinkInProgress) { + if (pLed->bLedNoLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } - if (pLed->bLedLinkBlinkInProgress == true) { + if (pLed->bLedLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedLinkBlinkInProgress = false; } - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } - if (pLed->bLedScanBlinkInProgress == true) { + if (pLed->bLedScanBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } @@ -1024,19 +1020,19 @@ static void SwLedControlMode1(struct _adapter *padapter, } break; case LED_CTL_STOP_WPS: - if (pLed->bLedNoLinkBlinkInProgress == true) { + if (pLed->bLedNoLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } - if (pLed->bLedLinkBlinkInProgress == true) { + if (pLed->bLedLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedLinkBlinkInProgress = false; } - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } - if (pLed->bLedScanBlinkInProgress == true) { + if (pLed->bLedScanBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } @@ -1111,11 +1107,11 @@ static void SwLedControlMode2(struct _adapter *padapter, case LED_CTL_SITE_SURVEY: if (pmlmepriv->sitesurveyctrl.traffic_busy) ; /* dummy branch */ - else if (pLed->bLedScanBlinkInProgress == false) { + else if (!pLed->bLedScanBlinkInProgress) { if (IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } @@ -1133,8 +1129,8 @@ static void SwLedControlMode2(struct _adapter *padapter, case LED_CTL_TX: case LED_CTL_RX: - if ((pLed->bLedBlinkInProgress == false) && - (check_fwstate(pmlmepriv, _FW_LINKED) == true)) { + if (!pLed->bLedBlinkInProgress && + check_fwstate(pmlmepriv, _FW_LINKED)) { if (pLed->CurrLedState == LED_SCAN_BLINK || IS_LED_WPS_BLINKING(pLed)) return; @@ -1168,12 +1164,12 @@ static void SwLedControlMode2(struct _adapter *padapter, case LED_CTL_START_WPS: /*wait until xinpin finish*/ case LED_CTL_START_WPS_BOTTON: - if (pLed->bLedWPSBlinkInProgress == false) { - if (pLed->bLedBlinkInProgress == true) { + if (!pLed->bLedWPSBlinkInProgress) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } - if (pLed->bLedScanBlinkInProgress == true) { + if (pLed->bLedScanBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } @@ -1244,10 +1240,10 @@ static void SwLedControlMode3(struct _adapter *padapter, case LED_CTL_SITE_SURVEY: if (pmlmepriv->sitesurveyctrl.traffic_busy) ; /* dummy branch */ - else if (pLed->bLedScanBlinkInProgress == false) { + else if (!pLed->bLedScanBlinkInProgress) { if (IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } @@ -1264,8 +1260,8 @@ static void SwLedControlMode3(struct _adapter *padapter, break; case LED_CTL_TX: case LED_CTL_RX: - if ((pLed->bLedBlinkInProgress == false) && - (check_fwstate(pmlmepriv, _FW_LINKED) == true)) { + if (!pLed->bLedBlinkInProgress && + check_fwstate(pmlmepriv, _FW_LINKED)) { if (pLed->CurrLedState == LED_SCAN_BLINK || IS_LED_WPS_BLINKING(pLed)) return; @@ -1298,12 +1294,12 @@ static void SwLedControlMode3(struct _adapter *padapter, break; case LED_CTL_START_WPS: /* wait until xinpin finish */ case LED_CTL_START_WPS_BOTTON: - if (pLed->bLedWPSBlinkInProgress == false) { - if (pLed->bLedBlinkInProgress == true) { + if (!pLed->bLedWPSBlinkInProgress) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } - if (pLed->bLedScanBlinkInProgress == true) { + if (pLed->bLedScanBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } @@ -1395,15 +1391,15 @@ static void SwLedControlMode4(struct _adapter *padapter, mod_timer(&pLed->BlinkTimer, jiffies + msecs_to_jiffies(0)); } - if (pLed->bLedStartToLinkBlinkInProgress == false) { + if (!pLed->bLedStartToLinkBlinkInProgress) { if (pLed->CurrLedState == LED_SCAN_BLINK || IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } - if (pLed->bLedNoLinkBlinkInProgress == true) { + if (pLed->bLedNoLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } @@ -1434,11 +1430,11 @@ static void SwLedControlMode4(struct _adapter *padapter, jiffies + msecs_to_jiffies(0)); } } - if (pLed->bLedNoLinkBlinkInProgress == false) { + if (!pLed->bLedNoLinkBlinkInProgress) { if (pLed->CurrLedState == LED_SCAN_BLINK || IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } @@ -1453,17 +1449,17 @@ static void SwLedControlMode4(struct _adapter *padapter, } break; case LED_CTL_SITE_SURVEY: - if ((pmlmepriv->sitesurveyctrl.traffic_busy) && - (check_fwstate(pmlmepriv, _FW_LINKED) == true)) + if (pmlmepriv->sitesurveyctrl.traffic_busy && + check_fwstate(pmlmepriv, _FW_LINKED)) ; - else if (pLed->bLedScanBlinkInProgress == false) { + else if (!pLed->bLedScanBlinkInProgress) { if (IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedNoLinkBlinkInProgress == true) { + if (pLed->bLedNoLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } @@ -1480,11 +1476,11 @@ static void SwLedControlMode4(struct _adapter *padapter, break; case LED_CTL_TX: case LED_CTL_RX: - if (pLed->bLedBlinkInProgress == false) { + if (!pLed->bLedBlinkInProgress) { if (pLed->CurrLedState == LED_SCAN_BLINK || IS_LED_WPS_BLINKING(pLed)) return; - if (pLed->bLedNoLinkBlinkInProgress == true) { + if (pLed->bLedNoLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } @@ -1510,16 +1506,16 @@ static void SwLedControlMode4(struct _adapter *padapter, mod_timer(&pLed->BlinkTimer, jiffies + msecs_to_jiffies(0)); } - if (pLed->bLedWPSBlinkInProgress == false) { - if (pLed->bLedNoLinkBlinkInProgress == true) { + if (!pLed->bLedWPSBlinkInProgress) { + if (pLed->bLedNoLinkBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedNoLinkBlinkInProgress = false; } - if (pLed->bLedBlinkInProgress == true) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } - if (pLed->bLedScanBlinkInProgress == true) { + if (pLed->bLedScanBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedScanBlinkInProgress = false; } @@ -1666,11 +1662,11 @@ static void SwLedControlMode5(struct _adapter *padapter, jiffies + msecs_to_jiffies(0)); break; case LED_CTL_SITE_SURVEY: - if ((pmlmepriv->sitesurveyctrl.traffic_busy) && - (check_fwstate(pmlmepriv, _FW_LINKED) == true)) + if (pmlmepriv->sitesurveyctrl.traffic_busy && + check_fwstate(pmlmepriv, _FW_LINKED)) ; /* dummy branch */ - else if (pLed->bLedScanBlinkInProgress == false) { - if (pLed->bLedBlinkInProgress == true) { + else if (!pLed->bLedScanBlinkInProgress) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } @@ -1687,7 +1683,7 @@ static void SwLedControlMode5(struct _adapter *padapter, break; case LED_CTL_TX: case LED_CTL_RX: - if (pLed->bLedBlinkInProgress == false) { + if (!pLed->bLedBlinkInProgress) { if (pLed->CurrLedState == LED_SCAN_BLINK) return; pLed->bLedBlinkInProgress = true; @@ -1737,8 +1733,8 @@ static void SwLedControlMode6(struct _adapter *padapter, break; case LED_CTL_TX: case LED_CTL_RX: - if (pLed->bLedBlinkInProgress == false && - (check_fwstate(pmlmepriv, _FW_LINKED) == true)) { + if (!pLed->bLedBlinkInProgress && + check_fwstate(pmlmepriv, _FW_LINKED)) { if (IS_LED_WPS_BLINKING(pLed)) return; pLed->bLedBlinkInProgress = true; @@ -1754,8 +1750,8 @@ static void SwLedControlMode6(struct _adapter *padapter, break; case LED_CTL_START_WPS: /*wait until xinpin finish*/ case LED_CTL_START_WPS_BOTTON: - if (pLed->bLedWPSBlinkInProgress == false) { - if (pLed->bLedBlinkInProgress == true) { + if (!pLed->bLedWPSBlinkInProgress) { + if (pLed->bLedBlinkInProgress) { del_timer(&pLed->BlinkTimer); pLed->bLedBlinkInProgress = false; } @@ -1805,7 +1801,7 @@ void LedControl871x(struct _adapter *padapter, enum LED_CTL_MODE LedAction) { struct led_priv *ledpriv = &(padapter->ledpriv); - if (ledpriv->bRegUseLed == false) + if (!ledpriv->bRegUseLed) return; switch (ledpriv->LedStrategy) { case SW_LED_MODE0: -- cgit v1.2.3