From patchwork Thu Jun 11 11:51:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 6587751 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 67BA59F399 for ; Thu, 11 Jun 2015 11:54:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 944B720605 for ; Thu, 11 Jun 2015 11:54:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AD67D2042A for ; Thu, 11 Jun 2015 11:54:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z3123-0007K2-E2; Thu, 11 Jun 2015 11:52:27 +0000 Received: from mail-la0-f41.google.com ([209.85.215.41]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z311z-0007EO-L7 for linux-arm-kernel@lists.infradead.org; Thu, 11 Jun 2015 11:52:24 +0000 Received: by labke4 with SMTP id ke4so3172822lab.0 for ; Thu, 11 Jun 2015 04:52:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=zZQ4r0QSHa+YFYlWNTc5D1NXl5XmT1ofXgWiY47FpuA=; b=RcoBxmPFVt1wm0GRz9/djPCPGjAZPYrQwwrBQNmtpLOVWJGkECKtDkVPvWy6NQvNJE XW3nHdFqAaTM03k9cxTxv3OfSa7MbpXDyFxw4Pdl7LTkJf1RN+/TgceseDLdCbLRvzAa SM1Go/nCg8XAhaYf+kOAb38YqiN9iip9XeI4upwFhA16EYFnPBw/TnUDLUUlM8WQ370Z nrSNSNzx+dDsn6XGH3K671urOYMc43NERW0h6bWG8kN5kKSvLG2Z32nDbSS4yk8JBhHA AMIG0CYmdIqquU6C/h7eLAV/r8hZ38W8yq/kp21dq2Fvyvs/7cYwQAZqWjKvMwDbFk/y r8hQ== X-Gm-Message-State: ALoCoQnN2z/wFy2WKpyWwZweBWlWJOGbpaYGb+pcdu+vV8TGNP1EWSChwJjwdRWEG4gVUllzErxt X-Received: by 10.152.3.199 with SMTP id e7mr9706366lae.78.1434023520357; Thu, 11 Jun 2015 04:52:00 -0700 (PDT) Received: from uffe-Latitude-E6430s.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id ca8sm107424lad.46.2015.06.11.04.51.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Jun 2015 04:51:59 -0700 (PDT) From: Ulf Hansson To: "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , linux-pm@vger.kernel.org Subject: [PATCH] PM / Domains: Try power off masters in error path of __pm_genpd_poweron() Date: Thu, 11 Jun 2015 13:51:51 +0200 Message-Id: <1434023511-4263-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150611_045223_890275_CDC96D65 X-CRM114-Status: GOOD ( 10.38 ) X-Spam-Score: -0.7 (/) Cc: Len Brown , Russell King , Geert Uytterhoeven , Krzysztof Kozlowski , Dmitry Torokhov , Axel Haslam , linux-arm-kernel@lists.infradead.org, Pavel Machek , Lina Iyer X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 2327613..32dcb80 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -235,6 +235,18 @@ static int genpd_power_off(struct generic_pm_domain *genpd) } /** + * 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. * @@ -315,8 +327,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; } @@ -490,18 +506,6 @@ static bool genpd_abort_poweroff(struct generic_pm_domain *genpd) } /** - * 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. *