From patchwork Wed Mar 4 17:33:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Glendinning X-Patchwork-Id: 24046 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.176.167]) by ozlabs.org (Postfix) with ESMTP id AB88FDE0D6 for ; Thu, 5 Mar 2009 04:33:34 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753654AbZCDRda (ORCPT ); Wed, 4 Mar 2009 12:33:30 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753642AbZCDRd3 (ORCPT ); Wed, 4 Mar 2009 12:33:29 -0500 Received: from drevil.shawell.net ([86.54.240.115]:37269 "EHLO drevil2.shawell.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753514AbZCDRd3 (ORCPT ); Wed, 4 Mar 2009 12:33:29 -0500 Received: from localhost.localdomain (kensington.shawell.net [10.0.20.15]) by drevil2.shawell.net (Postfix) with ESMTP id 1A936378FC; Wed, 4 Mar 2009 17:33:23 +0000 (GMT) From: Steve Glendinning To: netdev@vger.kernel.org Cc: Roel Kluin , Juha Leppanen , Ian Saturley , David Miller , Steve Glendinning Subject: [PATCH 2/2] smsc911x: improve EEPROM loading timeout logic in open Date: Wed, 4 Mar 2009 17:33:25 +0000 Message-Id: <1236188005-14065-2-git-send-email-steve.glendinning@smsc.com> X-Mailer: git-send-email 1.6.0.6 In-Reply-To: <1236188005-14065-1-git-send-email-steve.glendinning@smsc.com> References: <1236188005-14065-1-git-send-email-steve.glendinning@smsc.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch from Juha Leppanen suppresses a false warning if the eeprom load succeeds on the very last attempt. Juha> In function smsc911x_open smsc911x_reg_read+udelay can be run 50 Juha> times with timeout reaching -1, and the following if statetement Juha> does not catch the timeout and no warning is issued. Also if the Juha> 50th smsc911x_reg_read is GOOD, loop is exited with timeout as 0 Juha> and bogus warning issued. Replace testing order and --timeout Juha> instead of timeout-- and now max 50 smsc911x_reg_read's are done, Juha> with max 49 udelays. Signed-off-by: Steve Glendinning --- drivers/net/smsc911x.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c index 9a79510..ad15aab 100644 --- a/drivers/net/smsc911x.c +++ b/drivers/net/smsc911x.c @@ -1162,8 +1162,8 @@ static int smsc911x_open(struct net_device *dev) /* Make sure EEPROM has finished loading before setting GPIO_CFG */ timeout = 50; - while ((timeout--) && - (smsc911x_reg_read(pdata, E2P_CMD) & E2P_CMD_EPC_BUSY_)) { + while ((smsc911x_reg_read(pdata, E2P_CMD) & E2P_CMD_EPC_BUSY_) && + --timeout) { udelay(10); }