Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mt76: move mt76_token_init in mt76_alloc_device

In order to remove duplicated code, move mt76_token_init in
mt76_alloc_device routine

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>

authored by

Lorenzo Bianconi and committed by
Felix Fietkau
51252cc5 2bf301bc

+3 -13
+3
drivers/net/wireless/mediatek/mt76/mac80211.c
··· 428 428 mutex_init(&dev->mcu.mutex); 429 429 dev->tx_worker.fn = mt76_tx_worker; 430 430 431 + spin_lock_init(&dev->token_lock); 432 + idr_init(&dev->token); 433 + 431 434 INIT_LIST_HEAD(&dev->txwi_cache); 432 435 433 436 for (i = 0; i < ARRAY_SIZE(dev->q_rx); i++)
-1
drivers/net/wireless/mediatek/mt76/mt76.h
··· 1220 1220 struct mt76_txwi_cache * 1221 1221 mt76_token_release(struct mt76_dev *dev, int token, bool *wake); 1222 1222 int mt76_token_consume(struct mt76_dev *dev, struct mt76_txwi_cache **ptxwi); 1223 - void mt76_token_init(struct mt76_dev *dev); 1224 1223 void __mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked); 1225 1224 1226 1225 static inline void mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked)
-2
drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c
··· 40 40 mt76_wr(dev, MT_INT_SOURCE_CSR, ~0); 41 41 42 42 INIT_WORK(&dev->mcu_work, mt7615_pci_init_work); 43 - mt76_token_init(&dev->mt76); 44 - 45 43 ret = mt7615_eeprom_init(dev, addr); 46 44 if (ret < 0) 47 45 return ret;
-2
drivers/net/wireless/mediatek/mt76/mt7915/init.c
··· 351 351 mt76_wr(dev, MT_INT_SOURCE_CSR, ~0); 352 352 353 353 INIT_WORK(&dev->init_work, mt7915_init_work); 354 - mt76_token_init(&dev->mt76); 355 - 356 354 dev->dbdc_support = !!(mt76_rr(dev, MT_HW_BOUND) & BIT(5)); 357 355 358 356 /* If MCU was already running, it is likely in a bad state */
-1
drivers/net/wireless/mediatek/mt76/mt7921/init.c
··· 170 170 { 171 171 int ret, idx; 172 172 173 - mt76_token_init(&dev->mt76); 174 173 ret = mt7921_dma_init(dev); 175 174 if (ret) 176 175 return ret;
-7
drivers/net/wireless/mediatek/mt76/tx.c
··· 649 649 } 650 650 EXPORT_SYMBOL_GPL(mt76_queue_tx_complete); 651 651 652 - void mt76_token_init(struct mt76_dev *dev) 653 - { 654 - spin_lock_init(&dev->token_lock); 655 - idr_init(&dev->token); 656 - } 657 - EXPORT_SYMBOL_GPL(mt76_token_init); 658 - 659 652 void __mt76_set_tx_blocked(struct mt76_dev *dev, bool blocked) 660 653 { 661 654 struct mt76_phy *phy = &dev->phy, *phy2 = dev->phy2;