Received: by 10.213.65.68 with SMTP id h4csp3832870imn; Tue, 10 Apr 2018 05:30:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx484b0wzQH5jqOHoWz96jvM0gM0CJeBEca1QlRMPllqlzcIeVcu3O7SwY1NYtQQb42o/iWV0 X-Received: by 2002:a17:902:2a43:: with SMTP id i61-v6mr260230plb.54.1523363416892; Tue, 10 Apr 2018 05:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523363416; cv=none; d=google.com; s=arc-20160816; b=aUYzFPM8yRbYU2dQktJ1o00WMLuNxlh9hQzBEo2KrzhLPrNe2iwv36LUMGjm+yX58z SIMa26StyF6zOX6boOc990E8Ag0u60W0DIZ8ol4rYIFMf9LAGx+n9xdLzav7EG+o9yA7 RRcDKM1HyrS7+L2TbLiGITlmLXwkxpT7aewm+3yNs2wsymLhZTqEA5d3HHDBaE3ODznI 9RY7fZtdrzLkoCxRel4+Lo5qy4W05pVLUbVCIzNe4qgHuraOAmiYZpOxh02Y843cjA/G u2ACQI3bXX2PxFWKVHlYJFvzX8XIkgseX9TPF8ZQxhL9SkisdXT2QnS9LoG9RlzxI4GH hoRw== 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=GXlhfKuzbYCbyTVVUpE1A9ELkNae5SIkOFQC/f5nI0Q=; b=lveMMeq8aHiNSzMLuog8cJCTDcAl7a4hTQ07+vSavHbAKaruFQkwuOljYcHxVHEWRw lFLLQKYgwcXB9EUmwvOJo+koBHF1WhNhFKs8TxDfqn4wKW8pkdzjeiILYSymxiw9BAXY ZYO/BvQewXQ/VMbuFjx2oJHhYKz1bGYdTfZlh0tzwva/1e/Gj/LqOHTb2X9qjur7QsJv Aptmviyl8pAPHsZXtn3800iOjPKtMO1lvvIOUQJZECgiR1wBEQA4E9js2QhqWWzon+fo ZqwlyxA16QVk8pEeIZWlJPJvRY53XG6Vp7h4+4ZseNYPtobLPCsL2M1Wk4AJaaM2N30Y nIfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PbiiStuD; 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 f35-v6si2543831plh.691.2018.04.10.05.29.40; Tue, 10 Apr 2018 05:30:16 -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=PbiiStuD; 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 S1753056AbeDJMZV (ORCPT + 99 others); Tue, 10 Apr 2018 08:25:21 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:43762 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753037AbeDJMZT (ORCPT ); Tue, 10 Apr 2018 08:25:19 -0400 Received: by mail-pf0-f193.google.com with SMTP id j2so8157868pff.10 for ; Tue, 10 Apr 2018 05:25:19 -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=GXlhfKuzbYCbyTVVUpE1A9ELkNae5SIkOFQC/f5nI0Q=; b=PbiiStuDYfkphGEHXGll97YX7kc2VBHns2fwwqGoF12p16dG6bsAoYC0G09qUO1WT9 UYr4Y4P0qbVOt2GYd5k3vtat/lDCzvT8tp0ksRi7WLKdthpOl29goieH/37+DDe0AZ3z VxuIONU7P46EFck7zGQRguC8t/TW04OpXQUjJdtacLFYk6WKZX63abc5gAMGyWbfCHdZ RTofOVQE8l3jD05TaM1BW1mH2AKcIe68qYxU1QCIrrH68Jp29kaBQTjyp1ksxPZghCf4 QXaMJ2Uub5aUyKwgnqvfSb10QH7Okz8rybNxNPC+CcyaFnFmCoXj8ee+Ypfw3qyVHAAv ogag== 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=GXlhfKuzbYCbyTVVUpE1A9ELkNae5SIkOFQC/f5nI0Q=; b=qde1LcJg/w239jFneO7Pxrwk7/lGwb34m0Eh8uOd/HUeVxjMLxeIYHUNuJdKkEMyW/ pl/a3gP/Z1PMrbcTigCtAGwllqnB23Lh8cSbjnQsQkaR67tvQp2qpg7dsiRDHee2kKOz MEpehlLI5plRpcQiQg7ajy/DNb3g1UQBcyQY1ZwJpTWDq6NV28t/KikAF5kvUvub1KD7 P1BrMHRAppCJqPqEMMvGf2cYfqI/8j/GthFVhnrMKCU2ynPj3tzyJA11cDbL7ooGEE2h lBmYIH//mjwJ+NMYLNEZOVfKy9BGxD9pxV/ifk6PEwMXvk7Vf0NJoB2N3oxwUm+U4yQ/ WUYQ== X-Gm-Message-State: ALQs6tD7Ke4ZHu4KB9huscq6CIdD3jXzroUCwotg4p5PqfsJAA7j3ceR /ziSBJgtGqDZySizeFViEgk= X-Received: by 10.98.214.152 with SMTP id a24mr150876pfl.159.1523363119210; Tue, 10 Apr 2018 05:25:19 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id 204sm4958090pgb.67.2018.04.10.05.25.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 05:25:18 -0700 (PDT) From: Jia-Ju Bai To: gregkh@linuxfoundation.org, szekelyszilv@gmail.com, shreeya.patel23498@gmail.com, colin.king@canonical.com Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 5/6] staging: rtl8192u: Replace mdelay with usleep_range in rtl8192_usb_disconnect Date: Tue, 10 Apr 2018 20:25:09 +0800 Message-Id: <1523363109-30998-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 rtl8192_usb_disconnect() is never called in atomic context. rtl8192_usb_disconnect() is only set as ".disconnect" in struct usb_driver. Despite never getting called from atomic context, rtl8192_usb_disconnect() 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_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 46b3f19..04ed34a 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -5033,7 +5033,7 @@ static void rtl8192_usb_disconnect(struct usb_interface *intf) kfree(priv->pFirmware); priv->pFirmware = NULL; rtl8192_usb_deleteendpoints(dev); - mdelay(10); + usleep_range(10000, 11000); } free_ieee80211(dev); RT_TRACE(COMP_DOWN, "wlan driver removed\n"); -- 1.9.1