Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp4119940ybd; Tue, 25 Jun 2019 14:34:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqyNxkJsLPt1Td4SPw3WOyTDZ7dMVPrqz0RUT++on85x9SeJkcsbAwPFz/F4jN4PCIkyumXP X-Received: by 2002:a17:90a:b30a:: with SMTP id d10mr61868pjr.8.1561498464199; Tue, 25 Jun 2019 14:34:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561498464; cv=none; d=google.com; s=arc-20160816; b=lxtRf2g8I8OX1VCGjJx/F9E6O5y0gQtU9Q4+rmupA6NBRiEYXROr5b/Cy2PNHN9Ddb kxwbfhDGOpKLjxEuWXCz90+mf8fPdjg+FfiGUfnR024fe/ZZytzyBIp9Veof+JQfAdJu 6Cv+ZrGfLwM6cZLRT8cyvmDvozHyq+fUPzzKYCmC7WMJj+nyyWUDn14crlay91RNtt1n 6/9OkxAbC+eM8TNFtG+6f78zuIjZmBZ4eCad+Va/HcIqFmRjhU8uQPgUUcE83vWnnwoQ y9mSURBAvflNA4Ar7iAJYUUvY/5U2F1SU0m9aCbRMrezUZmwh8gvlxTZTY330CtvgftS 5+Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=lpO4xjO0dM1h5Blpl/u+aSxMu+4T0qkcqrt5hW3H2qY=; b=zjdQCMjLMgTN1x/nMaApfHjt7prv4sXcyIYpyFtNu6pgPyJzsIBdWsIbS27Jyp5+wa 9EIv4bUgyRNK0RC7fEkzRktkUXrpyxSLqTuFDUhDAWH2N1DVdZfs7xJ10XzFPbVDtVfW diAIC8wQgI/XLNSvQVP9f7cCsEhI2LqgrmZa2hhvPpv4dbWxj1QOeig85ADossPQUqmX 6nmOtk9qAADAGKueudhbbfTDm45zBTyRjsZv8lPbArRowyROfczp+H9+ofP4pOoobXVZ UNRJzvZIIjFSN4q/yp3ATtZ2tLtJb5UdN7J3pZOJT283GWOM/VD7oPrZRtLXEXUtpCeR aXIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Ph4Tz/3v"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g22si15590245pfh.219.2019.06.25.14.34.08; Tue, 25 Jun 2019 14:34:24 -0700 (PDT) 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=@google.com header.s=20161025 header.b="Ph4Tz/3v"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726467AbfFYVd4 (ORCPT + 99 others); Tue, 25 Jun 2019 17:33:56 -0400 Received: from mail-qt1-f202.google.com ([209.85.160.202]:50344 "EHLO mail-qt1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726442AbfFYVdw (ORCPT ); Tue, 25 Jun 2019 17:33:52 -0400 Received: by mail-qt1-f202.google.com with SMTP id g30so143241qtm.17 for ; Tue, 25 Jun 2019 14:33:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=lpO4xjO0dM1h5Blpl/u+aSxMu+4T0qkcqrt5hW3H2qY=; b=Ph4Tz/3vcNuZ/WoEa6GYfePulm3GVZ4kU2VTUl4xi8WiaIEzqgtKU6RkGGEnwHXhhZ 9vPvuryB17TSn9+Kp7LY1Gx5YrMIUz31583R/36kO/hMTIOoUV/sn5MclPgXsyQEdaLL WIe6divrdg6dWVjVEtjpiRsJwBEjA3bUGGFOMh4RHSgdB0xTwnKtTJwOoyaWrnMMYpAd QbMOf2mWXpegBj97lH2TEYZO3vf1dqaVfiROuXLySE89NxbGN8FrK94c3FRoqevPnQT7 /FP1bPaZab4eIe5MhuWr/0DIfUBi2MH8sIArazkMN18QtI3T40b8uhGx83jsqsSJRcDF EgKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=lpO4xjO0dM1h5Blpl/u+aSxMu+4T0qkcqrt5hW3H2qY=; b=HMLRQA+Ogm6la/w7eORQukv+Z60TNB9NV0eNjqM2458WGwXP4eraCttiPj5FDvJc/T jyvU5Ue/a6vZb7eLymmm2xdFKfBR5BSFreu44zHRAmee/FPB2o6xrF7CAn4oEmLfbCL4 Tc0hgz0LN1ZcuRRY6EaiIgoT9ZhIJhr9MTpdiHteyE1EwaQTO17LYjmISWgfOIrVsGsp zPIQl5SZF+6MqOugv9b235BbWKH1DcqWLghn2yrwS59R8ssxQ+IrOS3fE3muMjapADPA qnNE06wv74+cI7VN1Sa8fNwO/ic+N9bexISO/OBiacFor6y52fm9hMbfL9xDdrq8mnuF UrNw== X-Gm-Message-State: APjAAAWV0yTwKZOURxDdkAxKCHcb0/frh/njV98n6IybrmnScyoqDLuV v1GmZkLxsEtM/Sj9Zz7SPcMC6Z9aktNcmLA= X-Received: by 2002:a37:a648:: with SMTP id p69mr815052qke.136.1561498431578; Tue, 25 Jun 2019 14:33:51 -0700 (PDT) Date: Tue, 25 Jun 2019 14:33:36 -0700 In-Reply-To: <20190625213337.157525-1-saravanak@google.com> Message-Id: <20190625213337.157525-4-saravanak@google.com> Mime-Version: 1.0 References: <20190625213337.157525-1-saravanak@google.com> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog Subject: [PATCH v2 3/4] PM / devfreq: Cache OPP table reference in devfreq From: Saravana Kannan To: MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" Cc: Saravana Kannan , kernel-team@android.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The OPP table can be used often in devfreq. Trying to get it each time can be expensive, so cache it in the devfreq struct. Signed-off-by: Saravana Kannan --- drivers/devfreq/devfreq.c | 6 ++++++ include/linux/devfreq.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 6b6991f0e873..ac62b78dc035 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -597,6 +597,8 @@ static void devfreq_dev_release(struct device *dev) if (devfreq->profile->exit) devfreq->profile->exit(devfreq->dev.parent); + if (devfreq->opp_table) + dev_pm_opp_put_opp_table(devfreq->opp_table); mutex_destroy(&devfreq->lock); kfree(devfreq); } @@ -677,6 +679,10 @@ struct devfreq *devfreq_add_device(struct device *dev, devfreq->max_freq = devfreq->scaling_max_freq; devfreq->suspend_freq = dev_pm_opp_get_suspend_opp_freq(dev); + devfreq->opp_table = dev_pm_opp_get_opp_table(dev); + if (IS_ERR(devfreq->opp_table)) + devfreq->opp_table = NULL; + atomic_set(&devfreq->suspend_count, 0); dev_set_name(&devfreq->dev, "devfreq%d", diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index fbffa74bfc1b..0d877c9513d7 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -156,6 +156,7 @@ struct devfreq { struct devfreq_dev_profile *profile; const struct devfreq_governor *governor; char governor_name[DEVFREQ_NAME_LEN]; + struct opp_table *opp_table; struct notifier_block nb; struct delayed_work work; -- 2.22.0.410.gd8fdbe21b5-goog