[10/10] staging: r8188eu: summarize tx/rx and scan blinking

Message ID 20221015151115.232095-11-martin@kaiser.cx
State New
Headers
Series staging: r8188eu: led layer fix and cleanups |

Commit Message

Martin Kaiser Oct. 15, 2022, 3:11 p.m. UTC
  Summarize the code for tx/rx blinking and for scan blinking in blink_work.
The only difference is the delay for scheduling the next worker.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/staging/r8188eu/core/rtw_led.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)
  

Comments

Philipp Hortmann Oct. 15, 2022, 8:22 p.m. UTC | #1
On 10/15/22 17:11, Martin Kaiser wrote:
> Summarize the code for tx/rx blinking and for scan blinking in blink_work.
> The only difference is the delay for scheduling the next worker.
> 
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> ---
>   drivers/staging/r8188eu/core/rtw_led.c | 19 +++----------------
>   1 file changed, 3 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
> index f8bd183fba1e..ce8de2eb7845 100644
> --- a/drivers/staging/r8188eu/core/rtw_led.c
> +++ b/drivers/staging/r8188eu/core/rtw_led.c
> @@ -81,21 +81,6 @@ static void blink_work(struct work_struct *work)
>   		schedule_delayed_work(&pLed->blink_work, LED_BLINK_LINK_INTVL);
>   		break;
>   	case LED_BLINK_SCAN:
> -		pLed->BlinkTimes--;
> -		if (pLed->BlinkTimes == 0) {
> -			if (check_fwstate(pmlmepriv, _FW_LINKED)) {
> -				pLed->CurrLedState = LED_BLINK_NORMAL;
> -				schedule_delayed_work(&pLed->blink_work, LED_BLINK_LINK_INTVL);
> -			} else {
> -				pLed->CurrLedState = LED_BLINK_SLOWLY;
> -				schedule_delayed_work(&pLed->blink_work, LED_BLINK_NO_LINK_INTVL);
> -			}
> -			pLed->bLedBlinkInProgress = false;
> -			pLed->bLedScanBlinkInProgress = false;
> -		} else {
> -			schedule_delayed_work(&pLed->blink_work, LED_BLINK_SCAN_INTVL);
> -		}
> -		break;
>   	case LED_BLINK_TXRX:
>   		pLed->BlinkTimes--;
>   		if (pLed->BlinkTimes == 0) {
> @@ -109,7 +94,9 @@ static void blink_work(struct work_struct *work)
>   			pLed->bLedBlinkInProgress = false;
>   			pLed->bLedScanBlinkInProgress = false;
>   		} else {
> -			schedule_delayed_work(&pLed->blink_work, LED_BLINK_FASTER_INTVL);
> +			schedule_delayed_work(&pLed->blink_work,
> +					      pLed->CurrLedState == LED_BLINK_SCAN ?
> +					      LED_BLINK_SCAN_INTVL : LED_BLINK_FASTER_INTVL);
>   		}
>   		break;
>   	case LED_BLINK_WPS:


I cannot apply this patch.

Applying: staging: r8188eu: summarize tx/rx and scan blinking
error: patch failed: drivers/staging/r8188eu/core/rtw_led.c:81
error: drivers/staging/r8188eu/core/rtw_led.c: patch does not apply
Patch failed at 0001 staging: r8188eu: summarize tx/rx and scan blinking
  
Martin Kaiser Oct. 16, 2022, 4:07 p.m. UTC | #2
Hi Philipp,

Thus wrote Philipp Hortmann (philipp.g.hortmann@gmail.com):

> On 10/15/22 17:11, Martin Kaiser wrote:
> > Summarize the code for tx/rx blinking and for scan blinking in blink_work.
> > The only difference is the delay for scheduling the next worker.

> > Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> > ---
> >   drivers/staging/r8188eu/core/rtw_led.c | 19 +++----------------
> >   1 file changed, 3 insertions(+), 16 deletions(-)

> > diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
> > index f8bd183fba1e..ce8de2eb7845 100644
> > --- a/drivers/staging/r8188eu/core/rtw_led.c
> > +++ b/drivers/staging/r8188eu/core/rtw_led.c
> > @@ -81,21 +81,6 @@ static void blink_work(struct work_struct *work)
> >   		schedule_delayed_work(&pLed->blink_work, LED_BLINK_LINK_INTVL);
> >   		break;
> >   	case LED_BLINK_SCAN:
> > -		pLed->BlinkTimes--;
> > -		if (pLed->BlinkTimes == 0) {
> > -			if (check_fwstate(pmlmepriv, _FW_LINKED)) {
> > -				pLed->CurrLedState = LED_BLINK_NORMAL;
> > -				schedule_delayed_work(&pLed->blink_work, LED_BLINK_LINK_INTVL);
> > -			} else {
> > -				pLed->CurrLedState = LED_BLINK_SLOWLY;
> > -				schedule_delayed_work(&pLed->blink_work, LED_BLINK_NO_LINK_INTVL);
> > -			}
> > -			pLed->bLedBlinkInProgress = false;
> > -			pLed->bLedScanBlinkInProgress = false;
> > -		} else {
> > -			schedule_delayed_work(&pLed->blink_work, LED_BLINK_SCAN_INTVL);
> > -		}
> > -		break;
> >   	case LED_BLINK_TXRX:
> >   		pLed->BlinkTimes--;
> >   		if (pLed->BlinkTimes == 0) {
> > @@ -109,7 +94,9 @@ static void blink_work(struct work_struct *work)
> >   			pLed->bLedBlinkInProgress = false;
> >   			pLed->bLedScanBlinkInProgress = false;
> >   		} else {
> > -			schedule_delayed_work(&pLed->blink_work, LED_BLINK_FASTER_INTVL);
> > +			schedule_delayed_work(&pLed->blink_work,
> > +					      pLed->CurrLedState == LED_BLINK_SCAN ?
> > +					      LED_BLINK_SCAN_INTVL : LED_BLINK_FASTER_INTVL);
> >   		}
> >   		break;
> >   	case LED_BLINK_WPS:


> I cannot apply this patch.

> Applying: staging: r8188eu: summarize tx/rx and scan blinking
> error: patch failed: drivers/staging/r8188eu/core/rtw_led.c:81
> error: drivers/staging/r8188eu/core/rtw_led.c: patch does not apply
> Patch failed at 0001 staging: r8188eu: summarize tx/rx and scan blinking

did you apply the patch "staging: r8188eu: remove bLedLinkBlinkInProgress"
(that I sent on Oct 1st) before this series?

I didn't mention this dependency in the cover letter, sorry for that.

Thanks,
Martin
  

Patch

diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index f8bd183fba1e..ce8de2eb7845 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -81,21 +81,6 @@  static void blink_work(struct work_struct *work)
 		schedule_delayed_work(&pLed->blink_work, LED_BLINK_LINK_INTVL);
 		break;
 	case LED_BLINK_SCAN:
-		pLed->BlinkTimes--;
-		if (pLed->BlinkTimes == 0) {
-			if (check_fwstate(pmlmepriv, _FW_LINKED)) {
-				pLed->CurrLedState = LED_BLINK_NORMAL;
-				schedule_delayed_work(&pLed->blink_work, LED_BLINK_LINK_INTVL);
-			} else {
-				pLed->CurrLedState = LED_BLINK_SLOWLY;
-				schedule_delayed_work(&pLed->blink_work, LED_BLINK_NO_LINK_INTVL);
-			}
-			pLed->bLedBlinkInProgress = false;
-			pLed->bLedScanBlinkInProgress = false;
-		} else {
-			schedule_delayed_work(&pLed->blink_work, LED_BLINK_SCAN_INTVL);
-		}
-		break;
 	case LED_BLINK_TXRX:
 		pLed->BlinkTimes--;
 		if (pLed->BlinkTimes == 0) {
@@ -109,7 +94,9 @@  static void blink_work(struct work_struct *work)
 			pLed->bLedBlinkInProgress = false;
 			pLed->bLedScanBlinkInProgress = false;
 		} else {
-			schedule_delayed_work(&pLed->blink_work, LED_BLINK_FASTER_INTVL);
+			schedule_delayed_work(&pLed->blink_work,
+					      pLed->CurrLedState == LED_BLINK_SCAN ?
+					      LED_BLINK_SCAN_INTVL : LED_BLINK_FASTER_INTVL);
 		}
 		break;
 	case LED_BLINK_WPS: