From patchwork Fri Apr 10 17:58:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 6198331 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5CF379F1C4 for ; Fri, 10 Apr 2015 18:03:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 72DEB20430 for ; Fri, 10 Apr 2015 18:03:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 556462026F for ; Fri, 10 Apr 2015 18:03:03 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YgdDw-0002Uc-L7; Fri, 10 Apr 2015 18:00:12 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YgdDp-0001Z6-AN for linux-arm-kernel@lists.infradead.org; Fri, 10 Apr 2015 18:00:06 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NML00059RBGE920@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Sat, 11 Apr 2015 02:59:40 +0900 (KST) X-AuditID: cbfee61a-f79516d000006302-2f-55280f8c78bd Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 3A.49.25346.C8F08255; Sat, 11 Apr 2015 02:59:40 +0900 (KST) Received: from amdc1032.digital.local ([106.116.147.136]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NML004B7RB00E40@mmp1.samsung.com>; Sat, 11 Apr 2015 02:59:40 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Thomas Abraham , Sylwester Nawrocki , Mike Turquette , Kukjin Kim , Kukjin Kim , Viresh Kumar Subject: [PATCH 1/6] cpufreq / OPP: allow allocation of extra table entries in freq_table Date: Fri, 10 Apr 2015 19:58:57 +0200 Message-id: <1428688742-15578-2-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1428688742-15578-1-git-send-email-b.zolnierkie@samsung.com> References: <1428688742-15578-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrALMWRmVeSWpSXmKPExsVy+t9jAd0efo1Qg38LRC02zljPanH9y3NW i/+PXrNaHP1dYNG74CqbRf/j18wWXw+vYLR483Azo8Wmx9dYLS7vmsNm8bn3CKPFjPP7mCye TrjIZnH4TTurRccyRotVu/4wWmz86uEg6PH3+XUWj52z7rJ7bFrVyeZx59oeNo/NS+o9+ras YvTYfm0es8fnTXIBHFFcNimpOZllqUX6dglcGV/+LWIpaJesOHxnGnsD43WRLkZODgkBE4mb z9+zQthiEhfurWfrYuTiEBJYxCixaP4ZJgjnN6PEpWMP2UCq2ASsJCa2r2IESYgIfGCUeP3u G1gLs8B8ZokJT0+xdDFycAgLREu8nBcF0sAioCpxetIlsBW8Ah4STSufsIGUSAgoSMyZZAMS 5hTwlNhztI8dJCwEVLK7PWwCI+8CRoZVjKKpBckFxUnpuYZ6xYm5xaV56XrJ+bmbGMHh/Exq B+PKBotDjAIcjEo8vDfi1UOFWBPLiitzDzFKcDArifDWfAEK8aYkVlalFuXHF5XmpBYfYpTm YFES552jKxcqJJCeWJKanZpakFoEk2Xi4JRqYKxI3Rmy9QOvrQzrLw5FTmN/kQlHDRf92q9j rGIp/One+uJ05vy3dW21TSsNgtdyPkgSljEw7l2+sUl5flAUc/UGR8Wn8hM/Np1g6xNUkdD2 LxNpF1bYUdSXf8o+h0s88ayd/YK5XBv7Vtgq/pmlFfJ7btHxX+KBP35LMK9ufRx71e9O9e9Z SizFGYmGWsxFxYkAJDy9OmMCAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150410_110005_518914_6CDA9D5B X-CRM114-Status: GOOD ( 13.14 ) X-Spam-Score: -5.0 (-----) Cc: Lukasz Majewski , Kevin Hilman , Heiko Stuebner , linux-pm@vger.kernel.org, b.zolnierkie@samsung.com, Tomasz Figa , linux-kernel@vger.kernel.org, Chanwoo Choi , linux-samsung-soc@vger.kernel.org, Javier Martinez Canillas , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Prefix dev_pm_opp_init_cpufreq_table() with "__" and add a wrapper for it to keep current users unchanged. Then add an extra_opps parameter to __dev_pm_opp_init_cpufreq_table() to allow allocation of extra table entries in freq_table. This patch is a preparation for adding 'boost' mode frequencies support to cpufreq-dt driver. Cc: Tomasz Figa Cc: Mike Turquette Cc: Javier Martinez Canillas Cc: Thomas Abraham Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/cpufreq/cpufreq_opp.c | 18 ++++++++++++++---- include/linux/cpufreq.h | 3 +++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/cpufreq_opp.c b/drivers/cpufreq/cpufreq_opp.c index 773bcde..773164b 100644 --- a/drivers/cpufreq/cpufreq_opp.c +++ b/drivers/cpufreq/cpufreq_opp.c @@ -21,9 +21,10 @@ #include /** - * dev_pm_opp_init_cpufreq_table() - create a cpufreq table for a device + * __dev_pm_opp_init_cpufreq_table() - create a cpufreq table for a device * @dev: device for which we do this operation * @table: Cpufreq table returned back to caller + * @extra_opps: Number of extra table entries to allocate * * Generate a cpufreq table for a provided device- this assumes that the * opp list is already initialized and ready for usage. @@ -44,8 +45,9 @@ * structures, we use RCU read lock inside this function. As a result, users of * this function DONOT need to use explicit locks for invoking. */ -int dev_pm_opp_init_cpufreq_table(struct device *dev, - struct cpufreq_frequency_table **table) +int __dev_pm_opp_init_cpufreq_table(struct device *dev, + struct cpufreq_frequency_table **table, + unsigned int extra_opps) { struct dev_pm_opp *opp; struct cpufreq_frequency_table *freq_table = NULL; @@ -60,7 +62,8 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev, goto out; } - freq_table = kcalloc((max_opps + 1), sizeof(*freq_table), GFP_ATOMIC); + freq_table = kcalloc((max_opps + extra_opps + 1), sizeof(*freq_table), + GFP_ATOMIC); if (!freq_table) { ret = -ENOMEM; goto out; @@ -89,6 +92,13 @@ out: return ret; } +EXPORT_SYMBOL_GPL(__dev_pm_opp_init_cpufreq_table); + +int dev_pm_opp_init_cpufreq_table(struct device *dev, + struct cpufreq_frequency_table **table) +{ + return __dev_pm_opp_init_cpufreq_table(dev, table, 0); +} EXPORT_SYMBOL_GPL(dev_pm_opp_init_cpufreq_table); /** diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 2ee4888..e46feed 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -505,6 +505,9 @@ struct cpufreq_frequency_table { }; #if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP) +int __dev_pm_opp_init_cpufreq_table(struct device *dev, + struct cpufreq_frequency_table **table, + unsigned int extra_opps); int dev_pm_opp_init_cpufreq_table(struct device *dev, struct cpufreq_frequency_table **table); void dev_pm_opp_free_cpufreq_table(struct device *dev,