Received: by 10.213.65.68 with SMTP id h4csp3597587imn; Tue, 10 Apr 2018 01:19:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx49dM4rcwIriII4wVvF/B9vd/fOsd0P1Z/53Eq9WPVL2g+gNcRHchYNtaCojSa+CPppmoKdu X-Received: by 10.98.133.139 with SMTP id m11mr1915417pfk.49.1523348342173; Tue, 10 Apr 2018 01:19:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523348342; cv=none; d=google.com; s=arc-20160816; b=gbQfGipdV3Xf1XDFVgyO9mft6EgBScEPqv7N2oJIjYudR1pWZQz535IXrg86DsKFvv LkjWhRjl0m8QHLfLRlG+HGqFhvmAIdzqXKFfN/4QYsZ2il1biCczW+5mQV8sP1rlWloc hKOKyppUcnScPV/RaydF85ZZ8CMbETTBXZFTAlpEjTtADFPIZxU/PTxMFo3oHWimtbuf f4UtQ101BZ1A7uygYTx7m21ldDPHpzoH5PY1i4Selj7ehuX9xzcsItRI7KIi4IbhEzEg 9D39/NvClZbLa7o94+b4lFvw2XtaGsOcql77eCGgys4V5e0tsiKUf/7XFgHPj9XvF6Rk s8/g== 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=d0gAr96IqlEEn2cMl9+gwnzV3Sbq3AgRTUbUzo7xOqw=; b=hBI7LUXVlEMoWvsPWjr2aVx3R5EgHOlKX4QQTjhXzKdXuDBLaLCVVNUQtlLXrVvNKX 8Icqm5x4GZ4auwBFRrjA2tW4xYycbX0L79jJhP0z9QVQ/tmICtysS0xf5EA7p1YwYIoE KujdF3+ZHxS8f3I+awG8gWlmAwdD/H9+cH6zi2XtdZ5DpXqY4k3bZiEYbMxiQJFul63e Ap1rtu19DxbVFGbfK6dqFL90N5eSFn76DRU0E5NMph4Jenp1OiVJo6HQtvP+2Ly2mXQM 47dRTWbu6epS5UfMLAAD/uAbWaTrzaQ1IAibzJdm+8157DjJTNBikNP/wCt8Xq8iCFY9 rtUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KoFb/Z8k; 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 r26si1391836pge.608.2018.04.10.01.18.25; Tue, 10 Apr 2018 01:19:02 -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=KoFb/Z8k; 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 S1752639AbeDJINZ (ORCPT + 99 others); Tue, 10 Apr 2018 04:13:25 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:51012 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752255AbeDJINX (ORCPT ); Tue, 10 Apr 2018 04:13:23 -0400 Received: by mail-it0-f65.google.com with SMTP id r19-v6so14694852itc.0; Tue, 10 Apr 2018 01:13:23 -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=d0gAr96IqlEEn2cMl9+gwnzV3Sbq3AgRTUbUzo7xOqw=; b=KoFb/Z8k0ea0+jNHuqLgf32yFT1lK3WmEzCnymfEtivS4s4jXwDNNU5vDKQcXQjHo+ yUhqyRCwrdfozIE1TAIHZehH5hLpqpnL/bbKIHtXhWTaHm1i6tfEqBpdl6Qx5650qZwq RDWkpdmNAIF45bH8fK8g3vyNYGNTbBJobNsFCOE+/3fDGgSTe+hDkVfThME6A73u27K4 +u6ggxE4z8AwvzW5nJ4QPVksOs/WZQieTFbFfeHh+769QwML6IXjUFGH6KAb+P+/Gqn/ Z7AEiaXKX+IpRQ/L9gXB01pbeRPokxvxLPVkZsd5740CcMaArbmGdq5ZIlvCMHdo8DVM MX6w== 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=d0gAr96IqlEEn2cMl9+gwnzV3Sbq3AgRTUbUzo7xOqw=; b=qIQ0tZlqUsXbR8BzBE1VsKT3fWxg+iqmVecs0n8HavmQEVRYNgXC3kLsfhd5RxWmvC naKJC/tNtfpMeQ7bczOusotNnWw0gjQArtYUELxagqTV26MWDtTNUfkZKH2On0xdLsgj RXhuB+YeqAKbNdzKJlQn23CU49aEkfRlmWGLPM09kt8lNyeSsHwRc7VcPYSUa9scGrSS uKJtu1LztWX4dzLeq4ZzpyxNo/iAs7zjzp/9BpF5Og2d7uRl5NICcIwgNnkU2ArklX+H qGB1EELinwf+zlvfXisaDBJW2DMA9xFGil90PUEAvksGm4VZj8p4R1AkHdW/xXF99nT7 Qt2A== X-Gm-Message-State: ALQs6tAqpQro/wCZlXvmoDTJnhSATJF1JHm4CXV9JG+vggW+INx5es9W tC/29r2hLxq4Hok1iRZh/qFrJJJj X-Received: by 2002:a24:7a12:: with SMTP id a18-v6mr1153274itc.88.1523348002927; Tue, 10 Apr 2018 01:13:22 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id i1-v6sm647981itf.28.2018.04.10.01.13.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 01:13:22 -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 2/3] thermal: armada_thermal: Replace mdelay with msleep in armada375_init_sensor Date: Tue, 10 Apr 2018 16:13:16 +0800 Message-Id: <1523347996-29417-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 armada375_init_sensor() is never called in atomic context. armada375_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, armada375_init_sensor() calls mdelay() to busily wait. This is not necessary and can be replaced with msleep() 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c index ae75328..0825a7a 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -127,11 +127,11 @@ static void armada375_init_sensor(struct platform_device *pdev, reg &= ~A375_HW_RESETn; writel(reg, priv->control + 4); - mdelay(20); + msleep(20); reg |= A375_HW_RESETn; writel(reg, priv->control + 4); - mdelay(50); + msleep(50); } static void armada380_init_sensor(struct platform_device *pdev, -- 1.9.1