mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/9] staging: r8188eu: more led cleanups
@ 2022-09-11 14:51 Martin Kaiser
  2022-09-11 14:51 ` [PATCH 1/9] staging: r8188eu: simplify the code to prevent scan blinking restart Martin Kaiser
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-09-11 14:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

Clean up the init code for some of the blink commands.

Martin Kaiser (9):
  staging: r8188eu: simplify the code to prevent scan blinking restart
  staging: r8188eu: cancel blink_work before scan blinking
  staging: r8188eu: update status before scan blinking
  staging: r8188eu: simplify the code to prevent tx/rx blinking restart
  staging: r8188eu: cancel blink_work before tx/rx blinking
  staging: r8188eu: update status before scan blinking
  staging: r8188eu: simplify the code to prevent link blinking restart
  staging: r8188eu: cancel blink_work before link blinking
  staging: r8188eu: update status before link blinking

 drivers/staging/r8188eu/core/rtw_led.c | 120 ++++++++++++-------------
 1 file changed, 57 insertions(+), 63 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/9] staging: r8188eu: simplify the code to prevent scan blinking restart
  2022-09-11 14:51 [PATCH 0/9] staging: r8188eu: more led cleanups Martin Kaiser
@ 2022-09-11 14:51 ` Martin Kaiser
  2022-09-11 14:51 ` [PATCH 2/9] staging: r8188eu: cancel blink_work before scan blinking Martin Kaiser
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-09-11 14:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

The code for scan blinking is wrapped into a big if clause to prevent
restarting if scan blinking is already running.

Revert the if condition and exit if scan blinking is running. This does
not change the behaviour.

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

diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index 5b7e12421d19..c934a1f1e119 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -261,30 +261,31 @@ void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction)
 		if ((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)))
 			return;
 
-		if (!pLed->bLedScanBlinkInProgress) {
-			if (IS_LED_WPS_BLINKING(pLed))
-				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;
-			}
-			pLed->bLedScanBlinkInProgress = true;
-			pLed->CurrLedState = LED_BLINK_SCAN;
-			pLed->BlinkTimes = 24;
-			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->bLedScanBlinkInProgress)
+			return;
+
+		if (IS_LED_WPS_BLINKING(pLed))
+			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;
+		}
+		pLed->bLedScanBlinkInProgress = true;
+		pLed->CurrLedState = LED_BLINK_SCAN;
+		pLed->BlinkTimes = 24;
+		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_TX:
 	case LED_CTL_RX:
-- 
2.30.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/9] staging: r8188eu: cancel blink_work before scan blinking
  2022-09-11 14:51 [PATCH 0/9] staging: r8188eu: more led cleanups Martin Kaiser
  2022-09-11 14:51 ` [PATCH 1/9] staging: r8188eu: simplify the code to prevent scan blinking restart Martin Kaiser
@ 2022-09-11 14:51 ` Martin Kaiser
  2022-09-11 14:51 ` [PATCH 3/9] staging: r8188eu: update status " Martin Kaiser
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-09-11 14:51 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 before we start scan blinking. 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 | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index c934a1f1e119..30b17c304277 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -266,18 +266,18 @@ void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction)
 
 		if (IS_LED_WPS_BLINKING(pLed))
 			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;
-		}
+
 		pLed->bLedScanBlinkInProgress = true;
 		pLed->CurrLedState = LED_BLINK_SCAN;
 		pLed->BlinkTimes = 24;
-- 
2.30.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 3/9] staging: r8188eu: update status before scan blinking
  2022-09-11 14:51 [PATCH 0/9] staging: r8188eu: more led cleanups Martin Kaiser
  2022-09-11 14:51 ` [PATCH 1/9] staging: r8188eu: simplify the code to prevent scan blinking restart Martin Kaiser
  2022-09-11 14:51 ` [PATCH 2/9] staging: r8188eu: cancel blink_work before scan blinking Martin Kaiser
@ 2022-09-11 14:51 ` Martin Kaiser
  2022-09-11 14:51 ` [PATCH 4/9] staging: r8188eu: simplify the code to prevent tx/rx blinking restart Martin Kaiser
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-09-11 14:51 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 scan
blinking. The if statements are not necessary.

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

diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index 30b17c304277..75328e6c9a8d 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -269,16 +269,11 @@ void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction)
 
 		cancel_delayed_work(&pLed->blink_work);
 
-		if (pLed->bLedNoLinkBlinkInProgress)
-			pLed->bLedNoLinkBlinkInProgress = false;
-
-		if (pLed->bLedLinkBlinkInProgress)
-			pLed->bLedLinkBlinkInProgress = false;
-
-		if (pLed->bLedBlinkInProgress)
-			pLed->bLedBlinkInProgress = false;
-
+		pLed->bLedNoLinkBlinkInProgress = false;
+		pLed->bLedLinkBlinkInProgress = false;
+		pLed->bLedBlinkInProgress = false;
 		pLed->bLedScanBlinkInProgress = true;
