Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 608b88cb authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by John W. Linville
Browse files

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: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 4c483817
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -157,6 +157,7 @@ struct ar9170_sta_tid {

struct ar9170 {
	struct ieee80211_hw *hw;
	struct ath_common common;
	struct mutex mutex;
	enum ar9170_device_state state;
	unsigned long bad_hw_nagger;
@@ -222,7 +223,6 @@ struct ar9170 {

	/* EEPROM */
	struct ar9170_eeprom eeprom;
	struct ath_regulatory regulatory;

	/* tx queues - as seen by hw - */
	struct sk_buff_head tx_pending[__AR9170_NUM_TXQ];
+8 −6
Original line number Diff line number Diff line
@@ -2641,6 +2641,7 @@ static int ar9170_read_eeprom(struct ar9170 *ar)
{
#define RW	8	/* number of words to read at once */
#define RB	(sizeof(u32) * RW)
	struct ath_regulatory *regulatory = &ar->common.regulatory;
	u8 *eeprom = (void *)&ar->eeprom;
	u8 *addr = ar->eeprom.mac_address;
	__le32 offsets[RW];
@@ -2707,8 +2708,8 @@ static int ar9170_read_eeprom(struct ar9170 *ar)
	else
		ar->hw->channel_change_time = 80 * 1000;

	ar->regulatory.current_rd = le16_to_cpu(ar->eeprom.reg_domain[0]);
	ar->regulatory.current_rd_ext = le16_to_cpu(ar->eeprom.reg_domain[1]);
	regulatory->current_rd = le16_to_cpu(ar->eeprom.reg_domain[0]);
	regulatory->current_rd_ext = le16_to_cpu(ar->eeprom.reg_domain[1]);

	/* second part of wiphy init */
	SET_IEEE80211_PERM_ADDR(ar->hw, addr);
@@ -2722,11 +2723,12 @@ static int ar9170_reg_notifier(struct wiphy *wiphy,
	struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
	struct ar9170 *ar = hw->priv;

	return ath_reg_notifier_apply(wiphy, request, &ar->regulatory);
	return ath_reg_notifier_apply(wiphy, request, &ar->common.regulatory);
}

int ar9170_register(struct ar9170 *ar, struct device *pdev)
{
	struct ath_regulatory *regulatory = &ar->common.regulatory;
	int err;

	/* try to read EEPROM, init MAC addr */
@@ -2734,7 +2736,7 @@ int ar9170_register(struct ar9170 *ar, struct device *pdev)
	if (err)
		goto err_out;

	err = ath_regd_init(&ar->regulatory, ar->hw->wiphy,
	err = ath_regd_init(regulatory, ar->hw->wiphy,
			    ar9170_reg_notifier);
	if (err)
		goto err_out;
@@ -2743,8 +2745,8 @@ int ar9170_register(struct ar9170 *ar, struct device *pdev)
	if (err)
		goto err_out;

	if (!ath_is_world_regd(&ar->regulatory))
		regulatory_hint(ar->hw->wiphy, ar->regulatory.alpha2);
	if (!ath_is_world_regd(regulatory))
		regulatory_hint(ar->hw->wiphy, regulatory->alpha2);

	err = ar9170_init_leds(ar);
	if (err)
+18 −0
Original line number Diff line number Diff line
@@ -19,8 +19,26 @@

#include <linux/skbuff.h>

struct reg_dmn_pair_mapping {
	u16 regDmnEnum;
	u16 reg_5ghz_ctl;
	u16 reg_2ghz_ctl;
};

struct ath_regulatory {
	char alpha2[2];
	u16 country_code;
	u16 max_power_level;
	u32 tp_scale;
	u16 current_rd;
	u16 current_rd_ext;
	int16_t power_limit;
	struct reg_dmn_pair_mapping *regpair;
};

struct ath_common {
	u16 cachelsz;
	struct ath_regulatory regulatory;
};

struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
+0 −3
Original line number Diff line number Diff line
@@ -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];
+7 −7
Original line number Diff line number Diff line
@@ -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);

Loading