Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1354495 > unrolled thread
| Started by | Claudiu Beznea <claudiu.beznea@gmail.com> |
|---|---|
| First post | 2016-03-09 23:00 +0100 |
| Last post | 2016-03-11 19:20 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] staging: rtl8712: added few code enhancements in rtl8712_led.c Claudiu Beznea <claudiu.beznea@gmail.com> - 2016-03-09 23:00 +0100
Re: [PATCH] staging: rtl8712: added few code enhancements in rtl8712_led.c Larry Finger <Larry.Finger@lwfinger.net> - 2016-03-11 19:20 +0100
| From | Claudiu Beznea <claudiu.beznea@gmail.com> |
|---|---|
| Date | 2016-03-09 23:00 +0100 |
| Subject | [PATCH] staging: rtl8712: added few code enhancements in rtl8712_led.c |
| Message-ID | <raUj9-5AY-3@gated-at.bofh.it> |
This patch tries to improve a part of the code from
rtl8712_led.c by removing duplicates condition checks.
Signed-off-by: Claudiu Beznea <claudiu.beznea@gmail.com>
---
drivers/staging/rtl8712/rtl8712_led.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/drivers/staging/rtl8712/rtl8712_led.c b/drivers/staging/rtl8712/rtl8712_led.c
index 9055827..aea6f2d 100644
--- a/drivers/staging/rtl8712/rtl8712_led.c
+++ b/drivers/staging/rtl8712/rtl8712_led.c
@@ -221,11 +221,9 @@ static void SwLedBlink(struct LED_871x *pLed)
break;
case LED_BLINK_StartToBlink:
if (check_fwstate(pmlmepriv, _FW_LINKED) &&
- (pmlmepriv->fw_state & WIFI_STATION_STATE))
- bStopBlinking = true;
- if (check_fwstate(pmlmepriv, _FW_LINKED) &&
- ((pmlmepriv->fw_state & WIFI_ADHOC_STATE) ||
- (pmlmepriv->fw_state & WIFI_ADHOC_MASTER_STATE)))
+ ((pmlmepriv->fw_state & WIFI_STATION_STATE) ||
+ (pmlmepriv->fw_state & WIFI_ADHOC_STATE) ||
+ (pmlmepriv->fw_state & WIFI_ADHOC_MASTER_STATE)))
bStopBlinking = true;
else if (pLed->BlinkTimes == 0)
bStopBlinking = true;
@@ -239,11 +237,12 @@ static void SwLedBlink(struct LED_871x *pLed)
break;
}
if (bStopBlinking) {
- if (check_fwstate(pmlmepriv, _FW_LINKED) &&
- !pLed->bLedOn)
- SwLedOn(padapter, pLed);
- else if (check_fwstate(pmlmepriv, _FW_LINKED) && pLed->bLedOn)
- SwLedOff(padapter, pLed);
+ if (check_fwstate(pmlmepriv, _FW_LINKED)) {
+ if (pLed->bLedOn)
+ SwLedOff(padapter, pLed);
+ else
+ SwLedOn(padapter, pLed);
+ }
pLed->BlinkTimes = 0;
pLed->bLedBlinkInProgress = false;
} else {
@@ -340,7 +339,7 @@ static void SwLedBlink1(struct LED_871x *pLed)
pLed->BlinkingLedState = LED_ON;
mod_timer(&pLed->BlinkTimer, jiffies +
msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA));
- } else if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
+ } else {
pLed->bLedNoLinkBlinkInProgress = true;
pLed->CurrLedState = LED_BLINK_SLOWLY;
if (pLed->bLedOn)
@@ -374,7 +373,7 @@ static void SwLedBlink1(struct LED_871x *pLed)
pLed->BlinkingLedState = LED_ON;
mod_timer(&pLed->BlinkTimer, jiffies +
msecs_to_jiffies(LED_BLINK_LINK_INTERVAL_ALPHA));
- } else if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
+ } else {
pLed->bLedNoLinkBlinkInProgress = true;
pLed->CurrLedState = LED_BLINK_SLOWLY;
if (pLed->bLedOn)
@@ -450,7 +449,7 @@ static void SwLedBlink2(struct LED_871x *pLed)
pLed->CurrLedState = LED_ON;
pLed->BlinkingLedState = LED_ON;
SwLedOn(padapter, pLed);
- } else if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
+ } else {
pLed->CurrLedState = LED_OFF;
pLed->BlinkingLedState = LED_OFF;
SwLedOff(padapter, pLed);
@@ -474,7 +473,7 @@ static void SwLedBlink2(struct LED_871x *pLed)
pLed->CurrLedState = LED_ON;
pLed->BlinkingLedState = LED_ON;
SwLedOn(padapter, pLed);
- } else if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
+ } else {
pLed->CurrLedState = LED_OFF;
pLed->BlinkingLedState = LED_OFF;
SwLedOff(padapter, pLed);
@@ -517,7 +516,7 @@ static void SwLedBlink3(struct LED_871x *pLed)
pLed->BlinkingLedState = LED_ON;
if (!pLed->bLedOn)
SwLedOn(padapter, pLed);
- } else if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
+ } else {
pLed->CurrLedState = LED_OFF;
pLed->BlinkingLedState = LED_OFF;
if (pLed->bLedOn)
@@ -543,7 +542,7 @@ static void SwLedBlink3(struct LED_871x *pLed)
pLed->BlinkingLedState = LED_ON;
if (!pLed->bLedOn)
SwLedOn(padapter, pLed);
- } else if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
+ } else {
pLed->CurrLedState = LED_OFF;
pLed->BlinkingLedState = LED_OFF;
if (pLed->bLedOn)
--
1.9.1
[toc] | [next] | [standalone]
| From | Larry Finger <Larry.Finger@lwfinger.net> |
|---|---|
| Date | 2016-03-11 19:20 +0100 |
| Subject | Re: [PATCH] staging: rtl8712: added few code enhancements in rtl8712_led.c |
| Message-ID | <rbzPl-1I3-25@gated-at.bofh.it> |
| In reply to | #1354495 |
On 03/09/2016 03:54 PM, Claudiu Beznea wrote: > This patch tries to improve a part of the code from > rtl8712_led.c by removing duplicates condition checks. > > Signed-off-by: Claudiu Beznea <claudiu.beznea@gmail.com> > --- > drivers/staging/rtl8712/rtl8712_led.c | 31 +++++++++++++++---------------- > 1 file changed, 15 insertions(+), 16 deletions(-) > > diff --git a/drivers/staging/rtl8712/rtl8712_led.c b/drivers/staging/rtl8712/rtl8712_led.c > index 9055827..aea6f2d 100644 > --- a/drivers/staging/rtl8712/rtl8712_led.c > +++ b/drivers/staging/rtl8712/rtl8712_led.c > @@ -221,11 +221,9 @@ static void SwLedBlink(struct LED_871x *pLed) > break; > case LED_BLINK_StartToBlink: > if (check_fwstate(pmlmepriv, _FW_LINKED) && > - (pmlmepriv->fw_state & WIFI_STATION_STATE)) > - bStopBlinking = true; > - if (check_fwstate(pmlmepriv, _FW_LINKED) && > - ((pmlmepriv->fw_state & WIFI_ADHOC_STATE) || > - (pmlmepriv->fw_state & WIFI_ADHOC_MASTER_STATE))) > + ((pmlmepriv->fw_state & WIFI_STATION_STATE) || > + (pmlmepriv->fw_state & WIFI_ADHOC_STATE) || > + (pmlmepriv->fw_state & WIFI_ADHOC_MASTER_STATE))) The above hunk messes up the alignment of the if statement. Observe the alignment of the stuff you are removing. It is correct. Other than the alignment above, the rest of the patch is correct. Larry
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web