From patchwork Fri Jan 13 15:15:31 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Antipov X-Patchwork-Id: 6186 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7BA3823E01 for ; Fri, 13 Jan 2012 15:14:41 +0000 (UTC) Received: from mail-bk0-f52.google.com (mail-bk0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 6240EA18630 for ; Fri, 13 Jan 2012 15:14:41 +0000 (UTC) Received: by bkbzu5 with SMTP id zu5so2935338bkb.11 for ; Fri, 13 Jan 2012 07:14:41 -0800 (PST) Received: by 10.205.126.137 with SMTP id gw9mr572577bkc.135.1326467681075; Fri, 13 Jan 2012 07:14:41 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.82.144 with SMTP id ac16cs32025bkc; Fri, 13 Jan 2012 07:14:40 -0800 (PST) Received: by 10.213.8.199 with SMTP id i7mr30068ebi.129.1326467679691; Fri, 13 Jan 2012 07:14:39 -0800 (PST) Received: from mail-bk0-f50.google.com (mail-bk0-f50.google.com [209.85.214.50]) by mx.google.com with ESMTPS id q6si5940020eeh.207.2012.01.13.07.14.39 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 13 Jan 2012 07:14:39 -0800 (PST) Received-SPF: neutral (google.com: 209.85.214.50 is neither permitted nor denied by best guess record for domain of dmitry.antipov@linaro.org) client-ip=209.85.214.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.214.50 is neither permitted nor denied by best guess record for domain of dmitry.antipov@linaro.org) smtp.mail=dmitry.antipov@linaro.org Received: by bkcjk14 with SMTP id jk14so2897247bkc.37 for ; Fri, 13 Jan 2012 07:14:39 -0800 (PST) Received: by 10.204.154.86 with SMTP id n22mr593818bkw.85.1326467679118; Fri, 13 Jan 2012 07:14:39 -0800 (PST) Received: from [192.168.0.171] ([78.153.153.8]) by mx.google.com with ESMTPS id iu2sm18729227bkb.0.2012.01.13.07.14.38 (version=SSLv3 cipher=OTHER); Fri, 13 Jan 2012 07:14:38 -0800 (PST) Message-ID: <4F104A93.4060606@linaro.org> Date: Fri, 13 Jan 2012 19:15:31 +0400 From: Dmitry Antipov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: patches@linaro.org Subject: Fwd: [PATCH] drivers/net/usb/smsc95xx.c: change msleep() to usleep_range() References: <1326455824-8685-1-git-send-email-dmitry.antipov@linaro.org> In-Reply-To: <1326455824-8685-1-git-send-email-dmitry.antipov@linaro.org> X-Forwarded-Message-Id: <1326455824-8685-1-git-send-email-dmitry.antipov@linaro.org> Due to git-send-email misconfiguration, this wasn't CC:ed to patches@linaro.org :-(. -------- Original Message -------- Subject: [PATCH] drivers/net/usb/smsc95xx.c: change msleep() to usleep_range() Date: Fri, 13 Jan 2012 15:57:04 +0400 From: Dmitry Antipov To: Steve Glendinning CC: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Dmitry Antipov The resolution of msleep is related to HZ, so 10ms msleep() causes ~23ms sleep with OMAP's default CONFIG_HZ=128 timer configuration. This looks too much, and usleep_range() with some slack gives more control of what is happening here. Signed-off-by: Dmitry Antipov --- drivers/net/usb/smsc95xx.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index d45520e..5d406d4 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -688,7 +688,7 @@ static int smsc95xx_phy_initialize(struct usbnet *dev) smsc95xx_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET); do { - msleep(10); + usleep_range(10000, 15000); bmcr = smsc95xx_mdio_read(dev->net, dev->mii.phy_id, MII_BMCR); timeout++; } while ((bmcr & BMCR_RESET) && (timeout < 100)); @@ -736,7 +736,7 @@ static int smsc95xx_reset(struct usbnet *dev) netdev_warn(dev->net, "Failed to read HW_CFG: %d\n", ret); return ret; } - msleep(10); + usleep_range(10000, 15000); timeout++; } while ((read_buf & HW_CFG_LRST_) && (timeout < 100)); @@ -759,7 +759,7 @@ static int smsc95xx_reset(struct usbnet *dev) netdev_warn(dev->net, "Failed to read PM_CTRL: %d\n", ret); return ret; } - msleep(10); + usleep_range(10000, 15000); timeout++; } while ((read_buf & PM_CTL_PHY_RST_) && (timeout < 100));