build: create pkginfo dir earlier to avoid build breakage
[openwrt.git] / package / madwifi / patches / 438-poweroffset_sysctl.patch
1 --- a/ath/if_ath.c
2 +++ b/ath/if_ath.c
3 @@ -10476,11 +10476,11 @@ set_node_txpower(void *arg, struct ieee8
4   * XXX: this function needs some locking to avoid being called 
5   * twice/interrupted. Returns the value actually stored. */
6  static u_int32_t
7 -ath_set_clamped_maxtxpower(struct ath_softc *sc, 
8 -               u_int32_t new_clamped_maxtxpower)
9 +ath_set_clamped_maxtxpower(struct ath_softc *sc, u_int32_t new_txpwr)
10  {
11 -       new_clamped_maxtxpower -= sc->sc_poweroffset;
12 -       (void)ath_hal_settxpowlimit(sc->sc_ah, new_clamped_maxtxpower);
13 +       new_txpwr = ((new_txpwr < sc->sc_poweroffset) ? 0 :
14 +               new_txpwr - sc->sc_poweroffset);
15 +       (void)ath_hal_settxpowlimit(sc->sc_ah, new_txpwr);
16         return ath_get_clamped_maxtxpower(sc);
17  }
18  
19 @@ -11031,6 +11031,7 @@ enum {
20         ATH_DEBUG,
21         ATH_TXANTENNA,
22         ATH_RXANTENNA,
23 +       ATH_POWEROFFSET,
24         ATH_DIVERSITY,
25         ATH_TXINTRPERIOD,
26         ATH_FFTXQMIN,
27 @@ -11311,6 +11312,9 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
28                                 ath_debug_global = (val &  ATH_DEBUG_GLOBAL);
29  #endif
30                                 break;
31 +                       case ATH_POWEROFFSET:
32 +                               sc->sc_poweroffset = val;
33 +                               break;
34                         case ATH_TXANTENNA:
35                                 /*
36                                  * antenna can be:
37 @@ -11478,6 +11482,9 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
38                 case ATH_DEBUG:
39                         val = sc->sc_debug | ath_debug_global;
40                         break;
41 +               case ATH_POWEROFFSET:
42 +                       val = sc->sc_poweroffset;
43 +                       break;
44                 case ATH_TXANTENNA:
45                         val = sc->sc_txantenna;
46                         break;
47 @@ -11619,6 +11626,12 @@ static const ctl_table ath_sysctl_templa
48         },
49  #endif
50         { .ctl_name     = CTL_AUTO,
51 +         .procname     = "poweroffset",
52 +         .mode         = 0644,
53 +         .proc_handler = ath_sysctl_halparam,
54 +         .extra2       = (void *)ATH_POWEROFFSET,
55 +       },
56 +       { .ctl_name     = CTL_AUTO,
57           .procname     = "txantenna",
58           .mode         = 0644,
59           .proc_handler = ath_sysctl_halparam,