From patchwork Tue Apr 10 13:44:41 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: 10333207 X-Patchwork-Delegate: kvalo@adurom.com 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 907CA60365 for ; Tue, 10 Apr 2018 13:45:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F84728DBF for ; Tue, 10 Apr 2018 13:45:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7063228DD0; Tue, 10 Apr 2018 13:45:05 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable 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 30DE228DBF for ; Tue, 10 Apr 2018 13:45:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753824AbeDJNox (ORCPT ); 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-Google-Smtp-Source: AIpwx4/tbpYZDt0DE4FhKJU3kLyPIuQqQ3Y5GUAbHB7wUvkyfwmvkuvktXgm8e/70GLMBEvncPNbMg== 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-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;