Received: by 10.192.165.156 with SMTP id m28csp185506imm; Tue, 10 Apr 2018 19:25:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx48l4OXzWZy43p8+pA2Id6FGJC6p2ZHmdm4IZYLzA3ZI69G4k8f37ZlCPzOx4w41Z5gplTjs X-Received: by 10.99.131.73 with SMTP id h70mr1979567pge.195.1523413501402; Tue, 10 Apr 2018 19:25:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523413501; cv=none; d=google.com; s=arc-20160816; b=bokJnihfw0av3dZmtqAF5Z2b4RwXTLvR8E0D8Q6Tvf4m4BcbR3KwKiBdeQ8eocycfH EqCE+uYNH4sQxPtJYcl5Ae9FtY/pZejCStiX0uZeseaQfxz7Pm7SD/Ojex4bxRv/S8G7 Lu8BRU8YBX9aOQLEKYPN+Htyj/kDCMgRyTZnL5FB8lzHNXQWh63WM5cVGELUg2y+luzM IWieWx2iQObU+0oRVWdCOj+1GG0GzIrCHRVuQg2Vm4rH6xk8UyvUJp5GShaotzP5naxF e0aCsnFGDizbQ9udPQgrx97c21pkkrxbEp6SSzmfAuozMhuOWs+hgL7SfSdi/4VQHEpZ 0GBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=2vzmte67hIzL8GTfw94d8KTY95Ha/IWd2MW5EQ36s/c=; b=hhzp0Nopp8/tM18wVnps+1mDfP4+j81YlBzSW5b+Vzo33hS+NXBNrneDqjqsJ3Pi0z ErJsrywpsiSopugPjiHHht5VBVpADZw7QbYTPc/miKBWPQhck8ShbBmVJeV7+WXEcgoD 2yllymtSuuWap/ekBtIimzud9vFSIyGfu8PzYaU7KTlHnvFGahiFUPnmlvQtpXslh3cK 90ajZsDa3KMZWYmSo2FG2sbRuDZBCOQnoGpv9s63fiyTqTwJSneiZTk1gMFEKeyIm5Ys OemeBgC2+oq82pOquaA70LQoLIv9FGCR2yk06InOzkxmwNKIpL6Ojz5F3944iAl5DTI6 e/vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qkw3aPfN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h23-v6si55024plr.576.2018.04.10.19.24.24; Tue, 10 Apr 2018 19:25:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qkw3aPfN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752623AbeDKCVb (ORCPT + 99 others); Tue, 10 Apr 2018 22:21:31 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:41492 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752295AbeDKCV3 (ORCPT ); Tue, 10 Apr 2018 22:21:29 -0400 Received: by mail-pl0-f68.google.com with SMTP id bj1-v6so240467plb.8; Tue, 10 Apr 2018 19:21:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=2vzmte67hIzL8GTfw94d8KTY95Ha/IWd2MW5EQ36s/c=; b=qkw3aPfN0EhSRtgRWfqc1UP1GeRZOkRjODFbou1Xt8h2zXh8IVCPKaKD4WEEArXTDa T51IMPw1bS6SV+nhi984U4dj8iJnmRKQzBdq8pg4zwMaoineMFHX43r5WrPNS3DzHE6+ KxpZHWac6efRDZGRvUERYAfoV/irIhQfAtj+JUdxdSTrN3om4WxhLmJDD4goLTDhNyQx 4CFR4vo5Xnu5cE/gT5Y81rSovb1cUhr7E8sTCkY5EMLHUHPlDcmtPl+wgHQ9lzYNUlQV QF31hz7Z516QLVNLHpG+LqxsWEUpwfW+YmfnisKp6i2QtT/dGBdmm+o33B22GK8fDPLo AaDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2vzmte67hIzL8GTfw94d8KTY95Ha/IWd2MW5EQ36s/c=; b=C2ZfL77i5s7Q5OeF9/4entJUpdvDgIznyf0qksLJ8vgUpaPV19A0ZeIhjScJIu6JDo zNpB74/vlKjDsIuYkMIEXbJuITWO0V4lRj3PQf+xTKC2OedHiYClTu2NAH1Z0+A0DWUu KTzzB/EEFsppwuIBpdbFqDCykEUrvyxsVtRq4gsbAswQ3nHYxGXMyjSeDx8am+tTVfKv zq/rVzMKzGn9bZpzVfuxYAKdTfHvtsH0uT1D3oTo98HLfYKqwWPGOQSmDeOKKGca7azg XOuCdFmSyS235kBBpzZQ0u0plIMR6gf2ZJZ3khUsuw6Yg3XziuZzh3bHAztb/liDaKxg eUgQ== X-Gm-Message-State: ALQs6tCk9cVVkOe4B3S6HzSusn9R/TicsEXbHZcZmujYEvraFrIg+1uq 9H+nNc9k7jV6Cm0VFTA2nCQ= X-Received: by 2002:a17:902:6547:: with SMTP id d7-v6mr2935582pln.253.1523413289401; Tue, 10 Apr 2018 19:21:29 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id c187sm102066pfa.181.2018.04.10.19.21.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 19:21:28 -0700 (PDT) From: Jia-Ju Bai To: bh74.an@samsung.com, ks.giri@samsung.com, vipul.pandya@samsung.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] net: samsung: sxgbe: Replace mdelay with usleep_range in sxgbe_sw_reset Date: Wed, 11 Apr 2018 10:21:20 +0800 Message-Id: <1523413280-2336-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org sxgbe_sw_reset() is never called in atomic context. sxgbe_sw_reset() is only called by sxgbe_drv_probe(), which is only called by sxgbe_platform_probe(). sxgbe_platform_probe() is set as ".probe" in struct platform_driver. This function is not called in atomic context. Despite never getting called from atomic context, sxgbe_sw_reset() calls mdelay() to busily wait. This is not necessary and can be replaced with usleep_range() to avoid busy waiting. This is found by a static analysis tool named DCNS written by myself. And I also manually check it. Signed-off-by: Jia-Ju Bai --- drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c index 89831ad..99cd586 100644 --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c @@ -2038,7 +2038,7 @@ static int sxgbe_sw_reset(void __iomem *addr) if (!(readl(addr + SXGBE_DMA_MODE_REG) & SXGBE_DMA_SOFT_RESET)) break; - mdelay(10); + usleep(10000, 11000); } if (retry_count < 0) -- 1.9.1