summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c89
1 files changed, 16 insertions, 73 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c b/drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c
index 3b29a6d3dc64..203256862dfd 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/usb_sdio.c
@@ -61,12 +61,11 @@ mt7663_usb_sdio_write_txwi(struct mt7615_dev *dev, struct mt76_wcid *wcid,
skb_push(skb, MT_USB_TXD_SIZE);
}
-static int
-mt7663_usb_sdio_set_rates(struct mt7615_dev *dev,
- struct mt7615_wtbl_desc *wd)
+static int mt7663_usb_sdio_set_rates(struct mt7615_dev *dev,
+ struct mt7615_wtbl_rate_desc *wrd)
{
- struct mt7615_rate_desc *rate = &wd->rate;
- struct mt7615_sta *sta = wd->sta;
+ struct mt7615_rate_desc *rate = &wrd->rate;
+ struct mt7615_sta *sta = wrd->sta;
u32 w5, w27, addr, val;
lockdep_assert_held(&dev->mt76.mutex);
@@ -132,86 +131,30 @@ mt7663_usb_sdio_set_rates(struct mt7615_dev *dev,
return 0;
}
-static int
-mt7663_usb_sdio_set_key(struct mt7615_dev *dev,
- struct mt7615_wtbl_desc *wd)
+static void mt7663_usb_sdio_rate_work(struct work_struct *work)
{
- struct mt7615_key_desc *key = &wd->key;
- struct mt7615_sta *sta = wd->sta;
- enum mt7615_cipher_type cipher;
- struct mt76_wcid *wcid;
- int err;
-
- lockdep_assert_held(&dev->mt76.mutex);
-
- if (!sta) {
- err = -EINVAL;
- goto out;
- }
-
- cipher = mt7615_mac_get_cipher(key->cipher);
- if (cipher == MT_CIPHER_NONE) {
- err = -EOPNOTSUPP;
- goto out;
- }
-
- wcid = &wd->sta->wcid;
-
- mt7615_mac_wtbl_update_cipher(dev, wcid, cipher, key->cmd);
- err = mt7615_mac_wtbl_update_key(dev, wcid, key->key, key->keylen,
- cipher, key->cmd);
- if (err < 0)
- goto out;
-
- err = mt7615_mac_wtbl_update_pk(dev, wcid, cipher, key->keyidx,
- key->cmd);
- if (err < 0)
- goto out;
-
- if (key->cmd == SET_KEY)
- wcid->cipher |= BIT(cipher);
- else
- wcid->cipher &= ~BIT(cipher);
-out:
- kfree(key->key);
-
- return err;
-}
-
-void mt7663_usb_sdio_wtbl_work(struct work_struct *work)
-{
- struct mt7615_wtbl_desc *wd, *wd_next;
- struct list_head wd_list;
+ struct mt7615_wtbl_rate_desc *wrd, *wrd_next;
+ struct list_head wrd_list;
struct mt7615_dev *dev;
dev = (struct mt7615_dev *)container_of(work, struct mt7615_dev,
- wtbl_work);
+ rate_work);
- INIT_LIST_HEAD(&wd_list);
+ INIT_LIST_HEAD(&wrd_list);
spin_lock_bh(&dev->mt76.lock);
- list_splice_init(&dev->wd_head, &wd_list);
+ list_splice_init(&dev->wrd_head, &wrd_list);
spin_unlock_bh(&dev->mt76.lock);
- list_for_each_entry_safe(wd, wd_next, &wd_list, node) {
- list_del(&wd->node);
+ list_for_each_entry_safe(wrd, wrd_next, &wrd_list, node) {
+ list_del(&wrd->node);
mt7615_mutex_acquire(dev);
-
- switch (wd->type) {
- case MT7615_WTBL_RATE_DESC:
- mt7663_usb_sdio_set_rates(dev, wd);
- break;
- case MT7615_WTBL_KEY_DESC:
- mt7663_usb_sdio_set_key(dev, wd);
- break;
- }
-
+ mt7663_usb_sdio_set_rates(dev, wrd);
mt7615_mutex_release(dev);
- kfree(wd);
+ kfree(wrd);
}
}
-EXPORT_SYMBOL_GPL(mt7663_usb_sdio_wtbl_work);
bool mt7663_usb_sdio_tx_status_data(struct mt76_dev *mdev, u8 *update)
{
@@ -357,8 +300,8 @@ int mt7663_usb_sdio_register_device(struct mt7615_dev *dev)
struct ieee80211_hw *hw = mt76_hw(dev);
int err;
- INIT_WORK(&dev->wtbl_work, mt7663_usb_sdio_wtbl_work);
- INIT_LIST_HEAD(&dev->wd_head);
+ INIT_WORK(&dev->rate_work, mt7663_usb_sdio_rate_work);
+ INIT_LIST_HEAD(&dev->wrd_head);
mt7615_init_device(dev);
err = mt7663_usb_sdio_init_hardware(dev);