From patchwork Tue Jan 7 01:40:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 22898 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E9ED823A3F for ; Tue, 7 Jan 2014 01:40:32 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id kp14sf49411295pab.2 for ; Mon, 06 Jan 2014 17:40:32 -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 :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=4TF9A0ZDUy6AHyNVB7JSI6/RzbcMv6TFkc3NgKRPrRo=; b=CMZvxGN1a1+uhMVX9kxKaUaoLppvYKAxNtt3Xe3Megq7/2A1TUovZM66knCTFXPUkp ksPssBg2QgUw8P1w8hWhtLsTIhSLatsv8VgawbwjACY1M/dVxzPm7fj7ZzS/7xeytbfZ 2GzZsAFTXDRkWc1Gv56nQ7tVnN7prqb8hbi2YCZAo3YXSGzj/UV+qVOJtQy940J2KSHY mS9MwDY0oCl8fd+9ABBxAIJzfUy59pJhtkRf2f8v5xhvPk8c2w3GsHqYHbjpGQeHrBqd r7nksfPSjaLTAuiChg5EoctN0dwhtvy708W4pQ2+k8uXDpYMm1/UHaTAm7mlYGk+qoce Egnw== X-Gm-Message-State: ALoCoQlC2lAeQgObFT7Bxbv30rQEcTVoLyio//quzEXLogACwTs5SshBB8iVuXNt0+CzkJjY5xsF X-Received: by 10.66.163.67 with SMTP id yg3mr824547pab.45.1389058832165; Mon, 06 Jan 2014 17:40:32 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.50.196 with SMTP id e4ls6078697qeo.3.gmail; Mon, 06 Jan 2014 17:40:32 -0800 (PST) X-Received: by 10.58.132.203 with SMTP id ow11mr61675012veb.1.1389058832033; Mon, 06 Jan 2014 17:40:32 -0800 (PST) Received: from mail-ve0-f176.google.com (mail-ve0-f176.google.com [209.85.128.176]) by mx.google.com with ESMTPS id sm7si32155763vdc.97.2014.01.06.17.40.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 06 Jan 2014 17:40:32 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.176; Received: by mail-ve0-f176.google.com with SMTP id oz11so9820695veb.35 for ; Mon, 06 Jan 2014 17:40:32 -0800 (PST) X-Received: by 10.52.244.49 with SMTP id xd17mr5365981vdc.26.1389058831952; Mon, 06 Jan 2014 17:40:31 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp130013ved; Mon, 6 Jan 2014 17:40:31 -0800 (PST) X-Received: by 10.68.130.169 with SMTP id of9mr131603358pbb.79.1389058830831; Mon, 06 Jan 2014 17:40:30 -0800 (PST) Received: from mail-pb0-f43.google.com (mail-pb0-f43.google.com [209.85.160.43]) by mx.google.com with ESMTPS id o7si45491754pbb.10.2014.01.06.17.40.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 06 Jan 2014 17:40:30 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.43 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.160.43; Received: by mail-pb0-f43.google.com with SMTP id rq2so19248901pbb.2 for ; Mon, 06 Jan 2014 17:40:30 -0800 (PST) X-Received: by 10.67.22.38 with SMTP id hp6mr1755240pad.53.1389058830193; Mon, 06 Jan 2014 17:40:30 -0800 (PST) Received: from localhost ([122.167.240.254]) by mx.google.com with ESMTPSA id wp8sm131801002pbc.26.2014.01.06.17.40.26 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 06 Jan 2014 17:40:29 -0800 (PST) From: Viresh Kumar To: rjw@rjwysocki.net Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Viresh Kumar Subject: [PATCH Resend 2/4] cpufreq: stats: remove hotplug notifiers Date: Tue, 7 Jan 2014 07:10:11 +0530 Message-Id: <2c5f1ca1f88407ad9b6938915409ce3a8df7d4c9.1389058746.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Either CPUs are hot-unplugged or suspend/resume occurs, cpufreq core will send notifications to cpufreq-stats and stats structure and sysfs entries would be correctly handled.. And so we don't actually need hotcpu notifiers in cpufreq-stats anymore. We were only handling cpu hot-unplug events here and that are already taken care of by POLICY notifiers. Acked-and-tested-by: Nicolas Pitre Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq_stats.c | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 0f71562..8fa5844 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -294,11 +294,8 @@ static int cpufreq_stat_notifier_policy(struct notifier_block *nb, if (val == CPUFREQ_CREATE_POLICY) ret = cpufreq_stats_create_table(policy, table); else if (val == CPUFREQ_REMOVE_POLICY) { - /* This might already be freed by cpu hotplug notifier */ - if (per_cpu(cpufreq_stats_table, cpu)) { - cpufreq_stats_free_sysfs(cpu); - cpufreq_stats_free_table(cpu); - } + cpufreq_stats_free_sysfs(cpu); + cpufreq_stats_free_table(cpu); } return ret; @@ -340,33 +337,6 @@ static int cpufreq_stat_notifier_trans(struct notifier_block *nb, return 0; } -static int cpufreq_stat_cpu_callback(struct notifier_block *nfb, - unsigned long action, - void *hcpu) -{ - unsigned int cpu = (unsigned long)hcpu; - - /* Don't free/allocate stats during suspend/resume */ - if (action & CPU_TASKS_FROZEN) - return 0; - - switch (action) { - case CPU_DOWN_PREPARE: - cpufreq_stats_free_sysfs(cpu); - break; - case CPU_DEAD: - cpufreq_stats_free_table(cpu); - break; - } - return NOTIFY_OK; -} - -/* priority=1 so this will get called before cpufreq_remove_dev */ -static struct notifier_block cpufreq_stat_cpu_notifier __refdata = { - .notifier_call = cpufreq_stat_cpu_callback, - .priority = 1, -}; - static struct notifier_block notifier_policy_block = { .notifier_call = cpufreq_stat_notifier_policy }; @@ -386,14 +356,11 @@ static int __init cpufreq_stats_init(void) if (ret) return ret; - register_hotcpu_notifier(&cpufreq_stat_cpu_notifier); - ret = cpufreq_register_notifier(¬ifier_trans_block, CPUFREQ_TRANSITION_NOTIFIER); if (ret) { cpufreq_unregister_notifier(¬ifier_policy_block, CPUFREQ_POLICY_NOTIFIER); - unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier); for_each_online_cpu(cpu) cpufreq_stats_free_table(cpu); return ret; @@ -409,7 +376,6 @@ static void __exit cpufreq_stats_exit(void) CPUFREQ_POLICY_NOTIFIER); cpufreq_unregister_notifier(¬ifier_trans_block, CPUFREQ_TRANSITION_NOTIFIER); - unregister_hotcpu_notifier(&cpufreq_stat_cpu_notifier); for_each_online_cpu(cpu) { cpufreq_stats_free_table(cpu); cpufreq_stats_free_sysfs(cpu);