summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/mediatek/mt76/mt7615
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2021-04-20 23:05:31 +0200
committerFelix Fietkau <nbd@nbd.name>2021-04-21 20:55:55 +0200
commitb17aff3368916136ba2a87669bb3c319e5c6d0b2 (patch)
tree086b19e007dd3c9d03130997a393e74455213dc6 /drivers/net/wireless/mediatek/mt76/mt7615
parentfe3fccde8870764ba3e60610774bd7bc9f8faeff (diff)
mt76: move token_lock, token and token_count in mt76_dev
Move token_lock, token and token_count data structures in mt76_dev. This is a preliminary patch to move token management in mt76 common module since it is shared by mt7615, mt7915 and mt7921 drivers. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt7615')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7615/mac.c14
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h3
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c4
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7615/pci_mac.c14
4 files changed, 16 insertions, 19 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
index 747bf90f9d8a..e3b727c17129 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
@@ -1466,9 +1466,9 @@ mt7615_mac_tx_free_token(struct mt7615_dev *dev, u16 token)
trace_mac_tx_free(dev, token);
- spin_lock_bh(&dev->token_lock);
- txwi = idr_remove(&dev->token, token);
- spin_unlock_bh(&dev->token_lock);
+ spin_lock_bh(&mdev->token_lock);
+ txwi = idr_remove(&mdev->token, token);
+ spin_unlock_bh(&mdev->token_lock);
if (!txwi)
return;
@@ -1977,8 +1977,8 @@ void mt7615_tx_token_put(struct mt7615_dev *dev)
struct mt76_txwi_cache *txwi;
int id;
- spin_lock_bh(&dev->token_lock);
- idr_for_each_entry(&dev->token, txwi, id) {
+ spin_lock_bh(&dev->mt76.token_lock);
+ idr_for_each_entry(&dev->mt76.token, txwi, id) {
mt7615_txp_skb_unmap(&dev->mt76, txwi);
if (txwi->skb) {
struct ieee80211_hw *hw;
@@ -1988,8 +1988,8 @@ void mt7615_tx_token_put(struct mt7615_dev *dev)
}
mt76_put_txwi(&dev->mt76, txwi);
}
- spin_unlock_bh(&dev->token_lock);
- idr_destroy(&dev->token);
+ spin_unlock_bh(&dev->mt76.token_lock);
+ idr_destroy(&dev->mt76.token);
}
EXPORT_SYMBOL_GPL(mt7615_tx_token_put);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
index 4c533b8ffa47..989f05ed4377 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
@@ -263,9 +263,6 @@ struct mt7615_dev {
bool flash_eeprom;
bool dbdc_support;
- spinlock_t token_lock;
- struct idr token;
-
u8 fw_ver;
struct work_struct rate_work;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c b/drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c
index 736d19699a03..89475d5931a6 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c
@@ -40,8 +40,8 @@ static int mt7615_init_hardware(struct mt7615_dev *dev)
mt76_wr(dev, MT_INT_SOURCE_CSR, ~0);
INIT_WORK(&dev->mcu_work, mt7615_pci_init_work);
- spin_lock_init(&dev->token_lock);
- idr_init(&dev->token);
+ spin_lock_init(&dev->mt76.token_lock);
+ idr_init(&dev->mt76.token);
ret = mt7615_eeprom_init(dev, addr);
if (ret < 0)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/pci_mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/pci_mac.c
index d20962cdecc8..d5aff409132d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/pci_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/pci_mac.c
@@ -37,9 +37,9 @@ void mt7615_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue_entry *e)
token = le16_to_cpu(txp->hw.msdu_id[0]) &
~MT_MSDU_ID_VALID;
- spin_lock_bh(&dev->token_lock);
- t = idr_remove(&dev->token, token);
- spin_unlock_bh(&dev->token_lock);
+ spin_lock_bh(&mdev->token_lock);
+ t = idr_remove(&mdev->token, token);
+ spin_unlock_bh(&mdev->token_lock);
e->skb = t ? t->skb : NULL;
}
@@ -161,9 +161,9 @@ int mt7615_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,
t = (struct mt76_txwi_cache *)(txwi + mdev->drv->txwi_size);
t->skb = tx_info->skb;
- spin_lock_bh(&dev->token_lock);
- id = idr_alloc(&dev->token, t, 0, MT7615_TOKEN_SIZE, GFP_ATOMIC);
- spin_unlock_bh(&dev->token_lock);
+ spin_lock_bh(&mdev->token_lock);
+ id = idr_alloc(&mdev->token, t, 0, MT7615_TOKEN_SIZE, GFP_ATOMIC);
+ spin_unlock_bh(&mdev->token_lock);
if (id < 0)
return id;
@@ -314,7 +314,7 @@ void mt7615_mac_reset_work(struct work_struct *work)
mt7615_dma_reset(dev);
mt7615_tx_token_put(dev);
- idr_init(&dev->token);
+ idr_init(&dev->mt76.token);
mt76_wr(dev, MT_WPDMA_MEM_RNG_ERR, 0);