Received: by 10.192.165.156 with SMTP id m28csp415969imm; Wed, 11 Apr 2018 00:57:08 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/9D7qUOwRSK0Rq0LdEkox/wFH8WI+92xdOq4fq8K6rI5836kgaXtv/sPiNfqHu++quSNwR X-Received: by 2002:a17:902:b082:: with SMTP id p2-v6mr3977741plr.11.1523433428000; Wed, 11 Apr 2018 00:57:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523433427; cv=none; d=google.com; s=arc-20160816; b=CmfpRmM4QhS5wQZySMj3DfxkmZoLHUDkVxJxkAOdZtVTkiSxxBEUnEQDAqFtok0ePF nwzLG1aiag2ATdma3UdiwWfFOl6LfVICcrNCMf+lUd81bR7MSOYPKwu9RgPPMYOMvMuI HSC3BuAINdsijHjIlopJmAvRL2JANYawWTifIT5+kzPJGIkCBbA/vWzzAmjBuN22lISV Uc1zFBnpxWTbMIxf7KvNP7WiWiAGxiyMKMkY/tsMVi0b1VIedaCYWzF/Sy6nxst5U7xb wmwddIONw+yhQewtbQf3s0loVHeNbWaTdHxqWgiwQHkX4MxQfkhHWfWKULyljEEpJNEa 0Wlw== 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=zVQtH2PVhmICL2dkiUUV4K2AG9u/T2kuFC6ek3RK0ts=; b=0lB6qmV9Lu2/ZmoXfdM9Pay5awb0IMkt3oh093fHXkdnJIrhhkvW0rDrk+IFNondtP ptw+dQBQpUSCtRPdJLUMXwv2vOawtiquXRZBRZRkYwQ3TTrbwOohPnkJe1KQSlbiqc5p MBqLtwZvOJ0owNpq94l7aILZD2oVX0l8jvzfAt2LEbN+6CBSvaAk+J4EAJedtNNWzpph eZxGjbe/qLnqhb4pewt7mrPCYJ6iCRR8UTVaE5jqnzcFwQ73q7eKF6D09QkjZ8lLk/qU JzptN8tIP0V4pKHtNCMhPl47cYm5u28rev1l8FoCAMyuSQZU6PN2zTogXi6nnv22xSH7 YVvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tJTdSSL6; 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 o61-v6si582894pld.646.2018.04.11.00.56.31; Wed, 11 Apr 2018 00:57:07 -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=tJTdSSL6; 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 S1752458AbeDKHww (ORCPT + 99 others); Wed, 11 Apr 2018 03:52:52 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:41905 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752410AbeDKHwu (ORCPT ); Wed, 11 Apr 2018 03:52:50 -0400 Received: by mail-io0-f193.google.com with SMTP id m83so1365222ioi.8; Wed, 11 Apr 2018 00:52:50 -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=zVQtH2PVhmICL2dkiUUV4K2AG9u/T2kuFC6ek3RK0ts=; b=tJTdSSL67Gt4py9tCt1/+D2YJjAuL6dhrX6TSzkJzcol6lKWHPZ03jeSNUvV192P0o lb5alZ06zZ1SDYOyxi4FHNg98eHWGSMFyRrpTzuK8oosGNq9seNXrEdz++QQ0QeQ16wA MXRXYx+cra2VW5Fp2V3aK5pGy+ot+FRkBdRZZ56GmHSgZJui1GacjHaOiuI8BXwe6ISp 60pIVOJb2wsD4f+FFtLuQ/rWwsgIDUbtYjNANONyAukG3iXNH2VSFRTJ1r71hxsN4Ahv 4Oq/4xhBrMro1IIJp8YvSeecQHj7CmH140j8iHPQIB75KOWMeZdi8TqfJaT6mPLLSSLI Cy9w== 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=zVQtH2PVhmICL2dkiUUV4K2AG9u/T2kuFC6ek3RK0ts=; b=sbhWLV6hah4+51nIv+1fVYmpl/ka3PUfDbWMVllIhp/+SZc1yAvojneuwEqeKiNJzn DbqwBS9oCQ5ebnziW13YaKqCgdiI1f7Ia8v/F+MYsqkK4KWCeoJviZwDBK9fbGoxXlm5 JmwT3SUgph0oQwVXnziwSZ0pJzry2Zi2IEeuC+/oozI0ThrkbDz3thz9OgcZyv2qzTCB RQNx6InHljMuBqmzXVdfVPjkbBIR31pEJrpal/oV3G85ZrdorNFuSpMlH1ZfZu2ILUfl sSJjw2O0uA6P/kaxK73O3OtBafwJamp83MWJfy6A638ozeSW6dVHG1+365auxwPQpkQv S/6w== X-Gm-Message-State: ALQs6tDHQbReT05Sj5F1xUOYDYDmgpNZ6nuO+TD24DHP0Hcb1vw4Eggp JJreWoMgvUoRXRLqVh+Q4PI= X-Received: by 10.107.148.212 with SMTP id w203mr3703100iod.305.1523433170085; Wed, 11 Apr 2018 00:52:50 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:edc8:c1dd:b0a8:461d]) by smtp.gmail.com with ESMTPSA id k144-v6sm439318ita.31.2018.04.11.00.52.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Apr 2018 00:52:49 -0700 (PDT) From: Jia-Ju Bai To: davem@davemloft.net, frankt@promise.com, andre@linux-ide.org Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 1/2] ide: pdc202xx_new: Replace mdelay with usleep_range in detect_pll_input_clock Date: Wed, 11 Apr 2018 15:52:42 +0800 Message-Id: <1523433162-3910-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 --- 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(10); end_count = read_counter(dma_base); end_time = ktime_get(); -- 1.9.1