Received: by 10.223.176.46 with SMTP id f43csp824485wra; Fri, 26 Jan 2018 07:29:44 -0800 (PST) X-Google-Smtp-Source: AH8x227J77BAZTe0jQHJ9bn3uF/qcmmhgtSYxiIIlbaYkPOeGnhLnVN9IIFVhbe8CBcH4EsvR5Qh X-Received: by 2002:a17:902:46a:: with SMTP id 97-v6mr14383058ple.96.1516980584317; Fri, 26 Jan 2018 07:29:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516980584; cv=none; d=google.com; s=arc-20160816; b=SVNS3jZsbjMbdN9xAr3L0gKjhwy+DjJPYxYME8qSgpzBV3QjhH+ywdDTzJ5JConEkg FR8irCegZX07cwkQUDECrubNsnTqPVIlOwZ9hxZznouV9dtUx4FeiOK5Aedcn6IdP1Q8 k/TD/IjDmUKvZKpHHdbr26kGRagybMLtNydLrQuDr6LIHt0XVGW64CyPK0i3r+rXDQlM V7RTUdHqliva0Pk5C7TLer5bHiseVIaAS6lYSGVxOsF9lkViusUfSUZ2OF8t6rkjZ3tc JNjmJSjYv+0kCmmxjl1sIzoVb1UkNozJVG4clbu+fcoBe9z+awWfwa9K0KtTlrRANN66 Lrmw== 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=wJF8yK9bmKxpCPXtE0m2UEzP51sCN+JJuq99Ga9DZ10=; b=v8HwfYQ/QoSqp905OojZctLGo+YfBe7g1CNFsfMdvGnqwn5W/Uhh+/dFFzt+MizF6z +YemcpRk7hzF7LdC+vL/X16AZrj9AXeUb0X2okAMh1L44tg8vuOBjGUpoxlv3UuXdvOX UKNTpxhhgzunP8LJNcDXz03bVJAFG8GdDBeoLgYXkID8yroEd9xwG/tZkpcg63NNx+K6 ETlEuGUtdqCmTQKB0U2kotEsp2z5Vr3Ag+d7DxwCMMnJCnaWTHCGytg0vKZTBU+OM7BC CD1klxPlCT1gC3DMTYMOgoCrGlN40fIvPVJO7O/UIHFtVC4TfNysF7r+KZBN9y5J4Vzj o+uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZVTJc6fG; 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 u59-v6si3819786plb.722.2018.01.26.07.29.30; Fri, 26 Jan 2018 07:29:44 -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=ZVTJc6fG; 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 S1753562AbeAZP1N (ORCPT + 99 others); Fri, 26 Jan 2018 10:27:13 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:46579 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753463AbeAZP1C (ORCPT ); Fri, 26 Jan 2018 10:27:02 -0500 Received: by mail-pg0-f65.google.com with SMTP id s9so450154pgq.13 for ; Fri, 26 Jan 2018 07:27:02 -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=wJF8yK9bmKxpCPXtE0m2UEzP51sCN+JJuq99Ga9DZ10=; b=ZVTJc6fGRQ/VsFEaJPI53PrYPcv8RCLCM6vWtQNlyfk/wuKsAcIC/cTOQ+nSYb3fd8 rourcCpdMHIulmqyEiIhI5XmQTw/0+TePvRAMIMivfE4UAjidPMLZY8QbC5tAWYrq3K4 my5jTeCkppx90Js1mv+ML90FoO2biKCrBoJK6I2BWagzqAqcpW3VPm6lTpwIFLLUm3hL rRlmQWrxIv/mTiME24F0ceP9VNny/OKG9R0d8PRI+CtjA8GGTf6IS3KrzE8u0LA1Qc+o OW2oN8N7+ztsyzsUxRaaLA8whBH/VUVkS/9R7WTl8pWqRM2h+ulghTbZDbOBBtbLE0Io YQhg== 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=wJF8yK9bmKxpCPXtE0m2UEzP51sCN+JJuq99Ga9DZ10=; b=rWRbfHvEmRiD6NM18Wl6VLKj73WKjtukQgNcVh5Uc3v/T6YF08ySfSAloCEtLdK9sW f6CrzzHCobtsslHcn63zoh8zUo3cA2iyGZ4GlWgYvcsDLkB1Inkbj+cA23mXG2YuJ5sc O53BQ+rXj7VDFB50qOei/uIcv+amqoEEl6djNMIivDe5gCMn3WzRIL5QKyJLqDg7flcw ldbqifNum9W8CwxO7ih9XTwCh5lHdrcEag8cF+lp4KG0+PK0H4LQkMPswDFs3aNnT/AE TqXJe9IFYvDHxqGZrFOJlgXj3YJIEtWhuzdCoDjc6j1Slo5icUnsBKOkIpM4fs6zsoCX yPYQ== X-Gm-Message-State: AKwxyteCOseWpEAoEW40U3gW8cgjTUAnmG3hWmQ9wVs4xA5zD9EvK1JK ZeItwAX7psgedpvQJhf7uLw= X-Received: by 2002:a17:902:579d:: with SMTP id l29-v6mr5702355pli.27.1516980422178; Fri, 26 Jan 2018 07:27:02 -0800 (PST) Received: from bai-oslab.tsinghua.edu.cn ([2402:f000:1:4413:3967:a579:e81d:66fa]) by smtp.gmail.com with ESMTPSA id r84sm20288805pfk.92.2018.01.26.07.26.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 07:27:01 -0800 (PST) From: Jia-Ju Bai To: axboe@kernel.dk, ming.lei@redhat.com, Bart.VanAssche@sandisk.com, jthumshirn@suse.de, hare@suse.com, sagi@grimberg.me Cc: linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 1/3] block: mtip32xx: Replace mdelay with msleep in mtip_hw_init Date: Fri, 26 Jan 2018 23:31:34 +0800 Message-Id: <1516980694-7849-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 mtip_hw_init() here, my tool finds that this function is never called in atomic context, namely never in an interrupt handler or holding a spinlock. And mtip_hw_init() calls kzalloc_node(GFP_KERNEL) that can sleep, so it indicates that mtip_hw_init() can call functions that can sleep. Thus mdelay can be replaced with msleep to avoid busy wait. This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/block/mtip32xx/mtip32xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index b8af735..1d8ace6 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -3069,7 +3069,7 @@ static int mtip_hw_init(struct driver_data *dd) timeout = jiffies + msecs_to_jiffies(30000); while (((readl(dd->port->mmio + PORT_SCR_STAT) & 0x0F) != 0x03) && time_before(jiffies, timeout)) { - mdelay(100); + msleep(100); } if (unlikely(mtip_check_surprise_removal(dd->pdev))) { timetaken = jiffies - timetaken; -- 1.7.9.5