From patchwork Thu Apr 21 08:58:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 66354 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp18131qge; Thu, 21 Apr 2016 02:01:59 -0700 (PDT) X-Received: by 10.67.1.65 with SMTP id be1mr18936664pad.46.1461229319217; Thu, 21 Apr 2016 02:01:59 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u4si137983par.185.2016.04.21.02.01.58; Thu, 21 Apr 2016 02:01:59 -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=@linaro.org; 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 dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752516AbcDUJB4 (ORCPT + 29 others); Thu, 21 Apr 2016 05:01:56 -0400 Received: from mail-pf0-f173.google.com ([209.85.192.173]:36295 "EHLO mail-pf0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751526AbcDUI7g (ORCPT ); Thu, 21 Apr 2016 04:59:36 -0400 Received: by mail-pf0-f173.google.com with SMTP id e128so27971726pfe.3 for ; Thu, 21 Apr 2016 01:59:30 -0700 (PDT) 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 :in-reply-to:references; bh=fWCtKwBIjaR3y0+svpkk2e8tCdQ6ZVXsu4hqzU1C0Og=; b=Vf4gQZDdS71E30TJ/StSjQWEokcI9bkSiY3e9VrzPpMD6XdQcyEkTU5cO34II/P6cY pVtr5qDbM40f7NmLYFFV5gfHYSQCpEf6KNe6nHVDr0ZP+1URA3tK4WsJwA46J/sU2twk ZDnEVpD7b3euemlBpTgPjXNNUnKUx5mjPVkJg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=fWCtKwBIjaR3y0+svpkk2e8tCdQ6ZVXsu4hqzU1C0Og=; b=AvPWrDokIVC8DiXEt0/Pr0ud9gzJrMGfKP8NooLVX46TnO69BPz77k59l8AQjyJH2T 0ftgn2gSf0c0NFCXV+iCnCmd6OWUTSiQql0OlhnTbJY8QdIu/FGI3C23uvkK7Y91YJoR GODG9Da+o8zW6lRJ3Dr8tYQ3IGKQ0deowMRf6yTU6PE2U1qtIcp3bVbaa/+uC+7YPnD/ ng1//SaOVFsRp60XWrjQLYzMYG28Zqj0xdCJuVkhZTU1K5IASIflYnDBIsAAZgTToJTk TvQaeaYaXiAIQ5F2wOppYlltWUEEsCC5h9nYANTX/z2Fd56CrOEJY2gi4FWJWDx7hVaz MNAQ== X-Gm-Message-State: AOPr4FU8B9/X271cct7njO4feadAUD4w6Lal0bChNBA5diVs9MWet6+DxXsBTka3Ja9/nRNq X-Received: by 10.98.47.134 with SMTP id v128mr18986485pfv.97.1461229170403; Thu, 21 Apr 2016 01:59:30 -0700 (PDT) Received: from localhost ([122.167.26.250]) by smtp.gmail.com with ESMTPSA id u64sm3061369pfa.86.2016.04.21.01.59.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Apr 2016 01:59:29 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, arnd.bergmann@linaro.org, andrew@lunn.ch, gregory.clement@free-electrons.com, jason@lakedaemon.net, sebastian.hesselbarth@gmail.com, thomas.petazzoni@free-electrons.com, Viresh Kumar , linux-kernel@vger.kernel.org Subject: [PATCH 04/10] PM / OPP: Relocate dev_pm_opp_set_sharing_cpus() Date: Thu, 21 Apr 2016 14:28:56 +0530 Message-Id: <2e64f9a691dd6549baee5bf81cfe99d4b287b161.1461228504.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move dev_pm_opp_set_sharing_cpus() towards the end of the file. This is required for better readability after the next patch is applied, which adds dev_pm_opp_get_sharing_cpus(). Signed-off-by: Viresh Kumar --- drivers/base/power/opp/cpu.c | 112 +++++++++++++++++++++---------------------- 1 file changed, 56 insertions(+), 56 deletions(-) -- 2.7.1.410.g6faf27b diff --git a/drivers/base/power/opp/cpu.c b/drivers/base/power/opp/cpu.c index b151401d1513..491e8684bd5f 100644 --- a/drivers/base/power/opp/cpu.c +++ b/drivers/base/power/opp/cpu.c @@ -119,62 +119,6 @@ void dev_pm_opp_free_cpufreq_table(struct device *dev, EXPORT_SYMBOL_GPL(dev_pm_opp_free_cpufreq_table); #endif /* CONFIG_CPU_FREQ */ -/** - * dev_pm_opp_set_sharing_cpus() - Mark OPP table as shared by few CPUs - * @cpu_dev: CPU device for which we do this operation - * @cpumask: cpumask of the CPUs which share the OPP table with @cpu_dev - * - * This marks OPP table of the @cpu_dev as shared by the CPUs present in - * @cpumask. - * - * Returns -ENODEV if OPP table isn't already present. - * - * Locking: The internal opp_table and opp structures are RCU protected. - * Hence this function internally uses RCU updater strategy with mutex locks - * to keep the integrity of the internal data structures. Callers should ensure - * that this function is *NOT* called under RCU protection or in contexts where - * mutex cannot be locked. - */ -int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask) -{ - struct opp_device *opp_dev; - struct opp_table *opp_table; - struct device *dev; - int cpu, ret = 0; - - mutex_lock(&opp_table_lock); - - opp_table = _find_opp_table(cpu_dev); - if (IS_ERR(opp_table)) { - ret = PTR_ERR(opp_table); - goto unlock; - } - - for_each_cpu(cpu, cpumask) { - if (cpu == cpu_dev->id) - continue; - - dev = get_cpu_device(cpu); - if (!dev) { - dev_err(cpu_dev, "%s: failed to get cpu%d device\n", - __func__, cpu); - continue; - } - - opp_dev = _add_opp_dev(dev, opp_table); - if (!opp_dev) { - dev_err(dev, "%s: failed to add opp-dev for cpu%d device\n", - __func__, cpu); - continue; - } - } -unlock: - mutex_unlock(&opp_table_lock); - - return ret; -} -EXPORT_SYMBOL_GPL(dev_pm_opp_set_sharing_cpus); - #ifdef CONFIG_OF /** * dev_pm_opp_of_cpumask_remove_table() - Removes OPP table for @cpumask @@ -326,3 +270,59 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask } EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_sharing_cpus); #endif + +/** + * dev_pm_opp_set_sharing_cpus() - Mark OPP table as shared by few CPUs + * @cpu_dev: CPU device for which we do this operation + * @cpumask: cpumask of the CPUs which share the OPP table with @cpu_dev + * + * This marks OPP table of the @cpu_dev as shared by the CPUs present in + * @cpumask. + * + * Returns -ENODEV if OPP table isn't already present. + * + * Locking: The internal opp_table and opp structures are RCU protected. + * Hence this function internally uses RCU updater strategy with mutex locks + * to keep the integrity of the internal data structures. Callers should ensure + * that this function is *NOT* called under RCU protection or in contexts where + * mutex cannot be locked. + */ +int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, cpumask_var_t cpumask) +{ + struct opp_device *opp_dev; + struct opp_table *opp_table; + struct device *dev; + int cpu, ret = 0; + + mutex_lock(&opp_table_lock); + + opp_table = _find_opp_table(cpu_dev); + if (IS_ERR(opp_table)) { + ret = PTR_ERR(opp_table); + goto unlock; + } + + for_each_cpu(cpu, cpumask) { + if (cpu == cpu_dev->id) + continue; + + dev = get_cpu_device(cpu); + if (!dev) { + dev_err(cpu_dev, "%s: failed to get cpu%d device\n", + __func__, cpu); + continue; + } + + opp_dev = _add_opp_dev(dev, opp_table); + if (!opp_dev) { + dev_err(dev, "%s: failed to add opp-dev for cpu%d device\n", + __func__, cpu); + continue; + } + } +unlock: + mutex_unlock(&opp_table_lock); + + return ret; +} +EXPORT_SYMBOL_GPL(dev_pm_opp_set_sharing_cpus);