X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=arch%2Fpowerpc%2Fkernel%2Fsysfs.c;h=f41aec85aa497b1dd90c6da64d9e8389c22c80e1;hb=930861c4e6f13ce2e7d06cd1ef11441a065517d9;hp=4a2ee08af6a7f6c2448a45f71e51cbb973238ebd;hpb=d9e8a3a5b8298a3c814ed37ac5756e6f67b6be41;p=pandora-kernel.git diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c index 4a2ee08af6a7..f41aec85aa49 100644 --- a/arch/powerpc/kernel/sysfs.c +++ b/arch/powerpc/kernel/sysfs.c @@ -134,44 +134,23 @@ void ppc_enable_pmcs(void) } EXPORT_SYMBOL(ppc_enable_pmcs); -#if defined(CONFIG_6xx) || defined(CONFIG_PPC64) -/* XXX convert to rusty's on_one_cpu */ -static unsigned long run_on_cpu(unsigned long cpu, - unsigned long (*func)(unsigned long), - unsigned long arg) -{ - cpumask_t old_affinity = current->cpus_allowed; - unsigned long ret; - - /* should return -EINVAL to userspace */ - if (set_cpus_allowed(current, cpumask_of_cpu(cpu))) - return 0; - - ret = func(arg); - - set_cpus_allowed(current, old_affinity); - - return ret; -} -#endif - #define SYSFS_PMCSETUP(NAME, ADDRESS) \ -static unsigned long read_##NAME(unsigned long junk) \ +static void read_##NAME(void *val) \ { \ - return mfspr(ADDRESS); \ + *(unsigned long *)val = mfspr(ADDRESS); \ } \ -static unsigned long write_##NAME(unsigned long val) \ +static void write_##NAME(void *val) \ { \ ppc_enable_pmcs(); \ - mtspr(ADDRESS, val); \ - return 0; \ + mtspr(ADDRESS, *(unsigned long *)val); \ } \ static ssize_t show_##NAME(struct sys_device *dev, \ struct sysdev_attribute *attr, \ char *buf) \ { \ struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ - unsigned long val = run_on_cpu(cpu->sysdev.id, read_##NAME, 0); \ + unsigned long val; \ + smp_call_function_single(cpu->sysdev.id, read_##NAME, &val, 1); \ return sprintf(buf, "%lx\n", val); \ } \ static ssize_t __used \ @@ -183,7 +162,7 @@ static ssize_t __used \ int ret = sscanf(buf, "%lx", &val); \ if (ret != 1) \ return -EINVAL; \ - run_on_cpu(cpu->sysdev.id, write_##NAME, val); \ + smp_call_function_single(cpu->sysdev.id, write_##NAME, &val, 1); \ return count; \ }