Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp538811imm; Fri, 27 Jul 2018 01:26:24 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcEKq3Ji/u0tFScwgjq45L/PHrfr2PxZujHaHDmmcEBWw/l6dnKsKbL4S+BWHgJA7W4yUmw X-Received: by 2002:a17:902:822:: with SMTP id 31-v6mr5078277plk.172.1532679984312; Fri, 27 Jul 2018 01:26:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532679984; cv=none; d=google.com; s=arc-20160816; b=NO5UYKQdBKrHBXpFkuAMxGFdMPJsZ6ul66MXPzw6Faya7kGVcOczz6OWRt56Vn6/EL x2JShA/YSkUSIf22ZaVJFOeVGPa8d8kT0vhPcaixGnky/2WXyL2vO0rYC3fUsOXwhI1B QuwNLywYfgpySWLumpteccQLISpOvoKpDlUiFCtNijfI5dACZX3vj0YUr1frCNGC5OJC 7yGAhjqgGxFDJr1yiXyAXfe+BWF0VcrXyNF0IVgQCs+0es0RvfoWRx57ol6nlVjsVe+x AK4cuAPwNZvXEtl0B88rCuOZfPSpqocTrU23xkFKd01nr7alz9s8dkXTTKf8kwnzeb/X 2kyg== 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=3jlmpDi3pSMTdz6KTum7rjiXC4zJCibhSFCAK3K7xuA=; b=cFuc9bDhufc+42Qt89A8ljgTeyHVm396bKHFdZu1Qmfj7HJHVxECNcePhQJPvxIcwu /f3CwoNBnGzrCVPiRh1MncvbnFsm0PXAzkeCG1yuFKVjdfb103bdSfxPa35zF7SdE3mr NrdvNRBFIOPMvPMofPVqmaTdp+fUL7r4N+hkeL+V+/zAd3+d5rjGivcLT6ejnn75hre/ eVLABW9niwoS6cIHhvDky7rQDEfSTPm7oIMkR4an1SXFU3o+2bT0nm57sQr4cDg30p02 tm1/jo8VZFSvtSTqdI/LUa4tVV6OWrxylVEQ/8a0mVzAsstbOvLvmGKidue0Mru6L+lw sKQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FoS9EI8P; 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 r39-v6si3061428pld.83.2018.07.27.01.26.09; Fri, 27 Jul 2018 01:26:24 -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=FoS9EI8P; 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 S1729547AbeG0JqC (ORCPT + 99 others); Fri, 27 Jul 2018 05:46:02 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:34716 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729445AbeG0JqC (ORCPT ); Fri, 27 Jul 2018 05:46:02 -0400 Received: by mail-pg1-f193.google.com with SMTP id y5-v6so2816826pgv.1; Fri, 27 Jul 2018 01:25:15 -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=3jlmpDi3pSMTdz6KTum7rjiXC4zJCibhSFCAK3K7xuA=; b=FoS9EI8P/dpjTwRRG3tWmdxp9FMxfpMY5tbSqVH1NGyRo44jSNxd7gJGfsBywD2gui gFhdRV3DBy2Vn+ySA8LHMxYozqfXO8TjiZZI2kYzAnpHnil+nymCbzdqbWaNDMkB4jtf a+vrwl7KpkyNGrT97YrqfEAYMnLIc0Q4ExX2gnWUAuPYPvqR8xuYaqRofkNfKuUHJAjA 5ngXC7a+O/tBZb8IIbJiGZ1aF6UpqxvPdlD7Ewo9rApzsnWkd9dA+DsF/ltihi7lp8bK SAO2sINNGLoXbioknJ/IDpsesXfc932RN+i9Q2QRHzBSCY84t1gImP1m85HObmq9Xa2T mhWA== 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=3jlmpDi3pSMTdz6KTum7rjiXC4zJCibhSFCAK3K7xuA=; b=pOw3+3QxQ7nPt+XWLk5DYzXHt8w4ppDQVnJhTHWAaD8EMc4kaNViZf7692Z40MrkIx 0ecDo9e0x1h9Lo1QPZYTpbtVyiNiNr/40Kjk7237RAULPbiTSoMtI34VtUD5tjFlThNa rXh5qeSCEQ3saRQ/LAkFRWeZth8wYeHS4r+m68aQmsVZ75evpeikoTNgv8CTagodSHuJ kntAeKqk8HPujEfzKqLW7i78hfeQZ5jEPvQgKYAZSAKNckpm0yHthjH2kDzWRzG8A42b 64jBrY9c2SP9gcZk0sH4XJjDyh1TzhMqJaDfG0UVV3Rq9MZOvzqSm4rpagnCgfQHCDq+ QdlQ== X-Gm-Message-State: AOUpUlEKhMBvlSjj8uqeIGodrHCwSVSmRPHT4xVeBGGZdONAHVfkMLhA eldqJ/5nbkDpTd8Tq75Afmg= X-Received: by 2002:a63:ed56:: with SMTP id m22-v6mr5178830pgk.148.1532679915463; Fri, 27 Jul 2018 01:25:15 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:6c14:7712:e625:1be4]) by smtp.gmail.com with ESMTPSA id v7-v6sm5060830pgh.57.2018.07.27.01.25.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Jul 2018 01:25:15 -0700 (PDT) From: Jia-Ju Bai To: cooldavid@cooldavid.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] net: jme: Replace mdelay() with msleep() and usleep_range() in jme_wait_link() Date: Fri, 27 Jul 2018 16:25:07 +0800 Message-Id: <20180727082507.3917-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org jme_wait_link() is never called in atomic context. It calls mdelay() to busily wait, which is not necessary. mdelay() can be replaced with msleep() and usleep_range(). This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/net/ethernet/jme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/jme.c b/drivers/net/ethernet/jme.c index 8a165842fa85..de5ed09212b0 100644 --- a/drivers/net/ethernet/jme.c +++ b/drivers/net/ethernet/jme.c @@ -1909,10 +1909,10 @@ jme_wait_link(struct jme_adapter *jme) { u32 phylink, to = JME_WAIT_LINK_TIME; - mdelay(1000); + msleep(1000); phylink = jme_linkstat_from_phy(jme); while (!(phylink & PHY_LINK_UP) && (to -= 10) > 0) { - mdelay(10); + usleep_range(10000, 11000); phylink = jme_linkstat_from_phy(jme); } } -- 2.17.0