Received: by 10.192.165.156 with SMTP id m28csp201653imm; Tue, 10 Apr 2018 19:50:06 -0700 (PDT) X-Google-Smtp-Source: AIpwx49ifZE0ZV5mL90Vk3mwECXCSrY/oBK05r3rD4EJXKXv6mVVnGlLmB1A8vADv0H9Bdih7FwM X-Received: by 10.99.107.8 with SMTP id g8mr2058618pgc.271.1523415006541; Tue, 10 Apr 2018 19:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523415006; cv=none; d=google.com; s=arc-20160816; b=LbJy3Paf0Mkb7EHWymo44bN0/wgNadE7DjUUEwTRhB+PTMqyqjHdqgimM+xTOwYRrw dMTak51bSmoMVDrJ3HirWE2TQ8/L6fKXGwtE8AzTVdFvm5/GGuqnhaP0j9IDH7ybilUu lx7+CosnFYfxfJGeexnZRwQyeSJ5NO337MNP8T04kyYnHuLMH4ylxVNDD1rXU/kCQFU5 JJznshrHI151J3CCWjsR5XeKHhOktBD3cgvodYpSRtf0tZBhP4wBEUvYBgEywR58TQLK bxpopH+Ky+fQdmm/aRGMQwJQtMdaiC+33l3nFOjeswV9/nxPy0oKqxtUzx1nGE4hIyPl 4LqA== 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=gCOPC0DLGVqKedLjNmyhe9fwDZJn8DMYzwT5VqmjthU=; b=d4DkrnU8D6ZAqRtjtANb2kWLug0C7KJSxcPavt8kxiVq4wTnd7tWv4TpzacTpOlykJ EkDPuMJm8v1mwefFnxTWgh6wrCzkxrpHrXST2wDad3VaMpudpqsIC+7WT0H3VvTiDyVr L0RgNiatnLfN+oKtRlhsHgWdHPYOwSps/+PU3oJsuFl13LrFStU4b/+r/oJXvgqVp53i UMQHT3TBaHi+CNSrCVqzp1L4kjwDFugWtR3AF2lthIjxtNLzofg8utBTOhWtfDHx8zV8 1Fc3l/uRn7VTMuU7ZDPtuTRSEP9QzpJrfXc9GfeWIR+KIAVbXVsnLrAqwe75KUekvVF0 VGeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oc9PlI1Q; 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 m29si78434pgc.32.2018.04.10.19.49.29; Tue, 10 Apr 2018 19:50:06 -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=oc9PlI1Q; 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 S1752804AbeDKCqt (ORCPT + 99 others); Tue, 10 Apr 2018 22:46:49 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:37577 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752458AbeDKCqs (ORCPT ); Tue, 10 Apr 2018 22:46:48 -0400 Received: by mail-pl0-f66.google.com with SMTP id v5-v6so284827plo.4; Tue, 10 Apr 2018 19:46:47 -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=gCOPC0DLGVqKedLjNmyhe9fwDZJn8DMYzwT5VqmjthU=; b=oc9PlI1QGJs2ol68jF/iH2Ut5PDGhc7q3pZ2KXC6b4TSR50s9NpNuV8S6qoJMa4TGY eHGio9uu9cwXn+QIAk6lJBsm2AigiHr/iToRnVvDvyLTHAGqSrkiT0ynCpNOe1Ld+/43 oATQIXGrz/AwsAyrLVTfyHYl/jgihycND6SETeB4cixSwZnrntqlKhbXXnblx82chFTc Fq2WDh5hJAT6bWjhpBHc/Z55fQNxapH6e2mBiW1F2ySs55aVsiau/6annGzzY/55LERO S0wmMMPOTe2zrp0YSzRvPiUGsXuR7/NwmkPBop/QporV91X+hfO2rAdvpV5oriajmMjW vTkA== 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=gCOPC0DLGVqKedLjNmyhe9fwDZJn8DMYzwT5VqmjthU=; b=FWlxFsdy902UhiXkUEkpoccbglVqGrtTpVTOSP+5zqMd3XZyMgyaOZ2r5EnbBtPjwJ bRrSnycwByc0Sllas2WGe54Ts75h4Ab/1t7XH2ctkLgzsVw80u1cLZSV76zr1B5WdE5Y vgipg39pL2S4uPX2PfQUsU3bwxNBGtDl/dH4Aq6gcIFEcpSsE76EscYWzBdM8dS/RWEa 9IQBZATTv/0T+JTJ19OJXu1qmn+gVHHgfEsPU3YMJoP5rkBHtl1MuYUV23Ml3aZTDxVK 9WexPBE63WfCWAzGGzw0tHlnSYwukkwPzqvez3WRWvgT3blu6o0FRFvsQgFWt0hFXU19 5OJQ== X-Gm-Message-State: ALQs6tBIVXoeBf9Uo8hSGIuPOLotN+KNxF8KBjHk3xslvDS1TknWu2pN 3a4kJ6wvOTZz5mUg/dYcOKc= X-Received: by 2002:a17:902:57ce:: with SMTP id g14-v6mr3069230plj.222.1523414807761; Tue, 10 Apr 2018 19:46:47 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id r81sm191341pfj.79.2018.04.10.19.46.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 19:46:47 -0700 (PDT) From: Jia-Ju Bai To: pierre@ossman.eu, ulf.hansson@linaro.org Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 1/3] mmc: wbsd: Replace mdelay with usleep_range in wbsd_init Date: Wed, 11 Apr 2018 10:46:43 +0800 Message-Id: <1523414803-2626-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 wbsd_init() is never called in atomic context. The call chains ending up at wbsd_init() are: [1] wbsd_init() <- wbsd_probe() [2] wbsd_init() <- wbsd_pnp_probe() wbsd_probe() is set as ".probe" in struct platform_driver. wbsd_pnp_probe() is set as ".probe" in struct pnp_driver. These functions are not called in atomic context. Despite never getting called from atomic context, wbsd_init() 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/mmc/host/wbsd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c index 546aaf8..6224d12 100644 --- a/drivers/mmc/host/wbsd.c +++ b/drivers/mmc/host/wbsd.c @@ -1709,7 +1709,7 @@ static int wbsd_init(struct device *dev, int base, int irq, int dma, /* * Allow device to initialise itself properly. */ - mdelay(5); + usleep_range(5000, 6000); /* * Reset the chip into a known state. -- 1.9.1