From patchwork Mon May 18 05:13:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 48675 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F2C7021411 for ; Mon, 18 May 2015 05:15:20 +0000 (UTC) Received: by wizk4 with SMTP id k4sf18211979wiz.2 for ; Sun, 17 May 2015 22:15:19 -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=bmkh09J9ux6h/OoUOdQqgQfjgR8WLhNmXmTtaa+tkAE=; b=OP22ZM5FiEkyoTdVZy0afwQf2NZYfw2q78kf3SjYLUnYCBapa32CRA0BBhO9otiELz RwiwkBdsjGattMzx8juE/mwNzim939MFfUX0BXQcwMMdxNTcK6Hq8i0qw1jE3a0PQ2LP P49/7MUN2GU2C9PeszW2daSXyoKXnQr/oELuuppWWRM0K9uKFca9EFZyS6fAKvTM38yn khjLcs5tcV1xsKfyVS9tZmkw6GaZJ48AYWZMEv/BoLwVk2IPUffQq7wl4BkrOPEELIOM DCDzjgbstLABmZEsKo/a8ujBtiAhvEw9WdR45EnD3ZzLeSri8/SclA5tCx75iPYrbJfu Vr5g== X-Gm-Message-State: ALoCoQmUxl3NO7UCWZUnM1H1JRlOX2nvy71ENRBJYRiklq4Sun6xLscgZeebbALFmtnx7HuJZXbi X-Received: by 10.152.203.233 with SMTP id kt9mr16565798lac.7.1431926119540; Sun, 17 May 2015 22:15:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.195 with SMTP id g3ls741035lam.0.gmail; Sun, 17 May 2015 22:15:19 -0700 (PDT) X-Received: by 10.152.42.211 with SMTP id q19mr16512090lal.78.1431926119406; Sun, 17 May 2015 22:15:19 -0700 (PDT) Received: from mail-la0-f53.google.com (mail-la0-f53.google.com. [209.85.215.53]) by mx.google.com with ESMTPS id j2si5947060lam.114.2015.05.17.22.15.19 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 May 2015 22:15:19 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.53 as permitted sender) client-ip=209.85.215.53; Received: by labbd9 with SMTP id bd9so202313150lab.2 for ; Sun, 17 May 2015 22:15:19 -0700 (PDT) X-Received: by 10.112.29.36 with SMTP id g4mr16301558lbh.56.1431926118988; Sun, 17 May 2015 22:15:18 -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.108.230 with SMTP id hn6csp3711859lbb; Sun, 17 May 2015 22:15:17 -0700 (PDT) X-Received: by 10.70.52.130 with SMTP id t2mr30941669pdo.34.1431926117071; Sun, 17 May 2015 22:15:17 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id iu9si2678127pbc.77.2015.05.17.22.14.54; Sun, 17 May 2015 22:15:17 -0700 (PDT) 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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751261AbbERFOV (ORCPT + 11 others); Mon, 18 May 2015 01:14:21 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:35887 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751149AbbERFOV (ORCPT ); Mon, 18 May 2015 01:14:21 -0400 Received: by pdfh10 with SMTP id h10so133410985pdf.3 for ; Sun, 17 May 2015 22:14:20 -0700 (PDT) X-Received: by 10.70.98.197 with SMTP id ek5mr40745567pdb.109.1431926060893; Sun, 17 May 2015 22:14:20 -0700 (PDT) Received: from localhost ([122.167.226.34]) by mx.google.com with ESMTPSA id v7sm8597969pde.81.2015.05.17.22.14.19 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 17 May 2015 22:14:20 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, sboyd@codeaurora.org, prarit@redhat.com, skannan@codeaurora.org, Srivatsa Bhat , Viresh Kumar Subject: [PATCH V5 08/14] cpufreq: Track cpu managing sysfs kobjects separately Date: Mon, 18 May 2015 10:43:31 +0530 Message-Id: <84aa63d8a244c2c7095ff41a2bd0013d8b95f290.1431924457.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.4.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@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.215.53 as permitted sender) smtp.mail=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: , From: Saravana Kannan In order to prepare for the next few commits, that will stop migrating sysfs files on cpu hotplug, this patch starts managing sysfs-cpu separately. The behavior is still the same as we are still migrating sysfs files on hotplug, later commits would change that. Signed-off-by: Saravana Kannan Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 11 +++++++---- include/linux/cpufreq.h | 4 +++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 983961ba2f72..d7fc3d9294f8 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -966,7 +966,7 @@ static int cpufreq_add_dev_symlink(struct cpufreq_policy *policy) for_each_cpu(j, policy->cpus) { struct device *cpu_dev; - if (j == policy->cpu) + if (j == policy->kobj_cpu) continue; pr_debug("Adding link for CPU: %u\n", j); @@ -1185,6 +1185,7 @@ static int update_policy_cpu(struct cpufreq_policy *policy, unsigned int cpu, down_write(&policy->rwsem); policy->cpu = cpu; + policy->kobj_cpu = cpu; up_write(&policy->rwsem); return 0; @@ -1242,10 +1243,12 @@ static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) * the creation of a brand new one. So we need to perform this update * by invoking update_policy_cpu(). */ - if (recover_policy && cpu != policy->cpu) + if (recover_policy && cpu != policy->cpu) { WARN_ON(update_policy_cpu(policy, cpu, dev)); - else + } else { policy->cpu = cpu; + policy->kobj_cpu = cpu; + } cpumask_copy(policy->cpus, cpumask_of(cpu)); @@ -1424,7 +1427,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, CPUFREQ_NAME_LEN); up_write(&policy->rwsem); - if (cpu != policy->cpu) { + if (cpu != policy->kobj_cpu) { sysfs_remove_link(&dev->kobj, "cpufreq"); } else if (cpus > 1) { /* Nominate new CPU */ diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 48e37c07eb84..29ad97c34fd5 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -65,7 +65,9 @@ struct cpufreq_policy { unsigned int shared_type; /* ACPI: ANY or ALL affected CPUs should set cpufreq */ - unsigned int cpu; /* cpu nr of CPU managing this policy */ + unsigned int cpu; /* cpu managing this policy, must be online */ + unsigned int kobj_cpu; /* cpu managing sysfs files, can be offline */ + struct clk *clk; struct cpufreq_cpuinfo cpuinfo;/* see above */