Received: by 10.213.65.68 with SMTP id h4csp3597577imn; Tue, 10 Apr 2018 01:19:01 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/GlKdavsaFDOkYvIUNZR1VaSVY9Ux7MqeLuxkG07oTuqN1seNIkmas6WMiVNrrWcAyTIaR X-Received: by 2002:a17:902:a9c4:: with SMTP id b4-v6mr43049048plr.333.1523348341170; Tue, 10 Apr 2018 01:19:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523348341; cv=none; d=google.com; s=arc-20160816; b=pyw7xNMnW0SBWYjs1+2cxsOA9N87XX0ClHVBCDanz9v0uc6JRfwei3wx/wWd0JzHR4 crr+sGDGNOZCv8dV6PjqKhEmOsGmSI05XwWYnUFbr5I43X9/eF2lgnlWslIy5EzKca3H vvvm17Mahhp8fsDjeHa3DrfF/aIV+Go9loJU3XLmzjTIVPVjU2GUaQ6fk1gm2So+eGn6 76pgArgEwApVBMsYThsx+CdUNm8ebjMUH0it0ev3b83Nu8IcJU1bIq2YIQtcj7wbibZX xtzcjLOQsw6Z2txLMOWPIgEi/uJwOC0H2FwmOrlwW0uSnBVv5qq/gAdl4/pZDWHQycqb dw4w== 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=if6EVntAvFMviZI+PgkCid+C3JGXyWxTeDNQqQ2MTjE=; b=UGxBjqHpkiKN7MdR6Ar6lqfoEeoaaZ8Xg5LS/wn8H17Z2ovMAWourHDf2dYEPPEHOV VErqRdLSjao5lEaGYTvkg5aZ4J2YO2HghdkvlDKoJ31nXU5PEZddDmY27m67hVkhHvEL dylflxkEcH7/pfk41Pn9EHBOffwzMiU5DoBe4jEtTEEX8AtqpiCAfz5J3zm3frGtgvTw tg2cKA2hm+hJgdIJNuzNjwqsQ2MwWm0i1e26jlebJFLZ5/OFDr0KIBO1ntmjFERWAePG FrYALylqmT/Ti51jrSkBf+IHms5hd0fesb+PV408u59STfnlhGbBYL5+ghvkknTnNynO pBdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aR4wKIhj; 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 l12-v6si2108079plc.696.2018.04.10.01.18.24; Tue, 10 Apr 2018 01:19:01 -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=aR4wKIhj; 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 S1752677AbeDJINk (ORCPT + 99 others); Tue, 10 Apr 2018 04:13:40 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:34666 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752652AbeDJINi (ORCPT ); Tue, 10 Apr 2018 04:13:38 -0400 Received: by mail-io0-f193.google.com with SMTP id d6so12719666iog.1; Tue, 10 Apr 2018 01:13:37 -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=if6EVntAvFMviZI+PgkCid+C3JGXyWxTeDNQqQ2MTjE=; b=aR4wKIhjPG3CAgX9YyPO46ZNeqQ/j50gGjpqf9DUZQSdRDeGTFt/T/BGJu8AIDyfzI go9fB+v063726AzvKgjSjtPRN2Kr7Utbnv2Iuk8rn1xW7Fl9tBGKWPkfw26deF0sVecN vjiSm91W1qn02I425JYUBunJLOTviT92U8EYctd1SQSwTTr+L+1F+lS8U4ietF6Lv03e ofSs3HfwNIcSPVfZDKXKc8VVjWCHzbfJfkuYRlSeqWKlgA9wRQkoiFiGd+qAv9c7PnzV 8FKJTl0Umg+vZ3fQG2kpzOwGg5S0wptO7sEvi991B0vuS6GR8a7mDuSbQLfQZZ6k7d9v To+w== 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=if6EVntAvFMviZI+PgkCid+C3JGXyWxTeDNQqQ2MTjE=; b=D9pxFeVeAoiZKkwxHpUE4Y2n0ISngUxkk9n7lfzqRStdeq5GV3v8WANoprSTC7fcTE P/p6uJzroFge1FY1U9Tbt5o9o8jm0/H3O3xV1tN3YGLWMym5a4qZfUsDQbLCQctmngWs /rSbIPxuMpWwRbBU9fWFMtc45Yxhcf6EzS0hWdh8qjQ4ifwA7VCZ8dqa1djU5uq5vO1Y B64/f0fUcoLk07TAtPywbIkP+Cb2ZgAVPOKP3WvFh6I5FEHbh+f2bclOIr5JJHRaREg/ qaBiR4OhApjdxIySP+LVaRz86O/gyCDd3zYbH7Wb7NEsCaJb1XmMjdaG2oF1fJEFLnMG rw4Q== X-Gm-Message-State: ALQs6tAnA3YRFy08JsG9i9rvJtfgDCuVVvpnKXbfXebxu1K2e72nbfa5 BA5DZ2tgsyl7ko/Tu3Bd6p0= X-Received: by 10.107.15.196 with SMTP id 65mr2157412iop.90.1523348017401; Tue, 10 Apr 2018 01:13:37 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:8dc7:7954:4991:f324]) by smtp.gmail.com with ESMTPSA id n7-v6sm653935itg.0.2018.04.10.01.13.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Apr 2018 01:13:37 -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 3/3] thermal: armada_thermal: Replace mdelay with usleep_range in armada380_init_sensor Date: Tue, 10 Apr 2018 16:13:28 +0800 Message-Id: <1523348008-29461-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 armada380_init_sensor() is never called in atomic context. armada380_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, armada380_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..c289ae4 100644 --- a/drivers/thermal/armada_thermal.c +++ b/drivers/thermal/armada_thermal.c @@ -143,7 +143,7 @@ static void armada380_init_sensor(struct platform_device *pdev, if (!(reg & A380_HW_RESET)) { reg |= A380_HW_RESET; writel(reg, priv->control); - mdelay(10); + usleep_range(10000, 11000); } } -- 1.9.1