Received: by 10.213.65.68 with SMTP id h4csp3597179imn; Tue, 10 Apr 2018 01:18:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx4929NBodzzFtrC7rAjb7LbyZCLx9Pt2IKCrczqUbyyob92UpQR46wfim2QTkwszeYy3F4m/ X-Received: by 10.98.138.205 with SMTP id o74mr1964905pfk.114.1523348304399; Tue, 10 Apr 2018 01:18:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523348304; cv=none; d=google.com; s=arc-20160816; b=Mc7hoEqDoBgY+ISfdAVdSFd2CHE+trN8iUobO1Q6/8jii1E40k+SVWESOvmtkHG+Ko yZdrzrboyHc2p877zXRg6hFjs8tiB+NimHFfIJLJhve1r12bM5ROrzpKM+aYGtrPU+N0 6zd3KKKWQ0RJYB8+UQOOZBeNWZF6iznWtycWrB9BHeFPiGygaEJHanDF/qZ1Zj8qC2ue x13QwoXyUGbM5C0FFX7wg1lo3+EjN7KyEq9lPxELAZPQOMt75EoeP3u9Ctfi8IllS8JV 3Z4BOJKqoAqdyc4XCPeBsX0MaAWkuNkysd+pAbs/HS8tFIlGXtm0XBRCcXWPNGlUaro9 2Nbg== 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=qTRKVo3BILEx4dWsXQ8BUFRv+MMaB11DwXpAXw+d79Q=; b=GWWp/If6ONhIFK3imtArt7tHmDklLKHrx7u+WuSxO+lCy6PwON67lm9zDdGf1mtUkm gEao7vcpKt++BWFM3hAzfeRz12va9+i0VZYXVwgDcRxrczCw3cLsQamkZzP3inzVqiqX LOLd2IaWBO98kH1YW5VlfRDWWEivB8ILp5/JFTi3YiCfBnmucgooNtC2GvkaOzqHIAdk 7bUIOBrvLh4sa4BHkHd5S+2p1zmoiYeAJwKrfUFPcJShdDoCc2PcsldZlwLUK4fbq+gt xHP2CcPQaRNRXELmLhPMD9qlR99vD6CuKCX4A1bBqM+9aCs+BkV5mkze2qiSMMUBLKbM NfKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Dq1sNmom; 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 z18si1467154pgc.207.2018.04.10.01.17.47; Tue, 10 Apr 2018 01:18:24 -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=Dq1sNmom; 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 S1752622AbeDJINM (ORCPT + 99 others); Tue, 10 Apr 2018 04:13:12 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:56181 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752596AbeDJINL (ORCPT ); Tue, 10 Apr 2018 04:13:11 -0400 Received: by mail-it0-f66.google.com with SMTP id 142-v6so14682571itl.5; Tue, 10 Apr 2018 01:13:11 -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=qTRKVo3BILEx4dWsXQ8BUFRv+MMaB11DwXpAXw+d79Q=; b=Dq1sNmomZ0u9mBLGsUJMJpjZrLz3zpDTmGSsOKfVvhPT7fhVxV3yRhegwz4IYBx3YJ 3xJmGmuytQyU1JlKEJNfi01mOWaGJPpfmZle1UMlqAqmtr4R4CuS15+q2BCL4Go1zlC7 V4h5PsP+TGMk5UR5Fvb/QWAenX7KTfYnA/ur/aIuBuDLVbebwLedCPEy22FIB0sx/JTf FmKxAEyciP30re2OQyfhA2Q32w5AvbjEpE8w6CGmAVYRU6AFfXiZb30OHqxOgre699+S HJWIN+l1xNOKxhrAaqjGyi5ie8lQRZ7eyjgOc9Oo2jX/yPqxJd/fE1uxEzEz3qr9M/ah LJUg== 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=qTRKVo3BILEx4dWsXQ8BUFRv+MMaB11DwXpAXw+d79Q=; b=DjD9pxU+EDflBzv33VPw1mC3bN8TPGJtRVyVIeUkrphUbH1vqsuqWslAAP3V481/7k B1MrhxIMGz6ci9cj1x2QGNmpa6iq4TsoDKpveI7QwvJjztpa/q2o1CJGlYbXmCkJxRJ4 8bNNzrZzlSGQAhzHxnN/CeALCGztGavqO6cCX3FC97ZKv2bQcDBHnqctugWyRMyoeqdk 1JabLpYdiclzVQArMvkvPIAEWqeS3wzN/X/KP2fSDQUayy3i2fAv/0ejHOe4Btpv2xez PxoMYJt5cRN3V+HlaxI262MiXediQmU0MhXXkUxvS5XyMkuYZoC/LRX70g+pDe1VFKB7 C4BA== X-Gm-Message-State: ALQs6tCv6c32cN84i5vxVgAMq+alUl5rznq7xXrlRnss3H5q03DO9BKT y7vXdNgjVJn1Q+IzmTwetk0= X-Received: by 2002:a24:230a:: with SMTP id u10-v6mr1116003itu.49.1523347990912; Tue, 10 Apr 2018 01:13:10 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id z7sm980537iob.9.2018.04.10.01.13.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 01:13:10 -0700 (PDT) From: Jia-Ju Bai To: rui.zhang@intel.com, edubezval@gmail.com Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 1/3] thermal: armada_thermal: Replace mdelay with usleep_range in armada370_init_sensor Date: Tue, 10 Apr 2018 16:13:02 +0800 Message-Id: <1523347982-29373-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 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); } static void armada375_init_sensor(struct platform_device *pdev, -- 1.9.1