Received: by 10.223.176.46 with SMTP id f43csp169320wra; Thu, 25 Jan 2018 19:40:10 -0800 (PST) X-Google-Smtp-Source: AH8x224/cWkwXqkIHZuGI8vH3LyL/QrtHdt5RP4zz4JnZDqo33lblM/t4XpjjQviGPxftQZNfQLT X-Received: by 10.101.80.7 with SMTP id f7mr2240637pgo.35.1516938010735; Thu, 25 Jan 2018 19:40:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516938010; cv=none; d=google.com; s=arc-20160816; b=CbNskdHGkcxJVTOuZvTy/f1lNsixcboy0aXCh1NbV8xLMHomJc9xhvSA9ZWfUq8UkM MqZcfy/4vy2PEqja9OGuOoSvaTyvPjYe+MeXCiD+iTrOdypSQrt1G050Alzvg8jzyyvV TUP347asXtwhV0iTXsdLzrNjVF2ekxv0UnqRx68KYaKnyQW+U2vAb42RMxa/hJNqjmVw W/U/QciA0YXu7+y3q+zBuajeyz/nxpcakEuNJ8Oy+GDTUrnQdv6rB/DkbWv/8DKYh5mJ eMQ5GgiGmuOsVkNCgkSjf1hVwOvSX3DsmwKUcutrWan8aEJKh1v1rvdRWa/WMB5ISebE KEGg== 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=0HWVC3MfAxHQVMO2Gk0nzmRyDz2nxsGC2gB13NHHaHs=; b=DXwCk74JPnNjwUX8v1i5+4hf69x2HbIr2AbO23nkPq7Vzmj6PC6q7rOHHKPJpsbfW0 r4ddOKOkc844N2Vn7tJgCvPyIiIt7QiXBTEaaJV6wZSwyN2j3kHyjzJBJjBJHWXW7h0p 5RhjZZtzdZVeQ9VuWMo3dNLsRkIx7a4M2X1HE9JrMOAkHuco8bM4UShly1DHxKXWHDZD LGYj9aOm9+hYBRoiR+YWLXnOBaxKZwWzuf9HdiAXdurKMkglvEcJ0AJm5begoXSH6EOO ndUrQCKLvgK62D+6CYrexXZVzoBQ1ID8hsqsX3Ual9SEYO+sfMni3FHAIXe30qng7cqY P0wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tKD+9dzm; 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 d63si2440461pgc.260.2018.01.25.19.39.56; Thu, 25 Jan 2018 19:40:10 -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=tKD+9dzm; 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 S1751632AbeAZDh7 (ORCPT + 99 others); Thu, 25 Jan 2018 22:37:59 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:37077 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751594AbeAZDh5 (ORCPT ); Thu, 25 Jan 2018 22:37:57 -0500 Received: by mail-pg0-f65.google.com with SMTP id z17so6434820pgc.4; Thu, 25 Jan 2018 19:37:57 -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=0HWVC3MfAxHQVMO2Gk0nzmRyDz2nxsGC2gB13NHHaHs=; b=tKD+9dzmu6mYJAMvwppKcNZZU79kOzGefcky1W/lCAL6/iF3RtHXU7cIcgi4YInsKU OphF7JCZsHht+tVa+EQ9aHlBe9vHPKI8WTDpQglDtsdSpyJXXEY+rQXnUT5JISLMoSj9 /+ASMwRC2mYhGhxC9D98egyNv5CUk7OGn3e3drWnMePO7zKha+xQrSedPGnKLbJ/brRS P3+SGDZiawIefKj1gc5tQHw2UBnZeWdy5oDyr+cUu1G5YqtYjKgT5owSKb/fGlUT0By2 Q16CJBO0R3F9IirxKuDrhHStkUtiFzvexoyP2yqt9s47CLzdJPFDqOtAJ6AkOL89ZOlM cBpw== 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=0HWVC3MfAxHQVMO2Gk0nzmRyDz2nxsGC2gB13NHHaHs=; b=jXcsuKciXAJhgzLOtpgR5hvHBzga7oLZW/xymeeIyvYj5RLBjJe7Hw6Hqw9n1p7964 xfJMEB8q7bM5hyRJmn+cYZm6UBc4jeEmpTc9lGGgSHPsq4aH1KnJo0F3P2xp9CRTBfcR stPIPifHMVRAtb5BhIEehQZx+c5K3lKGam2Jo8Ho/cu89zbFntuify31o9jI9D61JG46 VChnJOC+Zpk8gwKIWp80RSC8/F3R6qaj+RUvlh6yjFIphml44VntxAJJWfR4ps/kSqrp SsCZsejaOy6570J1ueCtpxtgc4rafyXpSatlsz2cCWDQrhvND/W+zPwj4Dd+EChA80kQ S43A== X-Gm-Message-State: AKwxytebxMYXgGFm+JvpZKGGwklM78enwzwB4a8PAGqnkCXX0nLaOMeS Xv122HNCRZa3PqgkI1IESqv9kA== X-Received: by 2002:a17:902:8498:: with SMTP id c24-v6mr13130475plo.450.1516937876322; Thu, 25 Jan 2018 19:37:56 -0800 (PST) Received: from bai-oslab.tsinghua.edu.cn ([2402:f000:1:4413:9980:256a:8e6d:5903]) by smtp.gmail.com with ESMTPSA id a64sm16409512pfg.89.2018.01.25.19.37.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jan 2018 19:37:55 -0800 (PST) From: Jia-Ju Bai To: 3chas3@gmail.com Cc: linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] atm: idt77252: Replace mdelay with usleep_range in idt77252_preset Date: Fri, 26 Jan 2018 11:42:18 +0800 Message-Id: <1516938138-27259-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 idt77252_preset() here, my tool finds that idt77252_preset() is never called in atomic context, namely never in an interrupt handler or holding a spinlock. And idt77252_preset() calls deinit_card, which calls free_irq (can sleep), so it indicates that idt77252_preset() can call functions which can sleep. 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/atm/idt77252.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c index 0277f36..cea4bf2 100644 --- a/drivers/atm/idt77252.c +++ b/drivers/atm/idt77252.c @@ -3563,7 +3563,7 @@ static int idt77252_preset(struct idt77252_dev *card) /* Software reset */ writel(SAR_CFG_SWRST, SAR_REG_CFG); - mdelay(1); + usleep_range(500, 1000); writel(0, SAR_REG_CFG); IPRINTK("%s: Software resetted.\n", card->name); -- 1.7.9.5