Received: by 10.213.65.68 with SMTP id h4csp3974673imn; Tue, 10 Apr 2018 07:26:00 -0700 (PDT) X-Google-Smtp-Source: AIpwx49Fy9JjIQT0uRL0KvM3AqiqAoSrryyzd6t1l7QLxNff6RDAi2wwBAgGH9t6WgcR+VOHekbf X-Received: by 2002:a17:902:9001:: with SMTP id a1-v6mr657311plp.211.1523370360477; Tue, 10 Apr 2018 07:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523370360; cv=none; d=google.com; s=arc-20160816; b=inda1Tjb5tN1QB8PdK13u6aHgHsuGUl/HqZRKXODRUg7jH2oqRNlZG1P5KvDte+yFR eTH+CJea0P5kx41woYJUvAraZ/lzDJC9Cf72kMJF65NpC1Xa8oqKkCfM56PM2V4AF9Qd VbcSBdV7z3K7XZupSQRfQE2lKZtFFRBuY1AjskqrIvS/F1GHxYoj2KZyWS0gMUmUFL14 lEIZaSbqzGg+hxRFrSECjgPbXu14vQkk3pUHr+QzyNo1ArjoTVB30pys+xY39MVItM7z Vvm+Gf/hIuJvkfk/8tiX6tsx2BFe+lVMDYSLxjYn/0b5fxNBGQwZGPwdnibqwdJRj003 0IZg== 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=gxUBwnJCjd8cYZ9XAknAZ5ZhqTZ7y5DZy6zR4hEOIeU=; b=NNr1+OdCuBAV8NFZ60/kmRjgIYOSyhetmTaVgPWPxmyzPBZJZwD2ikzOmRxuTAv+k3 90pYwCfZp+nApcwilXYJcJwFKl/EQP5Wd7b/K2N9JRHYEi3S5zNo2YIaEQrViRanzkp9 subqzxE1Bn8hryK1e6CNeWTH1FjCUBYxPW+feKVLcEeR1HuYEBMAa6FrMIbHiXWwqaEY FHr9oi3Z851G4mkn/eoUJOfEoOgKFw0NmFLOC7mXu9vxxsSnzXBI6M5U0Z8goXD0AUjQ yY9YifAXbnU5UIf4ndaOq5QnUYIkJTUwX+Z9YfWSpOCA7pqH0XJ7jMupPRchY4/oTV72 JdPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Or0LGwdU; 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 f8si1894993pgu.758.2018.04.10.07.25.23; Tue, 10 Apr 2018 07:26:00 -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=Or0LGwdU; 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 S1753840AbeDJOWo (ORCPT + 99 others); Tue, 10 Apr 2018 10:22:44 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:42450 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753242AbeDJOWm (ORCPT ); Tue, 10 Apr 2018 10:22:42 -0400 Received: by mail-pl0-f66.google.com with SMTP id t20-v6so4775594ply.9; Tue, 10 Apr 2018 07:22:42 -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=gxUBwnJCjd8cYZ9XAknAZ5ZhqTZ7y5DZy6zR4hEOIeU=; b=Or0LGwdUOeDbmMmhLVIkgVehbZAjUPgKBRlXfLMIS/1ISkFSIC9j57TeMzTlAZpGhy s1WItWFd/3JkEhe4yIaUgDWXlzhiYBmgBtQp1dU4FY5OqBVc0plgKRYV7wBJt3v4GVj4 x2W8uyV1arAKug5Rp9NGZVxfc5m9R4sdeWKUwVcieoFcgEdd91sM5Ij9+smNaIDctEUc Ooe76uiePQcbEvgpC1EUqP9q0c8J8WPCmEdR9qALhIjK4+S3Kjr6IqsfC74gpb4MfxIM vD3KKH82+5OvR4vCHfFK9JG/4ph9FCwHlmtTTIuwhd42U4s8PCg5sZzgcRfX5awUfE5K RoKQ== 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=gxUBwnJCjd8cYZ9XAknAZ5ZhqTZ7y5DZy6zR4hEOIeU=; b=o6QgURi4lEyQkk4RmC++kgfmIeI//mH1oNHVz8+G82RFLr1g1q5wjjOxlx+eL4rgY8 1qBUqCXMVRXgdfzoB+Qid1zQyJXNCbhsveCnuvNCEUEEbiU8s3RiPvLB1xNlJ5CD4Zrj bXug7J2lmteudvRdA0VLWKvDO+jmo0XqYSxEMNLofVpVF5SzhQD+IPr9HZrgC2EZIMuu UdnGHkKFXGKlm2XS4uDDEkaVIEEIlwrSClb/ampFlYkL0d8VvzwrUt+REFTECGdNChC2 B5heQrrVWU257XlkdS/xllepzUDNOZx3JYsUMyZhekrOS5P2ZfQojmTt39qhaxnLoPmC 89hg== X-Gm-Message-State: ALQs6tBpHbzz5D+JsBnzNVUhmxN2U75Z/iid7PX4tIsj+ryyzcuJmhfc Wd/ypqb30t38Lg15sQ1dF3k= X-Received: by 2002:a17:902:5902:: with SMTP id o2-v6mr673439pli.81.1523370162448; Tue, 10 Apr 2018 07:22:42 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id t25sm6377883pfk.69.2018.04.10.07.22.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 07:22:41 -0700 (PDT) From: Jia-Ju Bai To: dhowells@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] net: sbni: Replace mdelay with msleep in sbni_probe1 Date: Tue, 10 Apr 2018 22:22:33 +0800 Message-Id: <1523370153-32354-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 sbni_probe1() is never called in atomic context. The call chains ending up at sbni_probe1() are: [1] sbni_probe1() <- sbni_init() <- sbni_probe() <- net_olddevs_init() [2] sbni_probe1() <- sbni_isa_probe() <- sbni_init() <- sbni_probe() <- net_olddevs_init() [3] sbni_probe1() <- sbni_pci_probe() <- sbni_init() <- sbni_probe() <- net_olddevs_init() net_olddevs_init() is set as a parameter of device_initcall(). This function is not called in atomic context. Despite never getting called from atomic context, sbni_probe1() calls mdelay() to busily wait. This is not necessary and can be replaced with msleep() 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/wan/sbni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c index bde8c03..b7dd665 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c @@ -361,7 +361,7 @@ static int __init sbni_init(struct net_device *dev) irq_mask = probe_irq_on(); outb( EN_INT | TR_REQ, ioaddr + CSR0 ); outb( PR_RES, ioaddr + CSR1 ); - mdelay(50); + msleep(50); irq = probe_irq_off(irq_mask); outb( 0, ioaddr + CSR0 ); -- 1.9.1