Received: by 10.213.65.68 with SMTP id h4csp3836911imn; Tue, 10 Apr 2018 05:33:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/BTUjRaCqC9mA3ZHnyJsh+lpcXkh71Rha1mknrGb91G1VqF1PNbseyEDV0mlmdyMqW9v/x X-Received: by 2002:a17:902:6085:: with SMTP id s5-v6mr209506plj.307.1523363611159; Tue, 10 Apr 2018 05:33:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523363611; cv=none; d=google.com; s=arc-20160816; b=lOBDPb1OkMtph139mr4IDXnjtu3fpoXBQ9R1HuWgcKOd08ldi/vMvkHCKNrrDLs4h9 iizo+A7S7koWk/3Ig8ljTnqytyAS9t3ErOmM/tg51Yy6b6ui2kqfdLDAGOqnJD6DBIiw FRzvBK1R8t0d/OrZaNorXDudBewjUC/qqTHeiPT8Kwj2Xw2L3/PolLADQaWXSfcVbHcM Bj31jJZbUBUGAntfsOnCV25imWohZBJYGRYTTuDOncOzLrnKSEuY/9TywNWIlin/gHe/ O66MMS4G2t47EnQRxTtpRxLxE+Dx2sl70qPdURW/ycvcTeYY5GbGCIZooo88HrrWJG/0 +nRQ== 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=XkhWC1mXrf47NnzCsmK4TQu16CLSp/EQI0XGFTMDFNs=; b=td0j2gdhBjYvBr6DqCakEIa6nm/btypVb1K481RSfpbl2LQJee70FIpydRT2ScoW2H LPUacdYaITgwDa/k4RujUt7m8uA5t4iyFE9Xq9NKt362jQt5RblUaxDwAWTZi7vDJw8y v98b872z5kkziZBFfFDCHgKA2mwlfkeSHGgCmWBzz+W/qcWpbkC41IeEBGqvu3haMh0p EGV7Sj/k2R7AjvSCp6KS439CtdPAPHrdH8bZ9TxZN2rn3CmCOyolPfAg4yfEGMQzMGl6 eTlUH5f/bUinzCQ2sZvc7pe6uhIYoAEJ46wJHhTU+3O8PwT93w6ZCg6j8cn7EjEfDvi3 yT6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NYb5f8st; 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 u21si2035377pfl.143.2018.04.10.05.32.51; Tue, 10 Apr 2018 05:33:31 -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=NYb5f8st; 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 S1753091AbeDJMZs (ORCPT + 99 others); Tue, 10 Apr 2018 08:25:48 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:44508 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752692AbeDJMZr (ORCPT ); Tue, 10 Apr 2018 08:25:47 -0400 Received: by mail-pf0-f194.google.com with SMTP id p15so8155042pff.11 for ; Tue, 10 Apr 2018 05:25:47 -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=XkhWC1mXrf47NnzCsmK4TQu16CLSp/EQI0XGFTMDFNs=; b=NYb5f8stGspWTirykNDIrh2JXHPPpCr41swlvV9wKa+V3qZCu75ubEeIFDOY6rk7/5 BfQmd3uE5P0e6u7954YzV1dic5cOc1ZqvtN9BpkTCu8D5nq/UpV2JsY/NLUWUZarPXsQ cdAwbc9tLgKq/d6Qk6R4TDVvvzKO7fFDPvti32x9985REj6T4ZJDWTvQMJC5mRZF3pKG IkccAEupYXddkqY5OPk50RXnhEE6F8JRxqcrb/t30JNPNMV8vrqiaUbPdZkNf6xqJKoi lUyWHOd3wf2otafJcCW2UluOiE47dZiHKIl6WkjgQrf4JdgHxxgOhX2206gxm89jTBIq 7t5Q== 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=XkhWC1mXrf47NnzCsmK4TQu16CLSp/EQI0XGFTMDFNs=; b=oD6afDJy4XPda8smbCy6dBRSpbih/OFm6MrurVCyNL6Rp80mUHR2O3bnsrJyL65VyN hiApM780hLlFx13CKlAb/VaS7dp2V622BXpjGFhebjU6igPq+1KLPiVNgUidDFVYuXfM xr5j4lQXzi4Qksr4efJP1f5t9FRaEb4K6R+JGbbYAWQ38+c4lBlytFpZ3unfYFgow+LS RRSwPkGzr/zfXJcYDtWzykMuo9ybHmgDg6rdAyQT3X6zQZ8ams4LQq/yBPC5d/w9u9ch eMgoyqJD+xAitQZpUgkfmACbYo7W6vMByUt77hIjdHTp2zIgqynlKUr/O87HMctKUmdr jcLw== X-Gm-Message-State: ALQs6tBzacNlbNzo8C6sXD6bwaVgpqlJr/SD6lBHLUROa1crGzo8qHyx HONYZiPYL79JGjI/TmAXDbQ= X-Received: by 10.101.69.198 with SMTP id m6mr154290pgr.244.1523363146899; Tue, 10 Apr 2018 05:25:46 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id r70sm6244233pfe.22.2018.04.10.05.25.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 05:25:46 -0700 (PDT) From: Jia-Ju Bai To: gregkh@linuxfoundation.org, tuomo.rinne@gmail.com, colin.king@canonical.com Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 6/6] staging: rtl8192u: Replace mdelay with usleep_range in dm_TXPowerTrackingCallback_TSSI Date: Tue, 10 Apr 2018 20:25:34 +0800 Message-Id: <1523363134-31050-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 dm_TXPowerTrackingCallback_TSSI() is never called in atomic context. dm_TXPowerTrackingCallback_TSSI() is only called by dm_txpower_trackingcallback(), which is set a parameter of INIT_DELAYED_WORK() in rtl8192_init_priv_task(). Despite never getting called from atomic context, dm_TXPowerTrackingCallback_TSSI() 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/staging/rtl8192u/r8192U_dm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index e6f8d1d..51b2516 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -538,13 +538,13 @@ static void dm_TXPowerTrackingCallback_TSSI(struct net_device *dev) rtStatus = SendTxCommandPacket(dev, &tx_cmd, 12); if (rtStatus == RT_STATUS_FAILURE) RT_TRACE(COMP_POWER_TRACKING, "Set configuration with tx cmd queue fail!\n"); - mdelay(1); + usleep_range(1000, 2000); /*DbgPrint("hi, vivi, strange\n");*/ for (i = 0; i <= 30; i++) { read_nic_byte(dev, 0x1ba, &Pwr_Flag); if (Pwr_Flag == 0) { - mdelay(1); + usleep_range(1000, 2000); continue; } read_nic_word(dev, 0x13c, &Avg_TSSI_Meas); -- 1.9.1