From patchwork Wed Sep 2 08:16:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 52956 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id 0401C22DC0 for ; Wed, 2 Sep 2015 08:16:23 +0000 (UTC) Received: by lanb10 with SMTP id b10sf1032211lan.3 for ; Wed, 02 Sep 2015 01:16:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=N+RS1ECn08Vggj3IS6uirVWi1JtpW//ttkd0PeshDjk=; b=TG2WWdfEo2b2HZ8gdjJ1dDmEWkTkMdQbRSYUBDJoW0hNiKSt6EOiJpoVS4prZ8ruW2 iaI7iKVlFPgVHQPu78AmTldsEfO1aoFUGnSBxpasDFeE5hDucdf5Oae+MFN81dq55WL5 ZHsYt42RzHckIUNx6oIOBp8YTlyM0XvoITLJf97ZpvhM/eKgnyb80bHMgQGngof5DazY WIRDnC65GVttawAyhDv3lc+Z6p7pE1z4zpflp66QfXBGxyV6EJ9quufHmyCIC9Xle9Vh LIwZLkABNRbw7kv7bqzwMIuYW68UxKzpXdUQHiv7yjisPlPop55unJVooxqmdv/DZLi1 X/aw== X-Gm-Message-State: ALoCoQkYEDVRUFMfPGOkccGrcMSQ4LVfoWcuDTH7cMPKsZUsj2N/BbdLGJsqsQ6eRzMtjiersau/ X-Received: by 10.112.167.201 with SMTP id zq9mr8888681lbb.2.1441181781977; Wed, 02 Sep 2015 01:16:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.36.99 with SMTP id p3ls38335laj.57.gmail; Wed, 02 Sep 2015 01:16:21 -0700 (PDT) X-Received: by 10.152.27.134 with SMTP id t6mr15302468lag.100.1441181781840; Wed, 02 Sep 2015 01:16:21 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id f5si18935921laa.134.2015.09.02.01.16.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Sep 2015 01:16:21 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lanb10 with SMTP id b10so1759198lan.3 for ; Wed, 02 Sep 2015 01:16:21 -0700 (PDT) X-Received: by 10.152.198.140 with SMTP id jc12mr6104464lac.19.1441181781737; Wed, 02 Sep 2015 01:16:21 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.164.42 with SMTP id yn10csp374986lbb; Wed, 2 Sep 2015 01:16:21 -0700 (PDT) X-Received: by 10.112.170.103 with SMTP id al7mr15462779lbc.66.1441181781268; Wed, 02 Sep 2015 01:16:21 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id y12si18939418lbk.130.2015.09.02.01.16.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Sep 2015 01:16:20 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by lamp12 with SMTP id p12so1739531lam.0 for ; Wed, 02 Sep 2015 01:16:20 -0700 (PDT) X-Received: by 10.152.28.105 with SMTP id a9mr15380305lah.9.1441181780547; Wed, 02 Sep 2015 01:16:20 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by smtp.gmail.com with ESMTPSA id bx5sm5348752lbc.36.2015.09.02.01.16.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Sep 2015 01:16:19 -0700 (PDT) From: Ulf Hansson To: "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , linux-pm@vger.kernel.org Cc: Len Brown , Pavel Machek , Geert Uytterhoeven , Lina Iyer , Krzysztof Kozlowski Subject: [PATCH V2] PM / Domains: Try power off masters in error path of __pm_genpd_poweron() Date: Wed, 2 Sep 2015 10:16:13 +0200 Message-Id: <1441181773-21733-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , While powering up a genpd, its domain masters are first being powered up. In the error path of __pm_genpd_poweron(), we didn't care to try power off these domain masters. Let's deal with that to avoid leaving unused PM domains powered. Signed-off-by: Ulf Hansson Reviewed-by: Krzysztof Kozlowski --- Changes in v2: Added Krzysztof's reviewed by tag. --- drivers/base/power/domain.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 4167201..62f7572 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -213,6 +213,18 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool timed) } /** + * genpd_queue_power_off_work - Queue up the execution of pm_genpd_poweroff(). + * @genpd: PM domait to power off. + * + * Queue up the execution of pm_genpd_poweroff() unless it's already been done + * before. + */ +static void genpd_queue_power_off_work(struct generic_pm_domain *genpd) +{ + queue_work(pm_wq, &genpd->power_off_work); +} + +/** * __pm_genpd_poweron - Restore power to a given PM domain and its masters. * @genpd: PM domain to power up. * @@ -259,8 +271,12 @@ static int __pm_genpd_poweron(struct generic_pm_domain *genpd) return 0; err: - list_for_each_entry_continue_reverse(link, &genpd->slave_links, slave_node) + list_for_each_entry_continue_reverse(link, + &genpd->slave_links, + slave_node) { genpd_sd_counter_dec(link->master); + genpd_queue_power_off_work(link->master); + } return ret; } @@ -349,18 +365,6 @@ static int genpd_dev_pm_qos_notifier(struct notifier_block *nb, } /** - * genpd_queue_power_off_work - Queue up the execution of pm_genpd_poweroff(). - * @genpd: PM domait to power off. - * - * Queue up the execution of pm_genpd_poweroff() unless it's already been done - * before. - */ -static void genpd_queue_power_off_work(struct generic_pm_domain *genpd) -{ - queue_work(pm_wq, &genpd->power_off_work); -} - -/** * pm_genpd_poweroff - Remove power from a given PM domain. * @genpd: PM domain to power down. *