From: olof@lixom.net (Olof Johansson)
To: Arnd Bergmann <arnd@arndb.de>
Cc: linuxppc-dev@ozlabs.org, cbe-oss-dev@ozlabs.org,
Christian Krafft <krafft@de.ibm.com>
Subject: [PATCH v2] cell: cbe_cpufreq cleanup and crash fix
Date: Fri, 27 Apr 2007 00:33:47 -0500 [thread overview]
Message-ID: <20070427053347.GA7755@lixom.net> (raw)
In-Reply-To: <20070426230754.GB30000@lixom.net>
cbe_cpufreq cleanups:
* comment format
* whitespace
* don't init on non-cell platforms
Signed-off-by: Olof Johansson <olof@lixom.net>
Index: powerpc/arch/powerpc/platforms/cell/cbe_cpufreq.c
===================================================================
--- powerpc.orig/arch/powerpc/platforms/cell/cbe_cpufreq.c
+++ powerpc/arch/powerpc/platforms/cell/cbe_cpufreq.c
@@ -155,7 +155,7 @@ static int set_pmode_reg(int cpu, unsign
}
static int set_pmode(int cpu, unsigned int slow_mode) {
- if(pmi_dev)
+ if (pmi_dev)
return set_pmode_pmi(cpu, slow_mode);
else
return set_pmode_reg(cpu, slow_mode);
@@ -167,7 +167,7 @@ static void cbe_cpufreq_handle_pmi(struc
u8 cpu;
u8 cbe_pmode_new;
- BUG_ON (pmi_msg.type != PMI_TYPE_FREQ_CHANGE);
+ BUG_ON(pmi_msg.type != PMI_TYPE_FREQ_CHANGE);
cpu = cbe_node_to_cpu(pmi_msg.data1);
cbe_pmode_new = pmi_msg.data2;
@@ -191,7 +191,7 @@ static struct pmi_handler cbe_pmi_handle
* cpufreq functions
*/
-static int cbe_cpufreq_cpu_init (struct cpufreq_policy *policy)
+static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy)
{
const u32 *max_freqp;
u32 max_freq;
@@ -200,7 +200,7 @@ static int cbe_cpufreq_cpu_init (struct
cpu = of_get_cpu_node(policy->cpu, NULL);
- if(!cpu)
+ if (!cpu)
return -ENODEV;
pr_debug("init cpufreq on CPU %d\n", policy->cpu);
@@ -210,13 +210,13 @@ static int cbe_cpufreq_cpu_init (struct
if (!max_freqp)
return -EINVAL;
- // we need the freq in kHz
+ /* we need the freq in kHz */
max_freq = *max_freqp / 1000;
pr_debug("max clock-frequency is at %u kHz\n", max_freq);
pr_debug("initializing frequency table\n");
- // initialize frequency table
+ /* initialize frequency table */
for (i=0; cbe_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) {
cbe_freqs[i].frequency = max_freq / cbe_freqs[i].index;
pr_debug("%d: %d\n", i, cbe_freqs[i].frequency);
@@ -235,10 +235,10 @@ static int cbe_cpufreq_cpu_init (struct
policy->cpus = cpu_sibling_map[policy->cpu];
#endif
- cpufreq_frequency_table_get_attr (cbe_freqs, policy->cpu);
+ cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu);
/* this ensures that policy->cpuinfo_min and policy->cpuinfo_max are set correctly */
- return cpufreq_frequency_table_cpuinfo (policy, cbe_freqs);
+ return cpufreq_frequency_table_cpuinfo(policy, cbe_freqs);
}
static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy)
@@ -270,7 +270,7 @@ static int cbe_cpufreq_target(struct cpu
freqs.new = cbe_freqs[cbe_pmode_new].frequency;
freqs.cpu = policy->cpu;
- mutex_lock (&cbe_switch_mutex);
+ mutex_lock(&cbe_switch_mutex);
cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
pr_debug("setting frequency for cpu %d to %d kHz, 1/%d of max frequency\n",
@@ -303,6 +303,9 @@ static int __init cbe_cpufreq_init(void)
{
struct device_node *np;
+ if (!machine_is(cell))
+ return -ENODEV;
+
np = of_find_node_by_type(NULL, "ibm,pmi");
pmi_dev = of_find_device_by_node(np);
@@ -315,7 +318,7 @@ static int __init cbe_cpufreq_init(void)
static void __exit cbe_cpufreq_exit(void)
{
- if(pmi_dev)
+ if (pmi_dev)
pmi_unregister_handler(pmi_dev, &cbe_pmi_handler);
cpufreq_unregister_driver(&cbe_cpufreq_driver);
next prev parent reply other threads:[~2007-04-27 5:33 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-25 20:46 [PATCH] [2.6.22] pasemi: cpufreq driver Olof Johansson
2007-04-25 23:47 ` Arnd Bergmann
2007-04-25 23:57 ` Olof Johansson
2007-04-26 1:57 ` Olof Johansson
2007-04-26 6:56 ` cbe_cpufreq crashes my machine Olof Johansson
2007-04-26 8:39 ` Benjamin Herrenschmidt
2007-04-26 23:07 ` [PATCH] cell: cbe_cpufreq cleanup and crash fix Olof Johansson
2007-04-27 5:22 ` [Cbe-oss-dev] " Akinobu Mita
2007-04-27 5:32 ` Olof Johansson
2007-04-27 5:33 ` Olof Johansson [this message]
2007-04-27 7:55 ` [PATCH v2] " Christian Krafft
2007-04-26 5:37 ` [PATCH v2] [2.6.22] pasemi: cpufreq driver Olof Johansson
2007-04-26 8:55 ` Arnd Bergmann
2007-04-26 16:48 ` Olof Johansson
2007-04-26 17:11 ` Arnd Bergmann
2007-04-26 19:05 ` Segher Boessenkool
2007-04-26 20:38 ` Olof Johansson
2007-04-27 0:10 ` Segher Boessenkool
2007-04-27 0:10 ` Segher Boessenkool
2007-04-26 20:26 ` Olof Johansson
2007-04-26 20:43 ` Arnd Bergmann
2007-04-26 10:26 ` Johannes Berg
2007-04-26 10:26 ` Johannes Berg
2007-04-26 20:37 ` Olof Johansson
2007-04-27 9:40 ` Johannes Berg
2007-04-27 9:40 ` Johannes Berg
2007-04-27 18:09 ` Olof Johansson
2007-04-27 5:46 ` [PATCH v3] " Olof Johansson
2007-04-29 2:50 ` Dominik Brodowski
2007-04-29 3:40 ` Stephen Rothwell
2007-04-29 4:39 ` Olof Johansson
2007-04-29 4:42 ` Olof Johansson
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=20070427053347.GA7755@lixom.net \
--to=olof@lixom.net \
--cc=arnd@arndb.de \
--cc=cbe-oss-dev@ozlabs.org \
--cc=krafft@de.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.