ath: move regulatory info into shared common structure
This moves the shared regulatory structure into the common structure. We will use this ongoing for common data. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:

committed by
John W. Linville

父節點
4c48381786
當前提交
608b88cb34
@@ -27,8 +27,6 @@
|
||||
#include <linux/types.h>
|
||||
#include <net/mac80211.h>
|
||||
|
||||
#include "../regd.h"
|
||||
|
||||
/* RX/TX descriptor hw structs
|
||||
* TODO: Driver part should only see sw structs */
|
||||
#include "desc.h"
|
||||
@@ -1077,7 +1075,6 @@ struct ath5k_hw {
|
||||
|
||||
int ah_gpio_npins;
|
||||
|
||||
struct ath_regulatory ah_regulatory;
|
||||
struct ath5k_capabilities ah_capabilities;
|
||||
|
||||
struct ath5k_txq_info ah_txq[AR5K_NUM_TX_QUEUES];
|
||||
|
@@ -718,9 +718,9 @@ static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *re
|
||||
{
|
||||
struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
|
||||
struct ath5k_softc *sc = hw->priv;
|
||||
struct ath_regulatory *reg = &sc->ah->ah_regulatory;
|
||||
struct ath_regulatory *regulatory = &sc->common.regulatory;
|
||||
|
||||
return ath_reg_notifier_apply(wiphy, request, reg);
|
||||
return ath_reg_notifier_apply(wiphy, request, regulatory);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -728,6 +728,7 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
|
||||
{
|
||||
struct ath5k_softc *sc = hw->priv;
|
||||
struct ath5k_hw *ah = sc->ah;
|
||||
struct ath_regulatory *regulatory = &sc->common.regulatory;
|
||||
u8 mac[ETH_ALEN] = {};
|
||||
int ret;
|
||||
|
||||
@@ -817,9 +818,8 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
|
||||
memset(sc->bssidmask, 0xff, ETH_ALEN);
|
||||
ath5k_hw_set_bssid_mask(sc->ah, sc->bssidmask);
|
||||
|
||||
ah->ah_regulatory.current_rd =
|
||||
ah->ah_capabilities.cap_eeprom.ee_regdomain;
|
||||
ret = ath_regd_init(&ah->ah_regulatory, hw->wiphy, ath5k_reg_notifier);
|
||||
regulatory->current_rd = ah->ah_capabilities.cap_eeprom.ee_regdomain;
|
||||
ret = ath_regd_init(regulatory, hw->wiphy, ath5k_reg_notifier);
|
||||
if (ret) {
|
||||
ATH5K_ERR(sc, "can't initialize regulatory system\n");
|
||||
goto err_queues;
|
||||
@@ -831,8 +831,8 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
|
||||
goto err_queues;
|
||||
}
|
||||
|
||||
if (!ath_is_world_regd(&sc->ah->ah_regulatory))
|
||||
regulatory_hint(hw->wiphy, sc->ah->ah_regulatory.alpha2);
|
||||
if (!ath_is_world_regd(regulatory))
|
||||
regulatory_hint(hw->wiphy, regulatory->alpha2);
|
||||
|
||||
ath5k_init_leds(sc);
|
||||
|
||||
|
@@ -50,6 +50,8 @@
|
||||
|
||||
#include "ath5k.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include "../regd.h"
|
||||
#include "../ath.h"
|
||||
|
||||
#define ATH_RXBUF 40 /* number of RX buffers */
|
||||
@@ -200,4 +202,15 @@ struct ath5k_softc {
|
||||
#define ath5k_hw_hasveol(_ah) \
|
||||
(ath5k_hw_get_capability(_ah, AR5K_CAP_VEOL, 0, NULL) == 0)
|
||||
|
||||
static inline struct ath_common *ath5k_hw_common(struct ath5k_hw *ah)
|
||||
{
|
||||
return &ah->ah_sc->common;
|
||||
}
|
||||
|
||||
static inline struct ath_regulatory *ath5k_hw_regulatory(struct ath5k_hw *ah)
|
||||
{
|
||||
return &(ath5k_hw_common(ah)->regulatory);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -2198,6 +2198,7 @@ static void
|
||||
ath5k_get_max_ctl_power(struct ath5k_hw *ah,
|
||||
struct ieee80211_channel *channel)
|
||||
{
|
||||
struct ath_regulatory *regulatory = ath5k_hw_regulatory(ah);
|
||||
struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
|
||||
struct ath5k_edge_power *rep = ee->ee_ctl_pwr;
|
||||
u8 *ctl_val = ee->ee_ctl;
|
||||
@@ -2208,7 +2209,7 @@ ath5k_get_max_ctl_power(struct ath5k_hw *ah,
|
||||
u8 ctl_idx = 0xFF;
|
||||
u32 target = channel->center_freq;
|
||||
|
||||
ctl_mode = ath_regd_get_band_ctl(&ah->ah_regulatory, channel->band);
|
||||
ctl_mode = ath_regd_get_band_ctl(regulatory, channel->band);
|
||||
|
||||
switch (channel->hw_value & CHANNEL_MODES) {
|
||||
case CHANNEL_A:
|
||||
|
Reference in New Issue
Block a user