From patchwork Fri Feb 17 09:55:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 9579371 X-Patchwork-Delegate: rjw@sisk.pl 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 E3A44600F6 for ; Fri, 17 Feb 2017 09:55:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA71228491 for ; Fri, 17 Feb 2017 09:55:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF530286A2; Fri, 17 Feb 2017 09:55:54 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 503712867A for ; Fri, 17 Feb 2017 09:55:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933800AbdBQJzu (ORCPT ); Fri, 17 Feb 2017 04:55:50 -0500 Received: from mail-lf0-f48.google.com ([209.85.215.48]:33665 "EHLO mail-lf0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933054AbdBQJzs (ORCPT ); Fri, 17 Feb 2017 04:55:48 -0500 Received: by mail-lf0-f48.google.com with SMTP id x1so20213625lff.0 for ; Fri, 17 Feb 2017 01:55:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bz1cQZd+817a4AA/NO0OxMpxjJEcrMcdvPu4Agsg2r8=; b=fS/mVkUb8SCmcRliW6Yu2o8KgI8cwz+zp1AkjGejiagYxO8zku2SswojQDM3+LB+nk klc9YZTKN0Iql7VKspMo40IHLxi7fdl/w+vCCTYdbCilik5mKL0bR4Yc4RmfAapy9eWt 4r3v9hFK8Jxh6aJcFEPVg0OFHWsjCoc6PjIfY= 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:in-reply-to :references; bh=bz1cQZd+817a4AA/NO0OxMpxjJEcrMcdvPu4Agsg2r8=; b=B417SIT7fKpmLsooBkMNxPk6xqTBpVYmNKVKxE8ZmLASCsbXJmyhEsPuXKSz3VxlnW 6stiS/P80zQuviKfxcaMWtEtlt3HcKpQC7YiPJYKNr6y1Ibc/Sv4tENZUiKMIwEUteJH tTUvYLZVPaU7oO5neg7Emim+8p1PN/yNmTA6t3jQWEqMsC0pwYMhx5+2EUUB4fv05LCf bdaveikzIc/7J9dSZlunJsc1a7C8gmmORZLy27ZcWI9wBS9lomBLULyULEVtOb8BQk8D eGhx+moG6yOJ90jBcucFyd34sYzBn7+iSqOzkl33tv/6RuuUvRkhzw6pW50C2nN4z2FV VeqQ== X-Gm-Message-State: AMke39kS4wcsrhRlFuxipqVWNTN3g5xXY198/ITLAx702XG9ur54dC0OPE/CtH9ty/kWnNRm X-Received: by 10.25.33.21 with SMTP id h21mr1984543lfh.114.1487325332251; Fri, 17 Feb 2017 01:55:32 -0800 (PST) Received: from localhost.localdomain (h-155-4-221-67.na.cust.bahnhof.se. [155.4.221.67]) by smtp.gmail.com with ESMTPSA id f133sm2372773lfg.32.2017.02.17.01.55.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Feb 2017 01:55:31 -0800 (PST) From: Ulf Hansson To: "Rafael J. Wysocki" , Ulf Hansson , linux-pm@vger.kernel.org Cc: Len Brown , Pavel Machek , Kevin Hilman , Geert Uytterhoeven , Lina Iyer , Jon Hunter , Marek Szyprowski Subject: [PATCH 2/3] PM / Domains: Rename is_async to one_dev_on for genpd_power_off() Date: Fri, 17 Feb 2017 10:55:24 +0100 Message-Id: <1487325325-18212-3-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1487325325-18212-1-git-send-email-ulf.hansson@linaro.org> References: <1487325325-18212-1-git-send-email-ulf.hansson@linaro.org> 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 The parameter name is_async, for genpd_power_off() gives a poor description of its purpose. To clarify, let's rename it to one_dev_on and update the documentation of it in the function header. Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 3dc44f2..179bb26 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -276,12 +276,15 @@ static void genpd_queue_power_off_work(struct generic_pm_domain *genpd) /** * genpd_power_off - Remove power from a given PM domain. * @genpd: PM domain to power down. - * @is_async: PM domain is powered down from a scheduled work + * @one_dev_on: If invoked from genpd's ->runtime_suspend|resume() callback, the + * RPM status of the releated device is in an intermediate state, not yet turned + * into RPM_SUSPENDED. This means genpd_power_off() must allow one device to not + * be RPM_SUSPENDED, while it tries to power off the PM domain. * * If all of the @genpd's devices have been suspended and all of its subdomains * have been powered down, remove power from @genpd. */ -static int genpd_power_off(struct generic_pm_domain *genpd, bool is_async) +static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on) { struct pm_domain_data *pdd; struct gpd_link *link; @@ -317,7 +320,7 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool is_async) not_suspended++; } - if (not_suspended > 1 || (not_suspended == 1 && is_async)) + if (not_suspended > 1 || (not_suspended == 1 && !one_dev_on)) return -EBUSY; if (genpd->gov && genpd->gov->power_down_ok) { @@ -459,7 +462,7 @@ static void genpd_power_off_work_fn(struct work_struct *work) genpd = container_of(work, struct generic_pm_domain, power_off_work); genpd_lock(genpd); - genpd_power_off(genpd, true); + genpd_power_off(genpd, false); genpd_unlock(genpd); } @@ -578,7 +581,7 @@ static int genpd_runtime_suspend(struct device *dev) return 0; genpd_lock(genpd); - genpd_power_off(genpd, false); + genpd_power_off(genpd, true); genpd_unlock(genpd); return 0; @@ -658,7 +661,7 @@ static int genpd_runtime_resume(struct device *dev) if (!pm_runtime_is_irq_safe(dev) || (pm_runtime_is_irq_safe(dev) && genpd_is_irq_safe(genpd))) { genpd_lock(genpd); - genpd_power_off(genpd, 0); + genpd_power_off(genpd, true); genpd_unlock(genpd); }