staging: rtl8188eu: refactor led related structures.
authornavin patidar <navin.patidar@gmail.com>
Sun, 20 Apr 2014 08:47:15 +0000 (14:17 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Apr 2014 22:59:51 +0000 (15:59 -0700)
struct led_priv contains two variables SwLed0 and SwLed1 but only
SwLed0 is being used by SwLedControlModel1() function.

SwLedControlModel1() function performs led operations.

This patch removes SwLed1 and code which uses SwLed1.

Signed-off-by: navin patidar <navin.patidar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/core/rtw_led.c
drivers/staging/rtl8188eu/hal/rtl8188eu_led.c
drivers/staging/rtl8188eu/include/rtw_led.h

index c42e17647b908a1615c46b19d20bf0f4683dd7cc..87d6f063476b1535c4be14b7ebeb8754ab5b4679 100644 (file)
@@ -70,10 +70,9 @@ void ResetLedStatus(struct LED_871x *pLed)
 
 /*Description: */
 /*             Initialize an LED_871x object. */
-void InitLed871x(struct adapter *padapter, struct LED_871x *pLed, enum LED_PIN_871x LedPin)
+void InitLed871x(struct adapter *padapter, struct LED_871x *pLed)
 {
        pLed->padapter = padapter;
-       pLed->LedPin = LedPin;
 
        ResetLedStatus(pLed);
 
index e3c86f7162cfc2cb4c0bd5a49bd7577442f2643b..77dce584f0db29bf154ff54cbc2b9a6b0c8ba4bb 100644 (file)
@@ -35,16 +35,7 @@ void SwLedOn(struct adapter *padapter, struct LED_871x *pLed)
        if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
                return;
        LedCfg = rtw_read8(padapter, REG_LEDCFG2);
-       switch (pLed->LedPin) {
-       case LED_PIN_LED0:
-               rtw_write8(padapter, REG_LEDCFG2, (LedCfg&0xf0)|BIT5|BIT6); /*  SW control led0 on. */
-               break;
-       case LED_PIN_LED1:
-               rtw_write8(padapter, REG_LEDCFG2, (LedCfg&0x0f)|BIT5); /*  SW control led1 on. */
-               break;
-       default:
-               break;
-       }
+       rtw_write8(padapter, REG_LEDCFG2, (LedCfg&0xf0)|BIT5|BIT6); /*  SW control led0 on. */
        pLed->bLedOn = true;
 }
 
@@ -60,25 +51,15 @@ void SwLedOff(struct adapter *padapter, struct LED_871x *pLed)
 
        LedCfg = rtw_read8(padapter, REG_LEDCFG2);/* 0x4E */
 
-       switch (pLed->LedPin) {
-       case LED_PIN_LED0:
-               if (pHalData->bLedOpenDrain) {
+       if (pHalData->bLedOpenDrain) {
                        /*  Open-drain arrangement for controlling the LED) */
-                       LedCfg &= 0x90; /*  Set to software control. */
-                       rtw_write8(padapter, REG_LEDCFG2, (LedCfg|BIT3));
-                       LedCfg = rtw_read8(padapter, REG_MAC_PINMUX_CFG);
-                       LedCfg &= 0xFE;
-                       rtw_write8(padapter, REG_MAC_PINMUX_CFG, LedCfg);
-               } else {
-                       rtw_write8(padapter, REG_LEDCFG2, (LedCfg|BIT3|BIT5|BIT6));
-               }
-               break;
-       case LED_PIN_LED1:
-               LedCfg &= 0x0f; /*  Set to software control. */
+               LedCfg &= 0x90; /*  Set to software control. */
                rtw_write8(padapter, REG_LEDCFG2, (LedCfg|BIT3));
-               break;
-       default:
-               break;
+               LedCfg = rtw_read8(padapter, REG_MAC_PINMUX_CFG);
+               LedCfg &= 0xFE;
+               rtw_write8(padapter, REG_MAC_PINMUX_CFG, LedCfg);
+       } else {
+               rtw_write8(padapter, REG_LEDCFG2, (LedCfg|BIT3|BIT5|BIT6));
        }
 exit:
        pLed->bLedOn = false;
@@ -98,9 +79,7 @@ void rtl8188eu_InitSwLeds(struct adapter *padapter)
        pledpriv->LedControlHandler = LedControl8188eu;
        haldata->bLedOpenDrain = true;
 
-       InitLed871x(padapter, &(pledpriv->SwLed0), LED_PIN_LED0);
-
-       InitLed871x(padapter, &(pledpriv->SwLed1), LED_PIN_LED1);
+       InitLed871x(padapter, &(pledpriv->SwLed0));
 }
 
 /*     Description: */
@@ -110,5 +89,4 @@ void rtl8188eu_DeInitSwLeds(struct adapter *padapter)
        struct led_priv *ledpriv = &(padapter->ledpriv);
 
        DeInitLed871x(&(ledpriv->SwLed0));
-       DeInitLed871x(&(ledpriv->SwLed1));
 }
index 690c82aea1cdc44ef34f63eba2157dd5cde691dc..ed1c687f807945f11666df0c5fdfad1ed8da2939 100644 (file)
@@ -96,19 +96,9 @@ enum LED_STATE_871x {
        LED_BLINK_ALWAYS_ON = 16,
 };
 
-enum LED_PIN_871x {
-       LED_PIN_NULL = 0,
-       LED_PIN_LED0 = 1,
-       LED_PIN_LED1 = 2,
-       LED_PIN_LED2 = 3,
-       LED_PIN_GPIO0 = 4,
-};
-
 struct LED_871x {
        struct adapter *padapter;
 
-       enum LED_PIN_871x       LedPin; /* Identify how to implement this
-                                        * SW led. */
        enum LED_STATE_871x     CurrLedState; /*  Current LED state. */
        enum LED_STATE_871x     BlinkingLedState; /*  Next state for blinking,
                                   * either RTW_LED_ON or RTW_LED_OFF are. */
@@ -148,7 +138,6 @@ void LedControl8188eu(struct adapter *padapter, enum LED_CTL_MODE   LedAction);
 struct led_priv{
        /* add for led control */
        struct LED_871x                 SwLed0;
-       struct LED_871x                 SwLed1;
        u8      bRegUseLed;
        void (*LedControlHandler)(struct adapter *padapter,
                                  enum LED_CTL_MODE LedAction);
@@ -166,8 +155,7 @@ void BlinkWorkItemCallback(struct work_struct *work);
 
 void ResetLedStatus(struct LED_871x *pLed);
 
-void InitLed871x(struct adapter *padapter, struct LED_871x *pLed,
-                enum LED_PIN_871x LedPin);
+void InitLed871x(struct adapter *padapter, struct LED_871x *pLed);
 
 void DeInitLed871x(struct LED_871x *pLed);