aboutsummaryrefslogtreecommitdiff
path: root/arch/powerpc/kernel/sysfs.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-03-30 10:23:53 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-30 10:23:53 -0700
commitebc8eca169be0283d5a7ab54c4411dd59cfb0f27 (patch)
tree831f6d577da3469e3154bf29409281c640bb67df /arch/powerpc/kernel/sysfs.c
parent25c1a411e8a0a709abe3449866125dc290711ea8 (diff)
parent9ff9a26b786c35ee8d2a66222924a807ec851a9f (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (180 commits) powerpc: clean up ssi.txt, add definition for fsl,ssi-asynchronous powerpc/85xx: Add support for the "socrates" board (MPC8544). powerpc: Fix bugs introduced by sysfs changes powerpc: Sanitize stack pointer in signal handling code powerpc: Add write barrier before enabling DTL flags powerpc/83xx: Update ranges in gianfar node to match other dts powerpc/86xx: Move gianfar mdio nodes under the ethernet nodes powerpc/85xx: Move gianfar mdio nodes under the ethernet nodes powerpc/83xx: Move gianfar mdio nodes under the ethernet nodes powerpc/83xx: Add power management support for MPC837x boards powerpc/mm: Introduce early_init_mmu() on 64-bit powerpc/mm: Add option for non-atomic PTE updates to ppc64 powerpc/mm: Fix printk type warning in mmu_context_nohash powerpc/mm: Rename arch/powerpc/kernel/mmap.c to mmap_64.c powerpc/mm: Merge various PTE bits and accessors definitions powerpc/mm: Tweak PTE bit combination definitions powerpc/cell: Fix iommu exception reporting powerpc/mm: e300c2/c3/c4 TLB errata workaround powerpc/mm: Used free register to save a few cycles in SW TLB miss handling powerpc/mm: Remove unused register usage in SW TLB miss handling ...
Diffstat (limited to 'arch/powerpc/kernel/sysfs.c')
-rw-r--r--arch/powerpc/kernel/sysfs.c35
1 files changed, 7 insertions, 28 deletions
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 4a2ee08af6a..f41aec85aa4 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; \
}