net: thunderx: Wait for delayed work to finish before destroying it
authorThanneeru Srinivasulu <tsrinivasulu@caviumnetworks.com>
Wed, 2 Dec 2015 10:06:14 +0000 (15:36 +0530)
committerDavid S. Miller <davem@davemloft.net>
Wed, 2 Dec 2015 20:58:50 +0000 (15:58 -0500)
While VNIC or BGX driver teardown, wait for already scheduled delayed work to
finish before destroying it.

Signed-off-by: Thanneeru Srinivasulu <tsrinivasulu@caviumnetworks.com>
Signed-off-by: Sunil Goutham <sgoutham@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/thunder/nic_main.c
drivers/net/ethernet/cavium/thunder/thunder_bgx.c

index c561fdcb79a730aeeb890c5a985b05cb873faa45..cfc24a1daff10d4dbd1bf412804a7e92a8085bc0 100644 (file)
@@ -1074,8 +1074,7 @@ static void nic_remove(struct pci_dev *pdev)
 
        if (nic->check_link) {
                /* Destroy work Queue */
-               cancel_delayed_work(&nic->dwork);
-               flush_workqueue(nic->check_link);
+               cancel_delayed_work_sync(&nic->dwork);
                destroy_workqueue(nic->check_link);
        }
 
index 2574a7ea1c0e5c07dfb01bc7a3cbd00c1b16328a..6534b73620911728edb120fbd8129864250f2684 100644 (file)
@@ -695,8 +695,7 @@ static void bgx_lmac_disable(struct bgx *bgx, u8 lmacid)
        lmac = &bgx->lmac[lmacid];
        if (lmac->check_link) {
                /* Destroy work queue */
-               cancel_delayed_work(&lmac->dwork);
-               flush_workqueue(lmac->check_link);
+               cancel_delayed_work_sync(&lmac->dwork);
                destroy_workqueue(lmac->check_link);
        }