From patchwork Fri Mar 3 20:41:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 94862 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp418553qgd; Fri, 3 Mar 2017 12:48:32 -0800 (PST) X-Received: by 10.98.157.12 with SMTP id i12mr5838127pfd.166.1488574112198; Fri, 03 Mar 2017 12:48:32 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17si11517761pgh.286.2017.03.03.12.48.31; Fri, 03 Mar 2017 12:48:32 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752050AbdCCUsa (ORCPT + 7 others); Fri, 3 Mar 2017 15:48:30 -0500 Received: from mail-pg0-f52.google.com ([74.125.83.52]:34022 "EHLO mail-pg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751882AbdCCUs2 (ORCPT ); Fri, 3 Mar 2017 15:48:28 -0500 Received: by mail-pg0-f52.google.com with SMTP id 77so3244335pgc.1 for ; Fri, 03 Mar 2017 12:47:45 -0800 (PST) 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=sJ77EBVzDaHDv2/++CsQ9yYNcdg0SgxhkHIqiuwQ58M=; b=ipd4BGsc5rKXadHe664OTY/VYpknX0gSsNWCPv0sTJjhD5tSWLjip0e289lmjXKomF 8/2WEusq3999re8QoFOcu1w6andUxcu5MaW+iVasBl64yPnPy5lNjehhvFAZC5KPm3VR BUnqlKDpN01iNJ2Z6ZjzaZFwqbiLEphjgIv7c= 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=sJ77EBVzDaHDv2/++CsQ9yYNcdg0SgxhkHIqiuwQ58M=; b=QVgIYVvJNpAp/vhiZ5e+156M+DC4kOwS7FfO3r+UdQ3/djhJsgcWWNtFiKSxXHqKsA Zq3Pk+b/kd2yeStPHdB8KEPbghAECgU+QvWXjuLGPVz/XGAomjM1GLYtCezQtot0zIsA Ww03yZpIGWR7zPbbmbxHXdUK0BGckhjImq7A4woHkAyiHoNv3Vr3l0LYif6SxdsmdTT4 Pr907G3MQe0a0RwlCDO6Oggn2e4H68guZdrdzrLFBRworT0S3I3/svrN5Pwt564uVgqD CDmAJIeQG7QlDZOJhl6U8zdf/oZTeXDE70o/wCMPCS2TEntpE1Xn58Xks2+ZxoRYOAnI 1NaA== X-Gm-Message-State: AMke39ls6sAc9WwkJzT+6i7IQT1P/A/0YQzEqUNgtko6U0NgtOrgI1OjGJAezM+AF1dOui6J X-Received: by 10.98.60.20 with SMTP id j20mr5858949pfa.128.1488573703014; Fri, 03 Mar 2017 12:41:43 -0800 (PST) Received: from ubuntu.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id o189sm25207003pga.12.2017.03.03.12.41.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Mar 2017 12:41:41 -0800 (PST) From: Lina Iyer To: ulf.hansson@linaro.org, khilman@kernel.org, rjw@rjwysocki.net, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andy.gross@linaro.org, sboyd@codeaurora.org, linux-arm-msm@vger.kernel.org, brendan.jackman@arm.com, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com, Juri.Lelli@arm.com, Lina Iyer , devicetree@vger.kernel.org, Rob Herring Subject: [PATCH V5 1/9] PM / Domains: Ignore domain-idle-states that are not compatible Date: Fri, 3 Mar 2017 12:41:27 -0800 Message-Id: <1488573695-106680-2-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488573695-106680-1-git-send-email-lina.iyer@linaro.org> References: <1488573695-106680-1-git-send-email-lina.iyer@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org domain-idle-states property may have phandles to idle state bindings that may not be compatible with idle state definition defined in [1]. Such phandles would just be ignored and not throw and error when read by the domain core. Cc: Cc: Rob Herring Signed-off-by: Lina Iyer --- Documentation/devicetree/bindings/power/power_domain.txt | 4 +++- drivers/base/power/domain.c | 16 +++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Acked-by: Rob Herring diff --git a/Documentation/devicetree/bindings/power/power_domain.txt b/Documentation/devicetree/bindings/power/power_domain.txt index 723e1ad..940707d 100644 --- a/Documentation/devicetree/bindings/power/power_domain.txt +++ b/Documentation/devicetree/bindings/power/power_domain.txt @@ -31,7 +31,9 @@ Optional properties: - domain-idle-states : A phandle of an idle-state that shall be soaked into a generic domain power state. The idle state definitions are - compatible with domain-idle-state specified in [1]. + compatible with domain-idle-state specified in [1]. phandles + that are not compatible with domain-idle-state will be + ignored. The domain-idle-state property reflects the idle state of this PM domain and not the idle states of the devices or sub-domains in the PM domain. Devices and sub-domains have their own idle-states independent of the parent diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index e697dec..de3e489 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2079,11 +2079,6 @@ static int genpd_parse_state(struct genpd_power_state *genpd_state, int err; u32 residency; u32 entry_latency, exit_latency; - const struct of_device_id *match_id; - - match_id = of_match_node(idle_state_match, state_node); - if (!match_id) - return -EINVAL; err = of_property_read_u32(state_node, "entry-latency-us", &entry_latency); @@ -2132,6 +2127,7 @@ int of_genpd_parse_idle_states(struct device_node *dn, int err, ret; int count; struct of_phandle_iterator it; + const struct of_device_id *match_id; count = of_count_phandle_with_args(dn, "domain-idle-states", NULL); if (count <= 0) @@ -2144,6 +2140,9 @@ int of_genpd_parse_idle_states(struct device_node *dn, /* Loop over the phandles until all the requested entry is found */ of_for_each_phandle(&it, err, dn, "domain-idle-states", NULL, 0) { np = it.node; + match_id = of_match_node(idle_state_match, np); + if (!match_id) + continue; ret = genpd_parse_state(&st[i++], np); if (ret) { pr_err @@ -2155,8 +2154,11 @@ int of_genpd_parse_idle_states(struct device_node *dn, } } - *n = count; - *states = st; + *n = i; + if (!i) + kfree(st); + else + *states = st; return 0; }