Received: by 10.192.165.148 with SMTP id m20csp193318imm; Thu, 26 Apr 2018 19:12:53 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp7T02BiYlTFgT8XdwR4lMbw92/4Og69HUnWcTnvnETLsYr7IiGtEh9K79P70VxYxLJH9PL X-Received: by 2002:a17:902:bc49:: with SMTP id t9-v6mr479078plz.109.1524795173248; Thu, 26 Apr 2018 19:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524795173; cv=none; d=google.com; s=arc-20160816; b=Pmer0X1MSt5TI6bObyYyTCLepciB70zYYTePkdCmtG7WBTZeZcwJsupUuA0C9Bt9+D SPGyWkZtxSRkD+Y6f4Uu91FguZ6qPPRiPjrAwgqSbf2/8/lNvCzCY+bsfpuiKEYAiWIp Zk8/K9QerwR4WiKvfunIWkF4VEO7diSu9Etfp+qZZCbX+ZQ6MShlpL6gLUcXZ9I3Em73 iDeUYDO5lCWJvOw7woBsFGrUyLsUMsdWAxExuTstcx84NycKDGbZCcTL+G5YLh1emsxE GUGTHg5G8w/e4f4Vtg0EQYMWr9t+P1WZx/uWneRrh5mIFEkJjGoQ6RGcUYc+f7ONjQAR xtbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=EEupqEMjSB1JlvDUJtBkX0PBi8ICg+iNHvDK9dzD184=; b=JvZfpR0D2cSOFonfC9w9WO5OgZWbQXR08wV/urhjMscKjYqDSWN5xzhriqiIMkMKzA BcZsY9alwIkgBzDG+kVnZmarFLaT1V4P54NulKV3vg2nshH7Srg7cZo+2qx9O9EMnZh4 kf2tmF2y2+iuohc5/y/FdX/SLdJnP03q4ylGvBtLEyVI/nsIFzfhmHxxkfzkQqiVaifz CKn8ve2wy40frvddDh7a/zTRzGEFPnPk3mnxlfcT+xQ3GCatrdVKBVATbB1R3dU3NSFK T0xOvtvqg+6n5VOlw+PGMHj4mrodK+91hMWe8IewCYlC3kA8bQmKflX8zqR/0qfElYCY hv0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=qgbKXt3J; 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 200-v6si249381pga.50.2018.04.26.19.12.38; Thu, 26 Apr 2018 19:12:53 -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=qgbKXt3J; 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 S932170AbeD0CL3 (ORCPT + 99 others); Thu, 26 Apr 2018 22:11:29 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:38915 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757142AbeD0CL1 (ORCPT ); Thu, 26 Apr 2018 22:11:27 -0400 Received: by mail-pf0-f195.google.com with SMTP id z9so296758pfe.6; Thu, 26 Apr 2018 19:11:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=EEupqEMjSB1JlvDUJtBkX0PBi8ICg+iNHvDK9dzD184=; b=qgbKXt3JzotydqBmsl0p6n4VIRlP3tt5Je4IT3TOoLqQA89xeIiwDx/2ByW63VSq6w EDOz4jBtWkYi8WACNZ8eoLYkXxCE3BZ1U0V1IWEMtXMkvIDiHBj8JoIne+QEepZKg0ps wciHcJriKHvDroozExBggRVRIz8vhF0J65MtmQ99ZLLauqauF8gK07F16/9sMwJ9+OD7 SEk3O4cTMAV2pIPv1JDtqPUOHmGtGdSA7UMdm75djAfdqHTiWNJ/mKTOtJVQukNUGump KeDleQuv3sydwjVXXSStHxAaA/OGEMnQy02QQTc1XsFsh9admMK/qj1tyIAuvhNTSTeH gJKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=EEupqEMjSB1JlvDUJtBkX0PBi8ICg+iNHvDK9dzD184=; b=n6tKa3g8rcY45rf8cQ0alv+r17639m3NN0txtoj8pPWPY6+S7m8ty7j4yGBboBuOGr bLEyJ8qpqqSIwgVq5PGf3LJvkjK03RH8tAW/IUxNbwOHB+MJbxfvW0nkkrX9slw49SoY v4XWkv/uAdpPdA1HqpaJldxfcEvFrayDEiIvA1qqZ6jLGq5I91J8hJs14k0dGDpYiPj2 DJ6Kdao15yDH6V0eJcrXalwQ8hPVMs6B+4qk+bU8ZRKDkcs184nyr1gn2srIehagpaIf WZyVaxHNEC6RCF2MQzNuFOkYJwR9hrabme6/b09WeRRKmTIeobC4W9ZUrMyomST2FWUO 9/AQ== X-Gm-Message-State: ALQs6tAewUA06WORXG/ikNAX1YCtOGDGQFQkPPLaO4kYmOJ/RAQndeqI 3o7kI6BKWs2zv6bMcum1vZg= X-Received: by 2002:a17:902:7406:: with SMTP id g6-v6mr442393pll.237.1524795087061; Thu, 26 Apr 2018 19:11:27 -0700 (PDT) Received: from localhost.localdomain ([70.102.96.7]) by smtp.gmail.com with ESMTPSA id v187sm270878pfv.21.2018.04.26.19.11.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Apr 2018 19:11:26 -0700 (PDT) Date: Thu, 26 Apr 2018 19:11:24 -0700 From: Eduardo Valentin To: Jia-Ju Bai Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/3] thermal: armada_thermal: Replace mdelay with usleep_range in armada370_init_sensor Message-ID: <20180427021122.GA30803@localhost.localdomain> References: <1523347982-29373-1-git-send-email-baijiaju1990@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1523347982-29373-1-git-send-email-baijiaju1990@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hey Jia-Ju, On Tue, Apr 10, 2018 at 04:13:02PM +0800, Jia-Ju Bai wrote: > armada370_init_sensor() is never called in atomic context. > > armada370_init_sensor() is set as ".init_sensor" in > struct armada_thermal_data. > ".init_sensor" is called armada_thermal_probe(). > armada_thermal_probe() is set as ".probe" in struct platform_driver. > This function is not called in atomic context. > > Despite never getting called from atomic context, armada370_init_sensor() > 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/thermal/armada_thermal.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c > index ae75328..807fe74 100644 > --- a/drivers/thermal/armada_thermal.c > +++ b/drivers/thermal/armada_thermal.c > @@ -113,7 +113,7 @@ static void armada370_init_sensor(struct platform_device *pdev, > reg &= ~PMU_TDC0_START_CAL_MASK; > writel(reg, priv->control); > > - mdelay(10); > + usleep_range(10000, 11000); Cool, but these have been already translated into msleep(): https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/thermal/armada_thermal.c#n141 > } > > static void armada375_init_sensor(struct platform_device *pdev, > -- > 1.9.1 >