This updates the bwmode set operation to actually set bwmode,
rather than just returning not supported

Signed-off-by: Pat Erley <pat-l...@erley.org>
---
 drivers/net/wireless/ath/ath5k/debug.c |   39 ++++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath5k/debug.c 
b/drivers/net/wireless/ath/ath5k/debug.c
index 335eebb..197fa59 100644
--- a/drivers/net/wireless/ath/ath5k/debug.c
+++ b/drivers/net/wireless/ath/ath5k/debug.c
@@ -847,12 +847,47 @@ static ssize_t write_file_bwmode(struct file *file,
                                 size_t count, loff_t *ppos)
 {
        struct ath5k_softc *sc = file->private_data;
-       char buf[20];
+       struct ath5k_hw *ah = sc->ah;
+       char buf[3];
+       int ret = 0;
+       int bw 20;
+       int tobwmode = AR5K_BWMODE_DEFAULT;
 
        if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
                return -EFAULT;
 
-       return -EOPNOTSUPP;
+       /* TODO: Add check for active interface */
+
+       if(strncmp(buf, "5", 1) == 0 ) {
+               tobwmode = AR5K_BWMODE_5MHZ;
+               bw = 5;
+       } else if ( strncmp(buf, "10", 2) == 0 ) {
+               tobwmode = AR5K_BWMODE_10MHZ;
+               bw = 10;
+       } else if ( strncmp(buf, "20", 8) == 0 ) {
+               tobwmode = AR5K_BWMODE_DEFAULT;
+               bw = 20;
+       } else if ( strncmp(buf, "40", 8) == 0 ) {
+               tobwmode = AR5K_BWMODE_40MHZ;
+               bw = 40;
+       } else
+               return -EINVAL;
+
+       ATH5K_INFO(sc, "Changing to %imhz channel width[%i]\n",
+               bw, tobwmode);
+
+       switch (ah->ah_radio) {
+               case AR5K_RF5413:
+                       ah->ah_bwmode = tobwmode;
+                       mutex_lock(&sc->lock);
+                       ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan,
+                                       NULL, false);
+                       mutex_unlock(&sc->lock);
+                       break;
+               default:
+                       return -EOPNOTSUPP;
+       }
+       return count;
 }
 
 static const struct file_operations fops_bwmode = {
-- 
1.7.4.1

_______________________________________________
ath5k-devel mailing list
ath5k-devel@lists.ath5k.org
https://lists.ath5k.org/mailman/listinfo/ath5k-devel

Reply via email to