From patchwork Tue Apr 27 22:51:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Fleming X-Patchwork-Id: 51119 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 16126B7D57 for ; Wed, 28 Apr 2010 08:51:52 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757476Ab0D0Wvr (ORCPT ); Tue, 27 Apr 2010 18:51:47 -0400 Received: from az33egw02.freescale.net ([192.88.158.103]:48929 "EHLO az33egw02.freescale.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755088Ab0D0Wvq (ORCPT ); Tue, 27 Apr 2010 18:51:46 -0400 Received: from az33smr01.freescale.net (az33smr01.freescale.net [10.64.34.199]) by az33egw02.freescale.net (8.14.3/az33egw02) with ESMTP id o3RMpjfZ020246; Tue, 27 Apr 2010 15:51:45 -0700 (MST) Received: from localhost (firefly.am.freescale.net [10.82.123.6]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id o3RN06uj028032; Tue, 27 Apr 2010 18:00:06 -0500 (CDT) From: Andy Fleming To: davem@davemloft.net Cc: netdev@vger.kernel.org Subject: [PATCH v2] gianfar: Wait for both RX and TX to stop Date: Tue, 27 Apr 2010 17:51:43 -0500 Message-Id: <1272408703-20931-1-git-send-email-afleming@freescale.com> X-Mailer: git-send-email 1.6.5.2.g6ff9a Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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(-) 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(®s->dmactrl, tempval); - while (!(gfar_read(®s->ievent) & - (IEVENT_GRSC | IEVENT_GTSC))) - cpu_relax(); + spin_event_timeout(((gfar_read(®s->ievent) & + (IEVENT_GRSC | IEVENT_GTSC)) == + (IEVENT_GRSC | IEVENT_GTSC)), -1, 0); } }