Skip to contentSkip to conversation

gianfar: Wait for both RX and TX to stop

PATCH Applied Andy Fleming 2 participants 2 messages Apr 27, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 gianfar: Wait for both RX and TX to stop

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.

---
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(-)
drivers/net/gianfar.c +3 -3
index 0cef967..5267c27 100644
@@ -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);
 	}
 }
 
Signature · 1 line
1.6.5.2.g6ff9a
maintainer Applied
#1 lore raw

From: Andy Fleming <[email protected]>
Date: Tue, 27 Apr 2010 17:51:43 -0500

Quoted 5 lines

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.

Applied, thanks.