Commit ec193b41 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

wifi: mt76: move irq_tasklet in mt76_dev struct

irq_tasklet struct is used by most of the drivers (e.g. mt7915, mt7921,
mt7615, mt7663 and mt7996) so move it in common code.
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 09d4d6da
...@@ -788,6 +788,7 @@ struct mt76_dev { ...@@ -788,6 +788,7 @@ struct mt76_dev {
spinlock_t rx_lock; spinlock_t rx_lock;
struct napi_struct napi[__MT_RXQ_MAX]; struct napi_struct napi[__MT_RXQ_MAX];
struct sk_buff_head rx_skb[__MT_RXQ_MAX]; struct sk_buff_head rx_skb[__MT_RXQ_MAX];
struct tasklet_struct irq_tasklet;
struct list_head txwi_cache; struct list_head txwi_cache;
struct list_head rxwi_cache; struct list_head rxwi_cache;
......
...@@ -80,14 +80,14 @@ static irqreturn_t mt7615_irq_handler(int irq, void *dev_instance) ...@@ -80,14 +80,14 @@ static irqreturn_t mt7615_irq_handler(int irq, void *dev_instance)
if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state)) if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state))
return IRQ_NONE; return IRQ_NONE;
tasklet_schedule(&dev->irq_tasklet); tasklet_schedule(&dev->mt76.irq_tasklet);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static void mt7615_irq_tasklet(struct tasklet_struct *t) static void mt7615_irq_tasklet(struct tasklet_struct *t)
{ {
struct mt7615_dev *dev = from_tasklet(dev, t, irq_tasklet); struct mt7615_dev *dev = from_tasklet(dev, t, mt76.irq_tasklet);
u32 intr, mask = 0, tx_mcu_mask = mt7615_tx_mcu_int_mask(dev); u32 intr, mask = 0, tx_mcu_mask = mt7615_tx_mcu_int_mask(dev);
u32 mcu_int; u32 mcu_int;
...@@ -202,7 +202,7 @@ int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base, ...@@ -202,7 +202,7 @@ int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base,
dev = container_of(mdev, struct mt7615_dev, mt76); dev = container_of(mdev, struct mt7615_dev, mt76);
mt76_mmio_init(&dev->mt76, mem_base); mt76_mmio_init(&dev->mt76, mem_base);
tasklet_setup(&dev->irq_tasklet, mt7615_irq_tasklet); tasklet_setup(&mdev->irq_tasklet, mt7615_irq_tasklet);
dev->reg_map = map; dev->reg_map = map;
dev->ops = ops; dev->ops = ops;
......
...@@ -245,8 +245,6 @@ struct mt7615_dev { ...@@ -245,8 +245,6 @@ struct mt7615_dev {
}; };
const struct mt76_bus_ops *bus_ops; const struct mt76_bus_ops *bus_ops;
struct tasklet_struct irq_tasklet;
struct mt7615_phy phy; struct mt7615_phy phy;
u64 omac_mask; u64 omac_mask;
...@@ -416,7 +414,7 @@ static inline void mt7615_irq_enable(struct mt7615_dev *dev, u32 mask) ...@@ -416,7 +414,7 @@ static inline void mt7615_irq_enable(struct mt7615_dev *dev, u32 mask)
{ {
mt76_set_irq_mask(&dev->mt76, 0, 0, mask); mt76_set_irq_mask(&dev->mt76, 0, 0, mask);
tasklet_schedule(&dev->irq_tasklet); tasklet_schedule(&dev->mt76.irq_tasklet);
} }
static inline bool mt7615_firmware_offload(struct mt7615_dev *dev) static inline bool mt7615_firmware_offload(struct mt7615_dev *dev)
......
...@@ -94,7 +94,7 @@ static int mt7615_pci_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -94,7 +94,7 @@ static int mt7615_pci_suspend(struct pci_dev *pdev, pm_message_t state)
mt76_for_each_q_rx(mdev, i) { mt76_for_each_q_rx(mdev, i) {
napi_disable(&mdev->napi[i]); napi_disable(&mdev->napi[i]);
} }
tasklet_kill(&dev->irq_tasklet); tasklet_kill(&mdev->irq_tasklet);
mt7615_dma_reset(dev); mt7615_dma_reset(dev);
......
...@@ -122,7 +122,7 @@ void mt7615_unregister_device(struct mt7615_dev *dev) ...@@ -122,7 +122,7 @@ void mt7615_unregister_device(struct mt7615_dev *dev)
mt7615_tx_token_put(dev); mt7615_tx_token_put(dev);
mt7615_dma_cleanup(dev); mt7615_dma_cleanup(dev);
tasklet_disable(&dev->irq_tasklet); tasklet_disable(&dev->mt76.irq_tasklet);
mt76_free_device(&dev->mt76); mt76_free_device(&dev->mt76);
} }
...@@ -1180,7 +1180,7 @@ static void mt7915_stop_hardware(struct mt7915_dev *dev) ...@@ -1180,7 +1180,7 @@ static void mt7915_stop_hardware(struct mt7915_dev *dev)
mt7915_mcu_exit(dev); mt7915_mcu_exit(dev);
mt7915_tx_token_put(dev); mt7915_tx_token_put(dev);
mt7915_dma_cleanup(dev); mt7915_dma_cleanup(dev);
tasklet_disable(&dev->irq_tasklet); tasklet_disable(&dev->mt76.irq_tasklet);
if (is_mt7986(&dev->mt76)) if (is_mt7986(&dev->mt76))
mt7986_wmac_disable(dev); mt7986_wmac_disable(dev);
......
...@@ -1627,7 +1627,7 @@ void mt7915_mac_reset_work(struct work_struct *work) ...@@ -1627,7 +1627,7 @@ void mt7915_mac_reset_work(struct work_struct *work)
} }
local_bh_enable(); local_bh_enable();
tasklet_schedule(&dev->irq_tasklet); tasklet_schedule(&dev->mt76.irq_tasklet);
mt76_wr(dev, MT_MCU_INT_EVENT, MT_MCU_INT_EVENT_RESET_DONE); mt76_wr(dev, MT_MCU_INT_EVENT, MT_MCU_INT_EVENT_RESET_DONE);
mt7915_wait_reset_state(dev, MT_MCU_CMD_NORMAL_STATE); mt7915_wait_reset_state(dev, MT_MCU_CMD_NORMAL_STATE);
......
...@@ -916,7 +916,7 @@ static void mt7915_rx_poll_complete(struct mt76_dev *mdev, ...@@ -916,7 +916,7 @@ static void mt7915_rx_poll_complete(struct mt76_dev *mdev,
/* TODO: support 2/4/6/8 MSI-X vectors */ /* TODO: support 2/4/6/8 MSI-X vectors */
static void mt7915_irq_tasklet(struct tasklet_struct *t) static void mt7915_irq_tasklet(struct tasklet_struct *t)
{ {
struct mt7915_dev *dev = from_tasklet(dev, t, irq_tasklet); struct mt7915_dev *dev = from_tasklet(dev, t, mt76.irq_tasklet);
struct mtk_wed_device *wed = &dev->mt76.mmio.wed; struct mtk_wed_device *wed = &dev->mt76.mmio.wed;
u32 intr, intr1, mask; u32 intr, intr1, mask;
...@@ -1000,7 +1000,7 @@ irqreturn_t mt7915_irq_handler(int irq, void *dev_instance) ...@@ -1000,7 +1000,7 @@ irqreturn_t mt7915_irq_handler(int irq, void *dev_instance)
if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state)) if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state))
return IRQ_NONE; return IRQ_NONE;
tasklet_schedule(&dev->irq_tasklet); tasklet_schedule(&dev->mt76.irq_tasklet);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -1041,7 +1041,7 @@ struct mt7915_dev *mt7915_mmio_probe(struct device *pdev, ...@@ -1041,7 +1041,7 @@ struct mt7915_dev *mt7915_mmio_probe(struct device *pdev,
if (ret) if (ret)
goto error; goto error;
tasklet_setup(&dev->irq_tasklet, mt7915_irq_tasklet); tasklet_setup(&mdev->irq_tasklet, mt7915_irq_tasklet);
return dev; return dev;
......
...@@ -294,7 +294,6 @@ struct mt7915_dev { ...@@ -294,7 +294,6 @@ struct mt7915_dev {
u32 wfdma_mask; u32 wfdma_mask;
const struct mt76_bus_ops *bus_ops; const struct mt76_bus_ops *bus_ops;
struct tasklet_struct irq_tasklet;
struct mt7915_phy phy; struct mt7915_phy phy;
/* monitor rx chain configured channel */ /* monitor rx chain configured channel */
...@@ -567,7 +566,7 @@ static inline void mt7915_irq_enable(struct mt7915_dev *dev, u32 mask) ...@@ -567,7 +566,7 @@ static inline void mt7915_irq_enable(struct mt7915_dev *dev, u32 mask)
else else
mt76_set_irq_mask(&dev->mt76, 0, 0, mask); mt76_set_irq_mask(&dev->mt76, 0, 0, mask);
tasklet_schedule(&dev->irq_tasklet); tasklet_schedule(&dev->mt76.irq_tasklet);
} }
static inline void mt7915_irq_disable(struct mt7915_dev *dev, u32 mask) static inline void mt7915_irq_disable(struct mt7915_dev *dev, u32 mask)
......
...@@ -287,7 +287,6 @@ struct mt7921_dev { ...@@ -287,7 +287,6 @@ struct mt7921_dev {
const struct mt76_bus_ops *bus_ops; const struct mt76_bus_ops *bus_ops;
struct mt7921_phy phy; struct mt7921_phy phy;
struct tasklet_struct irq_tasklet;
struct work_struct reset_work; struct work_struct reset_work;
bool hw_full_reset:1; bool hw_full_reset:1;
...@@ -395,7 +394,7 @@ static inline void mt7921_irq_enable(struct mt7921_dev *dev, u32 mask) ...@@ -395,7 +394,7 @@ static inline void mt7921_irq_enable(struct mt7921_dev *dev, u32 mask)
{ {
mt76_set_irq_mask(&dev->mt76, 0, 0, mask); mt76_set_irq_mask(&dev->mt76, 0, 0, mask);
tasklet_schedule(&dev->irq_tasklet); tasklet_schedule(&dev->mt76.irq_tasklet);
} }
static inline u32 static inline u32
......
...@@ -50,7 +50,7 @@ static irqreturn_t mt7921_irq_handler(int irq, void *dev_instance) ...@@ -50,7 +50,7 @@ static irqreturn_t mt7921_irq_handler(int irq, void *dev_instance)
if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state)) if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state))
return IRQ_NONE; return IRQ_NONE;
tasklet_schedule(&dev->irq_tasklet); tasklet_schedule(&dev->mt76.irq_tasklet);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -122,7 +122,7 @@ static void mt7921e_unregister_device(struct mt7921_dev *dev) ...@@ -122,7 +122,7 @@ static void mt7921e_unregister_device(struct mt7921_dev *dev)
mt7921_wfsys_reset(dev); mt7921_wfsys_reset(dev);
skb_queue_purge(&dev->mt76.mcu.res_q); skb_queue_purge(&dev->mt76.mcu.res_q);
tasklet_disable(&dev->irq_tasklet); tasklet_disable(&dev->mt76.irq_tasklet);
} }
static u32 __mt7921_reg_addr(struct mt7921_dev *dev, u32 addr) static u32 __mt7921_reg_addr(struct mt7921_dev *dev, u32 addr)
...@@ -309,7 +309,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev, ...@@ -309,7 +309,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
dev->fw_features = features; dev->fw_features = features;
dev->hif_ops = &mt7921_pcie_ops; dev->hif_ops = &mt7921_pcie_ops;
mt76_mmio_init(&dev->mt76, pcim_iomap_table(pdev)[0]); mt76_mmio_init(&dev->mt76, pcim_iomap_table(pdev)[0]);
tasklet_init(&dev->irq_tasklet, mt7921_irq_tasklet, (unsigned long)dev); tasklet_init(&mdev->irq_tasklet, mt7921_irq_tasklet, (unsigned long)dev);
dev->phy.dev = dev; dev->phy.dev = dev;
dev->phy.mt76 = &dev->mt76.phy; dev->phy.mt76 = &dev->mt76.phy;
...@@ -421,7 +421,7 @@ static int mt7921_pci_suspend(struct device *device) ...@@ -421,7 +421,7 @@ static int mt7921_pci_suspend(struct device *device)
mt76_wr(dev, MT_WFDMA0_HOST_INT_ENA, 0); mt76_wr(dev, MT_WFDMA0_HOST_INT_ENA, 0);
mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0x0); mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0x0);
synchronize_irq(pdev->irq); synchronize_irq(pdev->irq);
tasklet_kill(&dev->irq_tasklet); tasklet_kill(&mdev->irq_tasklet);
err = mt7921_mcu_fw_pmctrl(dev); err = mt7921_mcu_fw_pmctrl(dev);
if (err) if (err)
......
...@@ -902,7 +902,7 @@ void mt7996_unregister_device(struct mt7996_dev *dev) ...@@ -902,7 +902,7 @@ void mt7996_unregister_device(struct mt7996_dev *dev)
mt7996_mcu_exit(dev); mt7996_mcu_exit(dev);
mt7996_tx_token_put(dev); mt7996_tx_token_put(dev);
mt7996_dma_cleanup(dev); mt7996_dma_cleanup(dev);
tasklet_disable(&dev->irq_tasklet); tasklet_disable(&dev->mt76.irq_tasklet);
mt76_free_device(&dev->mt76); mt76_free_device(&dev->mt76);
} }
...@@ -1883,7 +1883,7 @@ void mt7996_mac_reset_work(struct work_struct *work) ...@@ -1883,7 +1883,7 @@ void mt7996_mac_reset_work(struct work_struct *work)
} }
local_bh_enable(); local_bh_enable();
tasklet_schedule(&dev->irq_tasklet); tasklet_schedule(&dev->mt76.irq_tasklet);
mt76_wr(dev, MT_MCU_INT_EVENT, MT_MCU_INT_EVENT_RESET_DONE); mt76_wr(dev, MT_MCU_INT_EVENT, MT_MCU_INT_EVENT_RESET_DONE);
mt7996_wait_reset_state(dev, MT_MCU_CMD_NORMAL_STATE); mt7996_wait_reset_state(dev, MT_MCU_CMD_NORMAL_STATE);
......
...@@ -251,7 +251,7 @@ static void mt7996_rx_poll_complete(struct mt76_dev *mdev, ...@@ -251,7 +251,7 @@ static void mt7996_rx_poll_complete(struct mt76_dev *mdev,
/* TODO: support 2/4/6/8 MSI-X vectors */ /* TODO: support 2/4/6/8 MSI-X vectors */
static void mt7996_irq_tasklet(struct tasklet_struct *t) static void mt7996_irq_tasklet(struct tasklet_struct *t)
{ {
struct mt7996_dev *dev = from_tasklet(dev, t, irq_tasklet); struct mt7996_dev *dev = from_tasklet(dev, t, mt76.irq_tasklet);
u32 i, intr, mask, intr1; u32 i, intr, mask, intr1;
mt76_wr(dev, MT_INT_MASK_CSR, 0); mt76_wr(dev, MT_INT_MASK_CSR, 0);
...@@ -308,7 +308,7 @@ irqreturn_t mt7996_irq_handler(int irq, void *dev_instance) ...@@ -308,7 +308,7 @@ irqreturn_t mt7996_irq_handler(int irq, void *dev_instance)
if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state)) if (!test_bit(MT76_STATE_INITIALIZED, &dev->mphy.state))
return IRQ_NONE; return IRQ_NONE;
tasklet_schedule(&dev->irq_tasklet); tasklet_schedule(&dev->mt76.irq_tasklet);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -349,7 +349,7 @@ struct mt7996_dev *mt7996_mmio_probe(struct device *pdev, ...@@ -349,7 +349,7 @@ struct mt7996_dev *mt7996_mmio_probe(struct device *pdev,
if (ret) if (ret)
goto error; goto error;
tasklet_setup(&dev->irq_tasklet, mt7996_irq_tasklet); tasklet_setup(&mdev->irq_tasklet, mt7996_irq_tasklet);
mt76_wr(dev, MT_INT_MASK_CSR, 0); mt76_wr(dev, MT_INT_MASK_CSR, 0);
......
...@@ -222,7 +222,6 @@ struct mt7996_dev { ...@@ -222,7 +222,6 @@ struct mt7996_dev {
u32 q_wfdma_mask; u32 q_wfdma_mask;
const struct mt76_bus_ops *bus_ops; const struct mt76_bus_ops *bus_ops;
struct tasklet_struct irq_tasklet;
struct mt7996_phy phy; struct mt7996_phy phy;
/* monitor rx chain configured channel */ /* monitor rx chain configured channel */
...@@ -451,7 +450,7 @@ static inline void mt7996_irq_enable(struct mt7996_dev *dev, u32 mask) ...@@ -451,7 +450,7 @@ static inline void mt7996_irq_enable(struct mt7996_dev *dev, u32 mask)
else else
mt76_set_irq_mask(&dev->mt76, 0, 0, mask); mt76_set_irq_mask(&dev->mt76, 0, 0, mask);
tasklet_schedule(&dev->irq_tasklet); tasklet_schedule(&dev->mt76.irq_tasklet);
} }
static inline void mt7996_irq_disable(struct mt7996_dev *dev, u32 mask) static inline void mt7996_irq_disable(struct mt7996_dev *dev, u32 mask)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment