diff options
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt7915')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt7915/init.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 42 | ||||
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h | 4 |
3 files changed, 23 insertions, 27 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c index 2d6b38d39356..b97834fae0ba 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c @@ -351,8 +351,8 @@ static int mt7915_init_hardware(struct mt7915_dev *dev) mt76_wr(dev, MT_INT_SOURCE_CSR, ~0); INIT_WORK(&dev->init_work, mt7915_init_work); - spin_lock_init(&dev->token_lock); - idr_init(&dev->token); + spin_lock_init(&dev->mt76.token_lock); + idr_init(&dev->mt76.token); dev->dbdc_support = !!(mt76_rr(dev, MT_HW_BOUND) & BIT(5)); diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c index 6a4b57509751..a2d60be00f9f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c @@ -1046,14 +1046,14 @@ int mt7915_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, MT7915_TOKEN_SIZE, GFP_ATOMIC); + spin_lock_bh(&mdev->token_lock); + id = idr_alloc(&mdev->token, t, 0, MT7915_TOKEN_SIZE, GFP_ATOMIC); if (id >= 0) - dev->token_count++; + mdev->token_count++; - if (dev->token_count >= MT7915_TOKEN_SIZE - MT7915_TOKEN_FREE_THR) + if (mdev->token_count >= MT7915_TOKEN_SIZE - MT7915_TOKEN_FREE_THR) mt7915_set_tx_blocked(dev, true); - spin_unlock_bh(&dev->token_lock); + spin_unlock_bh(&mdev->token_lock); if (id < 0) return id; @@ -1218,14 +1218,14 @@ void mt7915_mac_tx_free(struct mt7915_dev *dev, struct sk_buff *skb) msdu = FIELD_GET(MT_TX_FREE_MSDU_ID, info); stat = FIELD_GET(MT_TX_FREE_STATUS, info); - spin_lock_bh(&dev->token_lock); - txwi = idr_remove(&dev->token, msdu); + spin_lock_bh(&mdev->token_lock); + txwi = idr_remove(&mdev->token, msdu); if (txwi) - dev->token_count--; - if (dev->token_count < MT7915_TOKEN_SIZE - MT7915_TOKEN_FREE_THR && + mdev->token_count--; + if (mdev->token_count < MT7915_TOKEN_SIZE - MT7915_TOKEN_FREE_THR && dev->mphy.q_tx[0]->blocked) wake = true; - spin_unlock_bh(&dev->token_lock); + spin_unlock_bh(&mdev->token_lock); if (!txwi) continue; @@ -1257,9 +1257,9 @@ void mt7915_mac_tx_free(struct mt7915_dev *dev, struct sk_buff *skb) mt7915_mac_sta_poll(dev); if (wake) { - spin_lock_bh(&dev->token_lock); + spin_lock_bh(&mdev->token_lock); mt7915_set_tx_blocked(dev, false); - spin_unlock_bh(&dev->token_lock); + spin_unlock_bh(&mdev->token_lock); } mt76_worker_schedule(&dev->mt76.tx_worker); @@ -1290,9 +1290,9 @@ void mt7915_tx_complete_skb(struct mt76_dev *mdev, struct mt76_queue_entry *e) txp = mt7915_txwi_to_txp(mdev, e->txwi); - spin_lock_bh(&dev->token_lock); - t = idr_remove(&dev->token, le16_to_cpu(txp->token)); - spin_unlock_bh(&dev->token_lock); + spin_lock_bh(&mdev->token_lock); + t = idr_remove(&mdev->token, le16_to_cpu(txp->token)); + spin_unlock_bh(&mdev->token_lock); e->skb = t ? t->skb : NULL; } @@ -1588,8 +1588,8 @@ void mt7915_tx_token_put(struct mt7915_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) { mt7915_txp_skb_unmap(&dev->mt76, txwi); if (txwi->skb) { struct ieee80211_hw *hw; @@ -1598,10 +1598,10 @@ void mt7915_tx_token_put(struct mt7915_dev *dev) ieee80211_free_txskb(hw, txwi->skb); } mt76_put_txwi(&dev->mt76, txwi); - dev->token_count--; + dev->mt76.token_count--; } - spin_unlock_bh(&dev->token_lock); - idr_destroy(&dev->token); + spin_unlock_bh(&dev->mt76.token_lock); + idr_destroy(&dev->mt76.token); } /* system error recovery */ @@ -1649,7 +1649,7 @@ void mt7915_mac_reset_work(struct work_struct *work) mt7915_dma_reset(dev); mt7915_tx_token_put(dev); - idr_init(&dev->token); + idr_init(&dev->mt76.token); mt76_wr(dev, MT_MCU_INT_EVENT, MT_MCU_INT_EVENT_DMA_INIT); mt7915_wait_reset_state(dev, MT_MCU_CMD_RECOVERY_DONE); diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h index 80eb35231a1a..582c2bfdf070 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h @@ -187,10 +187,6 @@ struct mt7915_dev { u32 hw_pattern; - spinlock_t token_lock; - int token_count; - struct idr token; - bool dbdc_support; bool flash_mode; bool fw_debug; |