Skip to content

Commit

Permalink
sungem: update gp->reset_task flushing
Browse files Browse the repository at this point in the history
gp->reset_task_pending is always set right before reset_task is
scheduled and as there is no synchronization between the setting and
scheduling, busy looping on reset_task_pending before flushing
reset_task doesn't really buy anything.

Directly flush gp->reset_task on suspend and cancel on detach.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
  • Loading branch information
Tejun Heo committed Dec 12, 2010
1 parent 760141a commit fe8998c
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions drivers/net/sungem.c
Original file line number Diff line number Diff line change
Expand Up @@ -2380,10 +2380,8 @@ static int gem_suspend(struct pci_dev *pdev, pm_message_t state)
*/
mutex_unlock(&gp->pm_mutex);

/* Wait for a pending reset task to complete */
while (gp->reset_task_pending)
yield();
flush_scheduled_work();
/* Wait for the pending reset task to complete */
flush_work_sync(&gp->reset_task);

/* Shut the PHY down eventually and setup WOL */
gem_stop_phy(gp, gp->asleep_wol);
Expand Down Expand Up @@ -2928,10 +2926,8 @@ static void gem_remove_one(struct pci_dev *pdev)
/* We shouldn't need any locking here */
gem_get_cell(gp);

/* Wait for a pending reset task to complete */
while (gp->reset_task_pending)
yield();
flush_scheduled_work();
/* Cancel reset task */
cancel_work_sync(&gp->reset_task);

/* Shut the PHY down */
gem_stop_phy(gp, 0);
Expand Down

0 comments on commit fe8998c

Please sign in to comment.