Received: by 10.192.165.156 with SMTP id m28csp150209imm; Tue, 10 Apr 2018 18:34:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+KAoFpuOyA7K3olLEet04xAJ3bQa+TdOSiuI6H2rm88jEP+/isTc1xlpC/fEHSlU9J5TT4 X-Received: by 2002:a17:902:107:: with SMTP id 7-v6mr2802247plb.374.1523410483497; Tue, 10 Apr 2018 18:34:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523410483; cv=none; d=google.com; s=arc-20160816; b=SuP7BJQPG0iSfDRCsoF1c5Yf/coZahhVGS+SQo5T+2tDfPn5307DY6T5FM21jduZbe g2HYWpJOxzALhwHPo201r2SPhAfSa6ukpHxbCW89mswUqTqSXfDLDpznI5dU4uu9CvZ9 8TsQp/Sye2cCYhSMZEVAeQhhxl4WsrKNsYznOS7hcokjSDCLYLObX/cM6KfS8nhy2Y1D Ej4mkgdoyoJAJnESV0DkPjoh0/5neeaKkAIzsbZAJor+oDdgAzwRg6QmCqccSDGjey1k npBc38FjByjS+LV9fcYTjmBCm5gadTghtLt4NaU/BbJ+dZ/ZaB5wY0a25kQomb3HiziP G5BA== 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=Fg+tmeKFl8IAygHKbOOpqN9NBZ0+PA9KUsrfpdxySo4=; b=X059cU1BlZ5TignQxf2AqIAR0Y+zWqUhYop0PcAb/XAATUIsqQ1kIRo8uVF9zFqx/g sXgH32PvJUdiRkLpKH+SOqJZSFhHFBSJFx/zRtxSfGpMP0HSO7+R9TS1jPmgPyR8eDss rKBtzWRqaENPe/yptwTatfcbT+/fxy4YcXC+7Dq7KrK+fcVxKGnezwHTKqjkM5G4uzHf f1JvP6ED6QA9ZO5yrS5UMMbFxGV2zmE5+5HFaeOGZ3PntxaO8Aity3FYmVLg1jtLyfq3 tC6qK5ZpOXJd75U4ydm2ntcIiSVrE9Hq57vi4Dkuy4mKJDw3iYIfO3/Ybw+QcR1CjXC0 baNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bQdYFr0v; 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.34.05; Tue, 10 Apr 2018 18:34:43 -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=bQdYFr0v; 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 S1752627AbeDKB3o (ORCPT + 99 others); Tue, 10 Apr 2018 21:29:44 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:39703 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751946AbeDKB3n (ORCPT ); Tue, 10 Apr 2018 21:29:43 -0400 Received: by mail-pg0-f65.google.com with SMTP id b9so38200pgf.6; Tue, 10 Apr 2018 18:29:42 -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=Fg+tmeKFl8IAygHKbOOpqN9NBZ0+PA9KUsrfpdxySo4=; b=bQdYFr0vtN4tjulVjjz7q3cxElg9wtg0t4gI+AcK5DRRgvTqmmZIYiLSPjYC6FwNga WubThh7J3HzOJLCRuhPvt6TYiYpBTmgFHnxPHA6sPnd0EAPt1dHqdtUIlSYhPkKFUoFB ASGhuHZXwI1ibLEgdRFGR0Iou04prqfSP1PBmY1lwdCGY/Z3H3pF5qr1D8hnfMTAAVHd Dk6C2gMXOsir+ZxY13wVZddEjP+2VdIoTxCgdhj2qXTXmg7AqjAZmImAf0jh3dnEYWZW sh78zo8Mlu3QM2nMqktCzSU0MYOdOfwp90ne7PMRiXizf+YFi4AdxUzW06neC3YsQ+Ha K9TA== 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=Fg+tmeKFl8IAygHKbOOpqN9NBZ0+PA9KUsrfpdxySo4=; b=MbnsL9wiBxrTsxHfoPJjKJb9eYxDqYBW64awvTF2h/D9NCp7V2ZohFoGRCKMKEC5Ki 2gYbqQJr98CH7+oZY0rP8otsn19wQrY60k6x+zn54TGcZiwBkdUAYWvdpHSe7bntREU/ 99ugxLiAqo1PlPjtYwx9fmEZDykMtyW7nAsWVjHAtZ/ngCueI1UFhtM09ZW7n7kkcnRw 9UUOh8NsMEPpzJqH1l9agKrflAAhDb+yg/iF1qGwFGtRW+QZUcpd8bJDTBegYHsVPgpW pqa5WTIqizR0mKLfp6M7hwgGvfuwlK/lkEbs8YynBqIv3sv8HFd9t2rVlQS5ZZaqvhUi hofg== X-Gm-Message-State: ALQs6tA+a31N35+mt18Io24wzRVXY5u14cnjqkQSEh0pjvL77yndKKFx EerLqShD77qT2V7cxtSgXwQ= X-Received: by 10.99.95.22 with SMTP id t22mr1923427pgb.315.1523410182599; Tue, 10 Apr 2018 18:29:42 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id v1sm10519pfg.144.2018.04.10.18.29.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 18:29:42 -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 1/2] staging: irda: Replace mdelay with usleep_range in stir421x_fw_upload Date: Wed, 11 Apr 2018 09:29:34 +0800 Message-Id: <1523410174-1553-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 stir421x_fw_upload() is never called in atomic context. The call chain ending up at stir421x_fw_upload() is: [1] stir421x_fw_upload() <- stir421x_patch_device() <- irda_usb_probe() irda_usb_probe() is set as ".probe" in struct usb_driver. This function is not called in atomic context. Despite never getting called from atomic context, stir421x_fw_upload() 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..c6c8c2c 100644 --- a/drivers/staging/irda/drivers/irda-usb.c +++ b/drivers/staging/irda/drivers/irda-usb.c @@ -1050,7 +1050,7 @@ static int stir421x_fw_upload(struct irda_usb_cb *self, if (ret < 0) break; - mdelay(10); + usleep_range(10000, 11000); } kfree(patch_block); -- 1.9.1