aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/sysfs.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index d90d4b7810d6..e2a1d6fb3297 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -404,7 +404,7 @@ void ppc_enable_pmcs(void)
404} 404}
405EXPORT_SYMBOL(ppc_enable_pmcs); 405EXPORT_SYMBOL(ppc_enable_pmcs);
406 406
407#define __SYSFS_SPRSETUP(NAME, ADDRESS, EXTRA) \ 407#define __SYSFS_SPRSETUP_READ_WRITE(NAME, ADDRESS, EXTRA) \
408static void read_##NAME(void *val) \ 408static void read_##NAME(void *val) \
409{ \ 409{ \
410 *(unsigned long *)val = mfspr(ADDRESS); \ 410 *(unsigned long *)val = mfspr(ADDRESS); \
@@ -413,7 +413,9 @@ static void write_##NAME(void *val) \
413{ \ 413{ \
414 EXTRA; \ 414 EXTRA; \
415 mtspr(ADDRESS, *(unsigned long *)val); \ 415 mtspr(ADDRESS, *(unsigned long *)val); \
416} \ 416}
417
418#define __SYSFS_SPRSETUP_SHOW_STORE(NAME) \
417static ssize_t show_##NAME(struct device *dev, \ 419static ssize_t show_##NAME(struct device *dev, \
418 struct device_attribute *attr, \ 420 struct device_attribute *attr, \
419 char *buf) \ 421 char *buf) \
@@ -436,10 +438,15 @@ static ssize_t __used \
436 return count; \ 438 return count; \
437} 439}
438 440
439#define SYSFS_PMCSETUP(NAME, ADDRESS) \ 441#define SYSFS_PMCSETUP(NAME, ADDRESS) \
440 __SYSFS_SPRSETUP(NAME, ADDRESS, ppc_enable_pmcs()) 442 __SYSFS_SPRSETUP_READ_WRITE(NAME, ADDRESS, ppc_enable_pmcs()) \
441#define SYSFS_SPRSETUP(NAME, ADDRESS) \ 443 __SYSFS_SPRSETUP_SHOW_STORE(NAME)
442 __SYSFS_SPRSETUP(NAME, ADDRESS, ) 444#define SYSFS_SPRSETUP(NAME, ADDRESS) \
445 __SYSFS_SPRSETUP_READ_WRITE(NAME, ADDRESS, ) \
446 __SYSFS_SPRSETUP_SHOW_STORE(NAME)
447
448#define SYSFS_SPRSETUP_SHOW_STORE(NAME) \
449 __SYSFS_SPRSETUP_SHOW_STORE(NAME)
443 450
444/* Let's define all possible registers, we'll only hook up the ones 451/* Let's define all possible registers, we'll only hook up the ones
445 * that are implemented on the current processor 452 * that are implemented on the current processor