madwifi: minor cleanup for the channel handling patch
authorFelix Fietkau <nbd@openwrt.org>
Wed, 6 May 2009 14:06:59 +0000 (14:06 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 6 May 2009 14:06:59 +0000 (14:06 +0000)
SVN-Revision: 15637

package/madwifi/patches/421-channel_handling.patch

index 781194eed7bed0faf649f84f62cc0dc6cafcb5cf..a9ad2bd1a62b150ed97a1298e86c476a9bb5974c 100644 (file)
                if (rt->info[ix].shortPreamble ||
                    rt->info[ix].phy == IEEE80211_T_OFDM)
                        sc->sc_hwmap[i].flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
-@@ -10932,9 +10939,115 @@ enum {
+@@ -10932,9 +10939,106 @@ enum {
        ATH_MAXVAPS             = 26,
        ATH_INTMIT                      = 27,
        ATH_NOISE_IMMUNITY      = 28,
 +      struct ieee80211vap *vap;
 +      u_int16_t freq = 0;
 +      struct ifreq ifr;
-+      void *ptr;
-+      u32 *reg;
 +
 +      if (ic->ic_curchan != IEEE80211_CHAN_ANYC)
 +              freq = ic->ic_curchan->ic_freq;
 +
 +      switch(ctl) {
-+      case ATH_REGDOMAIN:
-+              ptr = ah;
-+              ptr += sizeof(struct ath_hal);
-+              ptr += 116;
-+              reg = ptr;
-+              *reg = val;
-+              return 0;
 +      case ATH_COUNTRYCODE:
 +              ic->ic_country_code = val;
 +              break;
  static int
  ath_sysctl_set_intmit(struct ath_softc *sc, long ctl, u_int val)
  {
-@@ -11013,6 +11126,7 @@ static int
+@@ -11013,6 +11117,7 @@ static int
  ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl, write, filp, buffer, lenp, ppos)
  {
        struct ath_softc *sc = ctl->extra1;
        struct ath_hal *ah = sc->sc_ah;
        u_int val;
        u_int tab_3_val[3];
-@@ -11036,25 +11150,31 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+@@ -11036,25 +11141,33 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
                                lenp, ppos);
                if (ret == 0) {
                        switch ((long)ctl->extra2) {
 +                      case ATH_REGDOMAIN:
++                              ath_hal_setregdomain(ah, val);
++                              break;
 +                      case ATH_COUNTRYCODE:
 +                      case ATH_CHANBW:
 +                              ret = ath_sysctl_setchanparam(sc, (long) ctl->extra2, val);
                                break;
                        case ATH_SOFTLED:
                                if (val != sc->sc_softled) {
-@@ -11206,7 +11326,12 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
-                       }
+@@ -11207,6 +11320,9 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
                }
        } else {
-+              void *ptr;
-+              u32 *reg;
                switch ((long)ctl->extra2) {
 +              case ATH_CHANBW:
 +                      val = sc->sc_chanbw ?: 20;
                case ATH_SLOTTIME:
                        val = ath_hal_getslottime(ah);
                        break;
-@@ -11225,11 +11350,18 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
+@@ -11225,6 +11341,9 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
                case ATH_COUNTRYCODE:
                        ath_hal_getcountrycode(ah, &val);
                        break;
                case ATH_MAXVAPS:
                        val = ath_maxvaps;
                        break;
-               case ATH_REGDOMAIN:
--                      ath_hal_getregdomain(ah, &val);
-+                      ptr = ah;
-+                      ptr += sizeof(struct ath_hal);
-+                      ptr += 116;
-+                      reg = ptr;
-+                      val = *reg;
-                       break;
-               case ATH_DEBUG:
-                       val = sc->sc_debug | ath_debug_global;
-@@ -11338,11 +11470,17 @@ static const ctl_table ath_sysctl_templa
+@@ -11338,11 +11457,17 @@ static const ctl_table ath_sysctl_templa
        },
        { .ctl_name     = CTL_AUTO,
          .procname     = "countrycode",
          .procname     = "maxvaps",
          .mode         = 0444,
          .proc_handler = ath_sysctl_halparam,
-@@ -11350,7 +11488,7 @@ static const ctl_table ath_sysctl_templa
+@@ -11350,7 +11475,7 @@ static const ctl_table ath_sysctl_templa
        },
        { .ctl_name     = CTL_AUTO,
          .procname     = "regdomain",
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_REGDOMAIN,
        },
-@@ -11413,6 +11551,12 @@ static const ctl_table ath_sysctl_templa
+@@ -11413,6 +11538,12 @@ static const ctl_table ath_sysctl_templa
          .extra2       = (void *)ATH_ACKRATE,
        },
        { .ctl_name     = CTL_AUTO,
          .procname     = "rp",
          .mode         = 0200,
          .proc_handler = ath_sysctl_halparam,
-@@ -11653,13 +11797,6 @@ static ctl_table ath_static_sysctls[] = 
+@@ -11653,13 +11784,6 @@ static ctl_table ath_static_sysctls[] = 
        },
  #endif
        { .ctl_name     = CTL_AUTO,
          .procname     = "maxvaps",
          .mode         = 0444,
          .data         = &ath_maxvaps,
-@@ -11667,13 +11804,6 @@ static ctl_table ath_static_sysctls[] = 
+@@ -11667,13 +11791,6 @@ static ctl_table ath_static_sysctls[] = 
          .proc_handler = proc_dointvec
        },
        { .ctl_name     = CTL_AUTO,
  
  /*
   * Iterate over the contents of the scan cache.
+--- a/ath/if_ath_hal_wrappers.h
++++ b/ath/if_ath_hal_wrappers.h
+@@ -111,6 +111,11 @@ static inline HAL_BOOL ath_hal_getregdom
+       return (ath_hal_getcapability(ah, HAL_CAP_REG_DMN, 0, destination) == HAL_OK);
+ }
++static inline HAL_BOOL ath_hal_setregdomain(struct ath_hal *ah, u_int32_t v)
++{
++      return (ath_hal_setcapability(ah, HAL_CAP_REG_DMN, 0, v, NULL));
++}
++
+ static inline HAL_BOOL ath_hal_gettkipmic(struct ath_hal *ah)
+ {
+       return (ath_hal_getcapability(ah, HAL_CAP_TKIP_MIC, 1, NULL) == HAL_OK);