All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] staging: rtl8188eu: remove unnecessary asignment
@ 2020-04-05 11:22 ` Michael Straube
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2020-04-05 11:22 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, devel, linux-kernel, Michael Straube

Remove unnecessary asignment in SwLedBlink1(). The code path with the
asignment 'pLed->BlinkTimes = 0' is only executed when
'pLed->BlinkTimes' is already zero and the value is not changed between
the test 'if (pLed->BlinkTimes == 0)' and the asignment.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/rtl8188eu/core/rtw_led.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_led.c b/drivers/staging/rtl8188eu/core/rtw_led.c
index d1406cc99768..91b0029d1179 100644
--- a/drivers/staging/rtl8188eu/core/rtw_led.c
+++ b/drivers/staging/rtl8188eu/core/rtw_led.c
@@ -188,7 +188,6 @@ static void SwLedBlink1(struct LED_871x *pLed)
 					  msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
 				RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState));
 			}
-			pLed->BlinkTimes = 0;
 			pLed->bLedBlinkInProgress = false;
 		} else {
 			if (pLed->bLedOn)
-- 
2.26.0


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

* [PATCH 1/2] staging: rtl8188eu: remove unnecessary asignment
@ 2020-04-05 11:22 ` Michael Straube
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2020-04-05 11:22 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Larry.Finger

Remove unnecessary asignment in SwLedBlink1(). The code path with the
asignment 'pLed->BlinkTimes = 0' is only executed when
'pLed->BlinkTimes' is already zero and the value is not changed between
the test 'if (pLed->BlinkTimes == 0)' and the asignment.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/rtl8188eu/core/rtw_led.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_led.c b/drivers/staging/rtl8188eu/core/rtw_led.c
index d1406cc99768..91b0029d1179 100644
--- a/drivers/staging/rtl8188eu/core/rtw_led.c
+++ b/drivers/staging/rtl8188eu/core/rtw_led.c
@@ -188,7 +188,6 @@ static void SwLedBlink1(struct LED_871x *pLed)
 					  msecs_to_jiffies(LED_BLINK_NO_LINK_INTERVAL_ALPHA));
 				RT_TRACE(_module_rtl8712_led_c_, _drv_info_, ("CurrLedState %d\n", pLed->CurrLedState));
 			}
-			pLed->BlinkTimes = 0;
 			pLed->bLedBlinkInProgress = false;
 		} else {
 			if (pLed->bLedOn)
-- 
2.26.0

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH 2/2] staging: rtl8188eu: remove unnecessary variable
  2020-04-05 11:22 ` Michael Straube
@ 2020-04-05 11:22   ` Michael Straube
  -1 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2020-04-05 11:22 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, devel, linux-kernel, Michael Straube

