Commit 1b0a54b3 authored by Martin Kaiser's avatar Martin Kaiser Committed by Greg Kroah-Hartman

staging: r8188eu: merge two led structs

The led layer uses struct led_priv and struct LED_871x to store state
info. Merge the two structs. Move LED_871x's components into led_priv.

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150
Signed-off-by: default avatarMartin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220626181000.287225-1-martin@kaiser.cxSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 80394da4
......@@ -16,7 +16,7 @@
(l)->CurrLedState == LED_BLINK_WPS_STOP || \
(l)->bLedWPSBlinkInProgress)
static void ResetLedStatus(struct LED_871x *pLed)
static void ResetLedStatus(struct led_priv *pLed)
{
pLed->CurrLedState = RTW_LED_OFF; /* Current LED state. */
pLed->bLedOn = false; /* true if LED is ON, false if LED is OFF. */
......@@ -32,7 +32,7 @@ static void ResetLedStatus(struct LED_871x *pLed)
pLed->bLedScanBlinkInProgress = false;
}
static void SwLedOn(struct adapter *padapter, struct LED_871x *pLed)
static void SwLedOn(struct adapter *padapter, struct led_priv *pLed)
{
u8 LedCfg;
int res;
......@@ -48,7 +48,7 @@ static void SwLedOn(struct adapter *padapter, struct LED_871x *pLed)
pLed->bLedOn = true;
}
static void SwLedOff(struct adapter *padapter, struct LED_871x *pLed)
static void SwLedOff(struct adapter *padapter, struct led_priv *pLed)
{
u8 LedCfg;
int res;
......@@ -75,7 +75,7 @@ static void SwLedOff(struct adapter *padapter, struct LED_871x *pLed)
static void blink_work(struct work_struct *work)
{
struct delayed_work *dwork = to_delayed_work(work);
struct LED_871x *pLed = container_of(dwork, struct LED_871x, blink_work);
struct led_priv *pLed = container_of(dwork, struct led_priv, blink_work);
struct adapter *padapter = pLed->padapter;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
......@@ -182,35 +182,32 @@ static void blink_work(struct work_struct *work)
void rtl8188eu_InitSwLeds(struct adapter *padapter)
{
struct led_priv *pledpriv = &padapter->ledpriv;
struct LED_871x *pLed = &pledpriv->SwLed0;
pLed->padapter = padapter;
ResetLedStatus(pLed);
INIT_DELAYED_WORK(&pLed->blink_work, blink_work);
pledpriv->padapter = padapter;
ResetLedStatus(pledpriv);
INIT_DELAYED_WORK(&pledpriv->blink_work, blink_work);
}
void rtl8188eu_DeInitSwLeds(struct adapter *padapter)
{
struct led_priv *ledpriv = &padapter->ledpriv;
struct LED_871x *pLed = &ledpriv->SwLed0;
cancel_delayed_work_sync(&pLed->blink_work);
ResetLedStatus(pLed);
SwLedOff(padapter, pLed);
cancel_delayed_work_sync(&ledpriv->blink_work);
ResetLedStatus(ledpriv);
SwLedOff(padapter, ledpriv);
}
void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction)
{
struct led_priv *ledpriv = &padapter->ledpriv;
struct led_priv *pLed = &padapter->ledpriv;
struct registry_priv *registry_par;
struct LED_871x *pLed = &ledpriv->SwLed0;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped) ||
(!padapter->hw_init_completed))
return;
if (!ledpriv->bRegUseLed)
if (!pLed->bRegUseLed)
return;
registry_par = &padapter->registrypriv;
......
......@@ -37,9 +37,11 @@ enum LED_STATE_871x {
LED_BLINK_RUNTOP = 13, /* Customized for RunTop */
};
struct LED_871x {
struct led_priv {
struct adapter *padapter;
bool bRegUseLed;
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. */
......@@ -58,11 +60,6 @@ struct LED_871x {
struct delayed_work blink_work;
};
struct led_priv{
struct LED_871x SwLed0;
bool bRegUseLed;
};
void rtl8188eu_InitSwLeds(struct adapter *padapter);
void rtl8188eu_DeInitSwLeds(struct adapter *padapter);
......
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