From patchwork Mon Mar 20 10:19:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 95491 Delivered-To: patches@linaro.org Received: by 10.182.3.34 with SMTP id 2csp1298391obz; Mon, 20 Mar 2017 03:19:35 -0700 (PDT) X-Received: by 10.25.235.77 with SMTP id j74mr7522666lfh.60.1490005175301; Mon, 20 Mar 2017 03:19:35 -0700 (PDT) Return-Path: Received: from mail-lf0-x22b.google.com (mail-lf0-x22b.google.com. [2a00:1450:4010:c07::22b]) by mx.google.com with ESMTPS id y9si9024233lja.182.2017.03.20.03.19.35 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Mar 2017 03:19:35 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22b as permitted sender) client-ip=2a00:1450:4010:c07::22b; 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::22b 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-x22b.google.com with SMTP id z15so53400095lfd.1 for ; Mon, 20 Mar 2017 03:19:35 -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=bhS1zuZ/C0X/CMPmVZeUEbvRXobk05Z4VqCfGzr+/XA=; b=Rgpy5Yq5fBsLs+D8XoPqri2G3Dpu9Cy788oiLEj7ss0k8AOXYNjrNOped6BwNgHxBJ 9l4rlOR59TjLWYjMGdjqCFWzyAqd8Wbnalv9OnAPDvlTZ4VliWaeq37c9LINTvIxlgn7 Iev4DYGiuIzSJMGdG3T3DhXRGofFwRXpvedKs= 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=bhS1zuZ/C0X/CMPmVZeUEbvRXobk05Z4VqCfGzr+/XA=; b=eIrQN2FAcLsi9c06+9CxcWrLuZh3dZsJ3Q0ICF9EwxP/FLEf4j3TJXyMQWzNJ+2HP7 3wSh1hNMjIS+dl9WiP0NsX6fZGx5z7UBK2L4a9NwC8BlWB1S41sgdrQAZyg+tbLwfq2U +hcUaOhB+prP3KZrk1u5jdJzvy0i67CBEodIiIR1nOWcTkNxlS8rEj3s7yEPGCSbZ5oL pksPcuM9gOA91KvqsHIjijIzdClMtpCXWvi8ukf8h3MN/0EEWbrNSZ50re7LsAG7Xpll 9kMnJjUkx1OUh2Kyo4UAvcNanaUf+lLMua3XoEUje5+banogl2OvGrVfeuUoWSlrHfKa d4ug== X-Gm-Message-State: AFeK/H000gZkOrtO2DvxDw/XVqFrpomkgvc/eU030DgDUTHrRqhoOXoxsVXjdfS0QEk0zm9nNZk= X-Received: by 10.46.21.13 with SMTP id s13mr2215818ljd.112.1490005174939; Mon, 20 Mar 2017 03:19:34 -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.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Mar 2017 03:19:34 -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 1/4] PM / Domains: Clean up code validating genpd's status Date: Mon, 20 Mar 2017 11:19:20 +0100 Message-Id: <1490005163-28633-2-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> There exists several similar validations of the genpd->status, against GPD_STATE_ACTIVE and GPD_STATE_POWER_OFF. Let's clean up this code by converting to use a helper macro, genpd_status_on(). Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) -- 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 e697dec..7a8e70d 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -121,6 +121,7 @@ static const struct genpd_lock_ops genpd_spin_ops = { #define genpd_lock_interruptible(p) p->lock_ops->lock_interruptible(p) #define genpd_unlock(p) p->lock_ops->unlock(p) +#define genpd_status_on(genpd) (genpd->status == GPD_STATE_ACTIVE) #define genpd_is_irq_safe(genpd) (genpd->flags & GENPD_FLAG_IRQ_SAFE) static inline bool irq_safe_dev_in_no_sleep_domain(struct device *dev, @@ -296,8 +297,7 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on, * (1) The domain is already in the "power off" state. * (2) System suspend is in progress. */ - if (genpd->status == GPD_STATE_POWER_OFF - || genpd->prepared_count > 0) + if (!genpd_status_on(genpd) || genpd->prepared_count > 0) return 0; if (atomic_read(&genpd->sd_count) > 0) @@ -373,7 +373,7 @@ static int genpd_power_on(struct generic_pm_domain *genpd, unsigned int depth) struct gpd_link *link; int ret = 0; - if (genpd->status == GPD_STATE_ACTIVE) + if (genpd_status_on(genpd)) return 0; /* @@ -752,7 +752,7 @@ static void genpd_sync_power_off(struct generic_pm_domain *genpd, bool use_lock, { struct gpd_link *link; - if (genpd->status == GPD_STATE_POWER_OFF) + if (!genpd_status_on(genpd)) return; if (genpd->suspended_count != genpd->device_count @@ -793,7 +793,7 @@ static void genpd_sync_power_on(struct generic_pm_domain *genpd, bool use_lock, { struct gpd_link *link; - if (genpd->status == GPD_STATE_ACTIVE) + if (genpd_status_on(genpd)) return; list_for_each_entry(link, &genpd->slave_links, slave_node) { @@ -1329,8 +1329,7 @@ static int genpd_add_subdomain(struct generic_pm_domain *genpd, genpd_lock(subdomain); genpd_lock_nested(genpd, SINGLE_DEPTH_NESTING); - if (genpd->status == GPD_STATE_POWER_OFF - && subdomain->status != GPD_STATE_POWER_OFF) { + if (!genpd_status_on(genpd) && genpd_status_on(subdomain)) { ret = -EINVAL; goto out; } @@ -1346,7 +1345,7 @@ static int genpd_add_subdomain(struct generic_pm_domain *genpd, list_add_tail(&link->master_node, &genpd->master_links); link->slave = subdomain; list_add_tail(&link->slave_node, &subdomain->slave_links); - if (subdomain->status != GPD_STATE_POWER_OFF) + if (genpd_status_on(subdomain)) genpd_sd_counter_inc(genpd); out: @@ -1406,7 +1405,7 @@ int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, list_del(&link->master_node); list_del(&link->slave_node); kfree(link); - if (subdomain->status != GPD_STATE_POWER_OFF) + if (genpd_status_on(subdomain)) genpd_sd_counter_dec(genpd); ret = 0; @@ -2221,7 +2220,7 @@ static int pm_genpd_summary_one(struct seq_file *s, if (WARN_ON(genpd->status >= ARRAY_SIZE(status_lookup))) goto exit; - if (genpd->status == GPD_STATE_POWER_OFF) + if (!genpd_status_on(genpd)) snprintf(state, sizeof(state), "%s-%u", status_lookup[genpd->status], genpd->state_idx); else From patchwork Mon Mar 20 10:19:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 95492 Delivered-To: patches@linaro.org Received: by 10.182.3.34 with SMTP id 2csp1298401obz; Mon, 20 Mar 2017 03:19:36 -0700 (PDT) X-Received: by 10.25.77.2 with SMTP id a2mr7922668lfb.143.1490005176598; Mon, 20 Mar 2017 03:19:36 -0700 (PDT) Return-Path: Received: from mail-lf0-x22f.google.com (mail-lf0-x22f.google.com. [2a00:1450:4010:c07::22f]) by mx.google.com with ESMTPS id 36si8995000lfp.407.2017.03.20.03.19.36 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Mar 2017 03:19:36 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:4010:c07::22f as permitted sender) client-ip=2a00:1450:4010:c07::22f; 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::22f 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-x22f.google.com with SMTP id z15so53400321lfd.1 for ; Mon, 20 Mar 2017 03:19:36 -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=8aF1bRw5WP9SnbVdBCFgnc6fPLCNiUqMgzg6h6r4R5Y=; b=XhHrkqi3343PRIfX4jMNNh75IYXh2RbLFIahl1GRV8g8h6AQh18O/cNALbXRLCcUnG kt+O//f+IqvrnfTboMFIsM6wBV21yBBjLts46mdE3oA1NeYiKY7zK0lMf2S2wh97W6/h sKJuicq0ULv+4AGvXBpUSmjgfTi2HPUzJ6Z/w= 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=8aF1bRw5WP9SnbVdBCFgnc6fPLCNiUqMgzg6h6r4R5Y=; b=naNVG4snKhdny+f625bQg1puuKWGlan4iphwsGIeEx9LZ0Xhb5s6GOIlxKS4/Lm69s 79yYh4BZbWT9zjiWyjIzUS3R8bCdX6Nhyki6OS7PiwJ3a8cRBwqLQG7FmoRHbTG0HK18 4oiufewpo2TqipIdXFIkMnkvfm9jIjax4h6bk9n0tX87R2zwZkEf66PZuwiBn+uq+/pF aXNjD6GMOCLVCxuHt9Q2oNKEnTelCOjg992vQRKV3Mr56SEYdrjwckuYuOpb7DAJEAaO p9FXBDJLQPNUcWHFQTNfLEOgVq3Miv0jEnWrCdPfdk72tZx0BciEfW1OOYdnI2s5u0rL AkeQ== X-Gm-Message-State: AFeK/H3fEpE0u7+GckL1Ysg614izO0hbPAbMOaY2TBDPpnDrvBAz+A/QnBGR285tF3eiFDSjs0M= X-Received: by 10.46.71.138 with SMTP id u132mr8538545lja.43.1490005176202; Mon, 20 Mar 2017 03:19:36 -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.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Mar 2017 03:19:35 -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 2/4] PM / Domains: Enable users of genpd to specify always on PM domains Date: Mon, 20 Mar 2017 11:19:21 +0100 Message-Id: <1490005163-28633-3-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 way to implement an always on PM domain consists of returning -EBUSY from the ->power_off() callback. This is a bit different compared to using the always on genpd governor, which prevents the PM domain from being powered off via runtime suspend, but not via system suspend. The approach to return -EBUSY from the ->power_off() callback to support always on PM domains in genpd is suboptimal. That is because it requires genpd to follow the regular execution path of the power off sequence, which ends by invoking the ->power_off() callback. To enable genpd to early abort the power off sequence for always on PM domains, it needs static information about these configurations. Therefore let's add a new genpd configuration flag, GENPD_FLAG_ALWAYS_ON. Users of the new GENPD_FLAG_ALWAYS_ON flag, are by genpd required to make sure the PM domain is powered on before calling pm_genpd_init(). Moreover, users don't need to implement the ->power_off() callback, as genpd doesn't ever invoke it. Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 14 ++++++++++++-- include/linux/pm_domain.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) -- 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 7a8e70d..e63712d 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -123,6 +123,7 @@ static const struct genpd_lock_ops genpd_spin_ops = { #define genpd_status_on(genpd) (genpd->status == GPD_STATE_ACTIVE) #define genpd_is_irq_safe(genpd) (genpd->flags & GENPD_FLAG_IRQ_SAFE) +#define genpd_is_always_on(genpd) (genpd->flags & GENPD_FLAG_ALWAYS_ON) static inline bool irq_safe_dev_in_no_sleep_domain(struct device *dev, struct generic_pm_domain *genpd) @@ -300,7 +301,12 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on, if (!genpd_status_on(genpd) || genpd->prepared_count > 0) return 0; - if (atomic_read(&genpd->sd_count) > 0) + /* + * Abort power off for the PM domain in the following situations: + * (1) The domain is configured as always on. + * (2) When the domain has a subdomain being powered on. + */ + if (genpd_is_always_on(genpd) || atomic_read(&genpd->sd_count) > 0) return -EBUSY; list_for_each_entry(pdd, &genpd->dev_list, list_node) { @@ -752,7 +758,7 @@ static void genpd_sync_power_off(struct generic_pm_domain *genpd, bool use_lock, { struct gpd_link *link; - if (!genpd_status_on(genpd)) + if (!genpd_status_on(genpd) || genpd_is_always_on(genpd)) return; if (genpd->suspended_count != genpd->device_count @@ -1491,6 +1497,10 @@ int pm_genpd_init(struct generic_pm_domain *genpd, genpd->dev_ops.start = pm_clk_resume; } + /* Always-on domains must be powered on at initialization. */ + if (genpd_is_always_on(genpd) && !genpd_status_on(genpd)) + return -EINVAL; + /* Use only one "off" state if there were no states declared */ if (genpd->state_count == 0) { ret = genpd_set_default_power_state(genpd); diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 5339ed5..9b6abe6 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -20,6 +20,7 @@ /* Defines used for the flags field in the struct generic_pm_domain */ #define GENPD_FLAG_PM_CLK (1U << 0) /* PM domain uses PM clk */ #define GENPD_FLAG_IRQ_SAFE (1U << 1) /* PM domain operates in atomic */ +#define GENPD_FLAG_ALWAYS_ON (1U << 2) /* PM domain is always powered on */ enum gpd_status { GPD_STATE_ACTIVE = 0, /* PM domain is active */ 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; From patchwork Mon Mar 20 10:19:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 95494 Delivered-To: patches@linaro.org Received: by 10.182.3.34 with SMTP id 2csp1298415obz; Mon, 20 Mar 2017 03:19:39 -0700 (PDT) X-Received: by 10.25.165.7 with SMTP id o7mr6936093lfe.141.1490005178909; Mon, 20 Mar 2017 03:19:38 -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 u69si9030669lfg.246.2017.03.20.03.19.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Mar 2017 03:19:38 -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 y193so53268205lfd.3 for ; Mon, 20 Mar 2017 03:19:38 -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=5KIZ6nL2aZukKxZne4YS/KyosXE2bZQMD4xvdYsEm4o=; b=c5fFtS9PpUnkkfUO7ey8YA4nSXfqOpsC0mI0WORf2k+gnjX4uZ/bG7VXgmhfUgCo3B 9FBmgXk9dcciRQt6zbXTMogYXCHOTDfZE5eEhdJXY/L8H866ELPk9WBi1dSwbAkUSssp R3yNx1L28UEdkMUwBxEEEHfG6xHQPqlbNNjhM= 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=5KIZ6nL2aZukKxZne4YS/KyosXE2bZQMD4xvdYsEm4o=; b=f6o+EwXAOyruQ0WAiVb+rWPtK1gExBxzPEw2gsdpsWBteDE4pmjyK5TpCJfPRS4xQK +nja1OqNG62W1vTu+5mDsC/chQqYGwoHbihc4s5XYSlwDHYbKocQFnIgaCeZX2LCFeBh nY+DnglBPgzrHE309FJ4jqhQetCm1t5uiq7JNyIoVgdH8oxSNIJ+rOSp1Gq6/kTO4RPC FWkRTOMZXwEhq9lPb74HNzHDhe/0pISL+Se24PxpwJqWHEYHRlb9GAYT1piqctUgO/4E CIpcpKBEWwmK390kPRxIySAamcwDygzT7QyCLzgNzsmc5mNRWmPbGhGQzbyyibuQ7zfm 1PSg== X-Gm-Message-State: AFeK/H0sl59DR6lAUTSL5/5RdTrjVAfmiGQ+D+TXLFDzN2vq74i4llyP9Th9gXnCmXl2PhwGrOg= X-Received: by 10.25.211.2 with SMTP id k2mr7960062lfg.61.1490005178536; Mon, 20 Mar 2017 03:19:38 -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.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Mar 2017 03:19:37 -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 4/4] PM / Domains: Don't warn about IRQ safe device for an always on PM domain Date: Mon, 20 Mar 2017 11:19:23 +0100 Message-Id: <1490005163-28633-5-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> When an IRQ safe device is attached to a no sleep domain, genpd prints a warning once, as to indicate it is a suboptimal configuration from power consumption point of view. However the warning doesn't make sense for an always on domain, since it anyway remains powered on. Therefore, let's change to not print the warning for this configuration. Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -- 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 8a2bfc8..bfba02f 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -132,8 +132,12 @@ static inline bool irq_safe_dev_in_no_sleep_domain(struct device *dev, ret = pm_runtime_is_irq_safe(dev) && !genpd_is_irq_safe(genpd); - /* Warn once if IRQ safe dev in no sleep domain */ - if (ret) + /* + * Warn once if an IRQ safe device is attached to a no sleep domain, as + * to indicate a suboptimal configuration for PM. For an always on + * domain this isn't case, thus don't warn. + */ + if (ret && !genpd_is_always_on(genpd)) dev_warn_once(dev, "PM domain %s will not be powered off\n", genpd->name);