staging: r8188eu: move SwLedOn and SwLedOff into rtw_led.c
authorMartin Kaiser <martin@kaiser.cx>
Sun, 26 Dec 2021 19:55:37 +0000 (20:55 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Dec 2021 16:12:33 +0000 (17:12 +0100)
Move the low-level functions SwLedOn and SwLedOff from the hal layer
into rtw_led.c. This is the only place where they're used.

There's no need to go through the hal layer for a simple register access
if the driver supports only a single chipset.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20211226195556.159471-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/core/rtw_led.c
drivers/staging/r8188eu/hal/rtl8188eu_led.c
drivers/staging/r8188eu/include/rtw_led.h

index 25fab7bce7dca1a45eae5578504068d304f7af7f..2e3a689fb2fd649569a64aaf4e74ceecd283f1af 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "../include/drv_types.h"
 #include "../include/rtw_led.h"
+#include "../include/rtl8188e_spec.h"
 
 void BlinkWorkItemCallback(struct work_struct *work)
 {
@@ -28,6 +29,36 @@ void ResetLedStatus(struct LED_871x *pLed)
        pLed->bLedScanBlinkInProgress = false;
 }
 
+static void SwLedOn(struct adapter *padapter, struct LED_871x *pLed)
+{
+       u8      LedCfg;
+
+       if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
+               return;
+
+       LedCfg = rtw_read8(padapter, REG_LEDCFG2);
+       rtw_write8(padapter, REG_LEDCFG2, (LedCfg & 0xf0) | BIT(5) | BIT(6)); /*  SW control led0 on. */
+       pLed->bLedOn = true;
+}
+
+static void SwLedOff(struct adapter *padapter, struct LED_871x *pLed)
+{
+       u8      LedCfg;
+
+       if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
+               goto exit;
+
+       LedCfg = rtw_read8(padapter, REG_LEDCFG2);/* 0x4E */
+
+       LedCfg &= 0x90; /*  Set to software control. */
+       rtw_write8(padapter, REG_LEDCFG2, (LedCfg | BIT(3)));
+       LedCfg = rtw_read8(padapter, REG_MAC_PINMUX_CFG);
+       LedCfg &= 0xFE;
+       rtw_write8(padapter, REG_MAC_PINMUX_CFG, LedCfg);
+exit:
+       pLed->bLedOn = false;
+}
+
 void InitLed871x(struct adapter *padapter, struct LED_871x *pLed)
 {
        pLed->padapter = padapter;
index 6fd1d1d476c7ed24121cd76e1e2bf59b89035b9e..46dd8c6703b749a8e85adc6b623997533dcd8d69 100644 (file)
@@ -6,38 +6,6 @@
 #include "../include/rtl8188e_hal.h"
 #include "../include/rtl8188e_led.h"
 
-/*  LED object. */
-
-void SwLedOn(struct adapter *padapter, struct LED_871x *pLed)
-{
-       u8      LedCfg;
-
-       if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
-               return;
-
-       LedCfg = rtw_read8(padapter, REG_LEDCFG2);
-       rtw_write8(padapter, REG_LEDCFG2, (LedCfg & 0xf0) | BIT(5) | BIT(6)); /*  SW control led0 on. */
-       pLed->bLedOn = true;
-}
-
-void SwLedOff(struct adapter *padapter, struct LED_871x *pLed)
-{
-       u8      LedCfg;
-
-       if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
-               goto exit;
-
-       LedCfg = rtw_read8(padapter, REG_LEDCFG2);/* 0x4E */
-
-       LedCfg &= 0x90; /*  Set to software control. */
-       rtw_write8(padapter, REG_LEDCFG2, (LedCfg | BIT(3)));
-       LedCfg = rtw_read8(padapter, REG_MAC_PINMUX_CFG);
-       LedCfg &= 0xFE;
-       rtw_write8(padapter, REG_MAC_PINMUX_CFG, LedCfg);
-exit:
-       pLed->bLedOn = false;
-}
-
 /*  Interface to manipulate LED objects. */
 /*  Default LED behavior. */
 
index e9b6d7768c2d0e913245955d798352db03ccee47..37f1dbc111f1407952fc7c099a4d92b2a624a021 100644 (file)
@@ -107,9 +107,6 @@ void ResetLedStatus(struct LED_871x * pLed);
 void InitLed871x(struct adapter *padapter, struct LED_871x *pLed);
 void DeInitLed871x(struct LED_871x *pLed);
 
-/* hal... */
 void BlinkHandler(struct LED_871x * pLed);
-void SwLedOn(struct adapter *padapter, struct LED_871x *pLed);
-void SwLedOff(struct adapter *padapter, struct LED_871x *pLed);
 
 #endif /* __RTW_LED_H_ */