From patchwork Fri Dec 14 10:15:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 153805 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1881732ljp; Fri, 14 Dec 2018 02:15:48 -0800 (PST) X-Google-Smtp-Source: AFSGD/XR4/fPR8PxB5ZNBz2cv9rQV1GqH8rALxgtsxiJqKwcaZ0c/jAPBfSw1gjAAne9Sxg3BVH8 X-Received: by 2002:a17:902:5601:: with SMTP id h1mr2382872pli.160.1544782548108; Fri, 14 Dec 2018 02:15:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544782548; cv=none; d=google.com; s=arc-20160816; b=XgchhnIxEuaOCg7uKrW8ySeFXXxr+Qu9P88TbME6IBNQojOuFkvWPnJQrb/GvohmsG O4ieqHZHlGOxLo0tNJhCl0xpkCIVUWLhpyHG5F5+j77PKZ9nkEIzKPIQJoeDj3kpzK9x thfTuvbFOJEE54QhgpbG2pqeYyKv26PoxHdXzKQMuAQRwBuAwAfnQtlKHJMp4nEf3mtM dW4Ax7Hj+0HOiMwz1s9TQE70VF3IpYbn5FEnzmwXpmkmaMveMJ34L4NInpl31lXZvI0q JvGrgagJ42rn86cFQeHxtH2ugjlaMSfovzJx7HhuGml8EVEoLNHawwttfgmfpk5RpWT1 DCKA== 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=XD5aPJDvHRZ581FcCUpgoeC6urUyEEoQWOeuEQ8rbv/59y08IGONbdds0TYsjms7pB X+kiOnJwGwnpMXklYSY/1eK/MYNNuYPK7NVnNI2GOZHEL7MLXOkDB75srfNMZnLprzdK uurtdrRDGjOyUyuoCMtY3ZxG6CGVIWcZpG5bFr1ygaK+f01g67ysY/me4a4KwmGzHm78 XPqeHDknCDNiRMazSVFioLC/FE+uBDsKFLJlMLtyu3MbxYjgcZisNUuOmWcakedzVWgp 06Or59pqVf8V5DnsKp6lMDPiWnYDw7yItjywN4yO633G7qQR2bTojW3RZET2kpGpu6TN 9Teg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Uw/P9maD"; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 v4si3778037pfm.71.2018.12.14.02.15.47; Fri, 14 Dec 2018 02:15:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-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="Uw/P9maD"; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-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 S1729491AbeLNKPq (ORCPT + 11 others); Fri, 14 Dec 2018 05:15:46 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:40685 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729488AbeLNKPp (ORCPT ); Fri, 14 Dec 2018 05:15:45 -0500 Received: by mail-pf1-f196.google.com with SMTP id i12so2619614pfo.7 for ; Fri, 14 Dec 2018 02:15: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 :mime-version:content-transfer-encoding; bh=2LwDno6pPq3+62WWHDum9qZ80rXO5n5aGPdUmxZHq/s=; b=Uw/P9maDkd8VqTiGsuCXmhrm+JkG2Noyk0z/Jgyk1x2hz0BnnLzjDvJV6QgYGzd8kR Rsm0s6bTTIeIOJXgXQBmW3VFkYiEU1Qj3b5uWSCYFoFYcxi7WP4q0/ZCI0I879BwlNIo fQV/3AQ36xDGa68tMmkM5gISuDLbxbB5py6+0= 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=YNRg+9jRZrtBaZ3nCD53ut8080E19+hK4mTIN2UgwwDpnn9RB5r28Z6SWVGzseh4fJ H+6MHQ5+6ItvNZQMUMFLU8IxdfRxyXi6FeaBer/F9jL1Q5pts4oQ2xz29KWhQJ0ADb8N 5rhKSQ6vDXqaGs8+1h6XEWPfOm1ZMOUmgMAa7ilLvTkcMBGCwBmpCM/u5XnNy4+x7J4q MMaGENkfqKyOABy5Rk4ep88zF+es/maCy8tH7+YhNb5846laRb0Wk5Vis/2nPjx6Enk7 9+xMR/Dckr44Azx1dexPIvTFrf1DbA0OfKSH0hfRYn+0PR4Ptl9MrZtti0ALgaBQ/liO 6dnA== X-Gm-Message-State: AA+aEWZddNPtx4FQ8ls87Q0j59+L1HLxlvzJOXKWneaKHdow36uo7v5n zSv7M10wR/ATGXoPkqFZSGQ7Cg== X-Received: by 2002:a65:47ca:: with SMTP id f10mr2243734pgs.166.1544782544631; Fri, 14 Dec 2018 02:15:44 -0800 (PST) Received: from localhost ([122.172.23.29]) by smtp.gmail.com with ESMTPSA id c81sm13095642pfb.107.2018.12.14.02.15.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Dec 2018 02:15:44 -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 V4 2/7] OPP: Improve _find_table_of_opp_np() Date: Fri, 14 Dec 2018 15:45:28 +0530 Message-Id: <184bbc28f982752cc040f0b9286516c3897e2808.1544782279.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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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); }