From 3465554a3a406cc92e6657b6a4c170112a277118 Mon Sep 17 00:00:00 2001 From: mentor Date: Sat, 13 Oct 2007 21:19:49 +0000 Subject: [PATCH] Refactor beacon buffer generating loop for readability git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@2742 0192ed92-7a03-0410-a25b-9323aeb14dbd --- ath/if_ath.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/ath/if_ath.c b/ath/if_ath.c index da20781..0d2c387 100644 --- a/ath/if_ath.c +++ b/ath/if_ath.c @@ -4280,7 +4280,7 @@ ath_beacon_send(struct ath_softc *sc, int *needmark) struct ieee80211vap *vap; struct ath_buf *bf; unsigned int slot; - u_int32_t bfaddr; + u_int32_t bfaddr = 0; /* * Check if the previous beacon has gone out. If @@ -4336,23 +4336,21 @@ ath_beacon_send(struct ath_softc *sc, int *needmark) bfaddr = bf->bf_daddr; } } else { /* burst'd beacons */ - u_int32_t *bflink; + u_int32_t *bflink = NULL; - bflink = &bfaddr; - /* XXX rotate/randomize order? */ + /* XXX: rotate/randomize order? */ for (slot = 0; slot < ATH_BCBUF; slot++) { - vap = sc->sc_bslot[slot]; - if (vap != NULL) { - bf = ath_beacon_generate(sc, vap, needmark); - if (bf != NULL) { + if ((vap = sc->sc_bslot[slot]) != NULL) { + if ((bf = ath_beacon_generate(sc, vap, needmark)) != NULL) { + if (bflink != NULL) #ifdef AH_NEED_DESC_SWAP - if (bflink != &bfaddr) *bflink = cpu_to_le32(bf->bf_daddr); - else - *bflink = bf->bf_daddr; #else - *bflink = bf->bf_daddr; + *bflink = bf->bf_daddr; #endif + else /* For the first bf, save bf_addr for later */ + bfaddr = bf->bf_daddr; + bflink = &bf->bf_desc->ds_link; } }