Received: by 10.192.165.156 with SMTP id m28csp885506imm; Wed, 11 Apr 2018 08:45:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+G6/XYinKU6TueklFUD7+++CEluw24C4Bm+fojb/xrda+52suHtpX6ugFzQf6JcszXU8Zu X-Received: by 10.99.124.16 with SMTP id x16mr3856810pgc.201.1523461501932; Wed, 11 Apr 2018 08:45:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523461501; cv=none; d=google.com; s=arc-20160816; b=N3dXCqrt4Zn/NS5IrokOQsr07hVIF+ziDyqR93kVWOPLkob9AlCagnZihIbeMkzEM/ wtMfGUXaGHRxwAM41ICYKfygdSKRjWorj4RAuCGkyEFHz5WVSpG3BH8IZVnd4rXLSL+n MRu5f7sdEgxrsolcDcCEhkCh540rQH5WxouE057QPRH5BCsQh33IsHBALDlrSyfP9/qt hLmVzodBClNF6isz1OdLjm9GobGWgEGV43yLcTXyAjDL+GOmzeIFo8kiRYPOYa8TcNYi PZBJGhbwDIxlMxZlMImoUPWtagjNvF70A7hZWVc/3b6r57oLCTjfejwJbCYpU9BAVH/6 xpIw== 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=rzG3necApYUKaevlF61U8QCxcpY70A30gGVJutzPUtw=; b=Kr4xLsPq1NINacfX1J2pdXNYUpEXN2JXxMZMUgSZ8JsAyKYD0S+pEN6NvG+1O/JJSv fSjImnetNI3oeu5j7X5n9k1bAhpif5OnExOFW4BXz0KxgvvkDtWvkZ/ojMmAxhzrVlho rfo3lHB5JFotX72HoT2H9C3wBZfvNGkEH0InEVfyFhwiqcqSGdsQPQbPNZogJEA5gbz6 BZCuSIHppg3lXp1n6eW/2moXs3Ldo7pZhE40JLj+DdbLAFnJaI5b2shs6gGTdYZZs7rz T39uwTjdUD+rI/Y4aqfwbMyCo0Eye27Gb8fdoGQaZNVTUPLDl2kVpduh2mNjfKvjMnb+ O94w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=C//Rm2Lz; 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 t65si944225pgc.343.2018.04.11.08.44.24; Wed, 11 Apr 2018 08:45: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=C//Rm2Lz; 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 S1753740AbeDKPkC (ORCPT + 99 others); Wed, 11 Apr 2018 11:40:02 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:36685 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752852AbeDKPkA (ORCPT ); Wed, 11 Apr 2018 11:40:00 -0400 Received: by mail-pg0-f66.google.com with SMTP id d6so928588pgt.3; Wed, 11 Apr 2018 08:40:00 -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=rzG3necApYUKaevlF61U8QCxcpY70A30gGVJutzPUtw=; b=C//Rm2LzFceWslzJ+QyjDuYDOriW4GRxEsf024f6TKBJEGY55ntidLwby2NFSsfZSH lw0cuxyy4VVK+STGBRXlrLYUsJgt1pe2BVByvNex0Tqc1QwHOX7eTxs03V0rZUiOSTZU U7b/LoVgXsQq1LKfhGKrvc5F5K150/8YcYgaZZ3s2LwBb6Zxmd190ZwcsNtPpnM+o1Y4 w+klukvxmaJBTdIue34+fbYQcaSQMULo3J3LP/+NT948d3fRFj73X8DNAwqgUdqwTtAM 82EUVrEk0pB75tLOTVGEMK8q2xOiwrlm3kt9Ma4/FQAHwlT2CWulqtnbzxVw3jyEy1wX AHSQ== 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=rzG3necApYUKaevlF61U8QCxcpY70A30gGVJutzPUtw=; b=Ip0/J6YnSx/71x6DzIcA+3RzyrF4YgXyIhqpgXJ2OyZVYPSfxWRZCwgSS9AYrUzGj4 NMRo/7MZtGew+/cgISw7E+lGp/7GZ9K4BWHgb2Zvt8n5FX0Pq+PejwT5/olL1gv41hnk +UXtQr0dgZgC7FM8DM5M+zIyS1cUX9wXczXyiEwUW/ga8ez1/AjD/enUNBC6vcPERCAR DCkfvw3w96y4MZFRlcMocwmY79LikvMC/G0K1rBRJFzbKyQK0NDxc7pJ2LOGEktw2f6V X4/J8a+r0qYG8iCA+qj3US2F4LKsJoo9BrG5OefBB2Fi5gPk5VNS39yx19uhKjATwuqY l/Uw== X-Gm-Message-State: ALQs6tBM2TVWnfSQ1CuyYJUViKGxbzMbkbhPDd2TKR1HsltZM3Tm0Jsq mI/5X0EYUXIm5ozWWOlh47o= X-Received: by 10.98.10.156 with SMTP id 28mr4493566pfk.33.1523461200246; Wed, 11 Apr 2018 08:40:00 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id l80sm4113687pfk.73.2018.04.11.08.39.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Apr 2018 08:39:59 -0700 (PDT) From: Jia-Ju Bai To: davem@davemloft.net, stephen@networkplumber.org, johannes.berg@intel.com, arvind.yadav.cs@gmail.com, dhowells@redhat.com Cc: netdev@vger.kernel.org, linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH v2] dec: tulip: de4x5: Replace mdelay with usleep_range in de4x5_hw_init Date: Wed, 11 Apr 2018 23:39:42 +0800 Message-Id: <1523461182-5897-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 de4x5_hw_init() is never called in atomic context. de4x5_hw_init() is only called by de4x5_pci_probe(), which is only set as ".probe" in struct pci_driver. Despite never getting called from atomic context, de4x5_hw_init() 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/dec/tulip/de4x5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c index 0affee9..3fb0119 100644 --- a/drivers/net/ethernet/dec/tulip/de4x5.c +++ b/drivers/net/ethernet/dec/tulip/de4x5.c @@ -1107,7 +1107,7 @@ static int (*dc_infoblock[])(struct net_device *dev, u_char, u_char *) = { pdev = to_pci_dev (gendev); pci_write_config_byte(pdev, PCI_CFDA_PSM, WAKEUP); } - mdelay(10); + usleep_range(10000, 11000); RESET_DE4X5; -- 1.9.1