staging: r8188eu: simplify the LED_CTL_POWER_OFF case
authorMartin Kaiser <martin@kaiser.cx>
Mon, 5 Sep 2022 20:01:40 +0000 (22:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Sep 2022 07:52:08 +0000 (09:52 +0200)
When a caller of rtw_led_control requests that the led be switched off,
we should cancel the blink worker and set all blinking state variables
to false. This does not depend on the current blinking state.

Tested-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220905200146.82259-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_led.c

index c57059eeda34e7a9994fa42fdfeabd0c3524c4e5..dd3f0169ff94755447c2aeeb35b3cf745b486e4f 100644 (file)
@@ -381,26 +381,12 @@ void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction)
        case LED_CTL_POWER_OFF:
                pLed->CurrLedState = RTW_LED_OFF;
                pLed->BlinkingLedState = RTW_LED_OFF;
-               if (pLed->bLedNoLinkBlinkInProgress) {
-                       cancel_delayed_work(&pLed->blink_work);
-                       pLed->bLedNoLinkBlinkInProgress = false;
-               }
-               if (pLed->bLedLinkBlinkInProgress) {
-                       cancel_delayed_work(&pLed->blink_work);
-                       pLed->bLedLinkBlinkInProgress = false;
-               }
-               if (pLed->bLedBlinkInProgress) {
-                       cancel_delayed_work(&pLed->blink_work);
-                       pLed->bLedBlinkInProgress = false;
-               }
-               if (pLed->bLedWPSBlinkInProgress) {
-                       cancel_delayed_work(&pLed->blink_work);
-                       pLed->bLedWPSBlinkInProgress = false;
-               }
-               if (pLed->bLedScanBlinkInProgress) {
-                       cancel_delayed_work(&pLed->blink_work);
-                       pLed->bLedScanBlinkInProgress = false;
-               }
+               pLed->bLedNoLinkBlinkInProgress = false;
+               pLed->bLedLinkBlinkInProgress = false;
+               pLed->bLedBlinkInProgress = false;
+               pLed->bLedWPSBlinkInProgress = false;
+               pLed->bLedScanBlinkInProgress = false;
+               cancel_delayed_work(&pLed->blink_work);
                SwLedOff(padapter, pLed);
                break;
        default: