diff mbox

[v2] gianfar: Wait for both RX and TX to stop

Message ID 1272408703-20931-1-git-send-email-afleming@freescale.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Andy Fleming April 27, 2010, 10:51 p.m. UTC
When gracefully stopping the controller, the driver was continuing if
*either* RX or TX had stopped.  We need to wait for both, or the
controller could get into an invalid state.

Signed-off-by: Andy Fleming <afleming@freescale.com>
---
Switched to use spin_event_timeout()

Kept the -1 timeout value, as that is the original behavior, and responding
to a timeout would require a much more substantial change, and such a change
would, at the least, require investigation of what, if anything, *can* be done.

 drivers/net/gianfar.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

Comments

David Miller April 27, 2010, 11:44 p.m. UTC | #1
From: Andy Fleming <afleming@freescale.com>
Date: Tue, 27 Apr 2010 17:51:43 -0500

> When gracefully stopping the controller, the driver was continuing if
> *either* RX or TX had stopped.  We need to wait for both, or the
> controller could get into an invalid state.
> 
> Signed-off-by: Andy Fleming <afleming@freescale.com>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 0cef967..5267c27 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1567,9 +1567,9 @@  static void gfar_halt_nodisable(struct net_device *dev)
 		tempval |= (DMACTRL_GRS | DMACTRL_GTS);
 		gfar_write(&regs->dmactrl, tempval);
 
-		while (!(gfar_read(&regs->ievent) &
-			 (IEVENT_GRSC | IEVENT_GTSC)))
-			cpu_relax();
+		spin_event_timeout(((gfar_read(&regs->ievent) &
+			 (IEVENT_GRSC | IEVENT_GTSC)) ==
+			 (IEVENT_GRSC | IEVENT_GTSC)), -1, 0);
 	}
 }