diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index dd03e5ecb5f..224a84f9ff6 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -4916,6 +4916,21 @@ ath_sysctl_tpc(SYSCTL_HANDLER_ARGS) return !ath_hal_settpc(sc->sc_ah, tpc) ? EINVAL : 0; } +static int +ath_sysctl_regdomain(SYSCTL_HANDLER_ARGS) +{ + struct ath_softc *sc = arg1; + u_int32_t rd; + int error; + + if (!ath_hal_getregdomain(sc->sc_ah, &rd)) + return EINVAL; + error = sysctl_handle_int(oidp, &rd, 0, req); + if (error || !req->newptr) + return error; + return !ath_hal_setregdomain(sc->sc_ah, rd) ? EINVAL : 0; +} + static void ath_sysctlattach(struct ath_softc *sc) { @@ -4927,10 +4942,9 @@ ath_sysctlattach(struct ath_softc *sc) SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "countrycode", CTLFLAG_RD, &sc->sc_countrycode, 0, "EEPROM country code"); - ath_hal_getregdomain(sc->sc_ah, &sc->sc_regdomain); - SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, - "regdomain", CTLFLAG_RD, &sc->sc_regdomain, 0, - "EEPROM regdomain code"); + SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "regdomain", CTLTYPE_INT | CTLFLAG_RW, sc, 0, + ath_sysctl_regdomain, "I", "EEPROM regdomain code"); sc->sc_debug = ath_debug; SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "debug", CTLFLAG_RW, &sc->sc_debug, 0, diff --git a/sys/dev/ath/if_athvar.h b/sys/dev/ath/if_athvar.h index b0081a6d03c..d64a3bb9d01 100644 --- a/sys/dev/ath/if_athvar.h +++ b/sys/dev/ath/if_athvar.h @@ -170,7 +170,6 @@ struct ath_softc { struct ifnet *sc_ifp; /* interface common */ struct ath_stats sc_stats; /* interface statistics */ struct ieee80211com sc_ic; /* IEEE 802.11 common */ - int sc_regdomain; int sc_countrycode; int sc_debug; void (*sc_recv_mgmt)(struct ieee80211com *, @@ -448,6 +447,8 @@ void ath_intr(void *); (ath_hal_getcapability(_ah, HAL_CAP_CIPHER, _cipher, NULL) == HAL_OK) #define ath_hal_getregdomain(_ah, _prd) \ ath_hal_getcapability(_ah, HAL_CAP_REG_DMN, 0, (_prd)) +#define ath_hal_setregdomain(_ah, _rd) \ + ((*(_ah)->ah_setRegulatoryDomain)((_ah), (_rd), NULL)) #define ath_hal_getcountrycode(_ah, _pcc) \ (*(_pcc) = (_ah)->ah_countryCode) #define ath_hal_tkipsplit(_ah) \