ath9k: Add a HW capability for WLAN/BT RX diversity
Make use of this capability to restrict the usage of the debugfs file and modparam using which this feature can be enabled. Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:

committed by
John W. Linville

parent
6308130542
commit
3f2da95517
@@ -289,6 +289,7 @@ static ssize_t write_file_bt_ant_diversity(struct file *file,
|
||||
{
|
||||
struct ath_softc *sc = file->private_data;
|
||||
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
|
||||
struct ath9k_hw_capabilities *pCap = &sc->sc_ah->caps;
|
||||
unsigned long bt_ant_diversity;
|
||||
char buf[32];
|
||||
ssize_t len;
|
||||
@@ -297,6 +298,9 @@ static ssize_t write_file_bt_ant_diversity(struct file *file,
|
||||
if (copy_from_user(buf, user_buf, len))
|
||||
return -EFAULT;
|
||||
|
||||
if (!(pCap->hw_caps & ATH9K_HW_CAP_BT_ANT_DIV))
|
||||
goto exit;
|
||||
|
||||
buf[len] = '\0';
|
||||
if (kstrtoul(buf, 0, &bt_ant_diversity))
|
||||
return -EINVAL;
|
||||
@@ -307,7 +311,7 @@ static ssize_t write_file_bt_ant_diversity(struct file *file,
|
||||
ath_dbg(common, CONFIG, "Enable WLAN/BT RX Antenna diversity: %d\n",
|
||||
common->bt_ant_diversity);
|
||||
ath9k_ps_restore(sc);
|
||||
|
||||
exit:
|
||||
return count;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user