Received: by 10.192.165.156 with SMTP id m28csp454661imm; Wed, 11 Apr 2018 01:46:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx48ZJlrt3Tr9RLYZOaVTfANnTE8FP0kmjoYmkn4pd5202JPsLH3m5JATlu63sleO8/fB9O32 X-Received: by 2002:a17:902:28e4:: with SMTP id f91-v6mr4181088plb.336.1523436380224; Wed, 11 Apr 2018 01:46:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523436380; cv=none; d=google.com; s=arc-20160816; b=amDavcLZAsu7p++222on0Gu4UeLQFGq/RGcJIhH7gyIDVlStMh6uOyviWQL1qwh6Dr raY9fIuCCyjrdRTfWloB83LH8v4oyaytien1U2u01NuymwXr8LaAjoY5VU0UTbEOZV07 zOSOeHFUX9hcJGrIdNTH/1W6Z5Q8ynrc2QsDPhUYAqy/q76VnvhButpPY2hGeIVTHqzr QWnGuEKFmem5+B1iAHwDFtKo+kZ/WOjAvs2qK4kf4CcDCT6yb66d/JAjuWsJKc3D8hi7 OtrcS/wJlUQtYUCQfh29IrTlhiWDepqKrKegN/hB98AFRRAEkDcL5sBazCH7AFodi+gf do5A== 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=f12Ggfs3VEfccZMS0d7K0wT/6OoFDT4xekR4IyLRpI8=; b=rZo1MCy+OD/BhriTXno417na+4bNK6tlZrl8SU3B4yhg8KBYQL5khPJyWRNHI7aEY1 RMTakOWeWYoWMX6Nsj5gqYEpM5+NrBV28XaCatGVD+Rq3eciMWw0LHBOBx03lEUox31U mBvcywQsHUmwApR+GO487oNS05KQtTyd1YE1w8c+bdXHV8Kg9g8l+os6XgmqkL8LV13N g3fyXA6LXWfZbJ1qF6/O/7e7kx/TJdWGwhDQp33yBhKq3v96Jy6UZSUwxRh4Nr3QAL94 uw3LyB95zuCMuo4qmUv1YOTcg2GUgXhowH9Wtd3fcN9FNO7qN8vX8brxfqjfEWs7kpS8 7tDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rExOmVUu; 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 102-v6si677744pla.230.2018.04.11.01.45.43; Wed, 11 Apr 2018 01:46:20 -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=rExOmVUu; 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 S1752576AbeDKImF (ORCPT + 99 others); Wed, 11 Apr 2018 04:42:05 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:56209 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752500AbeDKIl6 (ORCPT ); Wed, 11 Apr 2018 04:41:58 -0400 Received: by mail-it0-f68.google.com with SMTP id 142-v6so1716232itl.5; Wed, 11 Apr 2018 01:41:58 -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=f12Ggfs3VEfccZMS0d7K0wT/6OoFDT4xekR4IyLRpI8=; b=rExOmVUugdvu1ODSwVinfkklAbj4rsMLnhktXLnXanwg002ba6s68UDTBi9jnG3VGJ Jbk4TPkee1I/rHDfSRqkP2dYDnchr0igAV+Ju+3x13U3h8BJjIDcEgaieI/BVWVWBDlA 46sSX6Xu+Ja9Ielw13+Jsn4o6uf25bXZ8pheqGG8Ks2hST6fJM5SfFUu9TKt+SsnvjNm BeOzGyUxLubdxWUSABAkCf+1NRNKuPG428arPR4EbN1djrWTGCLkPxqt5ErOY8qhRElT x+TYhcghRLkvF7WRms1eK7JZaTtxO7G3ah9Wj4zLLRDJxx9EihpkfT5YXXExaYglgHFL uM2Q== 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=f12Ggfs3VEfccZMS0d7K0wT/6OoFDT4xekR4IyLRpI8=; b=JyyTX0INjWJ5S7xU10PKQ8Dxj1qYKkH8CF0LcKGuvmnwHDtMC54LB4Dm83yKgGHVHk xrpzl4AfYHV1MxYOePm8wkJjyAXGizxmpQ+Gav6/kSB3e8/0Ix6uEYO7rlEEwn7V5L1r 1SjRZAZX5Bj3H0VaPltB+7Z5II70BG3yF49B6Gt/og0fZ+H7Ez2oFBx6smK+fsJZEp0x RiHdMGKlivUSqnZtpI3qmXnoiplb8FC6KkaMIEFehiYBdf6YmCfNpkVvXt6620hHFqWU Obqp7TzAkXoX1RjtNC9Xwron1V1DTE/GcBuxDEkVSw7qI37WUJe9NA8C60j852LCRH7/ 9hGg== X-Gm-Message-State: ALQs6tCuAlWRQVAmSp7KdI/lYZ1TCo0OHzAlPpZVJC/R7+eNo0oqNzXE AYqnz0hwJ3YgJmyPN1rMfMb7X3OJ X-Received: by 2002:a24:d42:: with SMTP id 63-v6mr2833930itx.62.1523436118345; Wed, 11 Apr 2018 01:41:58 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id w80-v6sm484557ita.16.2018.04.11.01.41.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Apr 2018 01:41:57 -0700 (PDT) From: Jia-Ju Bai To: davem@davemloft.net, frankt@promise.com, andre@linux-ide.org, sergei.shtylyov@cogentembedded.com Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 1/2 v2] ide: pdc202xx_new: Replace mdelay with usleep_range in detect_pll_input_clock Date: Wed, 11 Apr 2018 16:41:27 +0800 Message-Id: <1523436087-4485-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 detect_pll_input_clock() is never called in atomic context. detect_pll_input_clock() is only called by init_chipset_pdcnew(), which 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, detect_pll_input_clock() 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 --- v2: * Correct wrong usage of usleep_range() in v1. Thank Sergei for pointing it out. --- drivers/ide/pdc202xx_new.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ide/pdc202xx_new.c b/drivers/ide/pdc202xx_new.c index b33646b..6afa66d 100644 --- a/drivers/ide/pdc202xx_new.c +++ b/drivers/ide/pdc202xx_new.c @@ -258,7 +258,7 @@ static long detect_pll_input_clock(unsigned long dma_base) outb(scr1 | 0x40, dma_base + 0x03); /* Let the counter run for 10 ms. */ - mdelay(10); + usleep_range(10000, 11000); end_count = read_counter(dma_base); end_time = ktime_get(); -- 1.9.1