Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 23f333a2 authored by Tejun Heo's avatar Tejun Heo
Browse files

drivers/net: don't use flush_scheduled_work()



flush_scheduled_work() is on its way out.  This patch contains simple
conversions to replace flush_scheduled_work() usage with direct
cancels and flushes.

Directly cancel the used works on driver detach and flush them in
other cases.

The conversions are mostly straight forward and the only dangers are,

* Forgetting to cancel/flush one or more used works.

* Cancelling when a work should be flushed (ie. the work must be
  executed once scheduled whether the driver is detaching or not).

I've gone over the changes multiple times but it would be much
appreciated if you can review with the above points in mind.

Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jay Cliburn <jcliburn@gmail.com>
Cc: Michael Chan <mchan@broadcom.com>
Cc: Divy Le Ray <divy@chelsio.com>
Cc: e1000-devel@lists.sourceforge.net
Cc: Vasanthy Kolluri <vkolluri@cisco.com>
Cc: Samuel Ortiz <samuel@sortiz.org>
Cc: Lennert Buytenhek <buytenh@wantstofly.org>
Cc: Andrew Gallatin <gallatin@myri.com>
Cc: Francois Romieu <romieu@fr.zoreil.com>
Cc: Ramkrishna Vepa <ramkrishna.vepa@exar.com>
Cc: Matt Carlson <mcarlson@broadcom.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Cc: Shreyas Bhatewara <sbhatewara@vmware.com>
Cc: netdev@vger.kernel.org
parent 6e07ebd8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1092,10 +1092,11 @@ static int __devinit rtl8139_init_one (struct pci_dev *pdev,
static void __devexit rtl8139_remove_one (struct pci_dev *pdev)
{
	struct net_device *dev = pci_get_drvdata (pdev);
	struct rtl8139_private *tp = netdev_priv(dev);

	assert (dev != NULL);

	flush_scheduled_work();
	cancel_delayed_work_sync(&tp->thread);

	unregister_netdev (dev);

+2 −2
Original line number Diff line number Diff line
@@ -1504,8 +1504,8 @@ static void __devexit atl2_remove(struct pci_dev *pdev)

	del_timer_sync(&adapter->watchdog_timer);
	del_timer_sync(&adapter->phy_config_timer);

	flush_scheduled_work();
	cancel_work_sync(&adapter->reset_task);
	cancel_work_sync(&adapter->link_chg_task);

	unregister_netdev(netdev);

+1 −1
Original line number Diff line number Diff line
@@ -1097,7 +1097,7 @@ static int bcm_enet_stop(struct net_device *dev)
	enet_dma_writel(priv, 0, ENETDMA_IRMASK_REG(priv->tx_chan));

	/* make sure no mib update is scheduled */
	flush_scheduled_work();
	cancel_work_sync(&priv->mib_update_task);

	/* disable dma & mac */
	bcm_enet_disable_dma(priv, priv->tx_chan);
+2 −2
Original line number Diff line number Diff line
@@ -8393,7 +8393,7 @@ bnx2_remove_one(struct pci_dev *pdev)
	struct net_device *dev = pci_get_drvdata(pdev);
	struct bnx2 *bp = netdev_priv(dev);

	flush_scheduled_work();
	cancel_work_sync(&bp->reset_task);

	unregister_netdev(dev);

@@ -8431,7 +8431,7 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state)
	if (!netif_running(dev))
		return 0;

	flush_scheduled_work();
	cancel_work_sync(&bp->reset_task);
	bnx2_netif_stop(bp, true);
	netif_device_detach(dev);
	del_timer_sync(&bp->timer);
+2 −2
Original line number Diff line number Diff line
@@ -3880,7 +3880,7 @@ static int cas_change_mtu(struct net_device *dev, int new_mtu)
	schedule_work(&cp->reset_task);
#endif

	flush_scheduled_work();
	flush_work_sync(&cp->reset_task);
	return 0;
}

@@ -5177,7 +5177,7 @@ static void __devexit cas_remove_one(struct pci_dev *pdev)
		vfree(cp->fw_data);

	mutex_lock(&cp->pm_mutex);
	flush_scheduled_work();
	cancel_work_sync(&cp->reset_task);
	if (cp->hw_running)
		cas_shutdown(cp);
	mutex_unlock(&cp->pm_mutex);
Loading