rt2x00: Fix rounding errors in RSSI average calculation
[pandora-kernel.git] / drivers / net / wireless / rt2x00 / rt2x00.h
index 704e944..e6e73be 100644 (file)
 #define SHORT_EIFS             ( SIFS + SHORT_DIFS + \
                                  GET_DURATION(IEEE80211_HEADER + ACK_SIZE, 10) )
 
+/*
+ * Structure for average calculation
+ * The avg field contains the actual average value,
+ * but avg_weight is internally used during calculations
+ * to prevent rounding errors.
+ */
+struct avg_val {
+       int avg;
+       int avg_weight;
+};
+
 /*
  * Chipset identification
  * The chipset on the device is composed of a RT and RF chip.
@@ -256,7 +267,7 @@ struct link_ant {
         * Similar to the avg_rssi in the link_qual structure
         * this value is updated by using the walking average.
         */
-       int rssi_ant;
+       struct avg_val rssi_ant;
 };
 
 /*
@@ -285,7 +296,7 @@ struct link {
        /*
         * Currently active average RSSI value
         */
-       int avg_rssi;
+       struct avg_val avg_rssi;
 
        /*
         * Currently precalculated percentages of successful