From patchwork Mon Mar 20 10:19:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 95493 Delivered-To: patches@linaro.org Received: by 10.182.3.34 with SMTP id 2csp1298409obz; Mon, 20 Mar 2017 03:19:37 -0700 (PDT) X-Received: by 10.25.159.147 with SMTP id i141mr7475378lfe.54.1490005177761; Mon, 20 Mar 2017 03:19:37 -0700 (PDT) Return-Path: Received: from mail-lf0-x233.google.com (mail-lf0-x233.google.com. [2a00:1450:4010:c07::233]) by mx.google.com with ESMTPS id u194si9024805lff.138.2017.03.20.03.19.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Mar 2017 03:19:37 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::233 as permitted sender) client-ip=2a00:1450:4010:c07::233; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::233 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-lf0-x233.google.com with SMTP id j90so53402193lfk.2 for ; Mon, 20 Mar 2017 03:19:37 -0700 (PDT) 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=DbndLKfL6PDffmkg9SsEJ3x+kwnPzeLbv6EnMPFLMGg=; b=Qiui1ewudt36Apnijc51zeaSVp28wqimOnDs0wUOaagQI/iBkISYVr1HvI5z+m0pYu xk/liai/nr571BrVny00dZowpwle9ZoiFmoJUzH7DlMeC06by/P6Witta0iQY9J0VVMT 6LUM5z3ifqVzC81QrpwYAvm/fVJnU5OG2YZ84= 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=DbndLKfL6PDffmkg9SsEJ3x+kwnPzeLbv6EnMPFLMGg=; b=FXdBgSwhemP4tG4Wy/RtpYjOIpSzEsCRaTNgE4/yYkB0I2/SoVKYJkEBFzA38mGwU8 jaAPPCwrTAlmuMWETCK11yvxMEFAk3hHTUdIB8Ypjhjso+0M19eL6reaJzEsupFRpZtL q6A0N18rzfvt2e0f2SquVGD88AmsMQnxxvIM78826nsBMOka1r7Uj24aPxQPZE3U6Tsp WigUvi/G0Ib1gh7o93+bRbLmAWJEjDHtAOmNQVkMb8X0mKfBfZ/CiZ+kph6xRx83dVbh Rg1m2fnuc8Hy1ASY+PHxOuwIU+lqg1gU2P81eIPyn4GWsQHqQ9WwoCRq9sWfnmaZLGME 5cVA== X-Gm-Message-State: AFeK/H2/G55F+OHp/T1Ya1QYNEdPwo2NZImOo4pVIoYUWKLfvcn4NSlIIi8MdQ6wrhLmWRM3YM8= X-Received: by 10.46.33.168 with SMTP id h40mr9259627lji.52.1490005177418; Mon, 20 Mar 2017 03:19:37 -0700 (PDT) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id c5sm223825lfk.51.2017.03.20.03.19.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Mar 2017 03:19:36 -0700 (PDT) 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 , Viresh Kumar Subject: [PATCH 3/4] PM / Domains: Respect errors from genpd's ->power_off() callback Date: Mon, 20 Mar 2017 11:19:22 +0100 Message-Id: <1490005163-28633-4-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1490005163-28633-1-git-send-email-ulf.hansson@linaro.org> References: <1490005163-28633-1-git-send-email-ulf.hansson@linaro.org> The current code in genpd_sync_power_off(), doesn't care about potential errors being returned from genpd's ->power_off() callback. Obviously this behaviour could lead to problems, such as incorrectly setting the genpd's status to GPD_STATE_POWER_OFF, but also to incorrectly decrease the subdomain count for the masters, which potentially allows them to be powered off in the next recursive call to genpd_sync_power_off(). Let's fix this behaviour by bailing out when the ->power_off() callback returns an error code. Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.7.4 Reviewed-by: Viresh Kumar Reviewed-by: Geert Uytterhoeven Reviewed-by: Bartlomiej Zolnierkiewicz diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index e63712d..8a2bfc8 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -767,7 +767,8 @@ static void genpd_sync_power_off(struct generic_pm_domain *genpd, bool use_lock, /* Choose the deepest state when suspending */ genpd->state_idx = genpd->state_count - 1; - _genpd_power_off(genpd, false); + if (_genpd_power_off(genpd, false)) + return; genpd->status = GPD_STATE_POWER_OFF;