[net-next v3 15/15] net: mtk-wed: Convert tasklet API to new bottom half workqueue mechanism
Allen Pais
allen.lkml at gmail.com
Tue Jul 30 11:34:03 PDT 2024
Migrate tasklet APIs to the new bottom half workqueue mechanism. It
replaces all occurrences of tasklet usage with the appropriate workqueue
APIs throughout the mtk-wed driver. This transition ensures compatibility
with the latest design and enhances performance.
Signed-off-by: Allen Pais <allen.lkml at gmail.com>
---
drivers/net/ethernet/mediatek/mtk_wed_wo.c | 12 ++++++------
drivers/net/ethernet/mediatek/mtk_wed_wo.h | 3 ++-
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/mtk_wed_wo.c b/drivers/net/ethernet/mediatek/mtk_wed_wo.c
index 7063c78bd35f..acca9ec67fcf 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_wo.c
+++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.c
@@ -71,7 +71,7 @@ static void
mtk_wed_wo_irq_enable(struct mtk_wed_wo *wo, u32 mask)
{
mtk_wed_wo_set_isr_mask(wo, 0, mask, false);
- tasklet_schedule(&wo->mmio.irq_tasklet);
+ queue_work(system_bh_wq, &wo->mmio.irq_bh_work);
}
static void
@@ -227,14 +227,14 @@ mtk_wed_wo_irq_handler(int irq, void *data)
struct mtk_wed_wo *wo = data;
mtk_wed_wo_set_isr(wo, 0);
- tasklet_schedule(&wo->mmio.irq_tasklet);
+ queue_work(system_bh_wq, &wo->mmio.irq_bh_work);
return IRQ_HANDLED;
}
-static void mtk_wed_wo_irq_tasklet(struct tasklet_struct *t)
+static void mtk_wed_wo_irq_bh_work(struct work_struct *work)
{
- struct mtk_wed_wo *wo = from_tasklet(wo, t, mmio.irq_tasklet);
+ struct mtk_wed_wo *wo = from_work(wo, work, mmio.irq_bh_work);
u32 intr, mask;
/* disable interrupts */
@@ -395,7 +395,7 @@ mtk_wed_wo_hardware_init(struct mtk_wed_wo *wo)
wo->mmio.irq = irq_of_parse_and_map(np, 0);
wo->mmio.irq_mask = MTK_WED_WO_ALL_INT_MASK;
spin_lock_init(&wo->mmio.lock);
- tasklet_setup(&wo->mmio.irq_tasklet, mtk_wed_wo_irq_tasklet);
+ INIT_WORK(&wo->mmio.irq_bh_work, mtk_wed_wo_irq_bh_work);
ret = devm_request_irq(wo->hw->dev, wo->mmio.irq,
mtk_wed_wo_irq_handler, IRQF_TRIGGER_HIGH,
@@ -449,7 +449,7 @@ mtk_wed_wo_hw_deinit(struct mtk_wed_wo *wo)
/* disable interrupts */
mtk_wed_wo_set_isr(wo, 0);
- tasklet_disable(&wo->mmio.irq_tasklet);
+ disable_work_sync(&wo->mmio.irq_bh_work);
disable_irq(wo->mmio.irq);
devm_free_irq(wo->hw->dev, wo->mmio.irq, wo);
diff --git a/drivers/net/ethernet/mediatek/mtk_wed_wo.h b/drivers/net/ethernet/mediatek/mtk_wed_wo.h
index 87a67fa3868d..50d619fa213a 100644
--- a/drivers/net/ethernet/mediatek/mtk_wed_wo.h
+++ b/drivers/net/ethernet/mediatek/mtk_wed_wo.h
@@ -6,6 +6,7 @@
#include <linux/skbuff.h>
#include <linux/netdevice.h>
+#include <linux/workqueue.h>
struct mtk_wed_hw;
@@ -247,7 +248,7 @@ struct mtk_wed_wo {
struct regmap *regs;
spinlock_t lock;
- struct tasklet_struct irq_tasklet;
+ struct work_struct irq_bh_work;
int irq;
u32 irq_mask;
} mmio;
--
2.34.1
More information about the Linux-mediatek
mailing list