From patchwork Tue Jan 27 08:36:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 43826 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 F3FF62409D for ; Tue, 27 Jan 2015 08:37:35 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id n3sf1661793wiv.0 for ; Tue, 27 Jan 2015 00:37:35 -0800 (PST) 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=QmyrjHBV/WxGqXY/YyxqrAPjHKQ82qDGZDJtJikWTmc=; b=gwKV90+8m3GUbpAFoHCQeXpHFMCWQzEsPco1/Ha1oiff2h0t9VYSlSR4iqc/PezztO EOtckX/fXjtVIzpbu6KMZ93SS3gYh2R6BhzcXb4O7cKfELZYHrSxKOU6M4cgH606l6XH kr85ICqmbLp9zWFjCkK9uaIogiaDOAj3UMMo4WLAiukcxozFamUnatrlIBj0hpRV3aL9 1XXtij8wDN0tB6kRT3eo4u9egOmTYmUnbFNjOBPxFrYco+xoHYprH8EPoGbifCPAkLI+ Qo0qWdK7eCnfbZNlcdVoyZ59Stx76ik/Fv+MZRiTTNIb+1lCv/NmVFssV3lmMoNA6oEj SzKw== X-Gm-Message-State: ALoCoQnWeE69PN5WpXL18P311p1+GJ18faeg2etXZlxGgNhGmd/HIjyTiwWS76BEHe7c1yxXFduQ X-Received: by 10.112.213.72 with SMTP id nq8mr33902lbc.18.1422347855258; Tue, 27 Jan 2015 00:37:35 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.17 with SMTP id s17ls4888lal.22.gmail; Tue, 27 Jan 2015 00:37:34 -0800 (PST) X-Received: by 10.112.126.98 with SMTP id mx2mr142951lbb.84.1422347854945; Tue, 27 Jan 2015 00:37:34 -0800 (PST) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id l9si598212lah.3.2015.01.27.00.37.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 27 Jan 2015 00:37:34 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id ms9so12015853lab.1 for ; Tue, 27 Jan 2015 00:37:34 -0800 (PST) X-Received: by 10.152.3.70 with SMTP id a6mr50276laa.71.1422347854666; Tue, 27 Jan 2015 00:37:34 -0800 (PST) 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.35.133 with SMTP id h5csp1025570lbj; Tue, 27 Jan 2015 00:37:33 -0800 (PST) X-Received: by 10.66.254.68 with SMTP id ag4mr34296pad.39.1422347850130; Tue, 27 Jan 2015 00:37:30 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g8si627522pdk.182.2015.01.27.00.37.29; Tue, 27 Jan 2015 00:37:30 -0800 (PST) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757904AbbA0Ih1 (ORCPT + 11 others); Tue, 27 Jan 2015 03:37:27 -0500 Received: from mail-pa0-f45.google.com ([209.85.220.45]:55532 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754074AbbA0IhW (ORCPT ); Tue, 27 Jan 2015 03:37:22 -0500 Received: by mail-pa0-f45.google.com with SMTP id et14so17162226pad.4 for ; Tue, 27 Jan 2015 00:37:22 -0800 (PST) X-Received: by 10.66.250.225 with SMTP id zf1mr46089pac.31.1422347842095; Tue, 27 Jan 2015 00:37:22 -0800 (PST) Received: from localhost ([122.178.198.250]) by mx.google.com with ESMTPSA id y4sm806408pdj.59.2015.01.27.00.37.20 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 27 Jan 2015 00:37:21 -0800 (PST) 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, Viresh Kumar Subject: [PATCH 11/18] cpufreq: Track cpu managing sysfs kobjects separately Date: Tue, 27 Jan 2015 14:06:17 +0530 Message-Id: <0e27bdf1275b50c03051a289f75b9bcc68947639.1422346933.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.3.0.rc0.44.ga94655d 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.42 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: , 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: 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 fffa37136b7b..4476471c594e 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -921,7 +921,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); @@ -1126,6 +1126,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; @@ -1188,10 +1189,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)); @@ -1393,7 +1396,7 @@ static int __cpufreq_remove_dev_prepare(struct device *dev, CPUFREQ_NAME_LEN); } - 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 e326cddef6db..9b8937f027fb 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 */