Skip to contentSkip to conversation

staging: r8188eu: drop some stop/removed checks in the led layer

PATCH In review Martin Kaiser 2 participants 4 messages Sep 25, 2022 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: r8188eu: drop some stop/removed checks in the led layer

Here's two small patches that remove unnecessary checks of bSurpriseRemoved and bDriverStopped in the led layer.

Martin Kaiser (2):
staging: r8188eu: don't check bSurpriseRemoved in SwLedOff
staging: r8188eu: don't check for stop/removal in the blink worker

 drivers/staging/r8188eu/core/rtw_led.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/2 staging: r8188eu: don't check bSurpriseRemoved in SwLedOff

The SwLedOff function calls rtw_read8 which in turn calls usb_read.

bSurpriseRemoved is checked in usb_read. We don't have to check it again in SwLedOff.

---
 drivers/staging/r8188eu/core/rtw_led.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/core/rtw_led.c +1 -1
index 989808a2b171..d3bd9a97efdc 100644
@@ -51,7 +51,7 @@ static void SwLedOff(struct adapter *padapter, struct led_priv *pLed)
 	u8	LedCfg;
 	int res;
 
-	if (padapter->bSurpriseRemoved || padapter->bDriverStopped)
+	if (padapter->bDriverStopped)
 		goto exit;
 
 	res = rtw_read8(padapter, REG_LEDCFG2, &LedCfg);/* 0x4E */
Signature · 1 line
2.30.2
#2 lore raw

PATCH 2/2 staging: r8188eu: don't check for stop/removal in the blink worker

In reply to Martin Kaiser

The blink_work function calls either SwLedOff or SwLedOn. These two functions handle bSurpriseRemoved and bDriverStopped.

There's no need to check bSurpriseRemoved and bDriverStopped again in the blink worker.

---
 drivers/staging/r8188eu/core/rtw_led.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/staging/r8188eu/core/rtw_led.c +0 -3
index d3bd9a97efdc..1e316e6358ea 100644
@@ -77,9 +77,6 @@ static void blink_work(struct work_struct *work)
 	struct adapter *padapter = pLed->padapter;
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 
-	if ((padapter->bSurpriseRemoved) || (padapter->bDriverStopped))
-		return;
-
 	if (padapter->pwrctrlpriv.rf_pwrstate != rf_on) {
 		SwLedOff(padapter, pLed);
 		ResetLedStatus(pLed);
Signature · 1 line
2.30.2
Tested-by on the v1 series
#3 lore raw
In reply to Martin Kaiser
Quoted 10 lines · Martin Kaiser

Here's two small patches that remove unnecessary checks of bSurpriseRemoved and bDriverStopped in the led layer.

Martin Kaiser (2):
staging: r8188eu: don't check bSurpriseRemoved in SwLedOff
staging: r8188eu: don't check for stop/removal in the blink worker

  drivers/staging/r8188eu/core/rtw_led.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)

Quick download test is working.
Observed LED is working fine