Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 315598
b: refs/heads/master
c: 5d9c7e3
h: refs/heads/master
v: v3
  • Loading branch information
Felix Fietkau authored and John W. Linville committed Jul 17, 2012
1 parent 50167f2 commit b174019
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 01967360a20598f95947a86af26c930ab1b50205
refs/heads/master: 5d9c7e3c82aaf40b9192e6482968a39b87427bf7
19 changes: 18 additions & 1 deletion trunk/drivers/net/wireless/ath/ath9k/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1923,12 +1923,29 @@ static u32 fill_chainmask(u32 cap, u32 new)
return filled;
}

static bool validate_antenna_mask(struct ath_hw *ah, u32 val)
{
switch (val & 0x7) {
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;
Expand Down

0 comments on commit b174019

Please sign in to comment.