From patchwork Wed Feb 8 16:34:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 9562777 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 41AA560574 for ; Wed, 8 Feb 2017 16:35:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5AB57284F8 for ; Wed, 8 Feb 2017 16:35:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4ED2228500; Wed, 8 Feb 2017 16:35:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 00FA6284F8 for ; Wed, 8 Feb 2017 16:35:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751060AbdBHQfr (ORCPT ); Wed, 8 Feb 2017 11:35:47 -0500 Received: from mail-pg0-f53.google.com ([74.125.83.53]:35943 "EHLO mail-pg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752563AbdBHQfo (ORCPT ); Wed, 8 Feb 2017 11:35:44 -0500 Received: by mail-pg0-f53.google.com with SMTP id v184so50217547pgv.3 for ; Wed, 08 Feb 2017 08:35:08 -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=xQ5pZT0mnirJ+IzemeCzSI8PQL6CDoUWG7qesUuZgdA=; b=XMFXJIIWqMCSHqTnhReI+du5ZtbCbrtILXekzFd71plMFLz5+NPRzadHZ4UY8+YnYy NtaPQI5OI4IFKfiFtttv3TFfg4Mh4gJQJxC6T9/+hAWR65TNLPxE2dcA/7dDpTT0sWuP Bemrmgc17mtR/eQcyfBjqYJmmGcqdPB1a6oWI= 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=xQ5pZT0mnirJ+IzemeCzSI8PQL6CDoUWG7qesUuZgdA=; b=FFB5ie4Vdqd4CVGWDHhmZj3Mm8U3pYBIZvOdsxG5lguIaAChMMkEpUrmp1q9RFj0M4 /2A1wKrwjDccTPcMoO6ivlGre+dfusF+XNYIOphMM/hPmGZh1EcLCYmMxiQypeDJtCq5 qV0l77pFkaAg1O3IxssfC7C6RbWJKckWJd8AB0xa4HlV360g0aQrGpOxVWvYKb2LTbuh E5MM6bNrDAXsCo7UpkV23NJdNImS7cE7541MqxJ5FUu5ztXSLb1r0bv027BxRpQovXBE QrfbIbPybYNqt+oUZAvQBbWduLll7VD5TJvHo4yEK7TJyWx4e493VAOyKVK27kklp2Yl 2hvw== X-Gm-Message-State: AMke39lIYkn37hXEbd0V461/3MQnaYb9tm8/8DL/pl7r+qqMFck9cKzd/sf06OSdn+9qFbm9 X-Received: by 10.84.172.193 with SMTP id n59mr9359740plb.87.1486571707845; Wed, 08 Feb 2017 08:35:07 -0800 (PST) Received: from ubuntu.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id y23sm21653325pfi.66.2017.02.08.08.35.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Feb 2017 08:35:06 -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 1/2] PM / Domains: Ignore domain-idle-states that are not compatible Date: Wed, 8 Feb 2017 08:34:51 -0800 Message-Id: <1486571692-33212-3-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486571692-33212-1-git-send-email-lina.iyer@linaro.org> References: <1486571692-33212-1-git-send-email-lina.iyer@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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 6b23d82..3825bb9 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2065,11 +2065,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); @@ -2118,6 +2113,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) @@ -2130,6 +2126,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 @@ -2141,8 +2140,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; }