]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mt76: move mt76x02_sw_scan and mt76x02_sw_scan_complete in mt76x02-lib module
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Sat, 20 Oct 2018 10:13:28 +0000 (12:13 +0200)
committerFelix Fietkau <nbd@nbd.name>
Fri, 30 Nov 2018 11:21:41 +0000 (12:21 +0100)
Move mt76x02_sw_scan and mt76x02_sw_scan_complete utility routines
in mt76x02_util.c in order to be reused by mt76x0 and mt76x2u drivers
and remove duplicated code

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt76x0/main.c
drivers/net/wireless/mediatek/mt76/mt76x0/mt76x0.h
drivers/net/wireless/mediatek/mt76/mt76x0/pci.c
drivers/net/wireless/mediatek/mt76/mt76x0/usb.c
drivers/net/wireless/mediatek/mt76/mt76x02.h
drivers/net/wireless/mediatek/mt76/mt76x02_util.c
drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c
drivers/net/wireless/mediatek/mt76/mt76x2/usb_main.c

index da98382bdb5a8fcc1e5a2ca401b3d70a0a17878f..5747d72bd13a6b5679953481c4399628e9c88d5f 100644 (file)
@@ -127,24 +127,6 @@ void mt76x0_bss_info_changed(struct ieee80211_hw *hw,
 }
 EXPORT_SYMBOL_GPL(mt76x0_bss_info_changed);
 
-void mt76x0_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-                   const u8 *mac_addr)
-{
-       struct mt76x02_dev *dev = hw->priv;
-
-       set_bit(MT76_SCANNING, &dev->mt76.state);
-}
-EXPORT_SYMBOL_GPL(mt76x0_sw_scan);
-
-void mt76x0_sw_scan_complete(struct ieee80211_hw *hw,
-                            struct ieee80211_vif *vif)
-{
-       struct mt76x02_dev *dev = hw->priv;
-
-       clear_bit(MT76_SCANNING, &dev->mt76.state);
-}
-EXPORT_SYMBOL_GPL(mt76x0_sw_scan_complete);
-
 int mt76x0_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
 {
        struct mt76x02_dev *dev = hw->priv;
index 9cdecb9bfc64394e3db5416b73b290a3fecd3c99..2f3abbe491c5ef849541cd857e99cf5889753793 100644 (file)
@@ -65,10 +65,6 @@ int mt76x0_config(struct ieee80211_hw *hw, u32 changed);
 void mt76x0_bss_info_changed(struct ieee80211_hw *hw,
                             struct ieee80211_vif *vif,
                             struct ieee80211_bss_conf *info, u32 changed);
-void mt76x0_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-                   const u8 *mac_addr);
-void mt76x0_sw_scan_complete(struct ieee80211_hw *hw,
-                            struct ieee80211_vif *vif);
 int mt76x0_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
 
 /* PHY */
index f15f9bf14900c770834d850dfd6570c1f3250ba4..7f506975c9b95fd8e23713f1e296133337a07e04 100644 (file)
@@ -80,8 +80,8 @@ static const struct ieee80211_ops mt76x0e_ops = {
        .sta_remove = mt76x02_sta_remove,
        .set_key = mt76x02_set_key,
        .conf_tx = mt76x02_conf_tx,
-       .sw_scan_start = mt76x0_sw_scan,
-       .sw_scan_complete = mt76x0_sw_scan_complete,
+       .sw_scan_start = mt76x02_sw_scan,
+       .sw_scan_complete = mt76x02_sw_scan_complete,
        .ampdu_action = mt76x02_ampdu_action,
        .sta_rate_tbl_update = mt76x02_sta_rate_tbl_update,
        .wake_tx_queue = mt76_wake_tx_queue,
index 245eb4aa9764f007f978b5e08aaa6c997e244139..8640ddf0e59480e299e1a8da6ab6d89ec1fe79ad 100644 (file)
@@ -150,8 +150,8 @@ static const struct ieee80211_ops mt76x0u_ops = {
        .sta_remove = mt76x02_sta_remove,
        .set_key = mt76x02_set_key,
        .conf_tx = mt76x02_conf_tx,
-       .sw_scan_start = mt76x0_sw_scan,
-       .sw_scan_complete = mt76x0_sw_scan_complete,
+       .sw_scan_start = mt76x02_sw_scan,
+       .sw_scan_complete = mt76x02_sw_scan_complete,
        .ampdu_action = mt76x02_ampdu_action,
        .sta_rate_tbl_update = mt76x02_sta_rate_tbl_update,
        .set_rts_threshold = mt76x0_set_rts_threshold,
index 1cd0f758587d9b38df21dd3816b5110909711a65..0890794c92d7ad7b04bf42e9fc8dc7ecfc98cc27 100644 (file)
@@ -147,6 +147,10 @@ int mt76x02_tx_prepare_skb(struct mt76_dev *mdev, void *txwi,
                           struct sk_buff *skb, struct mt76_queue *q,
                           struct mt76_wcid *wcid, struct ieee80211_sta *sta,
                           u32 *tx_info);
+void mt76x02_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+                    const u8 *mac);
+void mt76x02_sw_scan_complete(struct ieee80211_hw *hw,
+                             struct ieee80211_vif *vif);
 
 extern const u16 mt76x02_beacon_offsets[16];
 void mt76x02_set_beacon_offsets(struct mt76x02_dev *dev);
index 208c76d40afa880fd97057369e252c4f3ff54f0a..bbc2cab4ffdc16e3e396019f6ccf62be7d4ef7fb 100644 (file)
@@ -486,6 +486,28 @@ void mt76x02_remove_hdr_pad(struct sk_buff *skb, int len)
 }
 EXPORT_SYMBOL_GPL(mt76x02_remove_hdr_pad);
 
