fix an error message
[openwrt/svn-archive/archive.git] / package / madwifi / patches / 125-tpc_PR_1435.patch
1 Index: madwifi-ng-r2568-20070710/ath/if_ath.c
2 ===================================================================
3 --- madwifi-ng-r2568-20070710.orig/ath/if_ath.c 2007-07-13 11:18:17.733307111 +0200
4 +++ madwifi-ng-r2568-20070710/ath/if_ath.c 2007-07-13 11:18:18.945376179 +0200
5 @@ -273,9 +273,7 @@
6 static char *autocreate = NULL;
7 static char *ratectl = DEF_RATE_CTL;
8 static int rfkill = 0;
9 -#ifdef ATH_CAP_TPC
10 static int tpc = 0;
11 -#endif
12 static int countrycode = -1;
13 static int outdoor = -1;
14 static int xchanmode = -1;
15 @@ -533,12 +531,6 @@
16 rfkill ? "on" : "off");
17 ath_hal_setrfsilent(ah, rfkill);
18
19 -#ifdef ATH_CAP_TPC
20 - printk(KERN_INFO "ath_pci: ath_pci: switching per-packet transmit power control %s\n",
21 - tpc ? "on" : "off");
22 - ath_hal_settpc(ah, tpc);
23 -#endif
24 -
25 /*
26 * Setup rate tables for all potential media types.
27 */
28 @@ -818,11 +810,18 @@
29 */
30 #ifdef ATH_CAP_TPC
31 sc->sc_hastpc = ath_hal_hastpc(ah);
32 - if (sc->sc_hastpc || ath_hal_hastxpowlimit(ah))
33 + if(tpc && !sc->sc_hastpc) {
34 + printk(KERN_WARNING "ath_pci: WARNING: per-packet transmit power control was requested, but is not supported by the hardware.\n");
35 + tpc = 0;
36 + }
37 + printk(KERN_INFO "ath_pci: switching per-packet transmit power control %s\n",
38 + tpc ? "on" : "off");
39 + ath_hal_settpc(ah, tpc);
40 #else
41 sc->sc_hastpc = 0;
42 - if (ath_hal_hastxpowlimit(ah))
43 + tpc = 0; /* TPC is always zero, when compiled without ATH_CAP_TPC */
44 #endif
45 + if (sc->sc_hastpc || ath_hal_hastxpowlimit(ah))
46 ic->ic_caps |= IEEE80211_C_TXPMGT;
47
48 /*
49 @@ -1836,7 +1835,7 @@
50 ath_stop_locked(dev);
51
52 #ifdef ATH_CAP_TPC
53 - /* Re-enable after suspend (?) */
54 + /* Re-enable after suspend */
55 ath_hal_settpc(ah, tpc);
56 #endif
57
58 @@ -8787,26 +8786,16 @@
59 * Search for the VAP that needs a txpow change, if any
60 */
61 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
62 -#ifdef ATH_CAP_TPC
63 - if (ic->ic_newtxpowlimit == vap->iv_bss->ni_txpower) {
64 + if (!tpc || ic->ic_newtxpowlimit >= vap->iv_bss->ni_txpower) {
65 vap->iv_bss->ni_txpower = clamped_txpow;
66 ieee80211_iterate_nodes(&vap->iv_ic->ic_sta, set_node_txpower, &clamped_txpow);
67 }
68 -#else
69 - vap->iv_bss->ni_txpower = clamped_txpow;
70 - ieee80211_iterate_nodes(&vap->iv_ic->ic_sta, set_node_txpower, &clamped_txpow);
71 -#endif
72 }
73
74 - ic->ic_newtxpowlimit = sc->sc_curtxpow = clamped_txpow;
75 + sc->sc_curtxpow = clamped_txpow;
76
77 -#ifdef ATH_CAP_TPC
78 - if (ic->ic_newtxpowlimit >= txpowlimit)
79 - ath_hal_settxpowlimit(ah, ic->ic_newtxpowlimit);
80 -#else
81 - if (ic->ic_newtxpowlimit != txpowlimit)
82 - ath_hal_settxpowlimit(ah, ic->ic_newtxpowlimit);
83 -#endif
84 + if (clamped_txpow != txpowlimit)
85 + ath_hal_settxpowlimit(ah, clamped_txpow);
86 }
87
88
89 Index: madwifi-ng-r2568-20070710/net80211/ieee80211_wireless.c
90 ===================================================================
91 --- madwifi-ng-r2568-20070710.orig/net80211/ieee80211_wireless.c 2007-07-13 11:18:13.473064331 +0200
92 +++ madwifi-ng-r2568-20070710/net80211/ieee80211_wireless.c 2007-07-13 11:18:18.949376408 +0200
93 @@ -1403,6 +1403,7 @@
94 } else {
95 if (!fixed) /* no change */
96 return 0;
97 + ic->ic_newtxpowlimit = IEEE80211_TXPOWER_MAX;
98 ic->ic_flags &= ~IEEE80211_F_TXPOW_FIXED;
99 }
100 done: