Received: by 10.192.165.156 with SMTP id m28csp209747imm; Tue, 10 Apr 2018 20:01:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx48Ilvefn2HR3F7qhp0wmo48WwjZZkDMLmw2pvk2r0HgzIahGzLi7hqoEntBr1KvSZAOpP0z X-Received: by 2002:a17:902:b786:: with SMTP id e6-v6mr3006914pls.246.1523415704753; Tue, 10 Apr 2018 20:01:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523415704; cv=none; d=google.com; s=arc-20160816; b=rOkihLg7G5LpvRtng0DHkz7qAYf4t/KEDJADmyBY0gX+pjXljKhmkxoPF73//KOlFX ZOM2TMAFpp85JR7+CF+P668LOwQAWTSlFp8g8ZO9ETg5AYiZjrvFtF6Lec8orvKKIVl2 WDhVfoyRqUYT/Nu9ClNvpnNF+ObyEflHvGBZQq9Yu0FkM7oCdwkJe8HGTfzsnl5zUCGY W8Q4s/F8bP7v98roPpQ3TSqP2OAHmlEycWXxqnn+V92FC7us96daxOf/IUiS/pUzeNsO 7eRiGKlImdekpNyJirnrtp93NQRl1XYv6uta7OWxFekSI2GnJdj4W8VHIXtzFGPEpREy XqgQ== 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=4LaXnGuSrOn6hNH8034nHfGrkxYQoIEoO59doFGCDaQ=; b=BecmHwjq5Ddg6OC9lBTwdKYQOnbknQSzmkFsKt99Yv0rvELAQPeZoeKnbJJ+Xap76G N4Q+m7m48vrnqFqLL7hSAkfRwHqsWdX8b3gKST4MPEbkyqEMR3RYF7UnS/Rh55zJeqhu w8gL2SkBDlu1u+UdH3ZL1KjAo19qf5Or1kjYscMLkfRdjq0ilMP2qcekWHTnBTuzqL/K xpYAUTBXM6RqLrTZHaMqmqN5gu3zIaDom0+CFDUNP/Eir5eAd5g+IhKV2Gk51nmuPNs8 CQRB3IzBxDj6lgdOFUQI8wiD0Jn0TBUW3e5PuKBNCfFd+FNFAOGR8Gva+/ZWUIrlTLXw ohBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=h5Ihw3En; 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 99-v6si138417plc.601.2018.04.10.20.01.07; Tue, 10 Apr 2018 20:01:44 -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=h5Ihw3En; 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 S1752484AbeDKC6K (ORCPT + 99 others); Tue, 10 Apr 2018 22:58:10 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:45448 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752016AbeDKC6I (ORCPT ); Tue, 10 Apr 2018 22:58:08 -0400 Received: by mail-pl0-f68.google.com with SMTP id e22-v6so293701plj.12 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=o0ERCqlU/FQYZ0TJ1i9AFj0SCcvuSKyHJBgQs6YUwz1uVLqKl1EPPWDTFzjGvJEiO5 hYUPB0C/fCm5Be8DlWNgygeBE/DXthrJvHTeBDZ9mGmg/FrxRIdW8iX+xK6AleSOzLZS cVaLjxbGdeRpfJD1DQ4/SyTt4/GKiw6yOsOkS01DVSWnkrdjMbGCkpkNhyVxTx5RG5Jp H0zlmgAG0LJa47az4ea2OEEORO4OvKzePCUxjfBtEcA6FMom/sw7rLP/pSSN9Eu9eQJc qhdtVwWCblau235fJUGAsqYLK/2Meflpf1Ydof3OyP+ea3VzSYj8wXjrVAzcDCOfkvFJ +YSw== X-Gm-Message-State: ALQs6tBNO232kRiLhXLqwe7c5tSQhpNA6YkVpktRVrzpnHsPtWst81wr uiUXuKub5JdQVuv9xjEI3s8= 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 Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Jia-Ju Bai 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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); -- 1.9.1