Received: by 10.213.65.68 with SMTP id h4csp3929139imn; Tue, 10 Apr 2018 06:49:14 -0700 (PDT) X-Google-Smtp-Source: AIpwx482orAalm2ZEu0PNIE8+CXWb1SV6QxEMW4RIKHKK4tJhd9DZGakGs0GW3Qi9eW62d+Ri0Iz X-Received: by 10.101.99.66 with SMTP id p2mr366423pgv.396.1523368154365; Tue, 10 Apr 2018 06:49:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523368154; cv=none; d=google.com; s=arc-20160816; b=AMUAM4I49bp0riL4B80Tip846q09CdbVp/6C+ILAoG+ICimZnZgeJjtEuPYlOqw28w bZJJaaOrub+EJvJsqfWMUZboj40nRbdh1BP6ZzaHKwXe6H0BbD3q2C2NP93sFvKdboJT qIpPgKfPzNRO/e9cw6rNsGtUVXWtvDYiANgXfPVZ1r9ysKGA0lqMGYj6YvIGtPI+Ui8a DqCDKQ7UhKv/d2SsXGqbmwzDBfnEBBoEwGtH2D5axmWsZhhm13F1wOvbBdJFItk4ZA9J 9z0wJsOX1EJdW2WSCdxhQNLvldCRsPQ7g1P+qU/c3gycBB4efcojEqF5BKcC/wGhlUbc 9Org== 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=DdFLAEexjt06QYgPmMm2ICHuvf7Tj8M/zyktt4N+8Y8=; b=UJl5s2F8WtnXsidURttUlUWwRCH7t/4n4YaxuvmtBEse5UA89XS7JR0rCvbD13s023 fq4NPq/J3e6xj7gQ1CV7OAUHkhC1PTmgAlGjCdo7CRsyVwFcHnsuxCW8GDhR7vPUuYzh VgDo0t7dHXe0Ta4zNuZoQiBa1mBZq3WodEpFsv1FGmiXmloVPYzrELsQzvySiapChp66 La2Diz1n9lpwhESzWgFnYGfWPWXPI55CsSRpCEwICdhiYP2GkZY/z2gpAzlehSOlm/2s MCwiSxCdYVGJs73kz+2r3Mv3wMANnH3OfGXevgPAIwGTouez4VaQ2TEaUKCgupC5lK0f ptow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mNRYqLCm; 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 e13-v6si2745436pln.361.2018.04.10.06.48.37; Tue, 10 Apr 2018 06:49:14 -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=mNRYqLCm; 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 S1753875AbeDJNox (ORCPT + 99 others); Tue, 10 Apr 2018 09:44:53 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:39876 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753782AbeDJNou (ORCPT ); Tue, 10 Apr 2018 09:44:50 -0400 Received: by mail-pf0-f194.google.com with SMTP id c78so8346275pfj.6; Tue, 10 Apr 2018 06:44:50 -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=DdFLAEexjt06QYgPmMm2ICHuvf7Tj8M/zyktt4N+8Y8=; b=mNRYqLCmDzhPuQ4H5QKP6eoBVDhIBZt62zmh+tk40PlthrVltb1v5FeYwkomezBmgW 1QBZniENkq2nIQ43A6PdYqhDlX+Bn2WPMUmjoSccE596m/5wjaLBBOqQFXgRW9R5dO0q QS7dEQxDih0mXLIjvFPobdNLPLjmGs+y/BsC3dR1LX8aX8Imcz+5JwuMkDPCF8ItNsmx /QDC2AhLYs6lR7KXyL05ZkQ5QYIZ5UQC0m2hgAhoofa2d/RGpJUorFVGcTGE58Eand4Y iMzntwxAI645g9TyO7GxJuEtlKnAPL00aqkLMARRCF1Fnp2rB3o4gDrEBZKd9csvfMEp wMrA== 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=DdFLAEexjt06QYgPmMm2ICHuvf7Tj8M/zyktt4N+8Y8=; b=uJeILJ0z4J1EguVxWwAJi7vjqVU59gyDVSxCmz9Z8EVhZNiKLpz88rKVQLqvV7lHY4 3Ko8c4Zy9sfLkbfKQpqEiZnM5hAvlgu80fOas+cgN7OZTnoA0QaY881sex97UasZh9zE cz9GvJOts8Sl3Ex+yQ7zfs6FPsUPu7f6H0OQJPNKnDndJjO0SVz6Uo9qUaJQfTDqLfWV V5EGf2ReR5mFkfptL95fRjW6NrbRauOCgOVhlRmG9270TwKBrE6dqUCjmR08mn9v4Uv4 ZecY+c75lub/cDAEg1x+CcZxNVL9KQF6AQM4pwCl5RbjbRbpi1fjSewpEWvqL4VVDUBu Q6pA== X-Gm-Message-State: ALQs6tBYZCbVIuepu51kaf+A42WMOBVnRBmcKGALNhsYfm/24EH9k65k IZXW5LpayHJpwECKGiAecM8= X-Received: by 10.167.128.140 with SMTP id v12mr400267pff.177.1523367890136; Tue, 10 Apr 2018 06:44:50 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id 186sm6072809pfe.109.2018.04.10.06.44.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 06:44:49 -0700 (PDT) From: Jia-Ju Bai To: kvalo@codeaurora.org, davem@davemloft.net, gustavo@embeddedor.com, mingo@kernel.org, dhowells@redhat.com, johannes.berg@intel.com Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] net: wireless: cisco: airo: Replace mdelay with usleep_range in flashgchar Date: Tue, 10 Apr 2018 21:44:41 +0800 Message-Id: <1523367881-32058-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 flashgchar() is never called in atomic context. flashgchar() is only called by flashcard(). flashcard() calls copy_from_user() and kmalloc(GFP_KERNEL), which indicates this function is not called in atomic context. Despite never getting called from atomic context, flashgchar() 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/wireless/cisco/airo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c index 54201c0..45747b7 100644 --- a/drivers/net/wireless/cisco/airo.c +++ b/drivers/net/wireless/cisco/airo.c @@ -8106,7 +8106,7 @@ static int flashgchar(struct airo_info *ai,int matchbyte,int dwelltime){ if(dwelltime && !(0x8000 & rchar)){ dwelltime -= 10; - mdelay(10); + usleep_range(10000, 11000); continue; } rbyte = 0xff & rchar; -- 1.9.1