From patchwork Wed Dec 12 10:57:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 153570 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1679425ljp; Wed, 12 Dec 2018 02:57:55 -0800 (PST) X-Google-Smtp-Source: AFSGD/WNmppfKnePL9iqTLEOVJfl9ivXCdU/gchvq5QNNh6D30nL/SR0v/zlfX66lZrMDLwR+N29 X-Received: by 2002:a17:902:541:: with SMTP id 59mr19769489plf.88.1544612275383; Wed, 12 Dec 2018 02:57:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544612275; cv=none; d=google.com; s=arc-20160816; b=JAboJkeQWnsP8+ed/V2FrGT1uo3wWDtsZ4lPNmm9avSrHwpAx4fGlzqoon/gWhGpX8 /17TAqOsjM8QNhx/qbsyemi1b4vW527Yes7AIHh3DlZy0V65qJQBzsxNwyht21xY+C10 eVL/qFtG+yf0Ro3X/J36bpkAlw6vYUkYGdjeO+5iZg16KgVHZ9LPjkgl7VfX+l0En1b2 +r/qenSSTnlE7MWu0FdU5i7J9mQcmUPbr0aj8Cs09Cn+37gI33qxOXcYcNKEOzNEAkSs 5T/Xg4EamN/2E7Eizcy3LVMLcnLYgY3dwolYtRrveUPwp13pH39cSXBp/uxuq6EZjvHf bkoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2LwDno6pPq3+62WWHDum9qZ80rXO5n5aGPdUmxZHq/s=; b=WxhnvCsJoZeBshWhZfwEKhkSRqhVdhq3KJ/71artWzr14g8ySOpp0BzN5YNCo2W9se m1bJFjoShbQg1l0ALo2K1RMXTzpDczzoI3kJeUGuDmnpH3vv1o5D9SHM6U0vEGQiGGdT Od/fipgUL/a+QHq0p/Ofya0su4Wj0bTP+v/R5OxMKsrQFp16Japud2vo/IkhSRmevOMH xe9qJVZQO09uy8881Ma3O+pCZlAqvEicvidRtN/zkKcZzvZgX3XhOo1+pXThvLFWxZp3 BdHJdMQj0k2yOt7Wpr9Y56ts/LoboW1ukRKheOG07XUZZWxK5/7xGd6OWSvTZzE2qop9 po2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="cp/5Dlox"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b4si14042153pgk.350.2018.12.12.02.57.55; Wed, 12 Dec 2018 02:57:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="cp/5Dlox"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727283AbeLLK5y (ORCPT + 31 others); Wed, 12 Dec 2018 05:57:54 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:35244 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727159AbeLLK5x (ORCPT ); Wed, 12 Dec 2018 05:57:53 -0500 Received: by mail-pf1-f193.google.com with SMTP id z9so8712279pfi.2 for ; Wed, 12 Dec 2018 02:57:53 -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 :mime-version:content-transfer-encoding; bh=2LwDno6pPq3+62WWHDum9qZ80rXO5n5aGPdUmxZHq/s=; b=cp/5DloxzSyYYKEYpPoupB7nKkWCn4Y797pFKu1xK54mYGiDFdvKKl5Mc6insysd36 dQIJINwWf2ynGwlxCPYmYwBERSB8Z1gGGj1N3qcA3KYKgNFYtEd5HbhuxjvLuZRdswVR WaWiqyaUOC+dzreOlCz1L92A1pAlDQvAHmFMk= 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:mime-version:content-transfer-encoding; bh=2LwDno6pPq3+62WWHDum9qZ80rXO5n5aGPdUmxZHq/s=; b=XSz/of3QCWfiMWvco9tmGGIv+zhbyALumUl/Hl53NMOrkHhRausZja3DI6JlzrO7mT cxYH7u+0OHfVfvlLGVyptwsNF3N2fuxi/ACNvDTNVY+DXb6yxFCgXXRc4AheP98R6vOk mH3EFDXxN9TBDY3ez+jpFNPB6Hvqji9+hi8SpRw72jTtBhnKv/gui7pU+5SyzGtZ7ZwJ 7gVd3Ozt/pflmW5Np5WyUF8EdMcCypMJozMa0WrpG4tIPjgGGJ0O5O4HByWPwXSiFp4l bYDlXFkNqYrLcjrC/i0WzMAMyjNm8Lpc7Lu+e9/y6rsoLP0U1a8CdxqY/VMhhVROf1Zj yIOA== X-Gm-Message-State: AA+aEWYITSsR1Bkv3V/95FUzB8J3L8SMwPPbi0cGZKEVlSjoR6bj/+o0 2IHclGzejNRltFaUbubqlrHD/A== X-Received: by 2002:a63:7c13:: with SMTP id x19mr17597162pgc.45.1544612272831; Wed, 12 Dec 2018 02:57:52 -0800 (PST) Received: from localhost ([122.172.23.29]) by smtp.gmail.com with ESMTPSA id 4sm38982244pfq.10.2018.12.12.02.57.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 02:57:52 -0800 (PST) From: Viresh Kumar To: ulf.hansson@linaro.org, Rafael Wysocki , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , linux-pm@vger.kernel.org, Vincent Guittot , rnayak@codeaurora.org, niklas.cassel@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH V3 2/6] OPP: Improve _find_table_of_opp_np() Date: Wed, 12 Dec 2018 16:27:25 +0530 Message-Id: <184bbc28f982752cc040f0b9286516c3897e2808.1544611890.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.19.1.568.g152ad8e3369a In-Reply-To: References: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Make _find_table_of_opp_np() more efficient by using of_get_parent() to find the parent OPP table node. Tested-by: Rajendra Nayak Signed-off-by: Viresh Kumar --- drivers/opp/of.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) -- 2.19.1.568.g152ad8e3369a diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 3ef7f38c0986..8e57d257be77 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -114,19 +114,25 @@ static struct device_node *of_parse_required_opp(struct device_node *np, static struct opp_table *_find_table_of_opp_np(struct device_node *opp_np) { struct opp_table *opp_table; - struct dev_pm_opp *opp; + struct device_node *opp_table_np; lockdep_assert_held(&opp_table_lock); + opp_table_np = of_get_parent(opp_np); + if (!opp_table_np) + goto err; + + /* It is safe to put the node now as all we need now is its address */ + of_node_put(opp_table_np); + list_for_each_entry(opp_table, &opp_tables, node) { - opp = _find_opp_of_np(opp_table, opp_np); - if (opp) { - dev_pm_opp_put(opp); + if (opp_table_np == opp_table->np) { _get_opp_table_kref(opp_table); return opp_table; } } +err: return ERR_PTR(-ENODEV); }