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: 49755 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3A3622460E for ; Thu, 11 Jun 2015 11:52:02 +0000 (UTC) Received: by wgez8 with SMTP id z8sf1277673wge.2 for ; Thu, 11 Jun 2015 04:52:01 -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=zZQ4r0QSHa+YFYlWNTc5D1NXl5XmT1ofXgWiY47FpuA=; b=HhUh9q9Rj7OlgxxSFoJOxIXRs2z3E11xxo6wEI2YsYwYCY4fSg9GhnrKJukKOPtDEb BBHkkrVW26uG0of8/0I6M4HXNF6QGtobOdRFb/o7M1Ojwr8Fy3/0byR7yiSECVwxA/Eq at/JXfU6QH+6rhX50Zw4JEFPUTNYmAqBicNN6R1lG1zOuSZZ3U45nN9w0ZiiyxNlAFIB fvWJqy4AMhvE7i97IR4+beSp59LfpvxeGn13Z6bphApSLTzIaBK+hodrjf/VSLEyDx6e xsXBKZTccUbwmFRK4ET2ucvznDpDaUKtjw7H6PwWF8atub/DF/0/YwKsNH6jmKCZO6dO cS4A== X-Gm-Message-State: ALoCoQmmEWrCDn+a8QHV+N43SCBWTVv+UIcUt7eENCNV8an2qivmF3WPHID1l0oSSYW03XKo3NAf X-Received: by 10.112.53.102 with SMTP id a6mr8080238lbp.16.1434023521334; Thu, 11 Jun 2015 04:52:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.166 with SMTP id z6ls364106laj.64.gmail; Thu, 11 Jun 2015 04:52:01 -0700 (PDT) X-Received: by 10.152.197.2 with SMTP id iq2mr9467704lac.103.1434023521192; Thu, 11 Jun 2015 04:52:01 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id g1si371996laf.139.2015.06.11.04.52.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jun 2015 04:52:01 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbbqq2 with SMTP id qq2so2801835lbb.3 for ; Thu, 11 Jun 2015 04:52:01 -0700 (PDT) X-Received: by 10.152.225.166 with SMTP id rl6mr9466049lac.36.1434023521095; Thu, 11 Jun 2015 04:52:01 -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.108.230 with SMTP id hn6csp3985430lbb; Thu, 11 Jun 2015 04:52:00 -0700 (PDT) X-Received: by 10.112.155.103 with SMTP id vv7mr9287429lbb.75.1434023520654; Thu, 11 Jun 2015 04:52:00 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id j10si366940lbv.162.2015.06.11.04.52.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jun 2015 04:52:00 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by lbbqq2 with SMTP id qq2so2801730lbb.3 for ; Thu, 11 Jun 2015 04:52:00 -0700 (PDT) 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 Cc: Len Brown , Pavel Machek , Geert Uytterhoeven , Lina Iyer , Dmitry Torokhov , Axel Haslam , Krzysztof Kozlowski , Russell King , linux-arm-kernel@lists.infradead.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-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.217.178 as permitted sender) smtp.mail=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 --- 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. *