X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=arch%2Fsh%2Fkernel%2Fcpufreq.c;h=47abf6e49dfb116ce712c94c6ccbd4e3efb17d6e;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=85516164e866a2c34c85e4ffbe0e97775929f7c1;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/arch/sh/kernel/cpufreq.c b/arch/sh/kernel/cpufreq.c index 85516164e..47abf6e49 100644 --- a/arch/sh/kernel/cpufreq.c +++ b/arch/sh/kernel/cpufreq.c @@ -3,7 +3,7 @@ * * cpufreq driver for the SuperH processors. * - * Copyright (C) 2002, 2003 Paul Mundt + * Copyright (C) 2002, 2003, 2004, 2005 Paul Mundt * Copyright (C) 2002 M. R. Brown * * This program is free software; you can redistribute it and/or modify it @@ -18,7 +18,9 @@ #include #include #include +#include #include +#include /* set_cpus_allowed() */ #include #include @@ -46,9 +48,8 @@ struct clock_set { #endif }; -#define NR_CLOCK_SETS (sizeof(clock_sets) / sizeof(struct clock_set)) #define MIN_CLOCK_SET 0 -#define MAX_CLOCK_SET (NR_CLOCK_SETS - 1) +#define MAX_CLOCK_SET (ARRAY_SIZE(clock_sets) - 1) /* * For the time being, we only support two frequencies, which in turn are @@ -83,18 +84,16 @@ static void sh_cpufreq_update_clocks(unsigned int set) static int sh_cpufreq_setstate(unsigned int cpu, unsigned int set) { unsigned short frqcr = ctrl_inw(FRQCR); - unsigned long cpus_allowed; + cpumask_t cpus_allowed; struct cpufreq_freqs freqs; - int allowable_cpu_map; if (!cpu_online(cpu)) return -ENODEV; cpus_allowed = current->cpus_allowed; - allowable_cpu_map = 1 << cpu; - set_cpus_allowed(current, allowable_cpu_map); - - BUG_ON(!(allowable_cpu_map & (1 << smp_processor_id()))); + set_cpus_allowed(current, cpumask_of_cpu(cpu)); + + BUG_ON(smp_processor_id() != cpu); freqs.cpu = cpu; freqs.old = current_cpu_data.cpu_clock / 1000; @@ -134,7 +133,7 @@ static int sh_cpufreq_setstate(unsigned int cpu, unsigned int set) set_cpus_allowed(current, cpus_allowed); cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); - + return 0; }