From patchwork Thu Oct 15 16:05:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 55049 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f69.google.com (mail-lf0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id B05C622FFA for ; Thu, 15 Oct 2015 16:06:39 +0000 (UTC) Received: by lffv3 with SMTP id v3sf4780523lff.1 for ; Thu, 15 Oct 2015 09:06:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=N+8Kda7yptbr5VNRCst3BIIydxLl4DFZ4KMBzav94n8=; b=gbUSxTfLHkyszfD9XSVDXo94AHHgHTNAh4hSphW1dNEJW+nIcZbdiwloO/NQE2xz07 GeV4n2r8yxHJnw8bKpK9qXJBONYWTPUzOc4oNXrG2QalGFCsD2ZzbbtsTa22Y4a5nkan NsNDY4JSLpJUF8M3lI1mUCgDMG5m0+50wWWZ8iRwVaR2FV7w3Nn1aK8r9KVVfSlhCZF0 r7UkyyUfJlqQun2h0IQxG2qd40hA0wasxQbPVVhhJhUMVsJHU6Cs0VVpLX5aRhAdrKGr EWyomSeln4SbwlJzGbBTH9QTo8/MAUxuWMUCcZr/wuBowpv1F0wqNMXTBuEcFvWnIz3W UJCA== X-Gm-Message-State: ALoCoQm6VQCbZsxn9df/Bi3Ge1TxJ4KotTDA3xdawLA7E03YTJ03HXLSg860uf8If/EH2kUQn6Y0 X-Received: by 10.112.12.132 with SMTP id y4mr2354253lbb.0.1444925198617; Thu, 15 Oct 2015 09:06:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.16.222 with SMTP id 91ls202484lfq.12.gmail; Thu, 15 Oct 2015 09:06:38 -0700 (PDT) X-Received: by 10.112.14.9 with SMTP id l9mr5063444lbc.91.1444925198445; Thu, 15 Oct 2015 09:06:38 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id ub8si9589650lbb.49.2015.10.15.09.06.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2015 09:06:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbwr8 with SMTP id r8so74488370lbw.2 for ; Thu, 15 Oct 2015 09:06:38 -0700 (PDT) X-Received: by 10.112.159.136 with SMTP id xc8mr4148645lbb.76.1444925197797; Thu, 15 Oct 2015 09:06:37 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp722486lbq; Thu, 15 Oct 2015 09:06:36 -0700 (PDT) X-Received: by 10.66.121.225 with SMTP id ln1mr11028313pab.86.1444925196739; Thu, 15 Oct 2015 09:06:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rk11si22530678pab.163.2015.10.15.09.06.36; Thu, 15 Oct 2015 09:06:36 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753794AbbJOQG1 (ORCPT + 30 others); Thu, 15 Oct 2015 12:06:27 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:36542 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753411AbbJOQGU (ORCPT ); Thu, 15 Oct 2015 12:06:20 -0400 Received: by padcn9 with SMTP id cn9so10101531pad.3 for ; Thu, 15 Oct 2015 09:06:20 -0700 (PDT) X-Received: by 10.66.147.38 with SMTP id th6mr10840750pab.94.1444925179914; Thu, 15 Oct 2015 09:06:19 -0700 (PDT) Received: from localhost ([223.227.130.246]) by smtp.gmail.com with ESMTPSA id hq1sm4598212pbb.43.2015.10.15.09.06.18 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 15 Oct 2015 09:06:19 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, skannan@codeaurora.org, Viresh Kumar , linux-kernel@vger.kernel.org (open list) Subject: [PATCH V2 5/5] cpufreq: postfix policy directory with the first CPU in related_cpus Date: Thu, 15 Oct 2015 21:35:25 +0530 Message-Id: X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The sysfs policy directory is postfixed currently with the CPU number for which the policy was created, which isn't necessarily the first CPU in related_cpus mask. To make it more consistent and predictable, lets postfix the policy with the first cpu in related-cpus mask. Suggested-by: Saravana Kannan Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 4fa2215cc6ec..3fe13875565d 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1022,7 +1022,6 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) { struct device *dev = get_cpu_device(cpu); struct cpufreq_policy *policy; - int ret; if (WARN_ON(!dev)) return NULL; @@ -1040,13 +1039,6 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) if (!zalloc_cpumask_var(&policy->real_cpus, GFP_KERNEL)) goto err_free_rcpumask; - ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, - cpufreq_global_kobject, "policy%u", cpu); - if (ret) { - pr_err("%s: failed to init policy->kobj: %d\n", __func__, ret); - goto err_free_real_cpus; - } - INIT_LIST_HEAD(&policy->policy_list); init_rwsem(&policy->rwsem); spin_lock_init(&policy->transition_lock); @@ -1057,7 +1049,6 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) policy->cpu = cpu; return policy; -err_free_real_cpus: free_cpumask_var(policy->real_cpus); err_free_rcpumask: free_cpumask_var(policy->related_cpus); @@ -1163,6 +1154,16 @@ static int cpufreq_online(unsigned int cpu) cpumask_copy(policy->related_cpus, policy->cpus); /* Remember CPUs present at the policy creation time. */ cpumask_and(policy->real_cpus, policy->cpus, cpu_present_mask); + + /* Initialize the kobject */ + ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, + cpufreq_global_kobject, "policy%u", + cpumask_first(policy->related_cpus)); + if (ret) { + pr_err("%s: failed to init policy->kobj: %d\n", + __func__, ret); + goto out_exit_policy; + } } /*