* [PATCH 0/7] staging: r8188eu: continue rtw_led_control cleanup
@ 2022-09-05 20:01 Martin Kaiser
2022-09-05 20:01 ` [PATCH 1/7] staging: r8188eu: simplify the LED_CTL_POWER_OFF case Martin Kaiser
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: Martin Kaiser @ 2022-09-05 20:01 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
linux-staging, linux-kernel, Martin Kaiser
Here's some more small patches to make rtw_led_control simpler.
Martin Kaiser (7):
staging: r8188eu: simplify the LED_CTL_POWER_OFF case
staging: r8188eu: don't restart WPS blinking unnecessarily
staging: r8188eu: always cancel blink_work before WPS blinking
staging: r8188eu: always update status before WPS blinking
staging: r8188eu: always cancel blink_work when WPS failed
staging: r8188eu: reset blink state when WPS fails
staging: r8188eu: do not "scan blink" if we have a link
drivers/staging/r8188eu/core/rtw_led.c | 80 +++++++++-----------------
1 file changed, 28 insertions(+), 52 deletions(-)
--
2.30.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/7] staging: r8188eu: simplify the LED_CTL_POWER_OFF case
2022-09-05 20:01 [PATCH 0/7] staging: r8188eu: continue rtw_led_control cleanup Martin Kaiser
@ 2022-09-05 20:01 ` Martin Kaiser
2022-09-05 20:01 ` [PATCH 2/7] staging: r8188eu: don't restart WPS blinking unnecessarily Martin Kaiser
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Martin Kaiser @ 2022-09-05 20:01 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
linux-staging, linux-kernel, Martin Kaiser
When a caller of rtw_led_control requests that the led be switched off,
we should cancel the blink worker and set all blinking state variables
to false. This does not depend on the current blinking state.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
drivers/staging/r8188eu/core/rtw_led.c | 26 ++++++--------------------
1 file changed, 6 insertions(+), 20 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index c57059eeda34..dd3f0169ff94 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -381,26 +381,12 @@ void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction)
case LED_CTL_POWER_OFF:
pLed->CurrLedState = RTW_LED_OFF;
pLed->BlinkingLedState = RTW_LED_OFF;
- if (pLed->bLedNoLinkBlinkInProgress) {
- cancel_delayed_work(&pLed->blink_work);
- pLed->bLedNoLinkBlinkInProgress = false;
- }
- if (pLed->bLedLinkBlinkInProgress) {
- cancel_delayed_work(&pLed->blink_work);
- pLed->bLedLinkBlinkInProgress = false;
- }
- if (pLed->bLedBlinkInProgress) {
- cancel_delayed_work(&pLed->blink_work);
- pLed->bLedBlinkInProgress = false;
- }
- if (pLed->bLedWPSBlinkInProgress) {
- cancel_delayed_work(&pLed->blink_work);
- pLed->bLedWPSBlinkInProgress = false;
- }
- if (pLed->bLedScanBlinkInProgress) {
- cancel_delayed_work(&pLed->blink_work);
- pLed->bLedScanBlinkInProgress = false;
- }
+ pLed->bLedNoLinkBlinkInProgress = false;
+ pLed->bLedLinkBlinkInProgress = false;
+ pLed->bLedBlinkInProgress = false;
+ pLed->bLedWPSBlinkInProgress = false;
+ pLed->bLedScanBlinkInProgress = false;
+ cancel_delayed_work(&pLed->blink_work);
SwLedOff(padapter, pLed);
break;
default:
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/7] staging: r8188eu: don't restart WPS blinking unnecessarily
2022-09-05 20:01 [PATCH 0/7] staging: r8188eu: continue rtw_led_control cleanup Martin Kaiser
2022-09-05 20:01 ` [PATCH 1/7] staging: r8188eu: simplify the LED_CTL_POWER_OFF case Martin Kaiser
@ 2022-09-05 20:01 ` Martin Kaiser
2022-09-05 20:01 ` [PATCH 3/7] staging: r8188eu: always cancel blink_work before WPS blinking Martin Kaiser
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Martin Kaiser @ 2022-09-05 20:01 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
linux-staging, linux-kernel, Martin Kaiser
Simplify one of the cases in rtw_led_control. If we're already blinking
during WPS, we don't have to restart this blinking when the caller
requests it again. We can simply return and keep on blinking.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
drivers/staging/r8188eu/core/rtw_led.c | 49 +++++++++++++-------------
1 file changed, 25 insertions(+), 24 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index dd3f0169ff94..d899e42b703d 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -309,31 +309,32 @@ void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction)
}
break;
case LED_CTL_START_WPS: /* wait until xinpin finish */
- if (!pLed->bLedWPSBlinkInProgress) {
- if (pLed->bLedNoLinkBlinkInProgress) {
- cancel_delayed_work(&pLed->blink_work);
- pLed->bLedNoLinkBlinkInProgress = false;
- }
- if (pLed->bLedLinkBlinkInProgress) {
- cancel_delayed_work(&pLed->blink_work);
- pLed->bLedLinkBlinkInProgress = false;
- }
- if (pLed->bLedBlinkInProgress) {
- cancel_delayed_work(&pLed->blink_work);
- pLed->bLedBlinkInProgress = false;
- }
- if (pLed->bLedScanBlinkInProgress) {
- cancel_delayed_work(&pLed->blink_work);
- pLed->bLedScanBlinkInProgress = false;
- }
- pLed->bLedWPSBlinkInProgress = true;
- pLed->CurrLedState = LED_BLINK_WPS;
- if (pLed->bLedOn)
- pLed->BlinkingLedState = RTW_LED_OFF;
- else
- pLed->BlinkingLedState = RTW_LED_ON;
- schedule_delayed_work(&pLed->blink_work, LED_BLINK_SCAN_INTVL);
+ if (pLed->bLedWPSBlinkInProgress)
+ return;
+
+ if (pLed->bLedNoLinkBlinkInProgress) {
+ cancel_delayed_work(&pLed->blink_work);
+ pLed->bLedNoLinkBlinkInProgress = false;
}
+ if (pLed->bLedLinkBlinkInProgress) {
+ cancel_delayed_work(&pLed->blink_work);
+ pLed->bLedLinkBlinkInProgress = false;
+ }
+ if (pLed->bLedBlinkInProgress) {
+ cancel_delayed_work(&pLed->blink_work);
+ pLed->bLedBlinkInProgress = false;
+ }
+ if (pLed->bLedScanBlinkInProgress) {
+ cancel_delayed_work(&pLed->blink_work);
+ pLed->bLedScanBlinkInProgress = false;
+ }
+ pLed->bLedWPSBlinkInProgress = true;
+ pLed->CurrLedState = LED_BLINK_WPS;
+ if (pLed->bLedOn)
+ pLed->BlinkingLedState = RTW_LED_OFF;
+ else
+ pLed->BlinkingLedState = RTW_LED_ON;
+ schedule_delayed_work(&pLed->blink_work, LED_BLINK_SCAN_INTVL);
break;
case LED_CTL_STOP_WPS:
if (pLed->bLedNoLinkBlinkInProgress) {
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/7] staging: r8188eu: always cancel blink_work before WPS blinking
2022-09-05 20:01 [PATCH 0/7] staging: r8188eu: continue rtw_led_control cleanup Martin Kaiser
2022-09-05 20:01 ` [PATCH 1/7] staging: r8188eu: simplify the LED_CTL_POWER_OFF case Martin Kaiser
2022-09-05 20:01 ` [PATCH 2/7] staging: r8188eu: don't restart WPS blinking unnecessarily Martin Kaiser
@ 2022-09-05 20:01 ` Martin Kaiser
2022-09-05 20:01 ` [PATCH 4/7] staging: r8188eu: always update status " Martin Kaiser
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Martin Kaiser @ 2022-09-05 20:01 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
linux-staging, linux-kernel, Martin Kaiser
In rtw_led_control, we can always cancel a running blink worker when we
start WPS blinking.
The worker will be scheduled again and there's no point in having more
than one pending blink worker.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
drivers/staging/r8188eu/core/rtw_led.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index d899e42b703d..72fef3ac8c0e 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -312,22 +312,19 @@ void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction)
if (pLed->bLedWPSBlinkInProgress)
return;
- if (pLed->bLedNoLinkBlinkInProgress) {
- cancel_delayed_work(&pLed->blink_work);
+ cancel_delayed_work(&pLed->blink_work);
+ if (pLed->bLedNoLinkBlinkInProgress)
pLed->bLedNoLinkBlinkInProgress = false;
- }
- if (pLed->bLedLinkBlinkInProgress) {
- cancel_delayed_work(&pLed->blink_work);
+
+ if (pLed->bLedLinkBlinkInProgress)
pLed->bLedLinkBlinkInProgress = false;
- }
- if (pLed->bLedBlinkInProgress) {
- cancel_delayed_work(&pLed->blink_work);
+
+ if (pLed->bLedBlinkInProgress)
pLed->bLedBlinkInProgress = false;
- }
- if (pLed->bLedScanBlinkInProgress) {
- cancel_delayed_work(&pLed->blink_work);
+
+ if (pLed->bLedScanBlinkInProgress)
pLed->bLedScanBlinkInProgress = false;
- }
+
pLed->bLedWPSBlinkInProgress = true;
pLed->CurrLedState = LED_BLINK_WPS;
if (pLed->bLedOn)
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/7] staging: r8188eu: always update status before WPS blinking
2022-09-05 20:01 [PATCH 0/7] staging: r8188eu: continue rtw_led_control cleanup Martin Kaiser
` (2 preceding siblings ...)
2022-09-05 20:01 ` [PATCH 3/7] staging: r8188eu: always cancel blink_work before WPS blinking Martin Kaiser
@ 2022-09-05 20:01 ` Martin Kaiser
2022-09-05 20:01 ` [PATCH 5/7] staging: r8188eu: always cancel blink_work when WPS failed Martin Kaiser
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Martin Kaiser @ 2022-09-05 20:01 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
linux-staging, linux-kernel, Martin Kaiser
Always update the status variables in rtw_led_control when we start WPS
blinking. The code is easier to understand without the if conditions.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
drivers/staging/r8188eu/core/rtw_led.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index 72fef3ac8c0e..4841bb2898ba 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -313,18 +313,11 @@ void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction)
return;
cancel_delayed_work(&pLed->blink_work);
- if (pLed->bLedNoLinkBlinkInProgress)
- pLed->bLedNoLinkBlinkInProgress = false;
-
- if (pLed->bLedLinkBlinkInProgress)
- pLed->bLedLinkBlinkInProgress = false;
-
- if (pLed->bLedBlinkInProgress)
- pLed->bLedBlinkInProgress = false;
-
- if (pLed->bLedScanBlinkInProgress)
- pLed->bLedScanBlinkInProgress = false;
+ pLed->bLedNoLinkBlinkInProgress = false;
+ pLed->bLedLinkBlinkInProgress = false;
+ pLed->bLedBlinkInProgress = false;
+ pLed->bLedScanBlinkInProgress = false;
pLed->bLedWPSBlinkInProgress = true;
pLed->CurrLedState = LED_BLINK_WPS;
if (pLed->bLedOn)
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/7] staging: r8188eu: always cancel blink_work when WPS failed
2022-09-05 20:01 [PATCH 0/7] staging: r8188eu: continue rtw_led_control cleanup Martin Kaiser
` (3 preceding siblings ...)
2022-09-05 20:01 ` [PATCH 4/7] staging: r8188eu: always update status " Martin Kaiser
@ 2022-09-05 20:01 ` Martin Kaiser
2022-09-05 20:01 ` [PATCH 6/7] staging: r8188eu: reset blink state when WPS fails Martin Kaiser
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Martin Kaiser @ 2022-09-05 20:01 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
linux-staging, linux-kernel, Martin Kaiser
Cancel blink_work if WPS fails. Another worker will be scheduled after
the state variables are updated.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
drivers/staging/r8188eu/core/rtw_led.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index 4841bb2898ba..80d9d8184fcd 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -357,8 +357,8 @@ void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction)
}
break;
case LED_CTL_STOP_WPS_FAIL:
+ cancel_delayed_work(&pLed->blink_work);
if (pLed->bLedWPSBlinkInProgress) {
- cancel_delayed_work(&pLed->blink_work);
pLed->bLedWPSBlinkInProgress = false;
}
pLed->bLedNoLinkBlinkInProgress = true;
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6/7] staging: r8188eu: reset blink state when WPS fails
2022-09-05 20:01 [PATCH 0/7] staging: r8188eu: continue rtw_led_control cleanup Martin Kaiser
` (4 preceding siblings ...)
2022-09-05 20:01 ` [PATCH 5/7] staging: r8188eu: always cancel blink_work when WPS failed Martin Kaiser
@ 2022-09-05 20:01 ` Martin Kaiser
2022-09-05 20:01 ` [PATCH 7/7] staging: r8188eu: do not "scan blink" if we have a link Martin Kaiser
2022-09-06 13:13 ` [PATCH 0/7] staging: r8188eu: continue rtw_led_control cleanup Michael Straube
7 siblings, 0 replies; 9+ messages in thread
From: Martin Kaiser @ 2022-09-05 20:01 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
linux-staging, linux-kernel, Martin Kaiser
When WPS fails, WPS blinking is no longer in progress. The if statement
can be removed.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
drivers/staging/r8188eu/core/rtw_led.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index 80d9d8184fcd..f5af2e25e34a 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -358,9 +358,7 @@ void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction)
break;
case LED_CTL_STOP_WPS_FAIL:
cancel_delayed_work(&pLed->blink_work);
- if (pLed->bLedWPSBlinkInProgress) {
- pLed->bLedWPSBlinkInProgress = false;
- }
+ pLed->bLedWPSBlinkInProgress = false;
pLed->bLedNoLinkBlinkInProgress = true;
pLed->CurrLedState = LED_BLINK_SLOWLY;
if (pLed->bLedOn)
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 7/7] staging: r8188eu: do not "scan blink" if we have a link
2022-09-05 20:01 [PATCH 0/7] staging: r8188eu: continue rtw_led_control cleanup Martin Kaiser
` (5 preceding siblings ...)
2022-09-05 20:01 ` [PATCH 6/7] staging: r8188eu: reset blink state when WPS fails Martin Kaiser
@ 2022-09-05 20:01 ` Martin Kaiser
2022-09-06 13:13 ` [PATCH 0/7] staging: r8188eu: continue rtw_led_control cleanup Michael Straube
7 siblings, 0 replies; 9+ messages in thread
From: Martin Kaiser @ 2022-09-05 20:01 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
linux-staging, linux-kernel, Martin Kaiser
Do not blink the led to indicate that we're scanning if we are already
connected to a wireless network.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
drivers/staging/r8188eu/core/rtw_led.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index f5af2e25e34a..5b7e12421d19 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -258,9 +258,10 @@ void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction)
}
break;
case LED_CTL_SITE_SURVEY:
- if ((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED))) {
- ;
- } else if (!pLed->bLedScanBlinkInProgress) {
+ if ((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)))
+ return;
+
+ if (!pLed->bLedScanBlinkInProgress) {
if (IS_LED_WPS_BLINKING(pLed))
return;
if (pLed->bLedNoLinkBlinkInProgress) {
--
2.30.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 0/7] staging: r8188eu: continue rtw_led_control cleanup
2022-09-05 20:01 [PATCH 0/7] staging: r8188eu: continue rtw_led_control cleanup Martin Kaiser
` (6 preceding siblings ...)
2022-09-05 20:01 ` [PATCH 7/7] staging: r8188eu: do not "scan blink" if we have a link Martin Kaiser
@ 2022-09-06 13:13 ` Michael Straube
7 siblings, 0 replies; 9+ messages in thread
From: Michael Straube @ 2022-09-06 13:13 UTC (permalink / raw)
To: Martin Kaiser, Greg Kroah-Hartman
Cc: Larry Finger, Phillip Potter, Pavel Skripkin, linux-staging,
linux-kernel
On 9/5/22 22:01, Martin Kaiser wrote:
> Here's some more small patches to make rtw_led_control simpler.
>
> Martin Kaiser (7):
> staging: r8188eu: simplify the LED_CTL_POWER_OFF case
> staging: r8188eu: don't restart WPS blinking unnecessarily
> staging: r8188eu: always cancel blink_work before WPS blinking
> staging: r8188eu: always update status before WPS blinking
> staging: r8188eu: always cancel blink_work when WPS failed
> staging: r8188eu: reset blink state when WPS fails
> staging: r8188eu: do not "scan blink" if we have a link
>
> drivers/staging/r8188eu/core/rtw_led.c | 80 +++++++++-----------------
> 1 file changed, 28 insertions(+), 52 deletions(-)
>
For all patches:
Tested-by: Michael Straube <straube.linux@gmail.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-09-06 13:14 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-05 20:01 [PATCH 0/7] staging: r8188eu: continue rtw_led_control cleanup Martin Kaiser
2022-09-05 20:01 ` [PATCH 1/7] staging: r8188eu: simplify the LED_CTL_POWER_OFF case Martin Kaiser
2022-09-05 20:01 ` [PATCH 2/7] staging: r8188eu: don't restart WPS blinking unnecessarily Martin Kaiser
2022-09-05 20:01 ` [PATCH 3/7] staging: r8188eu: always cancel blink_work before WPS blinking Martin Kaiser
2022-09-05 20:01 ` [PATCH 4/7] staging: r8188eu: always update status " Martin Kaiser
2022-09-05 20:01 ` [PATCH 5/7] staging: r8188eu: always cancel blink_work when WPS failed Martin Kaiser
2022-09-05 20:01 ` [PATCH 6/7] staging: r8188eu: reset blink state when WPS fails Martin Kaiser
2022-09-05 20:01 ` [PATCH 7/7] staging: r8188eu: do not "scan blink" if we have a link Martin Kaiser
2022-09-06 13:13 ` [PATCH 0/7] staging: r8188eu: continue rtw_led_control cleanup Michael Straube
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).