+
 		pLed->CurrLedState = LED_BLINK_SCAN;
 		pLed->BlinkTimes = 24;
 		if (pLed->bLedOn)
-- 
2.30.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 4/9] staging: r8188eu: simplify the code to prevent tx/rx blinking restart
  2022-09-11 14:51 [PATCH 0/9] staging: r8188eu: more led cleanups Martin Kaiser
                   ` (2 preceding siblings ...)
  2022-09-11 14:51 ` [PATCH 3/9] staging: r8188eu: update status " Martin Kaiser
@ 2022-09-11 14:51 ` Martin Kaiser
  2022-09-11 14:51 ` [PATCH 5/9] staging: r8188eu: cancel blink_work before tx/rx blinking Martin Kaiser
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-09-11 14:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

The code for tx/rx blinking is wrapped into a big if clause to prevent
restarting if tx/rx blinking is already running.

Revert the if condition and exit if tx/rx blinking is running. This does
not change the behaviour.

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

diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index 75328e6c9a8d..a723f592e939 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -284,26 +284,27 @@ void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction)
 		break;
 	case LED_CTL_TX:
 	case LED_CTL_RX:
-		if (!pLed->bLedBlinkInProgress) {
-			if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
-				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;
-			}
-			pLed->bLedBlinkInProgress = true;
-			pLed->CurrLedState = LED_BLINK_TXRX;
-			pLed->BlinkTimes = 2;
-			if (pLed->bLedOn)
-				pLed->BlinkingLedState = RTW_LED_OFF;
-			else
-				pLed->BlinkingLedState = RTW_LED_ON;
-			schedule_delayed_work(&pLed->blink_work, LED_BLINK_FASTER_INTVL);
+		if (pLed->bLedBlinkInProgress)
+			return;
+
+		if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
+			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;
 		}
+		pLed->bLedBlinkInProgress = true;
+		pLed->CurrLedState = LED_BLINK_TXRX;
+		pLed->BlinkTimes = 2;
+		if (pLed->bLedOn)
+			pLed->BlinkingLedState = RTW_LED_OFF;
+		else
+			pLed->BlinkingLedState = RTW_LED_ON;
+		schedule_delayed_work(&pLed->blink_work, LED_BLINK_FASTER_INTVL);
 		break;
 	case LED_CTL_START_WPS: /* wait until xinpin finish */
 		if (pLed->bLedWPSBlinkInProgress)
-- 
2.30.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 5/9] staging: r8188eu: cancel blink_work before tx/rx blinking
  2022-09-11 14:51 [PATCH 0/9] staging: r8188eu: more led cleanups Martin Kaiser
                   ` (3 preceding siblings ...)
  2022-09-11 14:51 ` [PATCH 4/9] staging: r8188eu: simplify the code to prevent tx/rx blinking restart Martin Kaiser
@ 2022-09-11 14:51 ` Martin Kaiser
  2022-09-11 14:51 ` [PATCH 6/9] staging: r8188eu: update status before scan blinking Martin Kaiser
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-09-11 14:51 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 before we start tx/rx blinking. 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 | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index a723f592e939..358dbbcd5c55 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -289,14 +289,14 @@ void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction)
 
 		if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
 			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;
-		}
+
 		pLed->bLedBlinkInProgress = true;
 		pLed->CurrLedState = LED_BLINK_TXRX;
 		pLed->BlinkTimes = 2;
-- 
2.30.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 6/9] staging: r8188eu: update status before scan blinking
  2022-09-11 14:51 [PATCH 0/9] staging: r8188eu: more led cleanups Martin Kaiser
                   ` (4 preceding siblings ...)
  2022-09-11 14:51 ` [PATCH 5/9] staging: r8188eu: cancel blink_work before tx/rx blinking Martin Kaiser
@ 2022-09-11 14:51 ` Martin Kaiser
  2022-09-11 14:51 ` [PATCH 7/9] staging: r8188eu: simplify the code to prevent link blinking restart Martin Kaiser
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-09-11 14:51 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 tx/rx
blinking. The if statements are not necessary.

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

diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index 358dbbcd5c55..270880050c64 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -291,13 +291,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;
 
+		pLed->bLedNoLinkBlinkInProgress = false;
+		pLed->bLedLinkBlinkInProgress = false;
 		pLed->bLedBlinkInProgress = true;
+
 		pLed->CurrLedState = LED_BLINK_TXRX;
 		pLed->BlinkTimes = 2;
 		if (pLed->bLedOn)
