zd1211rw: move set_rts_cts_work to bss_info_changed
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>
Mon, 31 Jan 2011 18:47:56 +0000 (20:47 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 4 Feb 2011 21:29:49 +0000 (16:29 -0500)
As bss_info_changed may sleep, we can as well set RTS_CTS register right away.
Keep mac->short_preamble for later use (hw reset).

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/zd1211rw/zd_mac.c
drivers/net/wireless/zd1211rw/zd_mac.h

index 75d9a137f318ec88d9ebe4c8b963dff08ac395af..487ed33e951d668c26f2bf58ad93c577c458765b 100644 (file)
@@ -998,20 +998,9 @@ static void zd_op_configure_filter(struct ieee80211_hw *hw,
         * time. */
 }
 
-static void set_rts_cts_work(struct work_struct *work)
+static void set_rts_cts(struct zd_mac *mac, unsigned int short_preamble)
 {
-       struct zd_mac *mac =
-               container_of(work, struct zd_mac, set_rts_cts_work);
-       unsigned long flags;
-       unsigned int short_preamble;
-
        mutex_lock(&mac->chip.mutex);
-
-       spin_lock_irqsave(&mac->lock, flags);
-       mac->updating_rts_rate = 0;
-       short_preamble = mac->short_preamble;
-       spin_unlock_irqrestore(&mac->lock, flags);
-
        zd_chip_set_rts_cts_rate_locked(&mac->chip, short_preamble);
        mutex_unlock(&mac->chip.mutex);
 }
@@ -1022,7 +1011,6 @@ static void zd_op_bss_info_changed(struct ieee80211_hw *hw,
                                   u32 changes)
 {
        struct zd_mac *mac = zd_hw_mac(hw);
-       unsigned long flags;
        int associated;
 
        dev_dbg_f(zd_mac_dev(mac), "changes: %x\n", changes);
@@ -1060,15 +1048,11 @@ static void zd_op_bss_info_changed(struct ieee80211_hw *hw,
        /* TODO: do hardware bssid filtering */
 
        if (changes & BSS_CHANGED_ERP_PREAMBLE) {
-               spin_lock_irqsave(&mac->lock, flags);
+               spin_lock_irq(&mac->lock);
                mac->short_preamble = bss_conf->use_short_preamble;
-               if (!mac->updating_rts_rate) {
-                       mac->updating_rts_rate = 1;
-                       /* FIXME: should disable TX here, until work has
-                        * completed and RTS_CTS reg is updated */
-                       queue_work(zd_workqueue, &mac->set_rts_cts_work);
-               }
-               spin_unlock_irqrestore(&mac->lock, flags);
+               spin_unlock_irq(&mac->lock);
+
+               set_rts_cts(mac, bss_conf->use_short_preamble);
        }
 }
 
@@ -1142,7 +1126,6 @@ struct ieee80211_hw *zd_mac_alloc_hw(struct usb_interface *intf)
 
        zd_chip_init(&mac->chip, hw, intf);
        housekeeping_init(mac);
-       INIT_WORK(&mac->set_rts_cts_work, set_rts_cts_work);
        INIT_WORK(&mac->process_intr, zd_process_intr);
 
        SET_IEEE80211_DEV(hw, &intf->dev);
index f28ecb94c2a443b0dda291a0373cc08f8169b595..ff7ef30372a14dc8319979ee93e263446b11dcca 100644 (file)
@@ -189,9 +189,6 @@ struct zd_mac {
        /* Short preamble (used for RTS/CTS) */
        unsigned int short_preamble:1;
 
-       /* flags to indicate update in progress */
-       unsigned int updating_rts_rate:1;
-
        /* whether to pass frames with CRC errors to stack */
        unsigned int pass_failed_fcs:1;