From patchwork Mon Nov 26 08:10:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 151989 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5345470ljp; Mon, 26 Nov 2018 00:10:22 -0800 (PST) X-Google-Smtp-Source: AFSGD/WYJ9mNVw8MlQmsE1x9TW5WsODdjnvfARRrJrEHvuYC1EP/DzGoXCL42vcRWW0d5uMFnPVY X-Received: by 2002:a17:902:4681:: with SMTP id p1mr26305302pld.184.1543219822546; Mon, 26 Nov 2018 00:10:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543219822; cv=none; d=google.com; s=arc-20160816; b=JG9y+pqDznDZ9hvY+sSk/5PeRkvXQotVNzVDNXVJR92Pag6xMCBBEQdSgTPKfXhGIv H9IzdiFsp3gTdk3b/AjjXnxwAOP+Uq//idTHzPTybTQvwStc+4dKXSTSA64Tl614V9pV unv6PIeNtQeCnn1j9ieEVzI5HC6LxIsdI3wXqSPMTbS0HPzBDaSaJajOlyZ1BuOEPqsM JuP0MMCRTFxjPvlabrgnYH+AorXw7yuOxPz4hIyQyevsFkEpL0dkl0Qi+IitzQx8gZwS sqomR06Cw88GtsQzD5hdElHB49oj5YcuC0CRJYLtvZyik5OUmbg+NhDagp41Rq6U4Vma 6avQ== 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=msGAK4RrrMmKEQHc7IKbb8yv9gPVm8eo19cu/yD5PZM=; b=xufERTto0IthX492w33yKNXiB6h8xGnXR+FLXGAJmQM1xDdY2urjQMry/4AYc+xflo bTpNRQgaAxdkM2wbDS5+CehaX9+IJLTKz212st957SYaSc8Q7sMQwwC5SLJ2fzEuXDns 3bqW2Qc8nvTiDfeUeCO/iHl88Zs8L7TDL0CBetwbCHm1sA94oTg6TnHSfTyvQc/2GSMa BXSOfaxm0u61lgwGYBVrtU6OWxU7auXETxbAQVoOTARR3xcNrytVfvzrvMt6AmZjiNiv r0cSAJ9l23JSaxLZQAGr01iDcbgt2P4QwZ3ptVY5U2Neo/8HeAWMO4IU1LnZ5azE8NjB KE5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=akh0TU0w; 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 w1si19227832pgi.66.2018.11.26.00.10.22; Mon, 26 Nov 2018 00:10:22 -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=akh0TU0w; 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 S1726349AbeKZTDk (ORCPT + 11 others); Mon, 26 Nov 2018 14:03:40 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:39894 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726158AbeKZTDj (ORCPT ); Mon, 26 Nov 2018 14:03:39 -0500 Received: by mail-pg1-f194.google.com with SMTP id w6so5801134pgl.6 for ; Mon, 26 Nov 2018 00:10:20 -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=msGAK4RrrMmKEQHc7IKbb8yv9gPVm8eo19cu/yD5PZM=; b=akh0TU0wu4X/UJ5H904fmz49+221eV8eIaHnNwzkORb4SZl70SGS6MUPII/2EWe3JA z5duPkIG5iGCXPWCpKYnqlYCVomAhMCv4R8CeIVy4UiixflLrKMyR1/I08UMV1zi5q12 tx8ya/f+QT5pT06MMBRXdofC8ahTEx4pUTH08= 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=msGAK4RrrMmKEQHc7IKbb8yv9gPVm8eo19cu/yD5PZM=; b=dmJiricxKmep0cMirytg8acgcLUaQN9drZo4bSOx1K17mm1sS82BpOg7s000VEPqQ2 Bz9V3FWHY47StxVpzSIVbOfNLQlx+CVJm7DxkJrToBkZnZPrQ5+Zm4s9O9Eo4zjMO+0V D5eFHXQMs3Cpqrx/iCWOSfdozxET/cVV8X0B3VxvpK0u9JZe7JvwCFcwyLLyoP1fhMCF DMm9Poy2vm/UbiwNcsSpEjEq+whB77APg6f3omj8Y7C7aIiWN4a5WvR/xgRM8MDvZoX5 JYDl+++Noq84vr3pzykjEaymFHkeUVC4kLwZFSm51BU3Qr9bU8LI9qN60ZqBgHJDK9ni 8aWg== X-Gm-Message-State: AGRZ1gJdGKXhTNSd3xqUV8pPdTzuoETGTSyaZC3RMQEd8pDXq9q61bDW W6UBSwstFFL46WOBkpDcsjHHFQ== X-Received: by 2002:a62:6ec8:: with SMTP id j191mr26761209pfc.198.1543219819913; Mon, 26 Nov 2018 00:10:19 -0800 (PST) Received: from localhost ([122.172.88.116]) by smtp.gmail.com with ESMTPSA id x3sm52269025pgk.18.2018.11.26.00.10.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Nov 2018 00:10:19 -0800 (PST) From: Viresh Kumar To: ulf.hansson@linaro.org, Rafael Wysocki , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Viresh Kumar , Vincent Guittot , rnayak@codeaurora.org, niklas.cassel@linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 1/5] OPP: Improve _find_table_of_opp_np() Date: Mon, 26 Nov 2018 13:40:00 +0530 Message-Id: <24e67ba3145090fb73609a6f681c4f8ff8f73594.1543219386.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. 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 840f85181a37..04968b6a9708 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); }