-- 
2.30.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 7/9] staging: r8188eu: simplify the code to prevent link blinking restart
  2022-09-11 14:51 [PATCH 0/9] staging: r8188eu: more led cleanups Martin Kaiser
                   ` (5 preceding siblings ...)
  2022-09-11 14:51 ` [PATCH 6/9] staging: r8188eu: update status before scan blinking Martin Kaiser
@ 2022-09-11 14:51 ` Martin Kaiser
  2022-09-11 14:51 ` [PATCH 8/9] staging: r8188eu: cancel blink_work before link blinking Martin Kaiser
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-09-11 14:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel, Martin Kaiser

The blinking code to signal that a link is up has the same big if clause
around it as most other blink events.

Revert this if condition and exit if we're already blinking to show that
the link is up.

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

diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index 270880050c64..7cd6ed5385bb 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -237,25 +237,26 @@ void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction)
 		schedule_delayed_work(&pLed->blink_work, LED_BLINK_NO_LINK_INTVL);
 		break;
 	case LED_CTL_LINK:
-		if (!pLed->bLedLinkBlinkInProgress) {
-			if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
-				return;
-			if (pLed->bLedNoLinkBlinkInProgress) {
-				cancel_delayed_work(&pLed->blink_work);
-				pLed->bLedNoLinkBlinkInProgress = false;
-			}
-			if (pLed->bLedBlinkInProgress) {
-				cancel_delayed_work(&pLed->blink_work);
-				pLed->bLedBlinkInProgress = false;
-			}
-			pLed->bLedLinkBlinkInProgress = true;
-			pLed->CurrLedState = LED_BLINK_NORMAL;
-			if (pLed->bLedOn)
-				pLed->BlinkingLedState = RTW_LED_OFF;
-			else
-				pLed->BlinkingLedState = RTW_LED_ON;
-			schedule_delayed_work(&pLed->blink_work, LED_BLINK_LINK_INTVL);
+		if (!pLed->bLedLinkBlinkInProgress)
+			return;
+
+		if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
+			return;
+		if (pLed->bLedNoLinkBlinkInProgress) {
+			cancel_delayed_work(&pLed->blink_work);
+			pLed->bLedNoLinkBlinkInProgress = false;
+		}
+		if (pLed->bLedBlinkInProgress) {
+			cancel_delayed_work(&pLed->blink_work);
+			pLed->bLedBlinkInProgress = false;
 		}
+		pLed->bLedLinkBlinkInProgress = true;
+		pLed->CurrLedState = LED_BLINK_NORMAL;
+		if (pLed->bLedOn)
+			pLed->BlinkingLedState = RTW_LED_OFF;
+		else
+			pLed->BlinkingLedState = RTW_LED_ON;
+		schedule_delayed_work(&pLed->blink_work, LED_BLINK_LINK_INTVL);
 		break;
 	case LED_CTL_SITE_SURVEY:
 		if ((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)))
-- 
2.30.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 8/9] staging: r8188eu: cancel blink_work before link blinking
  2022-09-11 14:51 [PATCH 0/9] staging: r8188eu: more led cleanups Martin Kaiser
                   ` (6 preceding siblings ...)
  2022-09-11 14:51 ` [PATCH 7/9] staging: r8188eu: simplify the code to prevent link blinking restart Martin Kaiser
