From: Rusty Russell <rusty@rustcorp.com.au>
To: Paul Mackerras <paulus@samba.org>
Cc: linux-kernel@vger.kernel.org,
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: [PATCH 1/1] work_on_cpu: use on PowerPC
Date: Mon, 1 Dec 2008 19:17:22 +1030 [thread overview]
Message-ID: <200812011917.23507.rusty@rustcorp.com.au> (raw)
Use work_on_cpu() instead of cpumask games. (At least they had the
decency to have a FIXME!)
Compile-tested on powerpc (defconfig).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/kernel/sysfs.c | 31 +++++--------------------------
1 file changed, 5 insertions(+), 26 deletions(-)
diff -r 6f4737048b99 arch/powerpc/kernel/sysfs.c
--- a/arch/powerpc/kernel/sysfs.c Thu Oct 23 00:06:30 2008 +1100
+++ b/arch/powerpc/kernel/sysfs.c Thu Oct 23 00:20:57 2008 +1100
@@ -134,36 +134,15 @@ 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 long read_##NAME(void *junk) \
{ \
return mfspr(ADDRESS); \
} \
-static unsigned long write_##NAME(unsigned long val) \
+static long write_##NAME(void *val) \
{ \
ppc_enable_pmcs(); \
- mtspr(ADDRESS, val); \
+ mtspr(ADDRESS, (unsigned long)val); \
return 0; \
} \
static ssize_t show_##NAME(struct sys_device *dev, \
@@ -171,7 +150,7 @@ static ssize_t show_##NAME(struct sys_de
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 = work_on_cpu(cpu->sysdev.id, read_##NAME, NULL); \
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); \
+ work_on_cpu(cpu->sysdev.id, write_##NAME, (void *)val); \
return count; \
}
next reply other threads:[~2008-12-01 8:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-01 8:47 Rusty Russell [this message]
2008-12-31 13:10 ` [PATCH 1/1] work_on_cpu: use on PowerPC Rusty Russell
2009-01-01 1:26 ` Paul Mackerras
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=200812011917.23507.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.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.