Received: by 10.192.165.156 with SMTP id m28csp152283imm; Tue, 10 Apr 2018 18:37:47 -0700 (PDT) X-Google-Smtp-Source: AIpwx48wwwI5r8OEdr1lZ0Ud6V11NmidZzlIBH1CTimFbGThQ0nc40NIms6pWakXJ14bwJAJ/9UW X-Received: by 2002:a17:902:d685:: with SMTP id v5-v6mr2809310ply.284.1523410667780; Tue, 10 Apr 2018 18:37:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523410667; cv=none; d=google.com; s=arc-20160816; b=LEB+CTq59LWzyUpd4e9iOuxDPS5P8Azgl7DZxLD7dcMIV5RaqD4sUXVmOaayvwlYsU p7bDCDR/SOQZKSnt73OTTFSu1Qq4U6tSjOxhagBo/tOe2JqjyfSTzIje6cewmfrBwfyq JiRO7DLYtVZbpR0qZM2ksZ28/h0rJAyrqiWmdQxy7u1dDTWdjsnxx4bzZAlioUTZTT4y fL7wfo3aIthE/yTGbMSzF9Yw4UDYDkHjSNg9KZFBS1crXAR1Z4qTbFreO7l5DzyQitqO 82opJsH2U570OmjjKRvJhifs2fw4JbD7dzklMMh8x+udFyVgXoC/r3g7MT9V2pi8tinO Fwcg== 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=sKAguewKn861qBbj+ygZ8XBDSoRTqmXB9TLs66cnqZE=; b=neFqES57QNivHCLDQh/rGo8EDLUqx8bIzjnZsQnokTw/rercNpV4mmpk82XM0oYGqd 21sPoptZQ3ofIqX3tXwo3jiw7V8k97w57UGVQoWs5l7quAZ961ujWx74YWoxK4XHpMex tp08BruP9dSg+h7GhwoVUo0ct1/5ZmEcFMQe7WsJEM2xBG5lreOFZbm/xDpcs8y2CmgA 464kHyX37qgO+ijG+WZnwQJuI2vbbBq3KzlBdY0LpGy0PlsXU7U9aPkU6QVHKZcMHXGD lJrAKcY1TyKX/C0iDWTVNtlxSIqiACEJxCzoc2/S7i6c49YLNcshmjE6jOyNOW01M17F fNYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kxIDnjGs; 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 u20si10125pgv.12.2018.04.10.18.37.11; Tue, 10 Apr 2018 18:37:47 -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=kxIDnjGs; 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 S1752591AbeDKBeE (ORCPT + 99 others); Tue, 10 Apr 2018 21:34:04 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:34256 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752016AbeDKBeD (ORCPT ); Tue, 10 Apr 2018 21:34:03 -0400 Received: by mail-pl0-f66.google.com with SMTP id y12-v6so177532plt.1; Tue, 10 Apr 2018 18:34:03 -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=sKAguewKn861qBbj+ygZ8XBDSoRTqmXB9TLs66cnqZE=; b=kxIDnjGsnNYOVhPRvGScGJe7NKDGd1h25O5UwxKGD1gz31eziLw9/2uPzUBGhe0SmN Dgklh2bWBAunJzjuZPaKxyGXtKCQojcDrmdxR5grAMmteDej6Vdn1OOKoOF/qCbAbuYY cxl2+o/eEyTk8CM5jtrS0jMewHOsByzRKo/KM2/58jZOnEtcccvsIFMo8lWGdMkCh7A+ X4cPYF1kneUBb50Ev3xy0mcN/RhYjhRPWLFZKe8s25w8h/WpubPNLyDqwExwPZSQKDBb mzJpgERtFkItzJ9KXYJaDXpEhcLvEnjG2MksDGZnp2fczFHDPSR6i+waYKLdC3APaheZ 1vow== 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=sKAguewKn861qBbj+ygZ8XBDSoRTqmXB9TLs66cnqZE=; b=akaLVOHEBLLklWrHzWGWkHAh7rhJAvToLmgMV5361lwY5+pmpxibmgWUhxv5uL6ku/ n0y9SNJdpmd1DOxWnW5ng67fED8xNz//OTc497CtZ15Gi2Dbfzt2+CllOv2eKdjrkKBO 3LH2QhbaKBjYiBLg4mYV7IKgFB7AmwUiGNtcmaDHi/2qGsKNxD0hUw3Ep6+GKt8EELdt csvpAK/5yjz6Q2sVDLMiFIfhtye0Z7KpURb86TOsSn0OD3aBkj+kB/FWTOaU56EFpQk1 iTy75gErqs89UbD4/DX/QJhRVwXQwM/2FF38WaZqOKDLH9C81Rj4MOEyDMpgB0XIGzUM 1ZLA== X-Gm-Message-State: ALQs6tCegw+USs/A5eE2abGbw+wfDf1Z8ywp3MwoJFisuFNsy/Sj/Uw7 FEmLRIAldThIAjhxoNZzvD8= X-Received: by 2002:a17:902:9a86:: with SMTP id w6-v6mr2803340plp.168.1523410442802; Tue, 10 Apr 2018 18:34:02 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id c186sm43387pfb.40.2018.04.10.18.33.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 18:34:02 -0700 (PDT) From: Jia-Ju Bai To: samuel@sortiz.org, gregkh@linuxfoundation.org, davem@davemloft.net, johan@kernel.org, arvind.yadav.cs@gmail.com Cc: netdev@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 2/2] staging: irda: Replace mdelay with usleep_range in irda_usb_probe Date: Wed, 11 Apr 2018 09:33:55 +0800 Message-Id: <1523410435-1693-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 irda_usb_probe() is never called in atomic context. irda_usb_probe() is only set as ".probe" in struct usb_driver. Despite never getting called from atomic context, irda_usb_probe() 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/irda/drivers/irda-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/irda/drivers/irda-usb.c b/drivers/staging/irda/drivers/irda-usb.c index 723e49b..6ff5b08 100644 --- a/drivers/staging/irda/drivers/irda-usb.c +++ b/drivers/staging/irda/drivers/irda-usb.c @@ -1710,7 +1710,7 @@ static int irda_usb_probe(struct usb_interface *intf, pr_debug("usb_control_msg failed %d\n", ret); goto err_out_3; } else { - mdelay(10); + usleep_range(10000, 11000); } } -- 1.9.1