From patchwork Thu Mar 3 09:21:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 63440 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2836316lbc; Thu, 3 Mar 2016 01:22:00 -0800 (PST) X-Received: by 10.98.13.216 with SMTP id 85mr2149390pfn.143.1456996920018; Thu, 03 Mar 2016 01:22:00 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id va5si3300981pac.165.2016.03.03.01.21.59; Thu, 03 Mar 2016 01:21:59 -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; 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; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755582AbcCCJV5 (ORCPT + 11 others); Thu, 3 Mar 2016 04:21:57 -0500 Received: from mail-pa0-f48.google.com ([209.85.220.48]:33383 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756681AbcCCJVz (ORCPT ); Thu, 3 Mar 2016 04:21:55 -0500 Received: by mail-pa0-f48.google.com with SMTP id fl4so11653244pad.0 for ; Thu, 03 Mar 2016 01:21:54 -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; bh=ACoqfTIWSlbN8LKZ/nK+5iCu1uSTxWKdcmWlFRY7zEs=; b=d6KbUgKx7Mo6cPU00SmUnxaExkdIDxPD5Mgss+p5FLH5QONEXc+Bnsom4UkEJmcFuG l688QH/AbeNN0rBdHHJ/mtWy92olUpFPDOFOto/oLZYMhP19ATWWFpQru2kykgOe3+A8 0/N/FWhSVRT6rWQhnOrjWo6hJ2Wjw74Jx4Yvk= 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; bh=ACoqfTIWSlbN8LKZ/nK+5iCu1uSTxWKdcmWlFRY7zEs=; b=bfUD9k92zHMrM1EIluhWrZl82fz09ifPwYoDB4noUwkXPaLEtlCBOlesfEq4Co3Edx WC595GdZa+OQFftDMRsWxCpW4tK+OZn6+eEIc9jc3KePVVDHvb6QVy/tuUCug8fcYgkZ tD4CRxZCcQjhJC2J/91nczjjTlh+P/GwM2V8K8LvL/fE+968IOpDSO76wpC2zmknzoRE CC0bgv1AQJPKht/XjKbbQOgVoY+5DCKkWCx3Fh2lnscpDIre4q1iCqGlKC7RqDskkrjO 6IjigVdBcXNOLLyLmtrbSPoZ3+mtPMZzg291Wj2rN6slnuSudiWjFRqVRF235ZY1I2H1 2Xxg== X-Gm-Message-State: AD7BkJLx6l+/+1ddjnds849yvXVGbdrkOPiw2iWQDZ2GnnaxxChN8x8FghxQ2JaB4W0gZQ6K X-Received: by 10.66.193.131 with SMTP id ho3mr2195789pac.154.1456996914365; Thu, 03 Mar 2016 01:21:54 -0800 (PST) Received: from localhost ([122.171.118.240]) by smtp.gmail.com with ESMTPSA id kw10sm58992897pab.0.2016.03.03.01.21.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Mar 2016 01:21:53 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, skannan@codeaurora.org, shilpa.bhat@linux.vnet.ibm.com, linux-kernel@vger.kernel.org Subject: [PATCH] Revert "cpufreq: postfix policy directory with the first CPU in related_cpus" Date: Thu, 3 Mar 2016 14:51:33 +0530 Message-Id: X-Mailer: git-send-email 2.7.1.410.g6faf27b Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org This reverts commit 3510fac45492 ("cpufreq: postfix policy directory with the first CPU in related_cpus"). Earlier, the policy->kobj was added to the kobject core, before ->init() callback was called for the cpufreq drivers. Which allowed those drivers to add or remove, driver dependent, sysfs files/directories to the same kobj from their ->init() and ->exit() callbacks. That isn't possible anymore after commit 3510fac45492 got applied. Now, there is no other clean alternative that people can adopt. Its better to revert the earlier commit to allow cpufreq drivers to create/remove sysfs files from ->init() and ->exit() callbacks. --- @Rafael: This is required current to get below patch modified and submitted. http://marc.info/?l=linux-pm&m=145672798408786&w=2 drivers/cpufreq/cpufreq.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) -- 2.7.1.410.g6faf27b -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Signed-off-by: Viresh Kumar diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 6e9a829247ae..9113c8adf898 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1043,6 +1043,7 @@ 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; @@ -1060,7 +1061,13 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) if (!zalloc_cpumask_var(&policy->real_cpus, GFP_KERNEL)) goto err_free_rcpumask; - kobject_init(&policy->kobj, &ktype_cpufreq); + 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); @@ -1071,6 +1078,8 @@ 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); err_free_cpumask: @@ -1175,16 +1184,6 @@ 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); - - /* Name and add the kobject */ - ret = kobject_add(&policy->kobj, cpufreq_global_kobject, - "policy%u", - cpumask_first(policy->related_cpus)); - if (ret) { - pr_err("%s: failed to add policy->kobj: %d\n", __func__, - ret); - goto out_exit_policy; - } } /*