From patchwork Wed Apr 11 02:00:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia-Ju Bai X-Patchwork-Id: 10334753 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CA4CD602D8 for ; Wed, 11 Apr 2018 02:01:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B691128687 for ; Wed, 11 Apr 2018 02:01:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAF2928689; Wed, 11 Apr 2018 02:01:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E9F228687 for ; Wed, 11 Apr 2018 02:01:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752853AbeDKCBL (ORCPT ); Tue, 10 Apr 2018 22:01:11 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:40247 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752849AbeDKCBK (ORCPT ); Tue, 10 Apr 2018 22:01:10 -0400 Received: by mail-pl0-f67.google.com with SMTP id x4-v6so210476pln.7; Tue, 10 Apr 2018 19:01:10 -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=EneuiYEMJYPBd1/yXvDJQ6pevUek3g/GtjsoDlvBLeI=; b=s6lPty9elvPMA4QL/myRxFINvf8ENysaximm6uhwJoIqGn7CLNZlNaXm+y28CICBoI Dxs542+/5dckXTRRnz15dX+TlWqLkwSUILValT2Qc5kY5FlhJf9if4Iv+iouZmqmzqxJ 4oPMVhHlsAPAHhBkMpxAdED6HYjHnaMf3DyswlUmvOgE2ekE1tfdG2kzsEG1I85kyekX /pJIacAZxWxMFyy76801xw8N8C9WRh2e7aPrVDacmkyInqD5zPK3xG1hbWSJzQqBlJf+ Gprf1m3EPlUVcv9mIkZGtC1prkdj1nj98GjPDOy0pp+gfOLuS0ssEvaHqFMqDooAKWdZ VY4g== 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=EneuiYEMJYPBd1/yXvDJQ6pevUek3g/GtjsoDlvBLeI=; b=pf3x2ZuPUxjd+0lr9IPYiP/WfN+7QKfud7vIGOCRpPtJ+wEk3eDbvQjBenZQ8Ak6ff s8roO0kcWIialwXQheoMJ6yPz8TfytpXy99zfapeHT86zc91ow/knxIWZNsrONe9UUHY DUdIbCeRI+bJ0vGBAne+8fVmaikP7PI29tueox94C+rExsH9eMbKzlhwrx4t8uf0ClxW aPRrzEhK+1xUksQ6cqCzjz5RhDxm9Fqg941SqtIqLgfyAd2T/Swa5zIe/HDvxZ5w2Jlh 46Rtkyf+0vVeqaUK0syg8htEnJdljkSso45l1sDuWAl2+rfjFr0QPTFf0HL2JhquUqzF We+A== X-Gm-Message-State: ALQs6tA+n692JHM6hz2u9iG+NpoeAB0uaxybPmLY5U3CrNmBpsu32o3a Eb87atQbrek+Zt9tsRnpMcI= X-Google-Smtp-Source: AIpwx48R5J5Kphi+YzxksVyufGz79VUg7FY9RCcrcU0pRK4nY/U2ssXu0mzFUBFLarcbxcoirAvZ1A== X-Received: by 2002:a17:902:5416:: with SMTP id d22-v6mr2906952pli.111.1523412069801; Tue, 10 Apr 2018 19:01:09 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id d4sm65063pgc.43.2018.04.10.19.01.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 19:01:09 -0700 (PDT) From: Jia-Ju Bai To: davem@davemloft.net, dhowells@redhat.com, stephen@networkplumber.org, johannes.berg@intel.com, arvind.yadav.cs@gmail.com Cc: netdev@vger.kernel.org, linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] dec: tulip: de4x5: Replace mdelay with usleep_range in de4x5_hw_init Date: Wed, 11 Apr 2018 10:00:54 +0800 Message-Id: <1523412054-2108-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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(10000, 11000); RESET_DE4X5;