Commit 49552d33 authored by Arend van Spriel's avatar Arend van Spriel Committed by Greg Kroah-Hartman

staging: brcm80211: modify the FOREACH_BSS macro

The FOREACH_BSS macro was changed to remove a checkpatch error. However,
the patch was considered ugly. This patch is another attempt to make it
more clear. END_FOREACH_BSS is defined with braces to avoid an invalid
checkpatch.pl warning. Ideally, the checkpatch.pl script should be adapted
but lacking good perl knowledge to do so.
Reported-by: default avatarDan Carpenter <error27@gmail.com>
Reviewed-by: default avatarPieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: default avatarRoland Vossen <rvossen@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0da64910
...@@ -250,10 +250,14 @@ ...@@ -250,10 +250,14 @@
#define BSSCFG_STA(cfg) (1) #define BSSCFG_STA(cfg) (1)
#define BSSCFG_IBSS(cfg) (!(cfg)->BSS) #define BSSCFG_IBSS(cfg) (!(cfg)->BSS)
/* As above for all non-NULL BSS configs */ /* iterate through all valid bsscfg entries */
#define FOREACH_BSS(wlc, idx, cfg) \ #define FOREACH_BSS(wlc, idx, cfg) \
for (idx = 0; (int) idx < BRCMS_MAXBSSCFG; idx++) \ for (idx = 0; (int) idx < BRCMS_MAXBSSCFG; idx++) { \
if ((cfg = (wlc)->bsscfg[idx])) cfg = (wlc)->bsscfg[idx]; \
if (!cfg) \
continue;
/* close marker for iterator code block */
#define END_FOREACH_BSS() }
/* Shared memory location index for various AC params */ /* Shared memory location index for various AC params */
#define wme_shmemacindex(ac) wme_ac2fifo[ac] #define wme_shmemacindex(ac) wme_ac2fifo[ac]
...@@ -3315,14 +3319,14 @@ void brcms_c_init(struct brcms_c_info *wlc) ...@@ -3315,14 +3319,14 @@ void brcms_c_init(struct brcms_c_info *wlc)
brcms_c_reprate_init(wlc); brcms_c_reprate_init(wlc);
/* write ethernet address to core */ /* write ethernet address to core */
FOREACH_BSS(wlc, i, bsscfg) { FOREACH_BSS(wlc, i, bsscfg)
brcms_c_set_mac(bsscfg); brcms_c_set_mac(bsscfg);
brcms_c_set_bssid(bsscfg); brcms_c_set_bssid(bsscfg);
} END_FOREACH_BSS()
/* Update tsf_cfprep if associated and up */ /* Update tsf_cfprep if associated and up */
if (wlc->pub->associated) { if (wlc->pub->associated) {
FOREACH_BSS(wlc, i, bsscfg) { FOREACH_BSS(wlc, i, bsscfg)
if (bsscfg->up) { if (bsscfg->up) {
u32 bi; u32 bi;
...@@ -3340,7 +3344,7 @@ void brcms_c_init(struct brcms_c_info *wlc) ...@@ -3340,7 +3344,7 @@ void brcms_c_init(struct brcms_c_info *wlc)
break; break;
} }
} END_FOREACH_BSS()
} }
brcms_c_bandinit_ordered(wlc, chanspec); brcms_c_bandinit_ordered(wlc, chanspec);
...@@ -3540,7 +3544,7 @@ void brcms_c_switch_shortslot(struct brcms_c_info *wlc, bool shortslot) ...@@ -3540,7 +3544,7 @@ void brcms_c_switch_shortslot(struct brcms_c_info *wlc, bool shortslot)
wlc->shortslot = shortslot; wlc->shortslot = shortslot;
/* update the capability based on current shortslot mode */ /* update the capability based on current shortslot mode */
FOREACH_BSS(wlc, idx, cfg) { FOREACH_BSS(wlc, idx, cfg)
if (!cfg->associated) if (!cfg->associated)
continue; continue;
cfg->current_bss->capability &= cfg->current_bss->capability &=
...@@ -3548,7 +3552,7 @@ void brcms_c_switch_shortslot(struct brcms_c_info *wlc, bool shortslot) ...@@ -3548,7 +3552,7 @@ void brcms_c_switch_shortslot(struct brcms_c_info *wlc, bool shortslot)
if (wlc->shortslot) if (wlc->shortslot)
cfg->current_bss->capability |= cfg->current_bss->capability |=
WLAN_CAPABILITY_SHORT_SLOT_TIME; WLAN_CAPABILITY_SHORT_SLOT_TIME;
} END_FOREACH_BSS()
brcms_b_set_shortslot(wlc->hw, shortslot); brcms_b_set_shortslot(wlc->hw, shortslot);
} }
...@@ -3589,12 +3593,13 @@ void brcms_c_set_home_chanspec(struct brcms_c_info *wlc, u16 chanspec) ...@@ -3589,12 +3593,13 @@ void brcms_c_set_home_chanspec(struct brcms_c_info *wlc, u16 chanspec)
wlc->home_chanspec = chanspec; wlc->home_chanspec = chanspec;
FOREACH_BSS(wlc, idx, cfg) { FOREACH_BSS(wlc, idx, cfg)
if (!cfg->associated) if (!cfg->associated)
continue; continue;
cfg->current_bss->chanspec = chanspec; cfg->current_bss->chanspec = chanspec;
} END_FOREACH_BSS()
} }
} }
...@@ -5309,14 +5314,14 @@ static void brcms_c_watchdog(void *arg) ...@@ -5309,14 +5314,14 @@ static void brcms_c_watchdog(void *arg)
brcms_c_statsupd(wlc); brcms_c_statsupd(wlc);
/* Manage TKIP countermeasures timers */ /* Manage TKIP countermeasures timers */
FOREACH_BSS(wlc, i, cfg) { FOREACH_BSS(wlc, i, cfg)
if (cfg->tk_cm_dt) { if (cfg->tk_cm_dt) {
cfg->tk_cm_dt--; cfg->tk_cm_dt--;
} }
if (cfg->tk_cm_bt) { if (cfg->tk_cm_bt) {
cfg->tk_cm_bt--; cfg->tk_cm_bt--;
} }
} END_FOREACH_BSS()
/* Call any registered watchdog handlers */ /* Call any registered watchdog handlers */
for (i = 0; i < BRCMS_MAXMODULES; i++) { for (i = 0; i < BRCMS_MAXMODULES; i++) {
...@@ -5474,7 +5479,7 @@ int brcms_c_up(struct brcms_c_info *wlc) ...@@ -5474,7 +5479,7 @@ int brcms_c_up(struct brcms_c_info *wlc)
mboolset(wlc->pub->radio_disabled, mboolset(wlc->pub->radio_disabled,
WL_RADIO_HW_DISABLE); WL_RADIO_HW_DISABLE);
FOREACH_BSS(wlc, idx, bsscfg) { FOREACH_BSS(wlc, idx, bsscfg)
if (!BSSCFG_STA(bsscfg) if (!BSSCFG_STA(bsscfg)
|| !bsscfg->enable || !bsscfg->BSS) || !bsscfg->enable || !bsscfg->BSS)
continue; continue;
...@@ -5482,7 +5487,7 @@ int brcms_c_up(struct brcms_c_info *wlc) ...@@ -5482,7 +5487,7 @@ int brcms_c_up(struct brcms_c_info *wlc)
": rfdisable -> " ": rfdisable -> "
"bsscfg_disable()\n", "bsscfg_disable()\n",
wlc->pub->unit, idx); wlc->pub->unit, idx);
} END_FOREACH_BSS()
} }
} }
} }
...@@ -8918,10 +8923,10 @@ void brcms_c_update_beacon(struct brcms_c_info *wlc) ...@@ -8918,10 +8923,10 @@ void brcms_c_update_beacon(struct brcms_c_info *wlc)
struct brcms_bss_cfg *bsscfg; struct brcms_bss_cfg *bsscfg;
/* update AP or IBSS beacons */ /* update AP or IBSS beacons */
FOREACH_BSS(wlc, idx, bsscfg) { FOREACH_BSS(wlc, idx, bsscfg)
if (bsscfg->up && (BSSCFG_AP(bsscfg) || !bsscfg->BSS)) if (bsscfg->up && (BSSCFG_AP(bsscfg) || !bsscfg->BSS))
brcms_c_bss_update_beacon(wlc, bsscfg); brcms_c_bss_update_beacon(wlc, bsscfg);
} END_FOREACH_BSS()
} }
/* Write ssid into shared memory */ /* Write ssid into shared memory */
...@@ -8947,10 +8952,10 @@ void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend) ...@@ -8947,10 +8952,10 @@ void brcms_c_update_probe_resp(struct brcms_c_info *wlc, bool suspend)
struct brcms_bss_cfg *bsscfg; struct brcms_bss_cfg *bsscfg;
/* update AP or IBSS probe responses */ /* update AP or IBSS probe responses */
FOREACH_BSS(wlc, idx, bsscfg) { FOREACH_BSS(wlc, idx, bsscfg)
if (bsscfg->up && (BSSCFG_AP(bsscfg) || !bsscfg->BSS)) if (bsscfg->up && (BSSCFG_AP(bsscfg) || !bsscfg->BSS))
brcms_c_bss_update_probe_resp(wlc, bsscfg, suspend); brcms_c_bss_update_probe_resp(wlc, bsscfg, suspend);
} END_FOREACH_BSS()
} }
void void
...@@ -9031,9 +9036,9 @@ void brcms_c_reprate_init(struct brcms_c_info *wlc) ...@@ -9031,9 +9036,9 @@ void brcms_c_reprate_init(struct brcms_c_info *wlc)
int i; int i;
struct brcms_bss_cfg *bsscfg; struct brcms_bss_cfg *bsscfg;
FOREACH_BSS(wlc, i, bsscfg) { FOREACH_BSS(wlc, i, bsscfg)
brcms_c_bsscfg_reprate_init(bsscfg); brcms_c_bsscfg_reprate_init(bsscfg);
} END_FOREACH_BSS()
} }
/* per bsscfg init tx reported rate mechanism */ /* per bsscfg init tx reported rate mechanism */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment