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: 9603485 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 191FD604E2 for ; Fri, 3 Mar 2017 20:42:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06E4228555 for ; Fri, 3 Mar 2017 20:42:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF73F28588; Fri, 3 Mar 2017 20:42:56 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5A90E28555 for ; Fri, 3 Mar 2017 20:42:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=jkw6RivKl15gvp+oeJ7vfayShi/+B8tOigdURikCNxE=; b=dAj/v+55M48VR3NeWB2gOgMxX5 9iYQlODh2vUoLXImPbhzBjRxotS9nunmnyIFUtdqpRTVieFBqFpXeGaGoNwZK1Vnz8DVilJgrI4WQ g6jwsC4/zF6nOWAFYM8RonLYqGgqvHlRj5VaeWP3OdMqQ6ZsvESMOCwo+nNX+fvi/EIkN9WIxdTQG xGTwYB1fFGu8TsDE//9jpKGcKRKcIz5cR/3bP7IX9PFzq/Y2PDOJbtpgHAwXjQN/lJrUYzbUekXdh S7WddozrCM8IQ8vbemr891nJ+WskU9YE6z3DibGpyvs/QGFF0QWVFyZeEuGNXed5AVZR5hI9mFyc5 wj34MJGg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cju2R-00054B-Ts; Fri, 03 Mar 2017 20:42:55 +0000 Received: from mail-pf0-x231.google.com ([2607:f8b0:400e:c00::231]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cju1d-0004qM-4Y for linux-arm-kernel@lists.infradead.org; Fri, 03 Mar 2017 20:42:07 +0000 Received: by mail-pf0-x231.google.com with SMTP id j5so36671416pfb.2 for ; Fri, 03 Mar 2017 12:41:43 -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=OOeQbqDZ7ogu0tdvKTQ3azFn/B+lRl5OoCiY6NSlSupcRgCO7IFDU9FpU2cMwJBjYT DI9diSQty1FeSwSwCVdrm7auUEuOhTGKUXYNUqgSlopm4I3EHkbgUYM2CO3dYsxQbjKn 3tGiH1JO9AWTQdfFw3xYOd1WTFREOv7R3cCEeVytA17ynqXifbOGdYSKbUamx+cfZkXP dsWbAJhOA5Yd1gQw8XO3i9xN6VsTyvyr11W7csheRi5LmwynjvXyA38iLeGQ5gEqleY+ LLW7kyXzvAV6tHfIM3+MMfdNBLSNa6l9KdOJD7Mtl7rSBEEbTQny0ArIJ0EfYFFnSD2s kttQ== X-Gm-Message-State: AMke39ljeXviyH0whoAX/ZbpnonIR2QPW7I4cG+cJWSIULVtAviJn+wOYPbz1rCSeCl75jO4 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170303_124205_208984_4106E771 X-CRM114-Status: GOOD ( 11.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, lorenzo.pieralisi@arm.com, Juri.Lelli@arm.com, Rob Herring , linux-arm-msm@vger.kernel.org, sboyd@codeaurora.org, brendan.jackman@arm.com, sudeep.holla@arm.com, andy.gross@linaro.org, Lina Iyer MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 Acked-by: Rob Herring Acked-by: Ulf Hansson --- 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 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; }