1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-16 13:21:32 +02:00
openwrt-xburst/package/mac80211/patches/561-ath9k_antenna_mask_validate.patch
nbd b01eb369ce mac80211: update to latest version, fix tx gain patch
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@32655 3c298f89-4303-0410-b956-a3cf2f4a3e73
2012-07-10 00:21:25 +00:00

34 lines
755 B
Diff

--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1840,12 +1840,29 @@ static u32 fill_chainmask(u32 cap, u32 n
return filled;
}
+static bool validate_antenna_mask(struct ath_hw *ah, u32 val)
+{
+ switch (val & ah->caps.rx_chainmask) {
+ case 0x1:
+ case 0x3:
+ case 0x7:
+ return true;
+ case 0x2:
+ return (ah->caps.rx_chainmask == 1);
+ default:
+ return false;
+ }
+}
+
static int ath9k_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant)
{
struct ath_softc *sc = hw->priv;
struct ath_hw *ah = sc->sc_ah;
- if (!rx_ant || !tx_ant)
+ if (ah->caps.rx_chainmask != 1)
+ rx_ant |= tx_ant;
+
+ if (!validate_antenna_mask(ah, rx_ant) || !tx_ant)
return -EINVAL;
sc->ant_rx = rx_ant;