Received: by 10.192.165.148 with SMTP id m20csp2597737imm; Sun, 22 Apr 2018 10:28:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx48MGTCmM0VVwtBEeMe8HuLsGWb5jaFRFPK0Fst7v7sITjsvEegT953uQ68dLoviM+nQOlTk X-Received: by 2002:a17:902:69c5:: with SMTP id m5-v6mr17767259pln.358.1524418102469; Sun, 22 Apr 2018 10:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524418102; cv=none; d=google.com; s=arc-20160816; b=IXusPy6LGG9ZzL9poYx799yjr+Z9OPZ0zB4tY8uhWVA9KNTfVP1HSDmc2Pad2ntC3H 6XUVHE7kS5wX9GuYPLqPQfdM5WKJFSHNQhuklfqibey29GGT5kYMGaX0vPWxK9p/aJaC b++k8xDakuEf4qlgm3+IEE5GeLK8cz2frd1gIEFL1emcl1S+WtfHlnJhJE5o3ZTiJcyL 5ZWCemvWmmhPCBdvC2eYtjJMEwbE0sabYZmuZizetb7U9umBtIj9+5eYXcWa65NiC0xI TMci1R/dr548gOlGWGj332hlmAgXFPWhoqaxKiDDC+QvJJdY65pA5eZ9A4mjrAjcTw6s qI7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=mQavFFXGB27IC5K+e+8fQN4R38mZNq/c8Xk7S24wHO4=; b=QaCwb5ITJP1piKG9FAGU4ceWy4Xfwk6ANTZ6YoVl43cfnCva3ZSssKUDk1vG/Qs4bM XquzrxADWCQrhPlAUnZdvSEO82dapf3lPGIaIxKOIwWBil6Vhqa3zDg+/UwrHBv0P9m6 RazYSAG2LqI/u44f29P8iL7O7jA2cClxc/vP8Wq/iB8NR5IHlrY3ov/llmTSonkAVFEU Pjbj8kH/7ObIcKZnNn9GmeDXGRWKzuD7wgzGDXdO9ATeHVuiK7hrZ0dEDmOaCqbOZqht YwZGdCH+J8yV0Hf4o0lcDLQVlyOtxLAZiXsVf9bTqjkjh/8uWUXen8gZBvqQESHkQmoU ZlJA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l11si6450719pgn.315.2018.04.22.10.28.07; Sun, 22 Apr 2018 10:28:22 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753390AbeDVR1E (ORCPT + 99 others); Sun, 22 Apr 2018 13:27:04 -0400 Received: from mail.bootlin.com ([62.4.15.54]:46656 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751564AbeDVR1D (ORCPT ); Sun, 22 Apr 2018 13:27:03 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 8BCC02076C; Sun, 22 Apr 2018 19:27:01 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (unknown [195.53.49.241]) by mail.bootlin.com (Postfix) with ESMTPSA id 18E8F2084F; Sun, 22 Apr 2018 19:26:51 +0200 (CEST) Date: Sun, 22 Apr 2018 19:26:50 +0200 From: Boris Brezillon To: Jia-Ju Bai Cc: boris.brezillon@free-electrons.com, richard@nod.at, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, cyrille.pitchen@wedev4u.fr, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mtd: nand: diskonchip: Replace mdelay with usleep_range in doc_probe Message-ID: <20180422192650.45fcfa4e@bbrezillon> In-Reply-To: <1523415477-2850-1-git-send-email-baijiaju1990@gmail.com> References: <1523415477-2850-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 11 Apr 2018 10:57:57 +0800 Jia-Ju Bai wrote: > 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 ++-- Applied to nand/next after fixing the subject prefix and the file path. Thanks, Boris > 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); >