Received: by 10.192.165.156 with SMTP id m28csp414854imm; Wed, 11 Apr 2018 00:55:39 -0700 (PDT) X-Google-Smtp-Source: AIpwx49pIa9x1p6cGMA5M17BCart2UM1LfMuaoyNd6C0PftfELaxlDCHBs4LFjxMuHIfJ8X8R53P X-Received: by 10.98.141.205 with SMTP id p74mr3123834pfk.210.1523433339009; Wed, 11 Apr 2018 00:55:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523433338; cv=none; d=google.com; s=arc-20160816; b=otOASrCV0a6GPOri+hjzPpzsYCkBACrhPD9tXrtwps7tvplthSkJ24Zw1AHCSGcKYT PucC/Th1a450XQn6nLPrjuAcgYe7Pu6LBKSPmn5WDC+Pswaf2a/0e1a20KXnhI4BDh4x dLoYWkRje4LkTjQg3KA1Jqlp0IdapZja+zQRt9k/ndjBfW0Gur6LJMVuAaoP+8dbYX9P KO5PGYheRKBLOKjqwIJh8LLw516qG6A8lYir1TmsYeNQsfYJzHT5yBBVU7hWOWF/4WmD pHO+JfTYd7ZiETbvJxH82O0mw+X+2OKmQ5PBIm85P13JFXkZ7eW/E96tWHgyWW/rzLbI IpNw== 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=G7Fgv9rJ6w9JpzYXNQhw1EQj6uiXTk4bfalqyiTpshE=; b=DEllzkExq2pAK27lDAoSCsnOiK9OP8eRD5mijOmFBU10XwV5Y6fIgV3fAD9JVuY8Yc FFaYNB4x1wv6/Bu2VB1yOiH0xh6E0mbFOnM+w83PjDIYKDGeIUlDNTQQyc2+SUUNTzwp FoD71x0+9OhUqt/r+sW9PsHXw7tGm41FzE9r5JEIezVoUvevEoCQjXIAKnsz3alYc7q6 4LrOI3HkFJ3vfRzs7XV7bE+qT4B+pZVVYzudNPWwCNztCaschTWvmRsjkjrelNJ9BFxP HEUOdnLuDCir2A1C+R4Lhi3pgBINHE1MRJ/eZF6JnkEt/Ju6zhTFpO8hI4z9pSlVZHCC D4mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MdIcEuzv; 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 t23si374693pgu.285.2018.04.11.00.55.01; Wed, 11 Apr 2018 00:55:38 -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=MdIcEuzv; 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 S1752350AbeDKHuy (ORCPT + 99 others); Wed, 11 Apr 2018 03:50:54 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:35607 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752297AbeDKHuw (ORCPT ); Wed, 11 Apr 2018 03:50:52 -0400 Received: by mail-it0-f68.google.com with SMTP id q85-v6so1552529itc.0; Wed, 11 Apr 2018 00:50:52 -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=G7Fgv9rJ6w9JpzYXNQhw1EQj6uiXTk4bfalqyiTpshE=; b=MdIcEuzvOkyvZRU8tm9JksGKJ/wjWV7lY03f2Jn/8NHwXfklk1n5Qj9AWFyujDip/M nvUp5tH3mImO/t6dXNSkSr0TQrlUcWC5l6ndctDc7ocpImIySkW+ZiPkXn12ZGFe+E07 HMhjdnVVYbuouuTntj4WF60oM5wjRjuFvgJry71ECiHqT9ZQZ2mubyI5ZoW+LmJGd1+T 2E0E9Mn0QjnX4hw4hk/XHFHzCMhpuKokkeVQx6z3UyEjnj80JE8999EOzlzIQU5QYYCX HlswmuYcWZQfK3RrMVO+CwjG5g+an/HqlKr6WV5a4WlRZLbnD6s9slz+Z/2Wn0SmcjXn tasw== 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=G7Fgv9rJ6w9JpzYXNQhw1EQj6uiXTk4bfalqyiTpshE=; b=lMBFFFsz8h+bhH+TYGVvRo4FrPjmysvAygJsTGvfsYEit2Ia1aF+2vVK4GRhJ6E6Cw fHP0QDZdsJLUoo7anO5E9QMotwc5nYRQtpp/AlW/3jC5MQ8oA/QPTtg72dz7wIDCIlP4 cNf0X3qZwWA98MGbwJJlkdrKq5odeiAgicXL49JmOwXeJklo8YAgrvMA33Z1TPyIVE6h aWl3NgA2QUk9tcQqZigqZfBKHZs/oWbtOTVbSAqT5QQzz+8rZv/lPecB24zbhUkkjDvZ IupD+XfcxCuaPvdPLAdp5RRaDl3qbAckb4fk1Ob/yB7inNAbaD2S2FxwpJAD0HIA3gPa /t1A== X-Gm-Message-State: ALQs6tAmuFNVW0qLIzuYSLZWnx9WpQne8tC7tHebLyilkjpg2UanlZYm V+nx3Pb54DyTrIA0Ms9K7Vk= X-Received: by 2002:a24:11:: with SMTP id 17-v6mr2781939ita.111.1523433051868; Wed, 11 Apr 2018 00:50:51 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id c8-v6sm482555ita.18.2018.04.11.00.50.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Apr 2018 00:50:51 -0700 (PDT) From: Jia-Ju Bai To: davem@davemloft.net, source@mvista.com, alan@lxorguk.ukuu.org.uk Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] ide: hpt366: Replace mdelay with usleep_range in init_chipset_hpt366 Date: Wed, 11 Apr 2018 15:50:43 +0800 Message-Id: <1523433043-3811-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 init_chipset_hpt366() is never called in atomic context. init_chipset_hpt366() is set as ".init_chipset" in struct ide_port_info. This function is not called in atomic context. Despite never getting called from atomic context, init_chipset_hpt366() 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/ide/hpt366.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ide/hpt366.c b/drivers/ide/hpt366.c index 4b5dc01..4045559 100644 --- a/drivers/ide/hpt366.c +++ b/drivers/ide/hpt366.c @@ -984,7 +984,7 @@ static int init_chipset_hpt366(struct pci_dev *dev) for (temp = i = 0; i < 128; i++) { pci_read_config_word(dev, 0x78, &f_cnt); temp += f_cnt & 0x1ff; - mdelay(1); + usleep_range(1000, 2000); } f_cnt = temp / 128; } else -- 1.9.1