Received: by 10.192.165.156 with SMTP id m28csp897474imm; Wed, 11 Apr 2018 08:56:52 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/ZnbrrrDe7jdy0vTYGtRNDkcheeC8wEDgfCqzD3IhyuGUv1HNbzYuPJ+Zq1tDh20NIcwTL X-Received: by 10.99.106.202 with SMTP id f193mr3961012pgc.334.1523462212377; Wed, 11 Apr 2018 08:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523462212; cv=none; d=google.com; s=arc-20160816; b=E8J8fkfNNGlMxi5JH83JDXx4EybFHI3dbMeHf/6O0k3F/Rh2LfJapA+IEuclgJ+iEq ZmyHIx34PogN6Lx2YPQKnUxAsSO4wi6UESXJkVWL9+jDvzZ6uckIdClfO/ZKzG6E4omy JXLKn7FyioD5S2hAGG0tDpuBjkkXiVv6mwFVCYWVpKU4MCZ2pPrEYnYALsOnsJvwnlnc cBHalootH658YXvfr/jxwsQ37/ZowQfHTLp8KvBEumuNQZDRo9/TvkIlshtBspLGbBVt Z5tUOxztu1lS+XVX0FBe1mox2fcfCzJe735o2WQ8fMOdnoy9EGhmRneyGUVEG1O+S2XW h+2w== 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=n3KgKs6P3XHGt96asmRrPMY9D514v44MQS1WuhMqCdw=; b=asvMTRzMQuyxY8wEpFEfg8AH8B3qv9PuhTIPh24rPqD8TWrOyYFsi8A4d2Gg+TeMvQ 7mYOwtP8VWl2Wl8ih0P4OfsONbYN605fOBBc5A5m6jgHeWr95mLSdVt/TPdsRU1khuV6 BVqICsGgV8RMLublY03i2ZDXsegbahvBPYf3wM8LA54HCCQO1m8PQxumdG26XkP5Gd5h okUtGih8FUm6QqgBKQ1PD9As2iiQQD2Vdl1nIDpcyRI41JkZAU45EiOrslY7cjr0Ze/4 8ybVyHn3clqAJlETQ1R9N84Ha5md2mRDZscVpeGFNVmvVL3vGKGgMGyacNzTQQYc3mbg TAzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=C6ViugRr; 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 r62si1116534pfe.68.2018.04.11.08.56.08; Wed, 11 Apr 2018 08:56:52 -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=C6ViugRr; 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 S1753966AbeDKPwB (ORCPT + 99 others); Wed, 11 Apr 2018 11:52:01 -0400 Received: from mail-pl0-f65.google.com ([209.85.160.65]:43005 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752901AbeDKPv7 (ORCPT ); Wed, 11 Apr 2018 11:51:59 -0400 Received: by mail-pl0-f65.google.com with SMTP id t20-v6so1694956ply.9; Wed, 11 Apr 2018 08:51:59 -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=n3KgKs6P3XHGt96asmRrPMY9D514v44MQS1WuhMqCdw=; b=C6ViugRrw6QigpZeLPzhwkRjRlotjoDrT0fmF/c6TgMrEn5ovm7IV8ULwNw3+LA36z uli3y5GxcI3u4ab1Jeo6tRYEXMo3CSsmWa4Gxj6+shijMWHQU0b9RvdHexmjbVeL3Ag/ VQxHnnwVRFqMiHDa5XRFRChBOUhdHhZfyUwZyUG+FhbTnwV2eTLBdvPExfYh2n4gZnr8 xeOjU6hF/UX60nrZvNFcACjP7VocwaU9KozvE3082MnVBgH7QFtA2zCCm5NYBa0xOUq+ 6Oxvvj3TV2qTQvxTF1XX1bZu8vCyj1EI5RkUJPljtUW/rpaHPJ4zrBqWWdHBIVCVXK1g qjrA== 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=n3KgKs6P3XHGt96asmRrPMY9D514v44MQS1WuhMqCdw=; b=fb/cmViTaW9FF9rAxeqxABLuHG1lg4XnuyZi3wedLrxMQXEq09FNDvBvqtXpaFYG8l sn0bpjiQbHzMIQZeg33dV3r1x9pn8UO+cL/RQsBtyt0npyyPxPQYnFvVhVgUWeExnGGe W7RNBIlSf1wIgrzMUQL/nRC/+1VzA5txdK6j6EzKVEaVnja7ToJHhnhhS+8FdinGWHkx ws7Ywe/3K1GeyEXrkiR7kojk76/Cn43J9fYCrRhL7AzEIk8oTOfUt860i2lRghwPQlef s+9URAkASVlNidZWR5s8AraXCf/GE4JxOFI7UHdDt1U8L8ZZaDtdmrYEsMVbJZxZK5eB MZ6Q== X-Gm-Message-State: ALQs6tDoVxHvmdMBB+4nFGOm99VbOOyUvjPt608T2q0/bujBA9rKj7LY ni8/lvqI5kgCtX7BqwFllkM= X-Received: by 2002:a17:902:8501:: with SMTP id bj1-v6mr5766874plb.239.1523461919345; Wed, 11 Apr 2018 08:51:59 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id c3sm4516216pfd.28.2018.04.11.08.51.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Apr 2018 08:51:58 -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 v2] net: samsung: sxgbe: Replace mdelay with usleep_range in sxgbe_sw_reset Date: Wed, 11 Apr 2018 23:51:50 +0800 Message-Id: <1523461910-6294-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 --- v2: * Use usleep_range() to correct usleep() in v1. --- 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_range(10000, 11000); } if (retry_count < 0) -- 1.9.1