From patchwork Fri Jan 26 08:38:19 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: 10185309 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 6E1B660383 for ; Fri, 26 Jan 2018 08:33:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C32D290F6 for ; Fri, 26 Jan 2018 08:33:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F8A0290FB; Fri, 26 Jan 2018 08:33:48 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, 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 EC466290F6 for ; Fri, 26 Jan 2018 08:33:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752487AbeAZIdq (ORCPT ); Fri, 26 Jan 2018 03:33:46 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:41417 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752429AbeAZIdq (ORCPT ); Fri, 26 Jan 2018 03:33:46 -0500 Received: by mail-pg0-f68.google.com with SMTP id 136so6841694pgd.8; Fri, 26 Jan 2018 00:33:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=TDLIdkgFvJa3NlDPhJALTk7wD7IrDcL6feNo7sXr5l4=; b=PmoyJvMRYR1uV67KYhYTpaNVubzEKg4IymFwoAoPDl8RAQ+wS+pK3v0nfXUV7gOMVw h9tfo2ItHvyH3gfo/jzSqoAuIs/vpng2/OEVSACPS3wetHV/labp4dDc1GFSbAWWnNVz bVwlDNJMh7iipLOfFRnZz51VA6tu5l5Ct8UdbxgATTmWJUTcS2PbnwnpqWHK/5p2DwOP LqYlU8jQkA6Z7tBbgaOECVt8CfM4tMYZIjzZXUJAAnSU1FPQXn3X8MuzN1VIG1i4enB8 ianSJeGeLqwu6FZIewQ0dNsID1SJBgxMXXhZ0QcsVb01xA32ZfxLsnKAGjn9A0jMbT8k aQdQ== 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=TDLIdkgFvJa3NlDPhJALTk7wD7IrDcL6feNo7sXr5l4=; b=eRJE48R79LFTmb4h11JoKHI4occr1SdV4p5rHkmE41EcVu22brATU81gbZuMb6j2h0 qd2duMXHtuIg5PXlFZG/7KSXphtCwXu66OtgHDoaf0HGwxmTQI2p3QxktCxbx6foHV/L 2+6YkahyzSAInA3vjCTj0lNNgVSEwA60T+rwKJKOeU6C7Esd70O5pQCAqHlyMfBz3RDg K/yaXuHlFc9RhfHgJvqAaMretQh6QzaIb04HUwDjawyj5qq5g8AkFhJ/32D0M+lxtFkK e3Vtgg9EtCZwryWmHjACcuJfAFxniRwwJlZRVWPUT4Gr4RezackmFUkvLIXXf79ByGz6 dtCw== X-Gm-Message-State: AKwxytcRwM6620SoUE5cQfON+0yQP4tV1sGyzL6jpGa5vj556e9vWD0r JO1tjEIY3yKgP/vqNMx1CuM= X-Google-Smtp-Source: AH8x22682tbgnQ/IM7ap44eMG5RPQ0tj+2m8qX/RElRoqfkPm/jjcNedMLws8EIIyZ283oPX4/VlUg== X-Received: by 2002:a17:902:bc47:: with SMTP id t7-v6mr13615636plz.344.1516955625603; Fri, 26 Jan 2018 00:33:45 -0800 (PST) Received: from bai-oslab.tsinghua.edu.cn ([2402:f000:1:4413:3967:a579:e81d:66fa]) by smtp.gmail.com with ESMTPSA id h2sm6440164pgp.65.2018.01.26.00.33.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Jan 2018 00:33:45 -0800 (PST) From: Jia-Ju Bai To: rjw@rjwysocki.net, khilman@kernel.org, ulf.hansson@linaro.org, len.brown@intel.com, pavel@ucw.cz, gregkh@linuxfoundation.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] base: power: domain: Replace mdelay with msleep Date: Fri, 26 Jan 2018 16:38:19 +0800 Message-Id: <1516955899-31810-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.7.9.5 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 After checking all possible call chains to genpd_dev_pm_detach() and genpd_dev_pm_attach() here, my tool finds that these functions are never called in atomic context, namely never in an interrupt handler or holding a spinlock. Thus mdelay can be replaced with msleep to avoid busy wait. This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- drivers/base/power/domain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 0c80bea..f84ac72 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2144,7 +2144,7 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off) if (ret != -EAGAIN) break; - mdelay(i); + msleep(i); cond_resched(); } @@ -2231,7 +2231,7 @@ int genpd_dev_pm_attach(struct device *dev) if (ret != -EAGAIN) break; - mdelay(i); + msleep(i); cond_resched(); } mutex_unlock(&gpd_list_lock);