The variable 'bStopBlinking' is used in if tests immediately after its
value is set. Use the conditions for setting 'bStopBlinking' diretly in
the subsequent if tests and remove the variable. Slightly reduces
object file size by 16 bytes (gcc 9.2.1 x86_64).

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/rtl8188eu/core/rtw_led.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_led.c b/drivers/staging/rtl8188eu/core/rtw_led.c
index 91b0029d1179..32dccae186ca 100644
--- a/drivers/staging/rtl8188eu/core/rtw_led.c
+++ b/drivers/staging/rtl8188eu/core/rtw_led.c
@@ -90,7 +90,6 @@ static void SwLedBlink1(struct LED_871x *pLed)
 {
 	struct adapter *padapter = pLed->padapter;
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-	u8 bStopBlinking = false;
 
 	/*  Change LED according to BlinkingLedState specified. */
 	if (pLed->BlinkingLedState == RTW_LED_ON) {
@@ -128,9 +127,7 @@ static void SwLedBlink1(struct LED_871x *pLed)
 		break;
 	case LED_BLINK_SCAN:
 		pLed->BlinkTimes--;
-		if (pLed->BlinkTimes == 0)
-			bStopBlinking = true;
-		if (bStopBlinking) {
+		if (pLed->BlinkTimes == 0) {
 			if (check_fwstate(pmlmepriv, _FW_LINKED)) {
 				pLed->bLedLinkBlinkInProgress = true;
 				pLed->CurrLedState = LED_BLINK_NORMAL;
@@ -164,9 +161,7 @@ static void SwLedBlink1(struct LED_871x *pLed)
 		break;
 	case LED_BLINK_TXRX:
 		pLed->BlinkTimes--;
-		if (pLed->BlinkTimes == 0)
-			bStopBlinking = true;
-		if (bStopBlinking) {
+		if (pLed->BlinkTimes == 0) {
 			if (check_fwstate(pmlmepriv, _FW_LINKED)) {
 				pLed->bLedLinkBlinkInProgress = true;
 				pLed->CurrLedState = LED_BLINK_NORMAL;
@@ -207,12 +202,7 @@ static void SwLedBlink1(struct LED_871x *pLed)
 			  msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
 		break;
 	case LED_BLINK_WPS_STOP:	/* WPS success */
-		if (pLed->BlinkingLedState == RTW_LED_ON)
-			bStopBlinking = false;
-		else
-			bStopBlinking = true;
-
-		if (bStopBlinking) {
+		if (pLed->BlinkingLedState != RTW_LED_ON) {
 			pLed->bLedLinkBlinkInProgress = true;
 			pLed->CurrLedState = LED_BLINK_NORMAL;
 			if (pLed->bLedOn)
-- 
2.26.0


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

* [PATCH 2/2] staging: rtl8188eu: remove unnecessary variable
@ 2020-04-05 11:22   ` Michael Straube
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Straube @ 2020-04-05 11:22 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, Larry.Finger

The variable 'bStopBlinking' is used in if tests immediately after its
value is set. Use the conditions for setting 'bStopBlinking' diretly in
the subsequent if tests and remove the variable. Slightly reduces
object file size by 16 bytes (gcc 9.2.1 x86_64).

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/rtl8188eu/core/rtw_led.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_led.c b/drivers/staging/rtl8188eu/core/rtw_led.c
index 91b0029d1179..32dccae186ca 100644
--- a/drivers/staging/rtl8188eu/core/rtw_led.c
+++ b/drivers/staging/rtl8188eu/core/rtw_led.c
@@ -90,7 +90,6 @@ static void SwLedBlink1(struct LED_871x *pLed)
 {
 	struct adapter *padapter = pLed->padapter;
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
-	u8 bStopBlinking = false;
 
 	/*  Change LED according to BlinkingLedState specified. */
 	if (pLed->BlinkingLedState == RTW_LED_ON) {
@@ -128,9 +127,7 @@ static void SwLedBlink1(struct LED_871x *pLed)
 		break;
 	case LED_BLINK_SCAN:
 		pLed->BlinkTimes--;
-		if (pLed->BlinkTimes == 0)
-			bStopBlinking = true;
-		if (bStopBlinking) {
+		if (pLed->BlinkTimes == 0) {
 			if (check_fwstate(pmlmepriv, _FW_LINKED)) {
 				pLed->bLedLinkBlinkInProgress = true;
 				pLed->CurrLedState = LED_BLINK_NORMAL;
@@ -164,9 +161,7 @@ static void SwLedBlink1(struct LED_871x *pLed)
 		break;
 	case LED_BLINK_TXRX:
 		pLed->BlinkTimes--;
-		if (pLed->BlinkTimes == 0)
-			bStopBlinking = true;
-		if (bStopBlinking) {
+		if (pLed->BlinkTimes == 0) {
 			if (check_fwstate(pmlmepriv, _FW_LINKED)) {
 				pLed->bLedLinkBlinkInProgress = true;
 				pLed->CurrLedState = LED_BLINK_NORMAL;
@@ -207,12 +202,7 @@ static void SwLedBlink1(struct LED_871x *pLed)
 			  msecs_to_jiffies(LED_BLINK_SCAN_INTERVAL_ALPHA));
 		break;
 	case LED_BLINK_WPS_STOP:	/* WPS success */
-		if (pLed->BlinkingLedState == RTW_LED_ON)
-			bStopBlinking = false;
-		else
-			bStopBlinking = true;
-
-		if (bStopBlinking) {
+		if (pLed->BlinkingLedState != RTW_LED_ON) {
 			pLed->bLedLinkBlinkInProgress = true;
 			pLed->CurrLedState = LED_BLINK_NORMAL;
 			if (pLed->bLedOn)
-- 
2.26.0

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH 1/2] staging: rtl8188eu: remove unnecessary asignment
  2020-04-05 11:22 ` Michael Straube
@ 2020-04-06 11:25   ` Dan Carpenter
  -1 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2020-04-06 11:25 UTC (permalink / raw)
  To: Michael Straube; +Cc: gregkh, devel, linux-kernel, Larry.Finger

On Sun, Apr 05, 2020 at 01:22:29PM +0200, Michael Straube wrote:
> Remove unnecessary asignment in SwLedBlink1(). The code path with the
> asignment 'pLed->BlinkTimes = 0' is only executed when
> 'pLed->BlinkTimes' is already zero and the value is not changed between
> the test 'if (pLed->BlinkTimes == 0)' and the asignment.
> 

Better to get rid of the bStopBlinking variable and this becomes more
obvious.

regards,
dan carpenter


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

* Re: [PATCH 1/2] staging: rtl8188eu: remove unnecessary asignment
@ 2020-04-06 11:25   ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2020-04-06 11:25 UTC (permalink / raw)
  To: Michael Straube; +Cc: devel, gregkh, linux-kernel, Larry.Finger

On Sun, Apr 05, 2020 at 01:22:29PM +0200, Michael Straube wrote:
> Remove unnecessary asignment in SwLedBlink1(). The code path with the
> asignment 'pLed->BlinkTimes = 0' is only executed when
> 'pLed->BlinkTimes' is already zero and the value is not changed between
> the test 'if (pLed->BlinkTimes == 0)' and the asignment.
> 

Better to get rid of the bStopBlinking variable and this becomes more
obvious.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH 1/2] staging: rtl8188eu: remove unnecessary asignment
  2020-04-06 11:25   ` Dan Carpenter
@ 2020-04-06 11:26     ` Dan Carpenter
  -1 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2020-04-06 11:26 UTC (permalink / raw)
  To: Michael Straube; +Cc: gregkh, devel, linux-kernel, Larry.Finger

On Mon, Apr 06, 2020 at 02:25:20PM +0300, Dan Carpenter wrote:
> On Sun, Apr 05, 2020 at 01:22:29PM +0200, Michael Straube wrote:
> > Remove unnecessary asignment in SwLedBlink1(). The code path with the
> > asignment 'pLed->BlinkTimes = 0' is only executed when
> > 'pLed->BlinkTimes' is already zero and the value is not changed between
> > the test 'if (pLed->BlinkTimes == 0)' and the asignment.
> > 
> 
> Better to get rid of the bStopBlinking variable and this becomes more
> obvious.

Oh, never mind.  You did that in patch 2.  This is fine then.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter


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

* Re: [PATCH 1/2] staging: rtl8188eu: remove unnecessary asignment
@ 2020-04-06 11:26     ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2020-04-06 11:26 UTC (permalink / raw)
  To: Michael Straube; +Cc: devel, gregkh, linux-kernel, Larry.Finger

On Mon, Apr 06, 2020 at 02:25:20PM +0300, Dan Carpenter wrote:
> On Sun, Apr 05, 2020 at 01:22:29PM +0200, Michael Straube wrote:
> > Remove unnecessary asignment in SwLedBlink1(). The code path with the
> > asignment 'pLed->BlinkTimes = 0' is only executed when
> > 'pLed->BlinkTimes' is already zero and the value is not changed between
> > the test 'if (pLed->BlinkTimes == 0)' and the asignment.
> > 
> 
> Better to get rid of the bStopBlinking variable and this becomes more
> obvious.

Oh, never mind.  You did that in patch 2.  This is fine then.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

end of thread, other threads:[~2020-04-06 11:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-05 11:22 [PATCH 1/2] staging: rtl8188eu: remove unnecessary asignment Michael Straube
2020-04-05 11:22 ` Michael Straube
2020-04-05 11:22 ` [PATCH 2/2] staging: rtl8188eu: remove unnecessary variable Michael Straube
2020-04-05 11:22   ` Michael Straube
2020-04-06 11:25 ` [PATCH 1/2] staging: rtl8188eu: remove unnecessary asignment Dan Carpenter
2020-04-06 11:25   ` Dan Carpenter
2020-04-06 11:26   ` Dan Carpenter
2020-04-06 11:26     ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.