]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: macb: Convert tasklet API to new bottom half workqueue mechanism
authorAllen Pais <allen.lkml@gmail.com>
Tue, 30 Jul 2024 18:33:52 +0000 (11:33 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 1 Aug 2024 01:59:46 +0000 (18:59 -0700)
Migrate tasklet APIs to the new bottom half workqueue mechanism. It
replaces all occurrences of tasklet usage with the appropriate workqueue
APIs throughout the macb driver. This transition ensures compatibility
with the latest design and enhances performance.

Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Link: https://patch.msgid.link/20240730183403.4176544-5-allen.lkml@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/cadence/macb.h
drivers/net/ethernet/cadence/macb_main.c

index ea71612f6b36fb1969075c5e3a06515e1354a450..5740c98d8c9f03605533b9204ad8b72328974a58 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/net_tstamp.h>
 #include <linux/interrupt.h>
 #include <linux/phy/phy.h>
+#include <linux/workqueue.h>
 
 #if defined(CONFIG_ARCH_DMA_ADDR_T_64BIT) || defined(CONFIG_MACB_USE_HWSTAMP)
 #define MACB_EXT_DESC
@@ -1330,7 +1331,7 @@ struct macb {
        spinlock_t rx_fs_lock;
        unsigned int max_tuples;
 
-       struct tasklet_struct   hresp_err_tasklet;
+       struct work_struct      hresp_err_bh_work;
 
        int     rx_bd_rd_prefetch;
        int     tx_bd_rd_prefetch;
index 11665be3a22c7a352578d608ee093a3f2aea7b95..95e8742dce1dadfb87d59d3b939bc070dc6d9a0f 100644 (file)
@@ -1792,9 +1792,9 @@ static int macb_tx_poll(struct napi_struct *napi, int budget)
        return work_done;
 }
 
-static void macb_hresp_error_task(struct tasklet_struct *t)
+static void macb_hresp_error_task(struct work_struct *work)
 {
-       struct macb *bp = from_tasklet(bp, t, hresp_err_tasklet);
+       struct macb *bp = from_work(bp, work, hresp_err_bh_work);
        struct net_device *dev = bp->dev;
        struct macb_queue *queue;
        unsigned int q;
@@ -1994,7 +1994,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
                }
 
                if (status & MACB_BIT(HRESP)) {
-                       tasklet_schedule(&bp->hresp_err_tasklet);
+                       queue_work(system_bh_wq, &bp->hresp_err_bh_work);
                        netdev_err(dev, "DMA bus error: HRESP not OK\n");
 
                        if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
@@ -5172,7 +5172,7 @@ static int macb_probe(struct platform_device *pdev)
                goto err_out_unregister_mdio;
        }
 
-       tasklet_setup(&bp->hresp_err_tasklet, macb_hresp_error_task);
+       INIT_WORK(&bp->hresp_err_bh_work, macb_hresp_error_task);
 
        netdev_info(dev, "Cadence %s rev 0x%08x at 0x%08lx irq %d (%pM)\n",
                    macb_is_gem(bp) ? "GEM" : "MACB", macb_readl(bp, MID),
@@ -5216,7 +5216,7 @@ static void macb_remove(struct platform_device *pdev)
                mdiobus_free(bp->mii_bus);
 
                unregister_netdev(dev);
-               tasklet_kill(&bp->hresp_err_tasklet);
+               cancel_work_sync(&bp->hresp_err_bh_work);
                pm_runtime_disable(&pdev->dev);
                pm_runtime_dont_use_autosuspend(&pdev->dev);
                if (!pm_runtime_suspended(&pdev->dev)) {