From patchwork Tue Apr 10 08:13:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia-Ju Bai X-Patchwork-Id: 10332501 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 490F66053B for ; Tue, 10 Apr 2018 08:13:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 187F828D07 for ; Tue, 10 Apr 2018 08:13:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D1A228D0E; Tue, 10 Apr 2018 08:13:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB10428D07 for ; Tue, 10 Apr 2018 08:13:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752656AbeDJINj (ORCPT ); Tue, 10 Apr 2018 04:13:39 -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-Google-Smtp-Source: AIpwx4/DPxjmMuQ3aQijQE5f5E2lK9NmDrAiR3sgGng1V/t0Wq6OKeDvGnqttRzlL6Dn8TkxgwAzMA== 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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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); } }