+void mt76x02_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+                    const u8 *mac)
+{
+       struct mt76x02_dev *dev = hw->priv;
+
+       if (mt76_is_mmio(dev))
+               tasklet_disable(&dev->pre_tbtt_tasklet);
+       set_bit(MT76_SCANNING, &dev->mt76.state);
+}
+EXPORT_SYMBOL_GPL(mt76x02_sw_scan);
+
+void mt76x02_sw_scan_complete(struct ieee80211_hw *hw,
+                             struct ieee80211_vif *vif)
+{
+       struct mt76x02_dev *dev = hw->priv;
+
+       clear_bit(MT76_SCANNING, &dev->mt76.state);
+       if (mt76_is_mmio(dev))
+               tasklet_enable(&dev->pre_tbtt_tasklet);
+}
+EXPORT_SYMBOL_GPL(mt76x02_sw_scan_complete);
+
 const u16 mt76x02_beacon_offsets[16] = {
        /* 1024 byte per beacon */
        0xc000,
index 1b3b9594c2a2e63f5085eb2c34866f1032680f23..36042331e4b21997867e6dbb3ddfe9a8139c62e0 100644 (file)
@@ -175,25 +175,6 @@ mt76x2_sta_ps(struct mt76_dev *mdev, struct ieee80211_sta *sta, bool ps)
        mt76x02_mac_wcid_set_drop(dev, idx, ps);
 }
 
-static void
-mt76x2_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-              const u8 *mac)
-{
-       struct mt76x02_dev *dev = hw->priv;
-
-       tasklet_disable(&dev->pre_tbtt_tasklet);
-       set_bit(MT76_SCANNING, &dev->mt76.state);
-}
-
-static void
-mt76x2_sw_scan_complete(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
-{
-       struct mt76x02_dev *dev = hw->priv;
-
-       clear_bit(MT76_SCANNING, &dev->mt76.state);
-       tasklet_enable(&dev->pre_tbtt_tasklet);
-}
-
 static void
 mt76x2_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
             u32 queues, bool drop)
@@ -292,8 +273,8 @@ const struct ieee80211_ops mt76x2_ops = {
        .sta_remove = mt76x02_sta_remove,
        .set_key = mt76x02_set_key,
        .conf_tx = mt76x02_conf_tx,
-       .sw_scan_start = mt76x2_sw_scan,
-       .sw_scan_complete = mt76x2_sw_scan_complete,
+       .sw_scan_start = mt76x02_sw_scan,
+       .sw_scan_complete = mt76x02_sw_scan_complete,
        .flush = mt76x2_flush,
        .ampdu_action = mt76x02_ampdu_action,
        .get_txpower = mt76x2_get_txpower,
index 25c43175e6e5575955da4aa48dfdf3f4a660959e..5187a5f4832a45836847d2c8698c781b8201bc61 100644 (file)
@@ -143,23 +143,6 @@ mt76x2u_config(struct ieee80211_hw *hw, u32 changed)
        return err;
 }
 
-static void
-mt76x2u_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
-               const u8 *mac)
-{
-       struct mt76x02_dev *dev = hw->priv;
-
-       set_bit(MT76_SCANNING, &dev->mt76.state);
-}
-
-static void
-mt76x2u_sw_scan_complete(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
-{
-       struct mt76x02_dev *dev = hw->priv;
-
-       clear_bit(MT76_SCANNING, &dev->mt76.state);
-}
-
 const struct ieee80211_ops mt76x2u_ops = {
        .tx = mt76x02_tx,
        .start = mt76x2u_start,
@@ -175,7 +158,7 @@ const struct ieee80211_ops mt76x2u_ops = {
        .bss_info_changed = mt76x2u_bss_info_changed,
        .configure_filter = mt76x02_configure_filter,
        .conf_tx = mt76x02_conf_tx,
-       .sw_scan_start = mt76x2u_sw_scan,
-       .sw_scan_complete = mt76x2u_sw_scan_complete,
+       .sw_scan_start = mt76x02_sw_scan,
+       .sw_scan_complete = mt76x02_sw_scan_complete,
        .sta_rate_tbl_update = mt76x02_sta_rate_tbl_update,
 };