Received: by 10.213.65.68 with SMTP id h4csp3567810imn; Tue, 10 Apr 2018 00:41:25 -0700 (PDT) X-Google-Smtp-Source: AIpwx49p81O4TCEIIrg3mze9Ey5KOIloZitLFqqlIJPveRbqWPLdTDMcdDGh5yt5So/jUGdT5bLv X-Received: by 10.98.253.9 with SMTP id p9mr1827891pfh.152.1523346085086; Tue, 10 Apr 2018 00:41:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523346085; cv=none; d=google.com; s=arc-20160816; b=iWWWdDocGGR/3k0TMm7Hc48mGC3ZSKDLnSSkP4hbNN4Gg7t5yNQmPgUfQXXXltoAHc mBIrjKPML7RMySGhH5jyKJGoA1gMp9du6hCKO58Oc6AXo5KhVFFWu40/KQfQRmN2GYrN 5xwLkoOeWCfqpaVV4OcrdlbVCEXMHFIQDdsSq5pmq0Cf2xn2gVE8sbDf8udYtuTUNFzY +6zFQe19l+VIunupWmaCjTuzjLksBzj2nUQw93Kn4U4V/CAwL1jPdOIRK3p8L47pU1n8 TBndDiKioTJAEFH2MKLMJBECvF+Et3j3Sl4FEgTZOya5MHYXwzFXp1aJmvkbl6Kq0pM1 v8Lg== 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=Txo0e/JHkCxdHs5S37UO3VKEo6k1XCej/Rq+JxKzG2g=; b=kMOAMwisAYAPVJnp8U/ndzsZRGw9a0wEjZbioMSzTVWZ98DBZeWUB1NMAJzG49ISlF x6CQmUfuR8SSix2aLJuPS+oMsXoSxsBllpbTBR5zWJWLMA+uQsIyUA5pzFGS6USSRt9O yEKg9m+J+4PunZLsDm0TQWYSCrRzYP3wSrpZDc2ZK1mOGV9kqNeWLDnZoKOmy1Zmp1tJ kEWcWWK/ihQ63V0pETFUqVGs7ISF0XSDWSYbYEgxbSzk+atQk/Y8eCw2bNKcNQMNV6l8 eFt8j4ciQ7kcSuOuMTBK+Hi4gDnKYKc+3UipEVfkN2xRqmT2UX6DTjMC/+tcYC5dY/LD +8eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=DfD253Ij; 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 j1-v6si1969054pld.108.2018.04.10.00.40.48; Tue, 10 Apr 2018 00:41:25 -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=DfD253Ij; 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 S1752432AbeDJHhN (ORCPT + 99 others); Tue, 10 Apr 2018 03:37:13 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:46446 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752371AbeDJHhM (ORCPT ); Tue, 10 Apr 2018 03:37:12 -0400 Received: by mail-pf0-f196.google.com with SMTP id h69so7563341pfe.13; Tue, 10 Apr 2018 00:37:11 -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=Txo0e/JHkCxdHs5S37UO3VKEo6k1XCej/Rq+JxKzG2g=; b=DfD253Ij/YyQhKNfvICEqe7aAqWek6Ke9+sdQ7asEPRgDxBkx10Npkxk/8BphW0uID jnQIV35ZstDRBrPP/LMPl2D5zifkPsVpD5GTqUVUqs+ugERKtAE3hS5gpRhQWkU7utFn cjkYLG725lGYKQZNQtKllTJnDuST1zpQ84gPT8NqvrWSGmjj/RryECdevkPS1f3XOO7P dhG5pxCtyjlyEkP/kWG3UzB1E+joCQcam8XPrGtA/w20owIKUtVPONA6U7nlK9XVNs3i Jzv0ldccy2/O7Gwjvl7J/RcKy8dQRxLwUmE1fq/ZeMcl39oMuo5e6xiHyROBI6rQ93G0 Qd6Q== 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=Txo0e/JHkCxdHs5S37UO3VKEo6k1XCej/Rq+JxKzG2g=; b=gPk78r/Sfk0Y/PBeVHrI5WigOK8Kn++tpyrwys1wdpSj6eN74plcKjdpPt24s6xYzA 3kzK4cAhA/VI5bUE0lqnw995qbPHZFCmtMDTZ8kAfWS4Y4dyZfdQIB5pR18nphXYR1+f fRxBmrw1xEOd7K1awjvOy3IwtM7Rq1n6Z31f17WRREhVxxMbWI3cvNpt20Us/ovbfvUd JN4bpGJF8DNSo3I1YL7HRyhEdxLCPT09WMUnivmc0ysWSBr/7+t3Rsj8lhHEA+Oe6zvo HD7PKpsy2KhPoAzSs+1GF/cK/ne5n7TT/fjklUxegp6ex1AgQduYLLN7xh8VvLriPjYy UTtQ== X-Gm-Message-State: ALQs6tDxCCCzCKrwikh+mqQKqWv8ZJMByfqNKao2RqnwWcwB18M+gWAS NE4iEr9rsBJeHh0SUGmh4TU= X-Received: by 10.98.163.153 with SMTP id q25mr1830224pfl.189.1523345831746; Tue, 10 Apr 2018 00:37:11 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id x3sm3019871pgv.86.2018.04.10.00.37.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 00:37:11 -0700 (PDT) From: Jia-Ju Bai To: gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 2/2] usb: isp1760: Replace mdelay with msleep in isp1760_stop Date: Tue, 10 Apr 2018 15:37:06 +0800 Message-Id: <1523345826-29223-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 isp1760_stop() is never called in atomic context. The call chain ending up at isp1760_stop() is: [1] isp1760_stop() <- isp1760_shutdown() isp1760_shutdown() is set as ".shutdown" in struct hc_driver. isp1760_stop() is also set as ".stop" in hc_driver. These functions are not called in atomic context. Despite never getting called from atomic context, isp1760_stop() calls mdelay() to busily wait. This is not necessary and can be replaced with msleep() 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/usb/isp1760/isp1760-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c index 8e59e0c..5599310 100644 --- a/drivers/usb/isp1760/isp1760-hcd.c +++ b/drivers/usb/isp1760/isp1760-hcd.c @@ -2090,7 +2090,7 @@ static void isp1760_stop(struct usb_hcd *hcd) isp1760_hub_control(hcd, ClearPortFeature, USB_PORT_FEAT_POWER, 1, NULL, 0); - mdelay(20); + msleep(20); spin_lock_irq(&priv->lock); ehci_reset(hcd); -- 1.9.1