logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

revision 2742 committed: msg#00028

Subject: revision 2742 committed
Project     : madwifi
Revision    : 2742
Author      : mentor (Matthew W. S. Bell)
Date        : 2007-10-13 23:19:49 +0200 (Sat, 13 Oct 2007)

Log Message :
Refactor beacon buffer generating loop for readability

Affected Files:
* madwifi/trunk/ath/if_ath.c                          updated             


Modified: madwifi/trunk/ath/if_ath.c
===================================================================
--- madwifi/trunk/ath/if_ath.c  2007-10-13 18:41:45 UTC (rev 2741)
+++ madwifi/trunk/ath/if_ath.c  2007-10-13 21:19:49 UTC (rev 2742)
@@ -4280,7 +4280,7 @@
        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 @@
                                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;
                                }
                        }

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/


<Prev in Thread] Current Thread [Next in Thread>