mt76: move pre_tbtt_tasklet in mt76_dev

Move pre_tbtt_tasklet tasklet in mt76_dev data structure since
it is used by all drivers

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Lorenzo Bianconi
2019-04-30 15:12:01 +02:00
committed by Felix Fietkau
parent f1103fa6b3
commit dc6057f49a
12 changed files with 20 additions and 22 deletions

View File

@@ -469,6 +469,7 @@ struct mt76_dev {
u8 antenna_mask; u8 antenna_mask;
u16 chainmask; u16 chainmask;
struct tasklet_struct pre_tbtt_tasklet;
int beacon_int; int beacon_int;
u8 beacon_mask; u8 beacon_mask;

View File

@@ -27,7 +27,7 @@ irqreturn_t mt7603_irq_handler(int irq, void *dev_instance)
mt76_wr(dev, MT_HW_INT_STATUS(3), hwintr); mt76_wr(dev, MT_HW_INT_STATUS(3), hwintr);
if (hwintr & MT_HW_INT3_PRE_TBTT0) if (hwintr & MT_HW_INT3_PRE_TBTT0)
tasklet_schedule(&dev->pre_tbtt_tasklet); tasklet_schedule(&dev->mt76.pre_tbtt_tasklet);
if ((hwintr & MT_HW_INT3_TBTT0) && dev->mt76.csa_complete) if ((hwintr & MT_HW_INT3_TBTT0) && dev->mt76.csa_complete)
mt76_csa_finish(&dev->mt76); mt76_csa_finish(&dev->mt76);

View File

@@ -515,7 +515,7 @@ int mt7603_register_device(struct mt7603_dev *dev)
spin_lock_init(&dev->ps_lock); spin_lock_init(&dev->ps_lock);
INIT_DELAYED_WORK(&dev->mt76.mac_work, mt7603_mac_work); INIT_DELAYED_WORK(&dev->mt76.mac_work, mt7603_mac_work);
tasklet_init(&dev->pre_tbtt_tasklet, mt7603_pre_tbtt_tasklet, tasklet_init(&dev->mt76.pre_tbtt_tasklet, mt7603_pre_tbtt_tasklet,
(unsigned long)dev); (unsigned long)dev);
/* Check for 7688, which only has 1SS */ /* Check for 7688, which only has 1SS */
@@ -574,7 +574,7 @@ int mt7603_register_device(struct mt7603_dev *dev)
void mt7603_unregister_device(struct mt7603_dev *dev) void mt7603_unregister_device(struct mt7603_dev *dev)
{ {
tasklet_disable(&dev->pre_tbtt_tasklet); tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
mt76_unregister_device(&dev->mt76); mt76_unregister_device(&dev->mt76);
mt7603_mcu_exit(dev); mt7603_mcu_exit(dev);
mt7603_dma_cleanup(dev); mt7603_dma_cleanup(dev);

View File

@@ -1279,7 +1279,7 @@ static void mt7603_mac_watchdog_reset(struct mt7603_dev *dev)
mt76_txq_schedule_all(&dev->mt76); mt76_txq_schedule_all(&dev->mt76);
tasklet_disable(&dev->mt76.tx_tasklet); tasklet_disable(&dev->mt76.tx_tasklet);
tasklet_disable(&dev->pre_tbtt_tasklet); tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
napi_disable(&dev->mt76.napi[0]); napi_disable(&dev->mt76.napi[0]);
napi_disable(&dev->mt76.napi[1]); napi_disable(&dev->mt76.napi[1]);
@@ -1328,7 +1328,7 @@ skip_dma_reset:
tasklet_enable(&dev->mt76.tx_tasklet); tasklet_enable(&dev->mt76.tx_tasklet);
tasklet_schedule(&dev->mt76.tx_tasklet); tasklet_schedule(&dev->mt76.tx_tasklet);
tasklet_enable(&dev->pre_tbtt_tasklet); tasklet_enable(&dev->mt76.pre_tbtt_tasklet);
mt7603_beacon_set_timer(dev, -1, beacon_int); mt7603_beacon_set_timer(dev, -1, beacon_int);
napi_enable(&dev->mt76.napi[0]); napi_enable(&dev->mt76.napi[0]);

View File

@@ -294,9 +294,9 @@ mt7603_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if (changed & (BSS_CHANGED_BEACON_ENABLED | BSS_CHANGED_BEACON_INT)) { if (changed & (BSS_CHANGED_BEACON_ENABLED | BSS_CHANGED_BEACON_INT)) {
int beacon_int = !!info->enable_beacon * info->beacon_int; int beacon_int = !!info->enable_beacon * info->beacon_int;
tasklet_disable(&dev->pre_tbtt_tasklet); tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
mt7603_beacon_set_timer(dev, mvif->idx, beacon_int); mt7603_beacon_set_timer(dev, mvif->idx, beacon_int);
tasklet_enable(&dev->pre_tbtt_tasklet); tasklet_enable(&dev->mt76.pre_tbtt_tasklet);
} }
mutex_unlock(&dev->mt76.mutex); mutex_unlock(&dev->mt76.mutex);

View File

@@ -140,8 +140,6 @@ struct mt7603_dev {
u32 reset_test; u32 reset_test;
unsigned int reset_cause[__RESET_CAUSE_MAX]; unsigned int reset_cause[__RESET_CAUSE_MAX];
struct tasklet_struct pre_tbtt_tasklet;
}; };
extern const struct mt76_driver_ops mt7603_drv_ops; extern const struct mt76_driver_ops mt7603_drv_ops;

View File

@@ -213,7 +213,7 @@ error:
static void mt76x0e_cleanup(struct mt76x02_dev *dev) static void mt76x0e_cleanup(struct mt76x02_dev *dev)
{ {
clear_bit(MT76_STATE_INITIALIZED, &dev->mt76.state); clear_bit(MT76_STATE_INITIALIZED, &dev->mt76.state);
tasklet_disable(&dev->pre_tbtt_tasklet); tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
mt76x0_chip_onoff(dev, false, false); mt76x0_chip_onoff(dev, false, false);
mt76x0e_stop_hw(dev); mt76x0e_stop_hw(dev);
mt76x02_dma_cleanup(dev); mt76x02_dma_cleanup(dev);

View File

@@ -91,7 +91,6 @@ struct mt76x02_dev {
struct sk_buff *rx_head; struct sk_buff *rx_head;
struct napi_struct tx_napi; struct napi_struct tx_napi;
struct tasklet_struct pre_tbtt_tasklet;
struct delayed_work cal_work; struct delayed_work cal_work;
struct delayed_work wdt_work; struct delayed_work wdt_work;

View File

@@ -68,9 +68,9 @@ static void mt76x02_pre_tbtt_tasklet(unsigned long arg)
static void mt76x02e_pre_tbtt_enable(struct mt76x02_dev *dev, bool en) static void mt76x02e_pre_tbtt_enable(struct mt76x02_dev *dev, bool en)
{ {
if (en) if (en)
tasklet_enable(&dev->pre_tbtt_tasklet); tasklet_enable(&dev->mt76.pre_tbtt_tasklet);
else else
tasklet_disable(&dev->pre_tbtt_tasklet); tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
} }
static void mt76x02e_beacon_enable(struct mt76x02_dev *dev, bool en) static void mt76x02e_beacon_enable(struct mt76x02_dev *dev, bool en)
@@ -198,7 +198,7 @@ int mt76x02_dma_init(struct mt76x02_dev *dev)
tasklet_init(&dev->mt76.tx_tasklet, mt76x02_tx_tasklet, tasklet_init(&dev->mt76.tx_tasklet, mt76x02_tx_tasklet,
(unsigned long) dev); (unsigned long) dev);
tasklet_init(&dev->pre_tbtt_tasklet, mt76x02_pre_tbtt_tasklet, tasklet_init(&dev->mt76.pre_tbtt_tasklet, mt76x02_pre_tbtt_tasklet,
(unsigned long)dev); (unsigned long)dev);
spin_lock_init(&dev->txstatus_fifo_lock); spin_lock_init(&dev->txstatus_fifo_lock);
@@ -285,7 +285,7 @@ irqreturn_t mt76x02_irq_handler(int irq, void *dev_instance)
} }
if (intr & MT_INT_PRE_TBTT) if (intr & MT_INT_PRE_TBTT)
tasklet_schedule(&dev->pre_tbtt_tasklet); tasklet_schedule(&dev->mt76.pre_tbtt_tasklet);
/* send buffered multicast frames now */ /* send buffered multicast frames now */
if (intr & MT_INT_TBTT) { if (intr & MT_INT_TBTT) {
@@ -449,7 +449,7 @@ static void mt76x02_watchdog_reset(struct mt76x02_dev *dev)
ieee80211_stop_queues(dev->mt76.hw); ieee80211_stop_queues(dev->mt76.hw);
set_bit(MT76_RESET, &dev->mt76.state); set_bit(MT76_RESET, &dev->mt76.state);
tasklet_disable(&dev->pre_tbtt_tasklet); tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
tasklet_disable(&dev->mt76.tx_tasklet); tasklet_disable(&dev->mt76.tx_tasklet);
napi_disable(&dev->tx_napi); napi_disable(&dev->tx_napi);
@@ -508,7 +508,7 @@ static void mt76x02_watchdog_reset(struct mt76x02_dev *dev)
napi_enable(&dev->tx_napi); napi_enable(&dev->tx_napi);
napi_schedule(&dev->tx_napi); napi_schedule(&dev->tx_napi);
tasklet_enable(&dev->pre_tbtt_tasklet); tasklet_enable(&dev->mt76.pre_tbtt_tasklet);
for (i = 0; i < ARRAY_SIZE(dev->mt76.napi); i++) { for (i = 0; i < ARRAY_SIZE(dev->mt76.napi); i++) {
napi_enable(&dev->mt76.napi[i]); napi_enable(&dev->mt76.napi[i]);

View File

@@ -594,7 +594,7 @@ void mt76x02_sw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct mt76x02_dev *dev = hw->priv; struct mt76x02_dev *dev = hw->priv;
if (mt76_is_mmio(dev)) if (mt76_is_mmio(dev))
tasklet_disable(&dev->pre_tbtt_tasklet); tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
set_bit(MT76_SCANNING, &dev->mt76.state); set_bit(MT76_SCANNING, &dev->mt76.state);
} }
EXPORT_SYMBOL_GPL(mt76x02_sw_scan); EXPORT_SYMBOL_GPL(mt76x02_sw_scan);
@@ -606,7 +606,7 @@ void mt76x02_sw_scan_complete(struct ieee80211_hw *hw,
clear_bit(MT76_SCANNING, &dev->mt76.state); clear_bit(MT76_SCANNING, &dev->mt76.state);
if (mt76_is_mmio(dev)) if (mt76_is_mmio(dev))
tasklet_enable(&dev->pre_tbtt_tasklet); tasklet_enable(&dev->mt76.pre_tbtt_tasklet);
if (dev->cal.gain_init_done) { if (dev->cal.gain_init_done) {
/* Restore AGC gain and resume calibration after scanning. */ /* Restore AGC gain and resume calibration after scanning. */

View File

@@ -300,7 +300,7 @@ void mt76x2_stop_hardware(struct mt76x02_dev *dev)
void mt76x2_cleanup(struct mt76x02_dev *dev) void mt76x2_cleanup(struct mt76x02_dev *dev)
{ {
tasklet_disable(&dev->dfs_pd.dfs_tasklet); tasklet_disable(&dev->dfs_pd.dfs_tasklet);
tasklet_disable(&dev->pre_tbtt_tasklet); tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
mt76x2_stop_hardware(dev); mt76x2_stop_hardware(dev);
mt76x02_dma_cleanup(dev); mt76x02_dma_cleanup(dev);
mt76x02_mcu_cleanup(dev); mt76x02_mcu_cleanup(dev);

View File

@@ -59,7 +59,7 @@ mt76x2_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
mt76_set_channel(&dev->mt76); mt76_set_channel(&dev->mt76);
tasklet_disable(&dev->pre_tbtt_tasklet); tasklet_disable(&dev->mt76.pre_tbtt_tasklet);
tasklet_disable(&dev->dfs_pd.dfs_tasklet); tasklet_disable(&dev->dfs_pd.dfs_tasklet);
mt76x2_mac_stop(dev, true); mt76x2_mac_stop(dev, true);
@@ -73,7 +73,7 @@ mt76x2_set_channel(struct mt76x02_dev *dev, struct cfg80211_chan_def *chandef)
mt76x2_mac_resume(dev); mt76x2_mac_resume(dev);
tasklet_enable(&dev->dfs_pd.dfs_tasklet); tasklet_enable(&dev->dfs_pd.dfs_tasklet);
tasklet_enable(&dev->pre_tbtt_tasklet); tasklet_enable(&dev->mt76.pre_tbtt_tasklet);
clear_bit(MT76_RESET, &dev->mt76.state); clear_bit(MT76_RESET, &dev->mt76.state);