From patchwork Wed Apr 11 02:57:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia-Ju Bai X-Patchwork-Id: 897011 X-Patchwork-Delegate: boris.brezillon@free-electrons.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="KZiA+8Tm"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="h5Ihw3En"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40LTJN0lpZz9s1j for ; Wed, 11 Apr 2018 12:58:40 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=pwkQK0x8fOI+6TYcMDzFnpH81MDKemc4VnOtD5XulZw=; b=KZi A+8TmuYf5iMz6m+HJv7WH8KxYK+wAmqJOCD2dzTOlvlysoIfCz99H9+yHuP0cAvJhcfre244JOxYb NHBLQBgccsWWkFFJjbpArJYn1nOi715BNr9iny+jVE2mz1ajO0NIobYpOSRnV6qm//xZgD1smbH7+ 47Ni6EuGimGhcP37Dd4SGn21ytrp5fdQ7U27r58BQckUp1XtnWDQPcaCoucwMWFgleb5n5s9HzRgn cnZBEHDrtbd0bBoHi45JgXEh8IO1JcRH3hpR55mZzjAyJTpWo/csowIP7UYgi09tk5/U3Pafm0bqd oUG2crOcfHZABQC/+e6kh4XmYIAB8+g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f65xo-0002Pj-Dk; Wed, 11 Apr 2018 02:58:24 +0000 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f65xk-0002Nv-RW for linux-mtd@lists.infradead.org; Wed, 11 Apr 2018 02:58:22 +0000 Received: by mail-pl0-x242.google.com with SMTP id t20-v6so296841ply.9 for ; Tue, 10 Apr 2018 19:58:08 -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=4LaXnGuSrOn6hNH8034nHfGrkxYQoIEoO59doFGCDaQ=; b=h5Ihw3EnOTrPljdRpioXT06DiM6L4oyCWgngOv9jw+krvZH8gu0unu64MUY3p1fgR+ jzAw1F2WnkKlYJMoQxNjCV1cQg0/S4jcc6+7/kS5Uw4KAvyzL0ZcpefayVarTlbWCzas et5NhB1V+aeI4HQMdNVwWQniexdmM5s1HjrPs5qPOmQLOoRZAZkq5X6N4VvuBbGSWEBi xQ+TtljHzo+QAQA15Y9hQKT5OAkCFSqSHY4MoiDxQrpyn6l6IO7iBIAU/aoUR8DYyYaX 159peHetL3WOMx5lWmPAoqcR5+1JCzk+BVfGd6faSI19/HwwXS7R4iUjJmscbTZGlQy0 uczg== 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=4LaXnGuSrOn6hNH8034nHfGrkxYQoIEoO59doFGCDaQ=; b=Yt+ulwHIm4nwfdHK+klCY7ZhBeXEz5jT98g70ZcdWzd+60QSRQBFTNNJp1onyt3Sd7 +Uw0KjWHdbSGl3bpW6LmhIx4tCR2Iu+bLE85iIMqlTNRRKUG3DufA4yi0Gbe8fKqxrjb QxnCjCRPSf3buqekmnLrgOx4Dn4LkkHONr4VnJZgNJaHQoEEnOAuy13BvcDwCC4mHIXh f4R68PWxssqDy0xR1iDdT2uWFptNFG16D4HYRS6TJNgs8J2QXMwuQzugXBEPWOo5TO1C t8PVn+DTLaoq/6FpwqaQ8wOxVTHypI0K70a/mU4XFicD1DBH5aIEwhCu1lEarhKQZYeV pQJQ== X-Gm-Message-State: ALQs6tCK3L6n3nDleNe5b98L66De5H1ypkwA1GYbSVD5hMwP9vVurrws fi8MsK6o4URQUP277N3EIUU= X-Google-Smtp-Source: AIpwx49Y6VNLGqellRabbHY/EzMcqGU19KXm2cls+0e/RaCVYf/3DMVTdHQ+opUH3vu98cKNRDq+YA== X-Received: by 2002:a17:902:bb81:: with SMTP id m1-v6mr2991575pls.71.1523415488491; Tue, 10 Apr 2018 19:58:08 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id 73sm154246pgg.73.2018.04.10.19.58.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 19:58:07 -0700 (PDT) From: Jia-Ju Bai To: boris.brezillon@free-electrons.com, richard@nod.at, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, cyrille.pitchen@wedev4u.fr Subject: [PATCH] mtd: nand: diskonchip: Replace mdelay with usleep_range in doc_probe Date: Wed, 11 Apr 2018 10:57:57 +0800 Message-Id: <1523415477-2850-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180410_195820_933871_3BFB04DB X-CRM114-Status: GOOD ( 11.94 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400e:c01:0:0:0:242 listed in] [list.dnswl.org] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (baijiaju1990[at]gmail.com) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (baijiaju1990[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jia-Ju Bai , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org doc_probe() is never called in atomic context. doc_probe() is only called by init_nanddoc(), which is only set as a parameter of module_init(). This function is not called in atomic context. Despite never getting called from atomic context, doc_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/mtd/nand/diskonchip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c index c3aa53c..2679bc4 100644 --- a/drivers/mtd/nand/diskonchip.c +++ b/drivers/mtd/nand/diskonchip.c @@ -1482,12 +1482,12 @@ static int __init doc_probe(unsigned long physadr) WriteDOC(tmp, virtadr, Mplus_DOCControl); WriteDOC(~tmp, virtadr, Mplus_CtrlConfirm); - mdelay(1); + usleep_range(1000, 2000); /* Enable the Millennium Plus ASIC */ tmp = DOC_MODE_NORMAL | DOC_MODE_MDWREN | DOC_MODE_RST_LAT | DOC_MODE_BDECT; WriteDOC(tmp, virtadr, Mplus_DOCControl); WriteDOC(~tmp, virtadr, Mplus_CtrlConfirm); - mdelay(1); + usleep_range(1000, 2000); ChipID = ReadDOC(virtadr, ChipID);