Received: by 10.223.176.46 with SMTP id f43csp1938218wra; Thu, 25 Jan 2018 02:23:03 -0800 (PST) X-Google-Smtp-Source: AH8x22712+e+IxrLX8yF1s6Y3D/rfDCxVTPeO/vp2ErxYPqOwC+eQ0PSW/FJufmpHe8hle+EJ7oU X-Received: by 2002:a17:902:5509:: with SMTP id f9-v6mr1473924pli.83.1516875783736; Thu, 25 Jan 2018 02:23:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516875783; cv=none; d=google.com; s=arc-20160816; b=mYBBA2uJzOPSTBmzlOlCQW2K0iISC1gDAkxjSdSDKG1ENqwDHVC3PsfRSsc6vfy3xW 82l9F9mBr1ritzwkGlquKxTS54SPamUZskNFJeK7T0DyLX/2qYYXUlgcQxODOJ/FNX1w 9Ek4T3WHp8EUD57HbsP9GLG64DxmfrUkfeopemntkcurrYng3wFjlaqFMJSYi1RkzHEc Zkwo7iSIryhGmn7EeNll3a6A2Ba+g0M2zTqaRPhY80okac0GtFzoD+CdNFy1pl+ZUevB MuAlmZeKIaLW/t8SzSRE3ydd8FjfnlV+oNDEt0w8v1jKIvgvmoZ7Jgm0prAEY+yoPI9o zRaw== 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=0/k15gvHUENr6iEc7HNDEt6+upGzOWLFrVUN4q/qO+Y=; b=TnderljqU7q9Be2iVV6bbtJ8Hfnq0013AtEDXFBp4P6cm1iX4VjbKnY8WijZ+xBfEb v46Un8Bx9FPmpL3+0u9etkB2Uo2BedNGcC6yX2wRP9PDN1L1uWuvV8GOjsPEm/7wovRn sYzyOBgLv/n/St60WYTGbXBXTpWPDJCEdr9JWum8mSl+xl8IH3WNzMaymUCQCwKYCrwp zrP0dP4j7W/lu3OlIwPRp/NhR1onYlWlrlWXWuh/IIota9RuVmv2LkE1FgmTI78151H+ KBbsTftHEbn2UkZu9LCi3ucbPzsFdgMygGnm13Ee74eYbqhi3fotScWWagjbxEDFvuXK B3MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PTE6Gosh; 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=NONE 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 k11-v6si1737200pls.631.2018.01.25.02.22.48; Thu, 25 Jan 2018 02:23:03 -0800 (PST) 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=PTE6Gosh; 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=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750937AbeAYKWY (ORCPT + 99 others); Thu, 25 Jan 2018 05:22:24 -0500 Received: from mail-io0-f193.google.com ([209.85.223.193]:44901 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750769AbeAYKWV (ORCPT ); Thu, 25 Jan 2018 05:22:21 -0500 Received: by mail-io0-f193.google.com with SMTP id z6so8098844iob.11; Thu, 25 Jan 2018 02:22:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=0/k15gvHUENr6iEc7HNDEt6+upGzOWLFrVUN4q/qO+Y=; b=PTE6Goshe6ukm81tap1Im4teIdSdg+a3mSXxfO7a0SWWsGH9/PKJIpWUmkXaea8zXr Qc/OyoO5ykgOmzROVGHVePlFIgfch5D5VG1lDNp0ny7JnG2pzfvoFoAF+lNDsY1iYl+Q f/NNQtTp1P2+OCso8ksW8tRX6nXo4gtjd1IvjPxWCDozOVitiC6+mPPkCWQ3QDeHIx/B Ru2aOEAM8zlKMDhqvXKs9MX7jzGLQOLAh3WEEpSQUWN9OaaoOz+qdqpZ28B5qwqKSOmf xvGUH4Toww2tQhtYdzsV+sednVEBCtn9vuq1506eYzZTQiXGm/mtKNPXKo+zWx/tD9Lj /fkQ== 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=0/k15gvHUENr6iEc7HNDEt6+upGzOWLFrVUN4q/qO+Y=; b=drkOwowWysjxA7uzHnmuGlABmleFdYOu+Cpcu1/soYIX+2Jhw5jq+tempcSvIEltKZ h/vp1CiQ789FNsOq9eDFEp71QRZMAzJFFAOx4pIGXjrGjEBppRH6/FzPACXfD39SvVIj aTOvtoP1DgRNydEtXNn4D+rvajA8lLe+a7PgIWHIMULN3vRADN04KM0Fccv0jE8XVD7O kvEszHZwAQt74CHWNwgmuIAQ48X+xexdK/GG6fQfJ6q28/4pta4ViruBux49Fq8Ak85a UlQx2ETIhj422Jq2XwwC9pTrQm5jd8ApA/Pni3qHCBmbUem9LdnOUFnTTAKYnykKDGUd nbpA== X-Gm-Message-State: AKwxytf7TZ30P2Yo+lgzS2A6APiJMALNuGQZt3HNmTbchujBe7C+cy6S WkRMeK2EIiUinrNxO5EKBjk= X-Received: by 10.107.128.232 with SMTP id k101mr12818872ioi.152.1516875741233; Thu, 25 Jan 2018 02:22:21 -0800 (PST) Received: from bai-oslab.tsinghua.edu.cn ([2402:f000:1:4413:9980:256a:8e6d:5903]) by smtp.gmail.com with ESMTPSA id m34sm766648iti.24.2018.01.25.02.22.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jan 2018 02:22:20 -0800 (PST) From: Jia-Ju Bai To: tj@kernel.org, mlord@pobox.com Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] ata: sata_mv: Replace mdelay with usleep_range in mv_reset_channel Date: Thu, 25 Jan 2018 18:26:52 +0800 Message-Id: <1516876013-12653-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After checking all possible call chains to mv_reset_channel here, my tool finds that mv_reset_channel is never called in atomic context, namely never in an interrupt handler or holding a spinlock. Thus mdelay can be replaced with usleep_range to avoid busy wait. This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/ata/sata_mv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index cc208b7..42d4589 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c @@ -3596,7 +3596,7 @@ static void mv_reset_channel(struct mv_host_priv *hpriv, void __iomem *mmio, hpriv->ops->phy_errata(hpriv, mmio, port_no); if (IS_GEN_I(hpriv)) - mdelay(1); + usleep_range(500, 1000); } static void mv_pmp_select(struct ata_port *ap, int pmp) -- 1.7.9.5