@ 2022-09-11 14:51 ` Martin Kaiser
  2022-09-11 14:51 ` [PATCH 9/9] staging: r8188eu: update status " Martin Kaiser
  2022-09-11 15:43 ` [PATCH 0/9] staging: r8188eu: more led cleanups Philipp Hortmann
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-09-11 14:51 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 before we start link blinking. 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 | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index 7cd6ed5385bb..0881c81f4c74 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -242,14 +242,14 @@ void rtw_led_control(struct adapter *padapter, enum LED_CTL_MODE LedAction)
 
 		if (pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
 			return;
-		if (pLed->bLedNoLinkBlinkInProgress) {
-			cancel_delayed_work(&pLed->blink_work);
+
+		cancel_delayed_work(&pLed->blink_work);
+		if (pLed->bLedNoLinkBlinkInProgress)
 			pLed->bLedNoLinkBlinkInProgress = false;
-		}
-		if (pLed->bLedBlinkInProgress) {
-			cancel_delayed_work(&pLed->blink_work);
+
+		if (pLed->bLedBlinkInProgress)
 			pLed->bLedBlinkInProgress = false;
-		}
+
 		pLed->bLedLinkBlinkInProgress = true;
 		pLed->CurrLedState = LED_BLINK_NORMAL;
 		if (pLed->bLedOn)
-- 
2.30.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 9/9] staging: r8188eu: update status before link blinking
  2022-09-11 14:51 [PATCH 0/9] staging: r8188eu: more led cleanups Martin Kaiser
                   ` (7 preceding siblings ...)
  2022-09-11 14:51 ` [PATCH 8/9] staging: r8188eu: cancel blink_work before link blinking Martin Kaiser
@ 2022-09-11 14:51 ` Martin Kaiser
  2022-09-11 15:43 ` [PATCH 0/9] staging: r8188eu: more led cleanups Philipp Hortmann
  9 siblings, 0 replies; 11+ messages in thread
From: Martin Kaiser @ 2022-09-11 14:51 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 link
blinking. The if statements are not necessary.

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

diff --git a/drivers/staging/r8188eu/core/rtw_led.c b/drivers/staging/r8188eu/core/rtw_led.c
index 0881c81f4c74..98eebe3e4119 100644
--- a/drivers/staging/r8188eu/core/rtw_led.c
+++ b/drivers/staging/r8188eu/core/rtw_led.c
@@ -244,13 +244,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->bLedBlinkInProgress)
-			pLed->bLedBlinkInProgress = false;
 
+		pLed->bLedNoLinkBlinkInProgress = false;
+		pLed->bLedBlinkInProgress = false;
 		pLed->bLedLinkBlinkInProgress = true;
+
 		pLed->CurrLedState = LED_BLINK_NORMAL;
 		if (pLed->bLedOn)
 			pLed->BlinkingLedState = RTW_LED_OFF;
-- 
2.30.2


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/9] staging: r8188eu: more led cleanups
  2022-09-11 14:51 [PATCH 0/9] staging: r8188eu: more led cleanups Martin Kaiser
                   ` (8 preceding siblings ...)
  2022-09-11 14:51 ` [PATCH 9/9] staging: r8188eu: update status " Martin Kaiser
@ 2022-09-11 15:43 ` Philipp Hortmann
  9 siblings, 0 replies; 11+ messages in thread
From: Philipp Hortmann @ 2022-09-11 15:43 UTC (permalink / raw)
  To: Martin Kaiser, Greg Kroah-Hartman
  Cc: Larry Finger, Phillip Potter, Michael Straube, Pavel Skripkin,
	linux-staging, linux-kernel

On 9/11/22 16:51, Martin Kaiser wrote:
> Clean up the init code for some of the blink commands.
> 
> Martin Kaiser (9):
>    staging: r8188eu: simplify the code to prevent scan blinking restart
>    staging: r8188eu: cancel blink_work before scan blinking
>    staging: r8188eu: update status before scan blinking
>    staging: r8188eu: simplify the code to prevent tx/rx blinking restart
>    staging: r8188eu: cancel blink_work before tx/rx blinking
>    staging: r8188eu: update status before scan blinking
>    staging: r8188eu: simplify the code to prevent link blinking restart
>    staging: r8188eu: cancel blink_work before link blinking
>    staging: r8188eu: update status before link blinking
> 
>   drivers/staging/r8188eu/core/rtw_led.c | 120 ++++++++++++-------------
>   1 file changed, 57 insertions(+), 63 deletions(-)
> 

Observed LED: OK

Tested-by: Philipp Hortmann <philipp.g.hortmann@gmail.com> # Edimax N150

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-09-11 15:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-11 14:51 [PATCH 0/9] staging: r8188eu: more led cleanups Martin Kaiser
2022-09-11 14:51 ` [PATCH 1/9] staging: r8188eu: simplify the code to prevent scan blinking restart Martin Kaiser
2022-09-11 14:51 ` [PATCH 2/9] staging: r8188eu: cancel blink_work before scan blinking Martin Kaiser
2022-09-11 14:51 ` [PATCH 3/9] staging: r8188eu: update status " Martin Kaiser
2022-09-11 14:51 ` [PATCH 4/9] staging: r8188eu: simplify the code to prevent tx/rx blinking restart Martin Kaiser
2022-09-11 14:51 ` [PATCH 5/9] staging: r8188eu: cancel blink_work before tx/rx blinking Martin Kaiser
2022-09-11 14:51 ` [PATCH 6/9] staging: r8188eu: update status before scan blinking Martin Kaiser
2022-09-11 14:51 ` [PATCH 7/9] staging: r8188eu: simplify the code to prevent link blinking restart Martin Kaiser
2022-09-11 14:51 ` [PATCH 8/9] staging: r8188eu: cancel blink_work before link blinking Martin Kaiser
2022-09-11 14:51 ` [PATCH 9/9] staging: r8188eu: update status " Martin Kaiser
2022-09-11 15:43 ` [PATCH 0/9] staging: r8188eu: more led cleanups Philipp Hortmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®