mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dominik Brodowski <linux@brodo.de>
To: torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org, cpufreq@www.linux.org.uk
Subject: [PATCH 2.5] cpufreq: minor cleanups
Date: Sat, 21 Dec 2002 21:25:09 +0100	[thread overview]
Message-ID: <20021221202509.GA2503@brodo.de> (raw)

Get rid of CPUFREQ_ALL_CPUS codepaths not used anymore.

	Dominik

diff -ruN linux-original/kernel/cpufreq.c linux/kernel/cpufreq.c
--- linux-original/kernel/cpufreq.c	2002-12-21 21:21:57.000000000 +0100
+++ linux/kernel/cpufreq.c	2002-12-21 21:21:46.000000000 +0100
@@ -365,7 +365,7 @@
 {
 	struct cpufreq_policy policy;
 	down(&cpufreq_driver_sem);
-	if (!cpufreq_driver || !cpu_max_freq) {
+	if (!cpufreq_driver || !cpu_max_freq || (cpu > NR_CPUS)) {
 		up(&cpufreq_driver_sem);
 		return -EINVAL;
 	}
@@ -377,7 +377,20 @@
 	
 	up(&cpufreq_driver_sem);
 
-	return cpufreq_set_policy(&policy);
+	if (policy.cpu == CPUFREQ_ALL_CPUS)
+	{
+		unsigned int i;
+		unsigned int ret = 0;
+		for (i=0; i<NR_CPUS; i++) 
+		{
+			policy.cpu = i;
+			if (cpu_online(i))
+				ret |= cpufreq_set_policy(&policy);
+		}
+		return ret;
+	} 
+	else
+		return cpufreq_set_policy(&policy);
 }
 EXPORT_SYMBOL_GPL(cpufreq_set);
 
@@ -842,7 +855,6 @@
  */
 int cpufreq_set_policy(struct cpufreq_policy *policy)
 {
-	unsigned int i;
 	int ret;
 
 	down(&cpufreq_driver_sem);
@@ -889,24 +901,12 @@
 
 	up(&cpufreq_notifier_sem);
 
-	if (policy->cpu == CPUFREQ_ALL_CPUS) {
-		for (i=0;i<NR_CPUS;i++) {
-			cpufreq_driver->policy[i].min    = policy->min;
-			cpufreq_driver->policy[i].max    = policy->max;
-			cpufreq_driver->policy[i].policy = policy->policy;
-		} 
-	} else {
-		cpufreq_driver->policy[policy->cpu].min    = policy->min;
-		cpufreq_driver->policy[policy->cpu].max    = policy->max;
-		cpufreq_driver->policy[policy->cpu].policy = policy->policy;
-	}
+	cpufreq_driver->policy[policy->cpu].min    = policy->min;
+	cpufreq_driver->policy[policy->cpu].max    = policy->max;
+	cpufreq_driver->policy[policy->cpu].policy = policy->policy;
 
 #ifdef CONFIG_CPU_FREQ_24_API
-	if (policy->cpu == CPUFREQ_ALL_CPUS) {
-		for (i=0;i<NR_CPUS;i++)
-			cpu_cur_freq[i] = policy->max;
-	} else
-		cpu_cur_freq[policy->cpu] = policy->max;
+	cpu_cur_freq[policy->cpu] = policy->max;
 #endif
 
 	ret = cpufreq_driver->setpolicy(policy);
@@ -920,15 +920,6 @@
 
 
 /*********************************************************************
- *                    DYNAMIC CPUFREQ SWITCHING                      *
- *********************************************************************/
-#ifdef CONFIG_CPU_FREQ_DYNAMIC
-/* TBD */
-#endif /* CONFIG_CPU_FREQ_DYNAMIC */
-
-
-
-/*********************************************************************
  *            EXTERNALLY AFFECTING FREQUENCY CHANGES                 *
  *********************************************************************/
 
@@ -973,12 +964,7 @@
 		adjust_jiffies(CPUFREQ_POSTCHANGE, freqs);
 		notifier_call_chain(&cpufreq_transition_notifier_list, CPUFREQ_POSTCHANGE, freqs);
 #ifdef CONFIG_CPU_FREQ_24_API
-		if (freqs->cpu == CPUFREQ_ALL_CPUS) {
-			int i;
-			for (i=0;i<NR_CPUS;i++)
-				cpu_cur_freq[i] = freqs->new;
-		} else
-			cpu_cur_freq[freqs->cpu] = freqs->new;
+		cpu_cur_freq[freqs->cpu] = freqs->new;
 #endif
 		break;
 	}



             reply	other threads:[~2002-12-21 20:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-21 20:25 Dominik Brodowski [this message]
2002-12-22 21:25 ` Pavel Machek
2002-12-26 22:07   ` Dominik Brodowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021221202509.GA2503@brodo.de \
    --to=linux@brodo.de \
    --cc=cpufreq@www.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome